Using Regular Expressions inside Lambda Functions - C#

Question: I've a little test program that builds a List of different strings, all of which contain the same formatted number. I also then declare another list which is supposed to contain the specific numbers of each string in the former list.
My plan is to accomplish this by utilizing a regular expression match inside of a lambda function.
Every time I try and do this I get the following error:

List<string> newList = new List<string>(new string[] { "MyName - v 220.127.116.11 ... CPU:",
                                                           "MyName - v  ... CPU: - 188.8.131.52",
                                                           "188.8.131.52 - v  ... CPU:",
                                                           " - v  ... CPU: 31.522.9.0" });
Regex match = new Regex("(\\d+\\.)+\\d");
List<string> otherList = newList.FindAll(str => match.Match(str).Value);

Is there any way I can use lambda functions to accomplish this?
Comment: Well, do you understand the error? `FindAll` is expecting a predicate - something that returns true or false. `match.Match(str).Value` returns a string. Perhaps you were looking for `ConvertAll`? (Or just use `Select` and LINQ...)
Answer: You can try this:
List<string> otherList = newList.Select(str => match.Match(str).Value).ToList();

Btw, your code is failing because the predicate is expecting bool.
Comment: Nope, check this https://msdn.microsoft.com/en-us/library/bfcke1bz(v=vs.110).aspx It will explain about Predicate class. `FindAll` is more like `Where` but they are slightly different in term of execution and performance. If you want to "transform" your collection then `select`.
Comment: What do you mean? I thought the predicate was supposed to "essentially" assert the regex against each index in the first list, and assign that match to a spot in the new list.
Comment: Ah, I see. I'm still familiarizing myself with the System.Linq library for .NET, so thank you for the pointers!
Answer: you can try the following:
var otherList = newList.Select(str => match.Match(str).Value);
FindAll expects a Predicate, so you would need to do:
newList.FindAll(str => match.IsMatch(str));
But then you would have an IEnumerable that would contain the full strings and not just the numbers you are looking for.
Answer:     List<string> newList = new List<string>(new string[] { "MyName - v 22.214.171.124 ... CPU:",
                                                   "MyName - v  ... CPU: - 22.214.171.124",
                                                   "188.8.131.52 - v  ... CPU:",
                                                   " - v  ... CPU: 31.522.9.0" });
    Regex match = new Regex("(\\d+\\.)+\\d");
    var result = match.Matches(string.Join(" ", newList)).Cast<Match>().Select(m => m.Value);


Fit measures for GMM Arellano-Bond estimator in R

Question: A colleague and I have been working with difference GMM, i.e. the Arellano-Bond estimator, in R. Our option has been to use the pgmm command from the plm package. However, now I am struggling to test the fit of my models, since the package plm itself does not bring such functionality.
Would there be a good way to test for the model fit of a difference-GMM model? Of course, an approach would be to test the square of the correlation between Y and Yhat, as in Bloom, Bond et al. (2001). However, the pgmm command does not give the predictions, only the fitted-values.
Could anyone give any tips on that?
Answer: If you are using the pgmm command from the package plm you do have good ways to assess model fit available to you (if this is not what you're using it's what you should be using). The standard way to test model fit would be to look at the $J$-test of overidentifying restrictions, also called the Sargan test (see here or here). Strictly speaking this is a test of the validity of your all instruments (given that some subset of your instruments is valid). This test is listed under "Sargan test" when you use the summary command on your pgmm model. summary also shows test of serial correlation of the residuals.
I gather what you want is less to test the Arellano-Bond model itself and more to test the degree to which the predicted time series seems to be close to the result. You can actually reproduce the square correlation used in Bloom et al. (2001) pretty easily. The fitted values are exactly what you need. Starting with an example from the plm documentation found here:
data("EmplUK", package = "plm")
## Arellano and Bond (1991), table 4b
z1 <- pgmm(log(emp) ~ lag(log(emp), 1:2) + lag(log(wage), 0:1)
           + log(capital) + lag(log(output), 0:1) | lag(log(emp), 2:99),
            data = EmplUK, effect = "twoways", model = "twosteps")

# Shows Sargan test and serial correlation of residuals.
summary(z1)

# Getting the actual Y values out. There is likely a more elegant way to do this.
Y <- c()
for( i in 1:length(z1$model)){ Y <- c(Y,z1$model[[i]][,1])}

# Note that the fitted-values are exactly what you need.
Yhat <- z1$fitted.values[1:length(z1$fitted.values)]

# Squared correlation of fitted values and actual values
cor(Y,Yhat)^2

Comment: I'm a bit confused about `lag(log(emp), 2:99)` as the list of instruments. How did you arrive at that selection? Is it just because `T=100` and you're taking all lags but the first?
Comment: The references are:
Bloom, N., Bond, S., and Van Reenen, J., 2001. The Dynamics of Investment Under Uncertainty. Ssrn (February). doi: 10.2139/ssrn.261552
and
WINDMEIJER, F. (1995) "A Note on R2 in the Instrumental Variables Model", Journal of Quantitative Economics, 11, 257-261
Comment: At the end, you can probably use `Y <- as.vector(sapply(z1$model, function(L){L[,1]}))`  and  `Yhat <- as.vector(z1$fitted.values)`


Assistance with opening additional ports - CentOS

Question: I'm trying to open an additional outgoing port on my VPS (port 5900).
Here is my /etc/sysconfig/iptables:
# Generated by iptables-save v1.3.5 on Sun Jul 10 11:27:12 2011
*mangle
:PREROUTING ACCEPT [68:4952]
:INPUT ACCEPT [68:4952]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [60:7060]
:POSTROUTING ACCEPT [60:7060]
COMMIT
# Completed on Sun Jul 10 11:27:12 2011
# Generated by iptables-save v1.3.5 on Sun Jul 10 11:27:12 2011
*filter
:INPUT ACCEPT [68:4952]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [60:7060]
:RH-Firewall-1-INPUT - [0:0]
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 5900 -j ACCEPT
COMMIT
# Completed on Sun Jul 10 11:27:12 2011
# Generated by iptables-save v1.3.5 on Sun Jul 10 11:27:12 2011
*nat
:PREROUTING ACCEPT [18:1080]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Sun Jul 10 11:27:12 2011

However, the port 5900 is still closed.
Can someone assist me with this? Thanks.
Comment: 1) The rule you have for 5900 is an input rule, not output.
2) Normally output is not blocket by firewall, only input.

Why do you think the outgoing port 5900 is blocked?  Is it not likely that it is either a external firewall issue, or that is is the 5900 incomming on the receing port which is blocked?  How did you test it?
Comment: Also, if the VPS is accessed over a VPN, then most VPN implementations runs over UDP and not TCP
Answer: The policy on your output chain is accept. There are no rules denying output on port 5900 in your configuration.
Are you sure that you have something listening on port 5900 ?
try
sudo lsof -l :5900

or
sudo netstat -an | grep LISTEN | grep 5900

to see what (if anything) is attached.
Comment: It's not used by anything.
Comment: If there is nothing there then you have to fix that before 'fixing' your firewall.
Comment: How do I go by 'fixing' that? Sorry, I'm new to this VPS firewall stuff.
Comment: I have no idea, as you haven't said what your running that needs to use port 5900. If you turn your firewall off `/sbin/service iptables stop` can you do what you want ?
Comment: Apologies for the lack of information. I need the port 5900 so I can run a gaming server.
Comment: Is the gaming server running ?
Answer: I am assuming that you mean "incoming", not "outgoing" port 5900, because your outgoing port is properly opened by your current rules.
Usually I get rid of the RH-Firewall-1-INPUT chain and use the following:
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]

# Allow traffic from the loopback interface
-A INPUT -i lo -j ACCEPT

# Allow ICMP traffic as it helps with connection diagnostics
-A INPUT -p icmp --icmp-type any -j ACCEPT

# Allow traffic from already existing connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow connections on port 5900
-A INPUT -p tcp --dport 5900 -m state --state NEW -j ACCEPT

COMMIT

But if you want to keep as close to the original CentOS configuration as possible, you could try the following:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]

-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT

-A RH-Firewall-1-INPUT -i lo -j ACCEPT

-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type 255 -j ACCEPT

-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 22 -m state --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 5900 -m state --state NEW -j ACCEPT

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

COMMIT

The problem with your current ruleset is that you don't send all incoming traffic to the RH-Firewall-1-INPUT chain, which is done with the following line:
-A INPUT -j RH-Firewall-1-INPUT

Also, don't forget to reload your rules with service iptables restart.
Comment: I tried both rules, however, it still says it's closed.
Comment: Can you please explain what exactly are you trying to do? This way it will be much easier for us to help you. I am asking because your answers make me think that your problem isn't with the firewall, but with something else.
Comment: I'm not quite sure myself. I just need the port 5900 open so I can run a gaming server.
Comment: Run the following command to check if your gaming server is running and listening on the right port: **netstat -punta 2>/dev/null | grep LISTEN | grep :5900**
Comment: Ok, it's more of a "login server" file that runs off that port. To start the login server, I run "screen php login-server.php".
Comment: My question is still valid - does the command I wrote above return something?
Comment: No, your command does not return anything.
Comment: Ok, that means the there's nothing listening on port 5900 - you should make sure the the script is running and that it is really binding to port 5900. Maybe you should start another thread, because we are out of the scope of the original question, and your firewall should be fine by now.
Answer: If this is for VNC and your VPS is hosted on Amazon, then make sure to open the security restrictions in your amazon security group as well (by default amazon only allow port 22 and 80).
Output port are normally not blocked -- so probably nothing to do on the host originating the connection.
Also, the firewall rule for 5900 should be on the receiving host (i.e. your VPS), And I would have guessed it would have to look something like this;
-A INPUT -p tcp -m tcp -m state --dport 5800 --state NEW -j ACCEPT

BUT with the addition of checking that the IP is from you network and not from the internet in general (opening VNC to the public is probably not secure).
Finally, if your organization also have a firewall, you may want to check if the firewall prevent outgoing connection on unauthorized ports.


Checkbox behaviour modification with javascript

Question: I have got this group of checkboxes that behave like radio buttons.
I need some help in letting the user allow to uncheck a checkbox too, so there can be no selection within the group.
<input type="checkbox" name="cb1" class="chb" /> CheckBox1
<input type="checkbox" name="cb2" class="chb" /> CheckBox2
<input type="checkbox" name="cb3" class="chb" /> CheckBox3
<input type="checkbox" name="cb4" class="chb" /> CheckBox4

$(".chb").each(function()
           {
               $(this).change(function()
                              {
                                  $(".chb").attr('checked',false);
                                  $(this).attr('checked',true);
                              });
           });

Comment: I don't understand what are you trying to achieve. if you are allowing only one option, have you consider using a drop down list instead?
Comment: ...or radio buttons with a "None" option?
Answer: $(".chb").change(function()
{
    $(".chb").parent().siblings()
        .find('input').prop('checked', false);
});

Or even better:
var $inputs = $(".chb");

$inputs.change(function()
{
    $inputs.not(this).prop('checked', false);
});

And here's the fiddle: http://jsfiddle.net/zjJKc/
Comment: @Christian - What do you mean by "radio button behavior"? I thought you meant that only one of them can be checked, so that when you check one of them, all the others get unchecked. This is how my code works. If that's not what you meant, please explain what you mean by "radio button behavior".
Comment: the fiddle works. It does not work with my mark up because the checkboxes are in seperate html elements and not in one single group. when I implement it fiebug tells me "$inputs.not(this).prop('checked', false);
" is not a function
Comment: @Christian - Which version of jQuery are you using? `.prop` was introduced in version 1.6, so if you're using anything below that, use `.attr`.
Comment: @Christian - Since you haven't provided your full markup, there's no way for me to guide you on how to select all those checkboxes together into the `$inputs` variable...
Comment: thanks I was using 1.4. I upgraded to 1.6 and that fixed it. thanks for the valuable info and snippet ;-)


What is the JSON I have to put in Gupshup's Dialogflow JSON?

Question: Since last week there's a new Gupshup functionality in which in order to add a new bot, I can paste in the JSON of the Dialogflow agent.
Where do I get that JSON?
When I export the agent from Dialogflow as ZIP, and unzip it, I have 2 folders (entities + intents) and an 'agent' JSON + 'package' JSON (image below).

Do I have to take the agent.json and put it in Gupshup?

I did that, and deployed it on Telegram to test it (I don't know other way to test it). It's not working. It does not answer anything.
I did the Telegram set up correctly.
Thank you in advance.
Answer:
In Dialogflow Console. Click On The COG icon

Click On The Google Project

Once in Google Console. Click on The Hamburger Icon

Click On IAM & Admin

Click On The Service Account

Create A New Service Account

Make Sure To Provide Viewer Access

After Creation, in the service account list, click on Manage Keys.

Add a new Key For that service account

Select Type as JSON

Then a JSON file will be downloaded to your local machine. Copy-paste the content into the JSON field. Your Dialogflow agent will be linked.
Happy Coding. :)
Comment: It works. I tested it on telegram. Thank you!


TYPO3 - Translations set but neither processed nor displayed

Question: I've been building a TYPO3 website. I wanted to use the multi-language capacity of TYPO3 and get acquainted with the CMS. I'm using V.9.5.6 at the moment with the Introduction Package.
I followed the manual on multi-language setup here : https://docs.typo3.org/m/typo3/guide-frontendlocalization/9.5/en-us/Index.html
When switching languages, the page refreshes but no visible changes occur.

I deleted the original "German" et "Dansk" languages, then added "French" and "German". I used the contact page as proving grounds.
I added translations in germand and french from the original english page I built. There's only a header and a contact form. In english, it reads "contact form". In german and french it should read respectively "Kontaktieren Sie uns" and "Contactez-nous".
The languages UIDs are 2 for German and 3 for French. The template, in the languages section, has "auto" for the list of languages and it pulls correctly the 2 I added, in the correct order.

In a properly setup website, if default language is English, and I click on the "German" or "French" language button at the bottom, the page should refresh and display the content translated in the language I selected and have the selected language in bold at the bottom of the page.
When clicking on the bottom links, it adds the correct L= parameter and the page loads but no visible change occur on the page. Even the language link at the bottom of the page has "Default" in bold instead of whatever I clicked.
There is NO error message when clicking on the language buttons.

I'm pretty sure this is not the standard behavior of a TYPO3 multi-lingual installation. What can cause the CMS to not fetch a translated content OR fail to get the language change information from the parameters passed in the URL ?
Answer: I'll try to answer this vague question.
Usually there are three pitfalls you should look at:

realurl (or routes in v9) here is a nice gist: https://gist.github.com/koehlersimon/9dcbabb6b1b2adcbc84db96fd144fb08
TypoScript settings for the languages: https://docs.typo3.org/m/typo3/guide-frontendlocalization/9.5/en-us/TyposcriptConfiguration/Index.html#typoscript-configuration
proper .htaccess in connection with [1.]

I also suggest to update to v 9.5.9
There have been plenty bugfixes since v 9.5.6 and updating within branch 9.5.X is really easy and non-breaking!
Comment: Thank you very much, issue solved. Details to follow :

[1.] : The YAML configuration was not processed correctly and I did the changes manually using the backend editor of Site Configuration. Once it was done, the pages changed to 404 except the homepage
[2.]  : did not help as languages were set as detailled above, not using TScript
[3.]  : I changed the .htaccess to a pure directly from the source

After some adjusting in the YAML (domain name, etc...), I got 404'd again. Adjusting protocol (http to https) in site config' solved it (since i force https redirect).
Thank you again ! :)


wedge product (exterior algebra)

Question: I got confused on the operator of the wedge product on other 2 vectors. Please help.
Let $V=\mathbb R^3,e_1= (1,0,0),e_2= (0,1,0)$, and $e_3= (0,0,1)$.  Find:
$3e_1∧4e_3((1,α,0),(0,β,1))$, where α,β are irrational numbers.
Comment: This looks like an exercise so you must have some lecture notes. Where in your lecture notes is it mentioned that the wedge product of two vectors can be seen as a map?
Comment: this notation indeed seems kind of off. Indeed one can define the exterior algebra over a universal property involving maps, but this does not make the wedge into functions, but as a universal space for alternating functions to facto over.
Especially since there are 4 vectors appearing, but only 1 wedge
Comment: See: https://math.stackexchange.com/questions/2842911/how-to-perform-wedge-product
Answer: If I understand the notation correctly,
$$
(3e_1 \wedge 4e_3)((1,\alpha,0), (0,\beta,1))
= 12 (e_1 \wedge e_3)((1,\alpha,0), (0,\beta,1)) \\
= 12 (e_1 \otimes e_3)((1,\alpha,0), (0,\beta,1))
- 12 (e_1 \otimes e_3)((0,\beta,1), (1,\alpha,0)) \\
= 12\ e_1(1,\alpha,0)\ e_3(0,\beta,1)
- 12\ e_1(0,\beta,1)\ e_3(1,\alpha,0) \\
= 12 ((1,0,0)\cdot(1,\alpha,0)) ((0,0,1)\cdot(0,\beta,1))
- 12 ((1,0,0)\cdot(0,\beta,1)) ((0,0,1)\cdot(1,\alpha,0)) \\
= 12 \cdot 1 \cdot 1 - 12 \cdot 0 \cdot 0
= 12
$$
Comment: I think you forget the fraction $\frac{1}{2!}$
Comment: I was unsure if there should be such a factor.

wedge product (exterior algebra)


Tags in ASP.NET

Question: What's the difference between <%= Something %> and <%# Something %>?
Are there any other modifiers of this kind?
Duplicate

What is the difference between the <%# and <%= opening tags?
Answer: See these questions:

What is the difference between the <%# and <%= opening tags?
In ASP.NET what are the differant ways to inline code in the .aspx?

Tags in ASP.NET


How to disable page link?

Question: I am new to drupal 7. I read the online documentation but, due to less programming skills, I could not figure out the exact solution.
I want to disable pager link. How can I do that?
Answer: I can understand, its hard for beginer to understand but drupal.org provides full documentation on it. Please, google before you post here.
probably, this would help you.
Drupal support forum page
Comment: Thank. It helped me. It worked for me. Thanks. It really helped me out.
Comment: @Suresh Posts with little more than a link aren't considered answers on SE sites and end up getting deleted - could you bring the relevant points from the link you posted in here so that doesn't happen? Remember, your answer still needs to make sense even if Drupal.org goes down :)
Comment: Well, if you want to learn more, then drupal.org has the best option to learn.
Comment: If I want to learn more about, drupal 7 theming, then, what would be the best option for me.
Comment: Thanks, Clive, I will keep in mind now onwards. Thanks for reminding.

How to disable page link?


How to order a node's taxonomy terms hierarchically?

Question: Are the terms in a node's taxonomy array ordered hierarchically by default?
If not, what is the most efficient way to do so?
Answer: No they are not ordered hierarchically by default...
In order to do it yourself you could take a look at the following functions: taxonomy_get_parents() and taxonomy_get_children().
Here is a great article with nice examples: http://davidherron.com/content/improving-navigability-drupal-taxonomy-hierarchies


converter projetos java para maven

Question: Tenho alguns projetos java e gostaria de converte-los pro maven.

Existe algum comando maven para conversão de projetos java já existentes?
Se eu simplesmente adicionar o pom.xml ele se tornará um projeto maven?

Pensei nesses dois casos pois não tenho o eclipse e gostaria de colocar esse processo num pipeline.
Comment: Nunca parei pra testar isso, mas acabei de testar aqui no NetBeans 12, peguei dois projetos um em HTML e outro JavaScript adicionei o Pom.xml neles a IDE reconheceu como projetos Maven.
Answer: Não basta adicionar o pom.xml. É preciso que o projeto siga, pelo menos, a estrutura de diretórios:
- pom.xml
- src
  |-- main
  |   |-- java
  |   |   |-- App.java
  |   |-- resources
  |       |-- file.csv
  |-- test
      |-- java
      |   |-- AppTest.java
      |-- resources
          |-- testfile.csv

Há, evidentemente, outras possibilidades de organização dos diretórios e ficheiros de configuração adicionais, mas esta é a mínima para ele poder ser executado como projeto Maven.
Quanto a haver algum comando maven que faça, isso não sei.

converter projetos java para maven


How to remove black outline around TitlePane in Dojo

Question: I have to learn dojo for some project . Can some one let me know how to remove black outline around TitlePane in Dojo .

I did check out the sample application at the below URL and found
the same issue there too
Dojo tookit doc

I am using dojo v1.10
Answer: this style is generated by user agent browser (chrome) ,
if you want to remove it ,
just override the .dijitTitlePaneTitleFocus and set its outline to none as below :
.dijitTitlePaneTitleFocus {
    outline: none !important;
}

if you want to apply to all other widget you can apply this style :
.dijitFocused div  {
    outline: none !important;
}

See working snippet :

require(["dojo/ready", "dijit/TitlePane", "dojo/dom"], function(ready, TitlePane, dom){
    ready(function(){
        var tp;
        tp = new dijit.TitlePane({title:"I'm a TitlePane", content: "Collapse me!"});
        dom.byId("holder").appendChild(tp.domNode);
    });
});
.dijitFocused div{
    outline: none !important;
}

<link href="//ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/claro/claro.css" rel="stylesheet" />


Is this function converging or diverging?

Question: I'm trying to show whether or not this function is converging,
$$\sum_{n=0}^\infty\frac{(-1)^n \ln(n)}{{n}^{1/2}+1}$$
I'm using Leibniz' Test and I've shown that
$$\frac{\ln(n)}{{n}^{1/2}+1} \ge 0 \quad \forall n$$
And that as
$$n \to \infty,\quad \frac{\ln(n)}{{n}^{1/2}+1} \to 0$$
But I'm struggling with the final step, that the function is decreasing. Any help will be greatly appreciated and thanks in advanced.
Answer: Your way is fine, to conclude let consider
$$f(x)=\frac{\ln x}{{x}^{1/2}+1} \implies f'(x)=\frac{2\sqrt x-\sqrt x \log x+2}{2x({x}^{1/2}+1)^2}$$
which becomes eventually negative for $x\ge x_0$ with
$$\sqrt x_0 \log x_0>2\sqrt x_0+2 \implies \log x_0 >2+\frac2{\sqrt x_0}$$
therefore eventually $\frac{\ln n}{{n}^{1/2}+1}$ is strictly decreasing and the series converges.
Comment: Thanks, that's so much help
Comment: @B.Griffin You are welcome! Bye
Answer: Hint
$$f(x)=\frac{\ln(x)}{{x}^{1/2}+1} \\
f'(x)=\frac{\frac{1}{x}(\sqrt{x}+1)-\ln(x)\frac{1}{2 \sqrt{x}}}{({x}^{1/2}+1)^2}=\frac{2\sqrt{x}+2-\ln(x)\sqrt{x}}{2x({x}^{1/2}+1)^2}$$
It is easy to argue that for $x>A$ for some $A$ $f'(x) <0$. You can find such an $A$ for example by making sure that
$$\frac{1}{2}\ln(x)>2 \\
\sqrt{x} >1
$$


PHP JSON decoding with one square bracket

Question: Ok so I'm grabing market data with php and it's been working fine but I came across an api that gives me this
[{"market_id":"16","code":"DOGE","last_price":"0.00000136","yesterday_price":"0.00000140","exchange":"BTC","change":"-2.86","24hhigh":"0.00000150","24hlow":"0.00000132","24hvol":"6.544"}]
and normally I grab it with this code
$data = curl_exec($c);
curl_close($c);
$obj = json_decode($data);
$doge = print_r($obj->{'last_price'}."\n", true);

but it's not working because of the brackets "[". No other api has these.
How do I get around them to get the information?
Comment: It's just a wrapper array.
Comment: so, `var_dump` data before decode and see what type is it.
Comment: `$obj[0]->{"last_price"}`
Comment: FYI it's not true that "no other API has these [brackets]".  [Arrays are a perfectly normal part of JSON](http://www.json.org/) and _do_ appear in countless APIs.  You might just be seeing them for the first time, and that's fine.
Comment: you should use json_decode($json,true) so that jsonArray inside json are also taken care of
Comment: @Ray Toal, I meant apis that I've used so far.
Comment: Yep, all good, I was just saying you'll be seeing a lot more of them. :)
Answer: When you do a print_r of your object, you can see the structure like this.
Array
(
    [0] => stdClass Object
        (
            [market_id] => 16
            [code] => DOGE
            [last_price] => 0.00000136
            [yesterday_price] => 0.00000140
            [exchange] => BTC
            [change] => -2.86
            [24hhigh] => 0.00000150
            [24hlow] => 0.00000132
            [24hvol] => 6.544
        )

)

So to access it , you can see the last_price is under the array index 0 , So you need to provide the index before your object.
Accessing ways..
echo $doge =$obj[0]->last_price;

(or)
echo $doge =$obj[0]->{'last_price'};

Demo
Comment: You should actually explain what the OP is doing wrong, not just give code solution.
Answer: The response, you are getting is actually an array. First (and the only one in your case) element is an object. Therefore, in order to access this object you would simply call:
$array = json_decode($data);
$obj = $array[0];
$doge = print_r($obj->{'last_price'}."\n", true);


Rational function - domain and vertical asymptote

Question: Consider the function:
$f(x)=\frac{2x^4+7x^3-7x^2-3x+1}{x^3-x^2+x-1}.$
When looking for domain, the denominator $x^3-x^2+x-1$ can not be zero. So $f(x)$ is undefined when $x=1.$
But when simplifying given function I get:
$f(x)=\frac{2x^4+7x^3-7x^2-3x+1}{x^3-x^2+x-1}=\frac{(x-1)(2x-1)(x^2+4x-1)}{(x-1)(x^2+1)}=\frac{(2x-1)(x^2+4x-1)}{x^2+1}$.
Now domain seems to change, since $x^2+1>0$ for every $x \in \mathbb{R}$.
Does the domain change when simplifying given expression?
Also, when determinating the vertical asymptote, we look for domain. I was thinking that since $x^2+1>0$ for every $x \in \mathbb{R}$ that given function doesn't have any undefined points so vertical asymptote doesn't exist.
Or do I need to consider first domain and look for the limit of function as $x$ approaches $1^+$ or $1^-$?
Thank you!
Comment: Yes, the domain changes because when you "simplify" the function it is no longer the same function.  Taking J.W. Tanner's simpler example, x/x= 1 for all x **except** x= 0.  The graph of y= 1 is a horizontal straight line.  The graph of y= x/x is that same line **except** that the point (0, 1) is missing- there is a "hole" there.
Comment: Note:  $x/x$ is not defined when $x=0$ even though generally $x/x=1$
Comment: consider $\frac{x^2-4}{x-2}$ which is not defined for $x=4$ . But by simplifying  ,we get  $\frac{x^2-4}{x-2} = \frac{x-2}{x+2}$ which is defined for all $x$
Comment: Does that mean that domain will still be the same, $D_f = \mathbb{R} \setminus \{1\}.$
And I still need to look for the limit of $f(x)$ when $x$ approaches $1^+$ and $1^-$?
Answer: It is $$f(x)=\frac{(x-1)(2x-1)(x^2+4x-1)}{(x-1)(x^2+1)}=\frac{(2x-1)(x^2-4x-1)}{x^2+1}$$ only if $$x\neq 1$$
There is a whole in this function at $x=1$
Comment: Now you must compute $\lim_{x\to 1}f(x)$
Comment: Thanks, I got it! Now, to find vertical asymptote, I must consider the limit of function, right?


Melhor Método para Criar uma Matriz com Múltiplas Linhas Iguais?

Question: Tenho uma matrix 14x5 e desejo "replicá-la" para que as primeira mil linhas sejam iguais à primeira linha da matriz que já possuo, as próximas mil sejam iguais à segunda das linhas da matrix que já existe e assim por diante, gerando ao final uma matrix 14000x5.
Eu fiz a coisa "na mão" mas fiquei pensando se a matrix fosse 5000x5. Além de quase impraticável fica "feio" demais no código.
    memory =  np.vstack((susc_seade, expo_seade, assi_referencia, sint_seade, recu_assumido))
    memory = np.transpose(memory)
    rows, columns = np.shape(memory)
    matrix_memory = np.zeros([int(rows/dt - 1/dt), columns])
    for i in range((int(rows/dt))):
        for j in range(5):
            if i >=0 and i<= 1000:
               matrix_memory[i,j] = memory[1,j]
            if i >=1001 and i<= 2000:
               matrix_memory[i,j] = memory[2,j]
            if i >=2001 and i<= 3000:
               matrix_memory[i,j] = memory[3,j]
            if i >=3001 and i<= 4000:
               matrix_memory[i,j] = memory[4,j]
            if i >=4001 and i<= 5000:
               matrix_memory[i,j] = memory[5,j]
            if i >=5001 and i<= 6000:
               matrix_memory[i,j] = memory[6,j]
            if i >=6001 and i<= 7000:
               matrix_memory[i,j] = memory[7,j]
            if i >=7001 and i<= 8000:
               matrix_memory[i,j] = memory[8,j]
            if i >=8001 and i<= 9000:
               matrix_memory[i,j] = memory[9,j]
            if i >=9001 and i<= 10000:
               matrix_memory[i,j] = memory[10,j]
            if i >=10001 and i<= 11000:
               matrix_memory[i,j] = memory[11,j]
            if i >=11001 and i<= 12000:
               matrix_memory[i,j] = memory[12,j]
            if i >=12001 and i<= 12999:
               matrix_memory[i,j] = memory[13,j]
    return matrix_memory

No código, memory é a matrix 14x5, dt= 0.001 e matrix_memory é a matrix 14000x5 que desejo gerar.
Comment: Pelo visto uma simples operação matemática resolveria aí: `i // 1000 + 1`, pega a parte inteira da divisão de `i` por 1000 e soma 1. Assim, qualquer valor menor que 1000 tem a divisão igual a 0, que somando 1 fica 1; qualquer valor menor que 2000 tem a divisão igual a 1, que somando 1 fica 2 e por aí vai. Talvez você precisaria tratar os casos limites, 1000, 2000, etc, que a divisão cairia no próximo valor, mas dado que você comentou que quer as "primeiras mil linhas", não faz sentido tratar de 0 a 1000, inclusive, como iguais, pois seriam 1001 linhas.
Comment: Se uma matriz é 5x14, então ela possui 5 linhas e 14 colunas. De onde você pegaria as "*primeiras **mil** linhas*"?
Comment: Woss, acho que não fui muito claro. Deixe-me tentar explicar melhor: seja A a matrix 14x5 que eu tenho. Eu desejo, a partir dela, construir uma matrix B cujas primeiras mil linhas sejam idênticas à primeira linha de A, as próximas mil linhas sejam idênticas à segunda linha de A e assim por adiante. Acho que agora ficou mais claro! Obrigado por tentar entender meu problema e me ajudar.
Comment: Entendi! Realmente a minha conta de 1000 linhas em cada caso está errada. Estou incluindo 1001 linhas. Acabeide corrigir isso e vou usar sua sugestão. Obrigado.
Answer: Se procura repetir elementos de um array ou matriz Numpy uma solução pode ser obtida usando a função numpy.repeat().
A função numpy.repeat() repete os elementos de um array ou matriz ao longo de um eixo. No exemplo a baixo cada linha do array m será replicada por cinco vezes:
import numpy as np

#Declara o array m cujo as dimensões 3x4.
m = np.array([
  [1,2,3,4],
  [5,6,7,8],
  [9,10,11,12]
])

#Gera um novo array de dimensões 15x4 preenchido com 5 repetições de cada  linha de m.
print(np.repeat(m, 5, axis=0))
#[[ 1  2  3  4]
# [ 1  2  3  4]
# [ 1  2  3  4]
# [ 1  2  3  4]
# [ 1  2  3  4]
# [ 5  6  7  8]
# [ 5  6  7  8]
# [ 5  6  7  8]
# [ 5  6  7  8]
# [ 5  6  7  8]
# [ 9 10 11 12]
# [ 9 10 11 12]
# [ 9 10 11 12]
# [ 9 10 11 12]
# [ 9 10 11 12]]

Teste a solução no Replit
Aplicando a solução acima ao seu exemplo deve ficar algo assim:
memory =  np.vstack((susc_seade, expo_seade, assi_referencia, sint_seade, recu_assumido))
memory = np.transpose(memory)
#Retorna uma matriz de dimensões 14000x5 repetindo 1000 vezes cada linha de memory.
return np.repeat(memory, 1000, axis=0)

Comment: Augusto, ajudou demais! Python sempre tem um jeito elegante pra coisas acontecerem. É incrível. Obrigado novamente! :)


Passing control to another controller

Question: In a module I use forms. On special occasions I have to start another form in another module.
In this case I would like to do the following:
1 pass the control from the form to the Controller(1) of the module
2 this Controller(1) should then pass the control to the Controller(2) of the other module
3 this Controller(2) should start the desired form
Step 1 and 3 I can perform
Step 2 is still a problem because I read that a controller always must render output.
I do not want to create a new instance of Controller 2 in Controller 1.
Found out that you can return a redirect to another controller. The parameter handling is not yet clear to me, I cannot find a good tutorial about the usage ofRedirect and passing parameters with it.
Comment: Are you looking for multistep form or something similar? If yes, refer [this link](https://www.drupal.org/node/717750).
Answer: My aim is the implementation of a Mediator Pattern. Best practice to do this is using the Event Dispatcher Mechanism.
This is explained here.
A good example of implementing the mechanism, even create your own event type (above the existing types of Drupal) is described here

Passing control to another controller


Is there a way to change content in 1 master node and have it changed in hundreds of others?

Question: I have searched for quite a while but with no success. Using D7.41, Views 3.
I have a lot of nodes of the same content type (~50 nodes) and all of these nodes have images and some text, plus 4-6 blocks of views in each (different text, different images and in some cases different blocks).
Task: to let the content manager edit this master template (change text, images, change blocks for all these 50 nodes), but the changes would then be replicated 20 times - I have exactly same structure replicated for 20 different regions - the same content, different paths. So that would be some kind of "Master template".
I do understand, that all of this could be managed with blocks, when all the content of the page is done via blocks, but maybe there is some other more clever way to achieve this?
Updated: one of the ways to reduce the amount of blocks used, I guess (as per user comment below), would be solution to have fieldable blocks. But in that case there is another question - how to do that?
Comment: I'd absolutely go that way: displaying the shared, common content via views (and blocks) additionally on the nodes and let the unique content as it is. You could create a content type for shared content to make life easier.
Comment: Would it help if your blocks would be FIELDABLE? If so please adapt / exend your question accordingly (by editing it). I'd be happy to then post an answer about how you could achieve that.
Comment: I mean - I could create a content type for this type of nodes, that is absolutely empty and holds only name and path and depending on path then I could add huge amount of blocks, that would be also shown in all the copies. Therefore content manager by changing content of each block would do that for all the copies. But isn't it a little bit weird to do like this?
Comment: Well, that's what I thought, but today an idea of some mysterious "Master template for nodes" came to my mind - just didn't find anything similar to that. So that means, in general, that instead of nodes 'body' field I use 'body block' and then I have ~50 body blocks. But there are more sections, so even more blocks. Is it ok for all the caches?
Comment: You may describe a bit more detailed what the shared content is to get a better idea of what you want to achieve. Right now i can't fully imagine what you want to do. What is the unique content like? What the shared?
Comment: "Master" consists of 45 nodes that all goes like a pages of the book. Each node has unique scheme (image), description block (~500 words) and ~4 views blocks that are related to couple of taxonomy vocabularies used in all those pages. And it has to be changed constantly, periodically - the text, the scheme and the views. Tthis happens in 20 different regions, that have exactly same instructions (the pages are instructions), just 2 views blocks are filtered by the region and there is only 1 regional field that local content editors can edit. Rest of the content edited by 1 person.
Comment: The question was amended as per your request. I didn't think of that kind of solution at first, but if it's possible, it would be great to know how to do that - it would dramatically decrease the amount of used blocks.
Answer: If you have so many blocks, then you should try to find ways/techniques to reduce the amount of them. Below are some possible modules to help you on that.
BEAN
You should have a look at the Bean module, which potentially can help you to answer this question. Here is a quote about its project page:

Think of a Bean as a method to provide new types (compared to node this would be a content type) which then provides an add content interface to create as many blocks as you require (see screenshot below). The bean content can then be placed around the site just like any other block.

This module also works great in combination with the UUID and UUID Features Integration modules. And after you become familiar with the Bean module, you might find other cases in your site where you also want to use this module (which somehow compensates the fact that you need to add another module).
The video tutorial Drupal Bean module tutorial - using Bean Admin UI provides a great introduction to really understand the power of this module, and the kind of things you can do with it (by only using site building techniques, no custom coding involved). It also shows how the Bean module transforms Drupal blocks into fieldable entities.
Remark: this module (a raising star!) has been moved to core in D8 ...
Rules and Rules block visibility
Another module to have a look at (to help reduce the number of your blocks), is the Rules block visibility module. Here is a quote from its project page:

The Rules block visibility module allows Rules components to be used to control block visibility. This provides Drupal administrators and developers extreme flexibility in controlling when blocks should be displayed on their websites, in addition to the default visibility options provided by Drupal.
The general idea is that if you can do it with Rules, you can use it to control block visibility, so the possibilities are limitless:

Need to show a block only for users registered more than a month ago?

Perhaps you have a block that must be shown only between 8am-5pm on weekdays?

What about displaying or hiding a block based on current weather conditions?

All of this can be done by using Rules block visibility.
Comment: Thanks a lot - I've never tried any of those and will take a look. Anyway, it looks like one of the solutions is to use blocks everywhere and these modules hopefully will help me reducing the load!
Comment: Merci (oeps: thank you) for the feedback. You're not the only one who is not familiar with these "hidden gems". I'll be curious for your extra feedback when you had a closer look at them. Maybe you then also want to mark this answer as "accepted"? Also, if you have followup-questions related to these (new to you) modules, make sure to "notify" me about them (eg via ann extra comment here). And/or search within my profile for various answers that refer to either of these modules (to get more inspiration of how I typically use those modules).


How do I find the velocity of a sphere falling when an observer riding a glass elevator?

Question: The problem is as follows:

In a certain shopping mall which is many stories high there is a glass
  elevator in the middle plaza. One shopper ridding the elevator notices
  a kid drops a spheric toy from the top of the building where is
  located the toy store. The shopper riding the elevator labeled $A_{1}$
  is descending towards the ground with a velocity of
  $\vec{v}=-5\hat{j}\,\frac{m}{s}$. Find the speed (in meters per
  second) and the acceleration in $\frac{m}{s^{2}}$ which will be seen
  by the shopper in the glass elevator in the instant $t=3\,s$. You may
  use $g=10\,\frac{m}{s^{2}}$

The given alternatives on my book are as follows:
$\begin{array}{ll}
1.&-35\hat{i}-10\hat{j}\frac{m}{s}\\
2.&-25\hat{i}-10\hat{j}\frac{m}{s}\\
3.&-30\hat{i}-10\hat{j}\frac{m}{s}\\
4.&-25\hat{i}+10\hat{j}\frac{m}{s}\\
5.&-40\hat{i}-10\hat{j}\frac{m}{s}\\
\end{array}$
For this problem I'm totally lost at how should I understand or calculate the speed as seen from the observer. My first guess is that it might be the sum of the two speeds?. In other words that the speed of the shopper inside the glass elevator is the sum of the sphere as seen by him and the real speed. Or could it be the opposite?.
I'm still confused at this part.
The only thing which I could come up with was to write the position equation for the sphere as shown below:
$y(t)=y_{0}+v_{oy}t-\frac{1}{2}gt^2$
Although $v_{oy}=0$, and $t=3\,s$ there is no given information about how high is the building.
Then I turned my attention to the speed at $t=3\,s$ this would mean:
$v_{f}=v_{o}-gt$
$v_{f}=0-10(3)=-30\,\frac{m}{s}$
That would be the real speed of the sphere at that instant. My intuition tells me that the observer will see the ball going faster? and how about the acceleration?
Then and more importantly how can I find the acceleration and the velocity as seen by the observer riding in the elevator?. Can somebody help me here?.
Comment: setting $v_{oy}$ = `(initial velocity of sphere) = -(velocity of the elevator)` should do
Comment: @pooja Would you perhaps develop your answer a little bit more so I can follow the steps correctly?. How can I justify what you're implying?. Is the descending acceleration additive?.
Comment: Elevator is going at constant speed right?
Comment: @pooja It doesn't say. But *I assume* that **might be** the case. It doesn't make sense the elevator is moving with an acceleration down to the ground.
Comment: Before the sphere dropped, in observer's frame, the sphere appears to move up with 5m/s.
Comment: So you can add $+5 m/s $ to the initial velocity of the sphere
Comment: In observer's frame, the situation is same as if the kid has thrown the sphere vertically up with  speed  5m/s.
Comment: @pooja So then is just $+5-30=-25\hat{j}\frac{m}{s}$?. I mean if what I calculated before is correct?.
Answer: If the elevator is moving at a constant velocity, the acceleration due to gravity is the same inside the elevator as outside.
$a = -10\frac {m}{s^2}$
Velocities will be different due to the different frames of refference.
For the person in the elevator the relative velocity is.
$v = (-10t + 5) \frac{m}{s}$ at time $t=3, v(t) = -25\frac {m}{s}$
Comment: Okay where does the $-10t$ comes from?.
Comment: Is it because of the acceleration due gravity?.
Comment: Gravity provides acceleration to falling bodies.
Comment: Yes I know that. What I believe you might put is the equation in **this** order $v= +v_{o} - gt=+5-10t$ that's much easier for me to spot what you were intending to refer.
Comment: Addition is commutative.
Comment: Yes I know that. I mean that *typically* the equation for relating the final speed with an initial speed puts the latter as the first term and the second term is the acceleration multiplied the time. But that is just a custom.
Answer: That would be the real speed of the sphere at that instant. My intuition tells me that the observer will see the ball going faster? and how about the acceleration?
No. Since both the sphere and the observer are going down, the observer will see the ball going slower. As an example, suppose you're chasing me and our speeds are same, then you wouldn't see me moving at all.
Set $v_{oy}$ = (initial velocity of sphere) = -(velocity of the elevator) and work the kinematics equations as usual.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/100698/discussion-on-answer-by-pooja-how-do-i-find-the-velocity-of-a-sphere-falling-whe).
Comment: @pooja Mind checking? I did updated the chat with a clarification regarding my comment and answer to your latest comment as well.


Database design: Best Way to store heterogeneous subtypes of a parent class?

Question: Website has products with different categories
(Phones, tablets, Washing machines, ... etc)

Each product will have diff. prices depending on the store (If the user views Galaxy S4 16GB it will show $X for Xstore and $Y for Ystore)
The website will have heavy filtration. For instance phones might be filtered according to price, color, .. etc. also filtered by manufactures or stores. (All samsung products, all products at Xstore, ... etc)
For that reason Specs of each category should be stored separately (Phones: ScreenSize, Memory, Os, ... etc. watches will have different spec ..).
Each category (Phones or watches) is expected to have ~1000+ product.

Question:
I first thought of a pyramid-like design. One table for all products then adding general table for each category with the common specifications (For Phones it will have screen-size, Os, ..), then a third table for variations (Memory:16GB or 32GB, Price at each store, ... etc).
Problem is: The main table with all the products will be very large (thousands), and with heavy filtrations I will have to go back and forth between three tables at least, and If I'm filtering samsung products, I will have to deal with more table (tablets, laptops, ... etc).
I'm not sure whether it will go well from a performance point of view.
So I thought of the straight forward way; creating one single table for each category. Even variations will be duplicated (Galaxy S4 16GB and 32GB are 2 rows and even 16GB price at Xstore and Ystore will be in 2rows). I know it violates normalisation. But the table can barely exceed 1000 rows that way, I'll end up having much simpler code, and I think it will be performance efficient so I don't even need to index. The only case where I need to deal with all tables is when I'm filtering by manufacturer so I'll 've to grab Samsung tablets, phones, etc..
Sorry for elaborating, I was trying to make it as clear as possible as I don't have the schemas. Your patience is really appreciated and I'm open to new suggestions.
Thanks in advance :)

EDIT
The questions is categorization (only one level Phones, tablets, ..etc) each in a separate table VS all in one table and subs for category and diff attributes or specs. It's a performance question.
Comment: Could the same product have different attributes for different stores or do products differ based on teh attribute (128 meg IPAD vs 256 meg) same product different attributes or different products?
Comment: 128 GB IPAD is $1000 at store X.
128 GB IPAD is $990 at store y.
256 GB IPAD is $1200 at store Y
Comment: The first 2 are the same product but diff prices at diff stores. The third is another product.
Answer: category sub category can be a single table with parent child relation which help to have as many sub levels
or list all category in one table and another table to just specify relation
<code>id category parent
1 samsung    0
2 note       1
3  apple     0
4 ipad       3
</code>
store is sperate table
products will be another table with category id as foreign key
pricing another table with  product id and store id as foreign keys
just a brief idea !!
Comment: How did you categorise the products. Mine is:

(Phones, Tablets, Laptops, .. etc) and an ttribute in each item will tell its specifications (Manufacturer: Samsung, Memory: 16GB) so that I can do filteration based on these attributes or specifications.
Comment: i am not your db designer . thats just a sample data . DUMMY data


I need help with finding a polynomial and using it to find a perimeter

Question: So I need help with this problem, I'm new to polynomials.
Can you also explain how to get the answer?
Find the polynomial that models the problem and use it to estimate the quantity:

A rectangle has a length of $x$ and a width of $5x^3 + 4 - x^2$.
  Find the perimeter of the rectangle when the length is 5 feet.
Comment: Do you know the definitions of all the words (in particular: polynomial, Rectangle, length, width, perimeter) in the problem statement?
Comment: The perimeter of a rectangle is given by $2 \times (\mathrm{length} +\mathrm{width})$. Given $x = 5$ ft, you can use this to find to find the length and width. Then the aforementioned formula will give you the perimeter of the rectangle.
Answer: The perimeter of a rectangle is $2($length$+$width$)$. Put the values of length and width. You'll get :
Perimeter$=2×(x+5x^3+4-x^2)$. That's the polynomial of perimeter. Now put $x=5$, since the length$=5$. You'll get $2×(5+5×5^3+4-5^2) = 1218$. That's the required perimeter.
Comment: Yeah it's good now! @AnikBhowmick thanks for the help
Comment: How did you get the second 2 In 2 X (2 + 5 X $5^3$ + 4 - $5^2$)
Comment: Ohh sorry, that should be $x=5$. My bad... Thanks for noticing it !!
Comment: Now check it... I think it's okay now. @reberror


Showing that convolution is translation equivariant

Question: This question is inspired from this reading here
Let's take a simple example, take a kernel matrix of any size that holds any values. Take a zero matrix of any size larger than the kernel, and put a one somewhere in it. Convolution with the kernel and the matrix will simply reproduce the kernel surrounding where the 1 was in the matrix, a feature known as transitional equivariance (?).
While I can understand this conceptually and write out examples, I'm having a bit of trouble conceptualizing the written proof for the above case that shows that the convolution of a kernel with a zero-with-one-1 matrix. I was hoping someone could lead me in the right direction in coming up with a place to start.
Thanks.
Answer: I would start with the nice formula that your article gives you:
$$F*I(x,y)=\sum_{j=-N}^N\sum_{i=-N}^NF(i,j)I(x-i,y-j)$$
Now if $F(i,j)=\begin{cases}1&\text{if}\ i=i_0,j=j_0\ \text{for some specific $i_0,j_0$,}\\0&\text{else,}\end{cases}$ then we get $$F*I(x,y)=\sum_{j=-N}^N\sum_{i=-N}^NF(i,j)I(x-i,y-j) = F(i_0,j_0)I(x-i_0,y-j_0)+0=I(x-i_0,y-j_0)$$ because all terms where $i\neq i_0$ or $j\neq j_0$ are $0$.
Indeed, $I(x-i_0,y-j_0)$ is just the matrix $I$, but translated by $i_0,j_0$.


Suppose that $f = ι_{\mathbb{R}_+}$. Show that

Question: Suppose that $f = ι_{\mathbb{R}_+}$. Show that $0$ is in the boundary of dom f and that $∂f(0)$ is nonempty using the definition of the sub differential.
Any hints or suggestions is greatly appreciated.
Comment: Can you clarify on what $f = ι_{\mathbb{R}_+}$ means? I have not seen this symbol before
Comment: This is pretty standard notation. $\mathbb{R}_+ := \{z \in \mathbb{R}\text{ s.t } z \ge 0\}$ and $i_{\mathbb{R}_+}$ is its indicator function.
Comment: @dohmatob More usual are the notations $\mathbf 1_A$ or $\chi_A$, with $A=\mathbb R_+$.
Comment: @OP Suggestion: Read the definition of the subdifferential then explain the **specific** problem you have to apply it here.
Comment: @Did: Nope you're --perhaps-- confusing indicator / indicator function in measure theory with indicator function in convex analysis. This is pretty standard notation, once more.
Comment: @dohmatob You might want to slowdown on the epithetes, I am confusing nothing, standard or not (enthusiasm is allright, but not if it leads to insult people).
Comment: @Did: Sorry if this came across as an insult. But I maintain this is **standard** notation in the given context (convex analysis).
Comment: I'm with @dohmatob on the notational issue. I've personally not seen dotless-i used in this manner.
Answer: By $\text{dom }f$, I suppose you mean the set on which $f$ is strictly less than $\infty$. Well, clearly in your case $\text{dom }f = \mathbb{R}_+$, and its boundary is $\{0\}$, which of course contains $0$. Finally, using the definition of subdifferentials, one computes
\begin{eqnarray}
\begin{split}
\partial f(0) &:= \{v \in \mathbb{R} \text{ s.t }f(z) \ge f(x) + \langle v, z - 0\rangle\text{ }\forall z \in \mathbb{R}\} = \{v \in \mathbb{R} \text{ s.t }vz \le 0\text{ }\forall z \in \mathbb{R}_+\}\\
&= \{v \in \mathbb{R} : v \le 0\} \ne \emptyset.
\end{split}
\end{eqnarray}
Alternatively, you can use the theory of proximal operators to get
\begin{equation}
v = v - 0 \in \partial f(0) \iff 0 = \mathrm{prox}_f(v) = \mathrm{proj}_{\mathbb{R}_+}(v) = (v)_+ \iff v \le 0.
\end{equation}
Comment: Note that $f(z) = +\infty$ in case $z < 0$. Hence, the inequality in the definition of the subdifferential trivially holds for such $z$. I have corrected your answer.
Comment: Ya, you're definitely right. Pre-coffee posts...
Comment: @dohmatob, What would be the Prox Operator for $ f \left( x \right) = {x}_{+} $ (Projection on $ {\mathbb{R}}_{+} $)?


Stanley-Reisner ring and toric variety

Question: My question comes from two names.
For a finite (topological) simplicial complex $\Delta$, we have its Stanley-Reisner ring $k[x_1,\dots,x_n]/I_\Delta$. This ideal is homogeneous so we can take the $\mathrm{Proj}$ construction getting a projective variety (we assume $k$ is algebraically closed).
Because $\Delta$ is set to be finite, we have a polytope that is simplicial. Then we have a toric variety over $k$ associated to this polytope.
Do these constructions give us the same varieties? (If the answer is yes, we can know that this variety is simplicial as well.) (For this variety being simplicial, I might be wrong.)
Comment: I think the story goes as follows: The polytope defines a toric variety + a divisor. You can scale or translate your polytope and will get the same variety, but with a different divisor. Two polytopes will define isomorphic varieties iff there is an element of $GL_n(Z)$ taking one of the to the other.
Comment: 1. How do you produce a toric variety from your finite simplicial complex? The classical construction is from a fan, which is fairly different from a finite simplicial complex. 2. What is your definition of a simplicial variety?
Comment: @KReiser The fan is taken to be the normal fan of the polytope (see Cox, Little, Schenck, section 2.3). A toric variety is said to be simplicial if its fan is simplicial.
Answer: The components of $\mathbf{P}(\Delta) = \operatorname{Proj} k[x_1,...,x_n]/I_{\Delta}$ are in 1-1 correspondence with the maximal faces of $\Delta$, so you never get a toric variety this way, except in the case of $\Delta$ being a simplex (in which case you get $\mathbf{P}(\Delta) = \mathbf{P}^n$).
Now, I'm assuming you're talking about $\Delta$ being the boundary of a simplicial polytope. In that case, there's not much of a connection between the Stanley-Reisner (projective) scheme, and the toric variety $X_P$. However, if all the facet simplices of $P$ are unimodular, i.e. of volume $1$ (or dilations of unimodular simplices), then we do in fact have that $\mathbf{P}(\Delta)$ is isomorphic to the torus-invariant anti-canonical divisor $-K_{X_P} = \sum_{F \text{ facet}} D_F \subseteq X_P$.

Stanley-Reisner ring and toric variety


Active user account after administration's confirmation

Question: How to, by using module Profile2 Registration Path, the user's account becomes active after it is activated by the administrator. The administrator should get email when user creates new account.
Answer: I don't think you need a contrib module for that. You can set " Visitors, but administrator approval is required" under "Who can create accounts" on admin/config/people/accounts.
As for sending e-mail, create an advanced action at admin/config/system/actions and then set it on admin/structure/trigger/user to be triggered by account creation.
The core Action and Trigger modules are all that are required for that.


Inconsistent Glue Records

Question: We've picked up a number of issues on mxtoolbox and various other online DNS tools that we have inconsistent glue records. In particular, it appears that the glue records setup at the TLD (.host in this case) has glue records setup for our 4 nameservers but 2 of their NIC servers do not have an IP address assigned.
In particular, .host has 4 NIC servers (a.nic.host - d.nic.host) and it appears that only a.nic.host and b.nic.host has IP addresses assigned to our 4 name servers where c.nic.host and d.nic.host has none.
When we do a query for our domain on pingdom dns check tool we're given a number of errors:
 Nameserver ns1.intelli.host is listed for zone intelli.host without address information.
 Nameserver ns3.intelli.host is listed for zone intelli.host without address information.
 Nameserver ns4.intelli.host is listed for zone intelli.host without address information.

These errors appear at random (i predict based on which NIC server returned the results).
Ultradns is more precise at the bottom of the trace indicating that online a.nic.host and b.nic.host has IP addresses assigned.
When I however do a:
 dig +norec @c.nic.host intelli.host NS

I am given IP addresses for the 4 nameservers - This leads me to believe that either I'm not doing the correct dig command on that the various online tools like pingdom and ultratools are reporting incorrectly (which I doubt)
Can anyone confirm whether my understanding of the issues we experience is correct?
UPDATE (DAY 2)
Thank you all for your help thus far! From answers thus far it appears that it may pingdom leading us in the dark, but I have found 2 other DNS tool sites also giving random results.
What is clear in all of these cases is that, at random, we will get some sort of DNS issue, and from what I can again gather it's when c.nic.host or d.nic.host is reporting glue records:
VIEWDNS:
http://viewdns.info/dnsreport/?domain=intelli.host
Note that this one gives different results with some queries. It mostly changes dependant on which server gives it a result (in this case it was d.nic.host):
Nameserver records returned by the parent servers are:
ns2.intelli.host. [NO GLUE] [TTL=3600]
ns3.intelli.host. [NO GLUE] [TTL=3600]
ns1.intelli.host. [NO GLUE] [TTL=3600]
ns4.intelli.host. [NO GLUE] [TTL=3600]

This information was kindly provided by d.nic.host.

Error also from VIEWDNS:
Oops! The IP addresses (GLUE) returned for your nameserver don't match! You should closely observe the nameserver details above and identify where the differences lie.
ULTRADNS
https://www.ultratools.com/tools/dnsLookupResult (might have to search here for intelli.host as there is no direct link)
When going to trace, it shows at the bottom the returned HOST records as follows:
host.
b.nic.host.66 ms
intelli.host.   ns2.intelli.host.   126.96.36.199
intelli.host.   ns1.intelli.host.   18.104.22.168
intelli.host.   ns3.intelli.host.   220.127.116.11
intelli.host.   ns4.intelli.host.   18.104.22.168

d.nic.host.3 ms
intelli.HOST.   ns2.intelli.host.
intelli.HOST.   ns1.intelli.host.
intelli.HOST.   ns3.intelli.host.
intelli.HOST.   ns4.intelli.host.

c.nic.host.38 ms
intelli.HOST.   ns1.intelli.host.
intelli.HOST.   ns4.intelli.host.
intelli.HOST.   ns3.intelli.host.
intelli.HOST.   ns2.intelli.host.

a.nic.host.65 ms
intelli.host.   ns4.intelli.host.   126.96.36.199
intelli.host.   ns1.intelli.host.   22.214.171.124
intelli.host.   ns2.intelli.host.   220.127.116.11
intelli.host.   ns3.intelli.host.   22.214.171.124

Comment: At the time of this comment, ns3 and ns4 are no longer showing up in the [pingdom errors](http://dnscheck.pingdom.com/?domain=intelli.host). ns1 is still there, and ns2 (not in the original question) ihas appeared. Something strange is definitely going on here.
Comment: @AndrewB Yes this morning it's only indicating issues on ns2, the others are no longer reporting as problems, but the strange thing is we have not actually done anything. I've picked up similiar issues on ultradns and viewdns.org, but also at random
Comment: Describe "similar issues on [other services]"? An example would be helpful, as the current error messages are specific to Pingdom.
Comment: Sorry just updated my original question with the findings.
Comment: `c.nic.host` and `d.nic.host` being consistently involved would fit the theory that it has something to do with case sensitive comparison between DNS records. At this point I think it would be best to let [RADIX](https://radixregistry.com/dot-host) (TLD operator for .host) run with this problem as it is impacting their brand. There is a problem at the TLD nameserver level that you cannot correct (and that we can't reproduce), or those two servers of theirs are being incorrectly flagged by poorly written software. We need a second .host domain that delegates to child nameservers to confirm.
Comment: I actually already have a support ticket open with them and with enom (the actual registrar) - Enom has a massive backlog of support queries (ticket has been open for 12 days) so hoping radix will be helpful in resolving this query for us
Answer: You need to set both names and IP addresses for all your four name servers at the registrar. They probably have some web interface for that. Then, your name servers must have the exactly same four NS record (and their A records), all the name servers must have the same zone data etc.
See IANA Technical requirements for authoritative name servers:

Consistency between glue and authoritative data
For name servers that
  have IP addresses listed as glue, the IP addresses must match the
  authoritative A and AAAA records for that host.
Consistency between delegation and zone
The set of NS records served
  by the authoritative name servers must match those proposed for the
  delegation in the parent zone.
Comment: @Mauzilla Did you actually confirm that there was a mismatch between the glue and authoritative definitions? I don't see that this is the case, and the nameservers associated with the error have changed since the original question was posted. I don't think this was a result of acting on your answer as pingdom is now complaining about ns2, when it wasn't originally.
Comment: While you weren't having this problem, I'll keep this answer as it might be helpful for anyone who finds this on Google. This is the most common case.
Answer: I suspect you've stumbled across a bug in Pingdom's code with regard to mixed case. That's the most I can figure out here. Your next step should be to take this to Pingdom's technical support.
Step 1: Confirm that glue records are present
All glue records are present at the point of delegation:
$ dig +norec @c.nic.host intelli.host NS

; <<>> DiG 9.9.5-9+deb8u10-Debian <<>> +norec @c.nic.host intelli.host NS
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51608
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 4, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;intelli.host.                  IN      NS

;; AUTHORITY SECTION:
intelli.HOST.           3600    IN      NS      ns1.intelli.host.
intelli.HOST.           3600    IN      NS      ns3.intelli.host.
intelli.HOST.           3600    IN      NS      ns4.intelli.host.
intelli.HOST.           3600    IN      NS      ns2.intelli.host.

;; ADDITIONAL SECTION:
ns1.intelli.HOST.       3600    IN      A       126.96.36.199
ns2.intelli.HOST.       3600    IN      A       220.127.116.11
ns3.intelli.HOST.       3600    IN      A       220.127.116.11
ns4.intelli.HOST.       3600    IN      A       188.8.131.52

;; Query time: 32 msec
;; SERVER: 2a02:e180:3::2#53(2a02:e180:3::2)
;; WHEN: Tue Jun 20 23:32:59 UTC 2017
;; MSG SIZE  rcvd: 205

Step 2: Confirm that glue records align with data on child nameservers:
$ for ip in 18.104.22.168 22.214.171.124 220.127.116.11 188.8.131.52; do echo ==@$ip==; dig @$ip +noall +question +answer ns{1..4}.intelli.host; done
==@22.214.171.124==
;ns1.intelli.host.              IN      A
ns1.intelli.host.       14400   IN      A       220.127.116.11
;ns2.intelli.host.              IN      A
ns2.intelli.host.       14400   IN      A       220.127.116.11
;ns3.intelli.host.              IN      A
ns3.intelli.host.       14400   IN      A       22.214.171.124
;ns4.intelli.host.              IN      A
ns4.intelli.host.       14400   IN      A       22.214.171.124
==@220.127.116.11==
;ns1.intelli.host.              IN      A
ns1.intelli.host.       14400   IN      A       188.8.131.52
;ns2.intelli.host.              IN      A
ns2.intelli.host.       14400   IN      A       184.108.40.206
;ns3.intelli.host.              IN      A
ns3.intelli.host.       14400   IN      A       220.127.116.11
;ns4.intelli.host.              IN      A
ns4.intelli.host.       14400   IN      A       184.108.40.206
==@188.8.131.52==
;ns1.intelli.host.              IN      A
ns1.intelli.host.       14400   IN      A       18.104.22.168
;ns2.intelli.host.              IN      A
ns2.intelli.host.       14400   IN      A       22.214.171.124
;ns3.intelli.host.              IN      A
ns3.intelli.host.       14400   IN      A       126.96.36.199
;ns4.intelli.host.              IN      A
ns4.intelli.host.       14400   IN      A       184.108.40.206
==@18.104.22.168==
;ns1.intelli.host.              IN      A
ns1.intelli.host.       14400   IN      A       184.108.40.206
;ns2.intelli.host.              IN      A
ns2.intelli.host.       14400   IN      A       184.108.40.206
;ns3.intelli.host.              IN      A
ns3.intelli.host.       14400   IN      A       126.96.36.199
;ns4.intelli.host.              IN      A
ns4.intelli.host.       14400   IN      A       220.127.116.11

Step 3: Confirm that there is no NS record mismatch
$ for ip in 220.127.116.11 18.104.22.168 220.127.116.11 220.127.116.11; do echo ==@$ip==; dig @$ip +short intelli.host NS ; done
==@188.8.131.52==
ns1.intelli.host.
ns2.intelli.host.
ns3.intelli.host.
ns4.intelli.host.
==@18.104.22.168==
ns2.intelli.host.
ns3.intelli.host.
ns4.intelli.host.
ns1.intelli.host.
==@188.8.131.52==
ns2.intelli.host.
ns4.intelli.host.
ns1.intelli.host.
ns3.intelli.host.
==@22.214.171.124==
ns1.intelli.host.
ns2.intelli.host.
ns4.intelli.host.
ns3.intelli.host.

Step 4: Consult the almighty dnsviz for DNSSEC inconsistencies
Looks good.
Step 5: Re-evaluate the problem
Your initial question indicated that Pingdom reported problems with ns1, ns3, and ns4. When I ran the same check through Pingdom, I received errors for a different set of nameservers:

Delegation
Nameserver ns2.intelli.host is listed for zone intelli.host without
  address information.
Nameserver ns4.intelli.host is listed for zone intelli.host without
  address information.

The error for ns4 is still present.
The errors for ns1 and ns3 are gone.
The error for ns2 is new.

At this point I evaluated the possibility that the inconsistency was at the parent nameservers:
$ for ns in {a..d}; do echo ==@$ns.nic.host==; dig @$ns.nic.host +noall +question +authority +additional intelli.host; done
==@a.nic.host==
;intelli.host.                  IN      A
intelli.host.           3600    IN      NS      ns1.intelli.host.
intelli.host.           3600    IN      NS      ns2.intelli.host.
intelli.host.           3600    IN      NS      ns3.intelli.host.
intelli.host.           3600    IN      NS      ns4.intelli.host.
ns1.intelli.host.       3600    IN      A       126.96.36.199
ns2.intelli.host.       3600    IN      A       188.8.131.52
ns3.intelli.host.       3600    IN      A       126.96.36.199
ns4.intelli.host.       3600    IN      A       220.127.116.11
==@b.nic.host==
;intelli.host.                  IN      A
intelli.host.           3600    IN      NS      ns1.intelli.host.
intelli.host.           3600    IN      NS      ns3.intelli.host.
intelli.host.           3600    IN      NS      ns2.intelli.host.
intelli.host.           3600    IN      NS      ns4.intelli.host.
ns1.intelli.host.       3600    IN      A       22.214.171.124
ns2.intelli.host.       3600    IN      A       18.104.22.168
ns3.intelli.host.       3600    IN      A       184.108.40.206
ns4.intelli.host.       3600    IN      A       22.214.171.124
==@c.nic.host==
;intelli.host.                  IN      A
intelli.HOST.           3600    IN      NS      ns3.intelli.host.
intelli.HOST.           3600    IN      NS      ns2.intelli.host.
intelli.HOST.           3600    IN      NS      ns1.intelli.host.
intelli.HOST.           3600    IN      NS      ns4.intelli.host.
ns1.intelli.HOST.       3600    IN      A       184.108.40.206
ns2.intelli.HOST.       3600    IN      A       22.214.171.124
ns3.intelli.HOST.       3600    IN      A       184.108.40.206
ns4.intelli.HOST.       3600    IN      A       22.214.171.124
==@d.nic.host==
;intelli.host.                  IN      A
intelli.HOST.           3600    IN      NS      ns2.intelli.host.
intelli.HOST.           3600    IN      NS      ns4.intelli.host.
intelli.HOST.           3600    IN      NS      ns1.intelli.host.
intelli.HOST.           3600    IN      NS      ns3.intelli.host.
ns1.intelli.HOST.       3600    IN      A       220.127.116.11
ns2.intelli.HOST.       3600    IN      A       22.214.171.124
ns3.intelli.HOST.       3600    IN      A       22.214.171.124
ns4.intelli.HOST.       3600    IN      A       184.108.40.206

Note that the case for .HOST changes in the responses from C and D. At this point I suspect the most likely case is that Pingdom is barfing when attempting to do comparisons between mixed case DNS entities, which is would be a bug according to the DNS standards.
Comment: I've updated my question with some newer findings. Thank you so much for your comprehensive help so far!
Comment: Thanks Andrew, nice investigation! I must admit that I thought the `intelli.host` was a replacement for the actual domain. I confirm, this seems like a bug in Pingdom. Has someone reported it?

Inconsistent Glue Records


Graphical representation of an equation

Question: How to plot a graph of the equation
$12x^2-36x +15+ 16y^2 = 0$
I don't know how to plot that. Can you please give me the graph of this equation?
Comment: It should not go through origin. Shouldn't it?
Comment: I think [this](https://www.wolframalpha.com/input/?i=12x%5E2-36x+%2B15%2B+16y%5E2+%3D+0) is what you are looking for. Wolfram Alpha is a very useful site for getting this sort of information.
Comment: Sorry, that graph probably wasn't zoomed in enough. [This](https://www.wolframalpha.com/input/?i=12x%5E2-36x+%2B15%2B+16y%5E2+%3D+0,+x%3D0) will show that it doesn't actually ever reach $x=0$, so it can't touch the origin.
Answer: Observe we have
\begin{align}
12x^2-36x+15+16y^2=&\ 12(x^2-3x+\frac{9}{4})-27+15+16y^2\\
=&\ 12\left(x-\frac{3}{2}\right)^2+16y^2-14=0
\end{align}
which means
\begin{align}
\frac{\left(x-\frac{3}{2}\right)^2}{14/12}+\frac{y^2}{14/16} = 1
\end{align}
i.e. you have an ellipse centered at $(3/2, 0)$.
Answer: You can make the problem explicit solving for $y$ equation $$12x^2-36x +15+ 16y^2 = 0$$ This will give $$y=\pm \frac{\sqrt{3}}{4}  \sqrt{-4 x^2+12 x-5}$$ Since $-4 x^2+12 x-5 \geq 0\implies \frac 12 \leq x \leq \frac 52$.
Plot the two branches and get the ellipse identified by Jacky Chong.
Answer: You have an elipse generally of the form $$\frac{(X-X_0)^2}{a^2}+\frac{(Y-Y_0)^2}{b^2}=1$$ where $(X_0,Y_0)$ is the center of the ellipse, and a and b are the semi-axes.  Somehow you have to get your problem into this form.  But immediately you see that there is no Y term, so you know that $Y_0 = 0$.
Knowing that the widest diameter of the ellipse is on the X axis, you can solve as Leibovici above did.
To find the left and right boundaries of the ellipse, set Y=0 and factor $12X^2-36X+15$ to get $3(2x-5)(2x-1)$.  The center of the ellipse is half way between these two roots of $\frac{5}{2}$ and $\frac{1}{2}$ at $X_0 = \frac{3}{2}$.
To find the top and bottom boundaries of the ellipse, set $X = \frac{3}{2}$ and solve for Y.
The bottleneck in the problem was the factoring job.  Once that was done, the rest was easy!

Graphical representation of an equation


What is the meaning of squared root n when we talk about asymptotic properties?

Question: I just wonder what is the meaning or intuition behind $\sqrt{n}$ before $(\hat\beta-\beta)$ when we talk about asymptotic normality. Where does $\sqrt{n}$ come from?
$\sqrt{n}(\hat\beta-\beta)\xrightarrow{ d }N(0,\sigma^2)$
Answer: It "comes from" the central limit theorem, see What intuitive explanation is there for the central limit theorem?. It turns out that for many, although clearly not all estimators, scaling the estimation error $\hat\beta-\beta$ by $\sqrt{n}$ yields a nondegenerate asymptotic normal distribution.
See root-n consistent estimator, but root-n doesn't converge? for further discussion.
See Estimation of unit-root AR(1) model with OLS for an example of an estimator that does not converge at the $\sqrt{n}$ rate.


Standardized beta coefficients in nonlinear regression

Question: In linear models $Y=X\beta+\epsilon$, where the errors $\epsilon_i\sim\text{Normal}(0,\sigma^2)$ are independent, the standardized beta coefficients are given by
$$ \beta_i^*=\beta_i\frac{\sigma_{x_i}}{\sigma_y}, $$
where $\sigma_{x_i}$ is the standard deviation of the $i$-th column of $X$ and $\sigma_y$ is the standard deviation of $Y$.
For nonlinear models $Y=f(\beta)$, one linearizes $f$ and works with $X=Jf(\beta_{\text{ls}})$, where $Jf$ is the Jacobian matrix of $f$ and $\beta_{\text{ls}}$ is the least-squares fitting of $y=f(\beta)$, where $y$ is real data. The common formulas for linear regression are valid for the nonlinear case using the corresponding matrix $X$.
My question is whether the formulas for the standardized beta coefficients also hold in the nonlinear setting, namely taking as $\sigma_{x_i}$ the standard deviation of the $i$-th column of $Jf(\beta_{\text{ls}})$. I am asking this question because I have a nonlinear model and I would like to assess which variables have the greatest association with the response variable individually.
Comment: This form of standardization doesn't make a whole lot of sense for a nonlinear model.  (In a linear model, standardizing the *variables* induces this scale change in the corresponding parameters *specifically because the model is a multilinear function of the variables and the parameters.*)  Could you therefore explain *why* you are standardizing and how you hope to interpret the coefficients?
Answer: In nonlinear models, the relationship between the response variable and the predictors is not directly linear, making the interpretation of standardized beta coefficients less straightforward than in linear models. Although you can linearize the nonlinear function and use the Jacobian matrix to approximate a linear relationship, the standardized beta coefficients from this linear approximation may not accurately represent the true effect of each predictor in the original nonlinear model.
The idea of standardizing beta coefficients in the linearized version of a nonlinear model using the standard deviation of the i-th column of the Jacobian matrix might provide some insights into the relative importance of the predictors. However, this approach has limitations:

The linearized version of the model is only an approximation, and the standardized beta coefficients may not represent the true effect of the predictors in the original nonlinear model.
Standardized beta coefficients are more interpretable in linear models, where the effect of each predictor on the response variable is constant. In nonlinear models, the effect of predictors can change depending on the values of the other predictors.

Instead of relying on standardized beta coefficients, you may want to consider alternative methods to assess the importance of predictors in a nonlinear model, such as:

Sensitivity analysis: Examine how changes in each predictor affect the model's predictions. This approach can help you understand the relative importance of each predictor and how their effects might change depending on the values of other predictors.
Variable importance measures: Use techniques like Random Forests, which can handle nonlinear relationships and provide an importance score for each predictor.

In summary, the formulas for standardized beta coefficients in linear models do not directly translate to nonlinear models. Although you can use the linearized version of the model and the Jacobian matrix to approximate the relative importance of predictors, this approach has limitations. You may want to explore alternative methods, such as sensitivity analysis or variable importance measures, to assess the association between predictors and the response variable in a nonlinear model.


Where does the nick-name for Beethoven's Piano Sonata No. 14 in C-sharp Minor, Op. 27, No. 2 come from?

Question: It is commonly said in music spheres that Beethoven did not give the Sonata the title of Moonlight. That leads me to wonder what is the source of the unofficial name then if not from the composer?
Comment: @Aaron I disagree; all the necessary history is right there in a comment, and although the earlier question mentions a particular movement, it is the first hit when I search "moonlight sonata." I made an edit just now to its accepted answer to bring some of the data from the comment into an answer, but it's not expecting too much of people not only to search but to read the whole page (especially when the accepted answer mentions the comment, which was itself a comment because it simply pointed to Wikipedia).
Comment: The answer might not say which one, but the highest-rated comment to the question does.
Comment: The way duplicates work here is that they now both point to the same place, so any new person searching for **either** set of words will get to the right place.
Comment: I've voted to reopen. The other question does not relate to this one, and it's not a reasonable expectation that someone searching for this answer would read the comments — especially since there's no clear relationship between the questions.
Comment: @AndyBonner - with Aaron on this one. A  little technical, but fair nevertheless. And your edit happened *after*, not *before* the event.
Comment: @AndyBonner - sorry, that one doesn't fit the remit of this site..! Is the answer 'till he's found his satnav?'
Comment: It was in a comment under the duplicate question, yes (thankfully now edited into the top answer), but it was definitely visible there as soon as you went to that question.
Comment: So a music critic the answer does not say which one. It does not really answer my question. I would like to know what person coined the phrase. I don't really care why it was called what it is, I want to know who called it by that name.
Comment: The other question is vaguely related, but the answer to *this* one is only contained in a comment therein. How would searching for the other reveal the answer? It really concerns the *3rd* movement, which is most un-moonlight-like!? While only the 1st movement is moonlight-ish.
Comment: (I guess the meta-question is, if there's a case where the question is distinct from an earlier one, but their answers are (essentially) the same, should they be handled separately?) At any rate, if we do re-open, let's give this one an answer that we'll be able to reference for any future "Why come the [X] Sonata is called [X]?" question.
Comment: @AndyBonner As a community, we tend to treat questions as duplicates, but not answers. Personally, I tend to agree with you that if the answers are duplicates, then the questions should be treated that way as well. However, in the case of this specific question, I think it's one that deserves its own dedicated post.
Comment: @AndyBonner - there are many occasions when the answer to different questions is the same, for all sorts of reasons. Simple example - the answer's 2, what's the question(s)?
Comment: @Tim "How many roads must a man walk down?"
Comment: @DoktorMayhem - I don't see how asking the one question will come up with the answer to a different question, helping anyone. Why would someone trying to find out the name of someone type in '3rd movement, Moonlight'? And till now, the real answer was in a comment (till mine!).
Comment: Well done with enough editing the quoted question was made a dupe. Nothing like some after-the-fact editing to make a moderator choice correct.
Answer: It was another Ludwig. This one was called Rellstab. Five years after Beethoven had died,(1832) he was the critic who named the 'Moonlight.
Comment: @Doktor Mayhem - that was in there to show what little effort was made by OP. I thought we preferred that questions showed at least some effort by OP.
Comment: Hi @Tim - yeah, we do, but it got flagged by a couple of folks as rude so thought I'd remove. It doesn't take away from your post.
Comment: @DoktorMayhem - can't believe how sensitive some folks are... Must keep up the stocks of cotton wool ! A spade's a spade where I come from, but we're all different - it seems.


How can I change DatePickerDialog Header color background with my own customization? [Not Solved]

Question:
NOTE: This answer is not accurate. The problem in that accepted answer is it changes the footer color also.
I just want to change header color to black.
Please Note: Other things should not be change. For button, I sat button color programatically, which is perfect and date selected circle background color also should not be changed. Becasue I'm trying from last 6 hrs, but no luck.
I'm trying on 6.0.1
Code:

And, I use this theme (dialog_picker_theme) in my datapickerdialog.
Answer: Apply preferred header color to the attribute android:textColorPrimaryInverse on your app's Base Application Theme:
  <item name="android:textColorPrimaryInverse">@color/colorPrimary</item>


Is it possible to have an external server within a company's firewall?

Question: I am sure this is server admin 101, but I am unsure of the answer and would love some help.
I am a software developer I have built an application for a client and am currently hosting it successfully on SliceHost.  We are now coming out of Beta and the client wants to have the application within their firewall, but they do not want to deal with headache of hosting and maintaining the server.
Is there a way I can recommend that we put our server at SliceHost within their Firewall?  Is that an easy thing to do?
Their specific requirements are:

For my application to authenticate against their Active Directory, and
Only allow access to the application from within their network

If that is not possible, what should I recommend to my client?
Comment: Not sure what they are asking you.  Do they want the service to access internal resources, you may want a VPN.  Do they want be in complete control of the hardware?  If they want to host it inside their network but not deal with it, they may be expecting you to offer to contract to support the box for them.
Answer: No. If they want it "within" their firewall, that means that it's in their network, at their location, and they own and control the server - unless they are willing to pay to contract that server's management to a third-party.
Unless they mean something different by "within their firewall" - perhaps a fuller explanation of what they want might engender more suggestions?
Edit - with your new info, then the answer is maybe.

For my application to authenticate against there ActiveDirectory,

Yes, if SliceHost offers a site-to-site VPN option, then you can connect that to their firewall (assuming it can be an endpoint) and the hosted app can connect to their AD. You could also use LDAPS and expose the LDAPS port of a DC to the internet.

Only allow access to the application from within there network

Yes, if Slicehost offers site-to-site VPN as above, then make the server only allow connections from the VPN. Or, if you know the source IP(s) for the customer office won't change, see if SliceHost can restrict the host to allow connections from only those IPS.
Comment: This is the way to go based on their requirements. Establish a VPN between the slicehost server and their internal network. You can then either direct all traffic from the slicehost machine through the VPN, or keep the external data connections but route the AD traffic through the VPN.
Answer: I think the first thing to do is clarify what exactly "within their firewall" means.
Can you place a physical server on their network, inside their firewall, and manage it remotely (with the correct changes to said firewall to allow this)? Of course, perfectly normal way of doing things.
Other than that, I suppose you can create a VPN so your server, hosted wherever, tunnels through the VPN so it appears "logically" inside their firewall even though it isn't physically so. I'd ask what they hoped to achieve with this approach though if this is the sort of thing they're talking about because it's not really a straightforward way of doing things.
Without wishing to be rude, I have a few things that I classify as "If you have to ask, then you probably shouldn't" within IT and fiddling around with VPN and firewall settings is one (or is it two?) of them, so if this is what they're after you need to be very careful about what you do next. I'd certainly be uncomfortable with a server administered by a partner organisation but hosted at a random (to me) 3rd party being connected to my LAN via a VPN... so many potential sources of outages and security issues.
Comment: No offense taken, I will certainly not be doing this server/security setup -- we totally will engage an expert when the time comes.  I just want to be able to offer an intelligent proposal.  Thanks,  I updated my question with more specific requirements


Proper Lifecycle Order For Annotation Processing In Maven

Question: I'm currently working on a java project where I need to generate and compile JPA metamodel classes as part of the build. I did some research and found an answer here: Generate the JPA metamodel files using maven-processor-plugin - What is a convenient way for re-generation? that seems like a reasonable solution. The problem is, my project also contains some groovy classes that need to be compiled alongside the java. If I enable the maven-processor-plugin, the maven build will fail as soon as it encounters a java class that depends on a groovy class. Looking at the console output, I can see that maven-processor-plugin is running before the groovy compiler, so those groovy classes have not had a chance to be compiled.
Does anyone know if there is a good way to handle this? Is there some way to break the compilation process up into stages so that I can control what gets processed when?
Here is a snippet of my pom.xml:
<code><build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <showWarnings>false</showWarnings>
                <compilerId>groovy-eclipse-compiler</compilerId>
               <compilerArgument>-proc:none</compilerArgument>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-compiler</artifactId>
                    <version>3.6.0-03</version>
                  </dependency>
                  <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-batch</artifactId>
                    <version>3.0.7-02</version>
                  </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.bsc.maven</groupId>
            <artifactId>maven-processor-plugin</artifactId>
           <version>4.5-jdk8</version>
            <executions>
                <execution>
                    <id>process</id>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <phase>generate-sources</phase>
                    <configuration>
                        <outputDirectory>${project.build.directory}/../src/main/generated-sources/java/jpametamodel</outputDirectory>
                        <processors>
                            <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
                        </processors>
                        <overwrite>true</overwrite>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-jpamodelgen</artifactId>
                    <version>5.3.13.Final</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${project.build.directory}/../src/main/generated-sources/java/jpametamodel</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
    </plugins>
</build>
</code>
Comment: Does the processor plugin run over your Java sources? Does compilation happen afterwards? If you need to compile first, I think the choice of phase controls when the processor runs.
Answer: After a good bit of trial and error I finally found a solution that seems to work. maven-processor-plugin can use include/exclude filters to limit the scope of the files it looks at. I added an includes filter that restricts the processing to my domain classes. Now when I build it can process my annotated classes without getting hung up on the groovy files.
My final result ended up looking like this:
<code>          <plugin>
                <groupId>org.bsc.maven</groupId>
                <artifactId>maven-processor-plugin</artifactId>
               <version>4.5-jdk8</version>
                <executions>
                    <execution>
                        <id>process</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                        <includes>
                            <include>com/tura/product/domain/*.java</include>
                        </includes>
                            <outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
                            <processors>
                                <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
                            </processors>
                            <overwrite>true</overwrite>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-jpamodelgen</artifactId>
                        <version>5.3.13.Final</version>
                    </dependency>
                </dependencies>
            </plugin>
</code>