Normality test and Outlier detection

Question: In this question, I would like to ask two things:

outlier detection
normality test

Details are as follows:
I need to detect and remove outliers in my data. Before doing that, I want to test if my data is normally distributed or not. I have two variables X(independent) and Y(dependent) and have 951 records for both of them.
I want to know that while testing the normality, do I need consider both the variables simultaneously or both the variables but one at a time? (Somewhere, I have read that only dependent variable is considered to test the normality).
The attached figures show the results of normality test (Analyse>>Descriptive >>Explore) of dependent variable. If normality test is done only on dependent variable, then it shows that the data is highly skewed. In such a case, how can I remove the outliers?
The significance level of Shapiro-Wilk test and Kolmogorov-Smirnov test is 0.00. Skewness has statistic of 22.909 with SE of 0.079.
Comment: Many people ask for normality testing, even if no normality testing is needed. Please consider your reasons and what you likely want to do is test the residuals (not the independent and the dependend) variable for normality by means of a quartile-quartile-plot.
Comment: Did you look at some of the highly voted threads under your tags? There have been hundreds -- possibly even thousands -- of questions similar to this.
Comment: As for outliers: consider where these data come from and whether it makes sense, that some data are so much higher then the rest. If so, the so called outliers may contain worthwhile information. If not, try to define the cut off from the underlying science, not from statistics. If that does not work, have you considered using robust measures like the 5%-trimmed mean instead of the mean or some form of robust regression?
Comment: The variables are rainfall (independent variable) and runoff (dependent variable). As hydrologists believe that runoff measurement by human means involves error, so they tend to remove outliers (Ref: various scientific papers). That's why, I have been after removing outliers. But just after posting the question and receiving answers, I went to my data again and found that higher runoff (17mm) is caused due to higher rainfall (13mm), which I think makes sense. Cont...
Comment: And 0 is also, I don't think will be erroneous because if all the water infiltrates and rainfall is little, runoff would be zero. And moreover, this is satellite data. So, now I myself, thinking that if removing outlier would be fair or not!! Cont...
Comment: The histogram isn't very helpful beyond telling you about marked skewness. For example, are there values all the way up to 15 or so, but they are just rare? I can't see bars myself What are the minimum and maximum values? If the minimum is positive, I would certainly consider logarithmic transformation. Can you report at least minimum, median and quartiles and maximum?
Comment: @Nick. Yes, I have seen them. But I was bothered about highly skewed variation in my dataset. That's why, posted the results to get the views. Regarding what you asked- the data distribution is like- there is only one value 17.06; 13 values between 1-4; 158 values - 0.01-1, 421 values - 0-0.01; 359 values of 0. Min=0, max=17.06, mean = 0.066, median = 0.0000387, IQ range = 0.0029
Comment: So, the presence of zeros is a difficulty for working with logarithmic scale. Can you post the data or say a random sample of about 100 of them? I think we need to see both variables as the real issue is modelling the relationship between them. Are you prepared to say what the variables mean? Sometimes that substantive context is a good guide to which models make sense.
Comment: A sample of data is as follow: first column as rainfall, second as runoff                                                                                0.00405 1.25E-06
0.005175 1.25E-06
0.0036 1.25E-06
0.015885 2.5E-06
0.026325 2.5E-06
0.01026 2.5E-06
0.01179 2.5E-06
0.013365 2.5E-06
0.01476 2.5E-06
0.00603 2.5E-06
0.01719 2.5E-06
0.01134 2.5E-06
0.00729 2.5E-06
0.0036 2.5E-06
0.01296 3.75E-06
0.00675 3.75E-06
0.01935 5E-06
4.72342495 2.171861258
6.433 3.4569
7.663 3.9855
13.066 17.06
9E-05 0
9E-05 0
0.004 0
0.009 0
Comment: I have published and taught and am generally familiar with this kind of data. The substance here is presumably runoff from a small area in a dry climate (or a dry period) if some runoff figures are zero. There is a key question of response time (present runoff is always to some extent a result of past rainfall)  and a related issue of whether your time bins are too short for your goals. Most important, this is a problem where discarding outliers on either variable is precisely the worst thing to do as the big rainfalls and runoffs are by far the most important.
Comment: On say annual timescales rainfall can be roughly normally distributed but not for shorter periods. (References: various hydrological papers and texts.)
Comment: Hmm..this is 3 hourly data!
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/82542/discussion-between-alexia-k-boston-and-nick-cox).
Comment: I think the real issue is whether regression makes sense and (if so) what kind of regression. That needs a different question.
Comment: This question is very broad, and I believe you would profit from
reading an introductory level textbook. We have a helpful list of
[free statistical textbooks.](https://stats.stackexchange.com/q/170/) If
afterwards you still have more specific questions, then please do ask
them here. If you already *have* read such a textbook, please edit
your question to make it more specific. Thank you!
Comment: I think you will find the information you need in the linked thread. Please
read it. If it isn't what you want / you still have a question afterwards,
come back here & edit your question to state what you learned & what you still
need to know. Then we can provide the information you need without just
duplicating material elsewhere that already didn't help you.
Answer: You write:

I need to detect and remove outliers in my data

Why do you need to do this? Detecting outliers is a good thing, but automatically removing them is not (and that seems like what you want to do). Since, from your question, it seems like you have some sort of regression problem, you should consider keeping the data and changing the regression method to e.g. quantile regression or robust regression.
You should also be aware that even OLS regression does not make assumptions about the distribution of the data (except that the DV is continuous or nearly so) but about the error.
You then write:

Before doing that, I want to test if my data is normally distributed
  or not

Again, why? But, if you want to test normality, as @brad said in his answer, graphical methods are best. I like both density plots (as Brad suggested) and quantile plot (as Nick suggested).  However, the latter take a bit of experience to use well. You could also try box plots.
Then you write:

I want to know that while testing the normality, do I need consider
  both the variables simultaneously or both the variables but one at a
  time? (Somewhere, I have read that only dependent variable is
  considered to test the normality).

This makes me strongly suspect you are doing regression. As I noted above, neither variable needs to be normally distributed (I don't doubt that you read what you read, but it's incorrect).
Finally, you show a histogram of your DV.  The histogram is not a very useful plot (as William S. Cleveland notes in his books).

Normality test and Outlier detection


How does this first inequality lead to the second?

Question: I can't seem to understand how (5.3.23) was reached (below). In particular, how is the fact that $\lambda \mapsto \lambda e^{-\lambda/2}$ is decreasing being used?
Here is the passage in question:

For all $k \le n/2$ with $k \ge 5$, we bound $k(n-k) \ge kn/2$, so that $$\mathbb E_\lambda[X_k] \le n(e \lambda e^{-\lambda/2})^k. \tag{5.3.22}$$ As a result, for $\lambda = a \log n$ with $a > 1/2$, and all $k \ge 5$, and using that $\lambda \mapsto \lambda e^{-\lambda/2}$ is decreasing for $\lambda \ge 2$, $$\mathbb E_\lambda[X_k] \le n^{1-k/4}. \tag{5.3.23}$$
Answer: If $\lambda = a \log n$, then $e^{-\lambda/2} = n^{-a/2} = \frac{n^{-1/4}}{n^{a/2 - 1/4}},$ and we can write $$e\lambda e^{-\lambda/2} = \frac{a e \log n}{n^{a/2 - 1/4}} \cdot n^{-1/4}.$$
There's that messy factor out front that we want to ignore, but the numerator in it is $O(\log n)$ and the denominator is $n$ raised to a positive power, so when $n$ is large enough the messy factor is less than $1.$
So we know that if $\lambda$ actually is $a \log n$ from some constant $a>\frac12$, then (ignoring the messy factor, as we've earned the right to do) $$\mathbb E_\lambda[X_k] \le n\left(n^{-1/4}\right)^k \le n^{1 - k/4}.$$
As far as I can tell, the point of saying that $\lambda \mapsto \lambda e^{-\lambda/2}$ is decreasing is that Proposition 5.10 wants to be true for all $\lambda \ge a \log n$ for some $a > \frac12$. So if it were true for $\lambda = \frac23 \log n$, but then stopped being true for $\lambda = (\log n)^2$, that would be a problem. It's a problem we don't have here, because making $\lambda$ bigger only makes the term raised to the $k$-th power smaller.
Comment: I've thought about this some more. I'm not entirely sure that you're explanation for the use of decreasing is right. A few lines above, an argument is made about $f(\lambda)$ being decreasing. I believe *that* is the reason we can restrict ourselves to the case $\lambda = a \log(n)$ (rather than $\lambda > a \log(n))$. So I'm still a bit puzzled by why we need the fact that $\lambda \to \lambda e^{-\lambda/2}$ is decreasing.


Ecto - accessing datetime fields by month

Question: defp query_by(query, %{"min_end_date_month" => min_end_date_month} = params) do
  query = from(q in query, where: q.end_date.month <= ^min_end_date_month)

  query_by(query, Map.delete(params, "min_end_date_month"))
end

The query function above is returning this error: (Ecto.Query.CompileError) q.start_date().year() is not a valid query expression. However, in the iex console, I can normally do some_record.end_date.month since month is a valid key. What am I doing wrong?
Answer: When a query returns a Date value to Elixir, Elixir decodes it into a Date struct, which lets you access the parts of the date using .year, .month, etc. A query is executed by the database though, where you can't access the year/month/day with a .. There are database specific functions to extract these values from a Date value. Assuming you're on PostgreSQL, you can use date_part:
query = from(q in query, where: fragment("date_part('month', ?)", q.end_date) <= ^min_end_date_month)

Comment: Hi, I encountered this error after modifying my query:
`Postgrex expected a float, got "11"`
Comment: Is `min_end_date_month` a string? I think you need to do `^String.to_float(min_end_date_month)`.


Responsive Image Module not reducing the file size when resizing the browser (Drupal 8)

Question: I have an issue using Responsive Image Module for drupal 8 that I can't seem to solved or figure out. As shown in this screenshot the file size of the original image is 685kb. But once I started to resize to the first breakpoint which is around 1366px the file size jumps to 1023kb or 1mb. My expectations was the file size should be reduced to even smaller size. I tried the option Resize and setting different dimensions proportionally or even Scale. But I still get the same results
Answer: I guess the 685kB is your original, uploaded file and the 1MB file is generated on the webserver by GD or ImageMagick.
When your original file is heavily compressed and at the same time your JPG quality setting is very high, the generated (pixel-smaller) files can be (byte-wise) larger than your original. There is not much you can do against this except reducing JPG quality settings in Configuration > Media > Image Toolkit
Another option would be using a modified JPG library like MozJpeg, but this is beyond the scope of Drupal.


Ionic app Run time error - Didn't find class com.vladstirbu.cordova.plugin.utils.AssetProvider

Question: I am getting the following error when I try to run an ionic android application.
java.lang.RuntimeException: Unable to get provider com.vladstirbu.cordova.plugin.utils.AssetProvider: java.lang.ClassNotFoundException: Didn't find class "com.vladstirbu.cordova.plugin.utils.AssetProvider"

The app has been builded successfully and no error when installing it. But it is crashing when I try to open the app.
Can anyone please help me to solve the issue here?
Comment: post your package.json for more informations.
Answer: It appears to be an issue with the recent 0.5.6 release of InstagramPlugin !
ionic cordova plugin remove cordova-instagram-plugin
ionic cordova plugin add email@example.com
ionic cordova run android

I compiled with 0.5.5 and did not encounter this issue!
Answer: Same problem here!

ionic 3.20.0
cordova 8.0.0
OS: Mac OS X 10.13.4
Comment: These kind of remarks are not suitable as answers and should instead be posted as a comment ;)
Comment: Sorry! I haven't 50 reputation... :(
Comment: Whoops, forgot that that's an issue. No clue what the right way of handeling this is, sorry.


Mixin bootstrap 3 classes - Undeclared mixin

Question: I'm trying to make a mixin to inherit from different bootstrap classes so in order to clarify my code.
So, instead of writing

I would like to write something like

I've create a .less file:
@import 'bootstrap/less/bootstrap.less';

.myGroup{
    .row-fluid;      //Undeclared mixin
    .col-lg-12;      //Undeclared mixin
    .page-header;    //Loads Ok.

}

I'm compiling client-side. I receive "undeclared mixin".
Any idea? Thanks!
Comment: In bootstrap 3 i think you don't have a .row-fluid class, just .row or .container-fluid
Answer: Columns in Bootstrap LESS source are generated dynamically via mixins in mixins.less.
This is the reason you can't call them directly as mixins.
Anyway I think it's better practice to give .col-lg-12 as a class to the element and not hiding it to your stylesheet. You shouldn't use .row and .col-* in same element either.
There is no such thing as .row-fluid in Bootstrap 3.

 ...

Comment: Bootstrap provides [dedicated mixins](http://getbootstrap.com/css/#grid-less) (e.g. `.make-*-column` etc.) you should use in this case .
Comment: Strictly speaking Less (since v1.6.x) allows to use dynamically generated classes as mixins too but not when they are generated via quite hackish "text processing" tricks (like Bootstrap `.col-*-*` classes are). See this [gist](https://gist.github.com/seven-phases-max/78ef7353573e375ea0d9#file-24243674-less) for example.
Comment: Thanks! So it's not possible to make a kind of shortcut in order to avoid repeating n times something like "class="col-xs-6 col-md-4" with class="myMediumDiv" ?


When is a quadratic a cube?

Question: Given a quadratic $f(n)=an^2+bn+c$, for what $n$ is $f(n)=m^3$ for some $m$? Can all solutions be found?
The particular cases I'm looking at are $f_k(n)=n^2+n+k$ for $k=\pm1$ but I'm interested in the general problem as well.
Comment: Note that this does not seem to appear in Piezas' collection: https://sites.google.com/site/tpiezas/006
Answer: If you multiply through by 64, you get the Mordell equation $$ 64 m^3 = 16(2n+1)^2 + (64k-16)  $$ or $$ (4m)^3 = (8n+4)^2  + (64k-16)  $$ or
$$  (8n+4)^2 = (4m)^3 + (16 - 64 k)  $$ or
$$ y^2 = x^3 + K,  $$
with $$ y = 8n+4, \; \; x = 4m, \; \; K = 16 - 64k.     $$
For each $k,$ the number of integer $(x,y)$ solutions is finite. The subset of those with $x \equiv 0 \pmod 4$ and $y \equiv 4 \pmod 8$ is finite.
Yes, good tables. For your $k=1,$ my $K=-48.$
E_-00048: r = 1   t = 1   #III =  1
          E(Q) = <(4, 4)>
          R =   0.5063673554
           4 integral points
            1. (4, 4) = 1 * (4, 4)
            2. (4, -4) = -(4, 4)
            3. (28, 148) = -2 * (4, 4)
            4. (28, -148) = -(28, 148)

So, $$k=1; \; \; m=1, n =0,-1; \; \; m=7, n =18,-19. $$
For your $k=-1,$ my $K=80.$
E_+00080: r = 1   t = 1   #III =  1
          E(Q) = <(4, 12)>
          R =   0.1536400350
           8 integral points
            1. (4, 12) = 1 * (4, 12)
            2. (4, -12) = -(4, 12)
            3. (-4, 4) = 2 * (4, 12)
            4. (-4, -4) = -(-4, 4)
            5. (1, 9) = -3 * (4, 12)
            6. (1, -9) = -(1, 9)
            7. (44, 292) = -4 * (4, 12)
            8. (44, -292) = -(44, 292)

So, $$k=-1; \; \; m=1, n =1,-2; \; \; m=-1, n =0,-1; \; \; m=11, n =36,-37. $$
This entry was at PLUS. The opposite signs are at MINUS
EEDDDDDDDIITTTTT: For the general $$ a n^2 + b n + c = m^3,  $$ I multiplied through by $64a^3$ and wound up with $$ (8 a^2 n + 4 ab)^2 = (4am)^3 + (16 a^2 b^2 - 64 a^3 c),   $$ so you can finish this with existing tables when $$ |16 a^2 b^2 - 64 a^3 c| \leq 10000. $$
EEEEEDDDITTTTTTTT TOO: When $a n^2 + b n + c$ factors over the integers, which happens when $b^2 - 4ac$ is non-ngative and a perfect square $0,1,4,9,16,\ldots$ evidently what happens is that you get one integer solution for free, then cannot be sure of any others. The example i did: with $a=1,b=1,c= -t^2 - t,$ we have $$ n^2 + n - t^2 - t = m^3.  $$ Now, this always has the solution $n=t,m=0.$ Usually that is all. But sometimes there are others. For $$ n^2 + n - 90 = m^3,   $$ there are two pair of other solutions $$ m=6, n=17,-18; \; \; m=456, n=9737,-9738.  $$ Go Figure.
Comment: Shouldn't that be $(4m)^3 = 64m^3$?
Comment: @TMM, yes, fixed that. It's always something.
Comment: I (+1)'d though, even before you fixed that small mistake ;)
Comment: (In particular you get $x = 4m$ and so both solutions give you solutions to the original problem: $7^3 = 18^2 + 18 + 1$ and $1^3 = 0^2 + 0 + 1$.)

When is a quadratic a cube?


Getting IMetadataDetailsProviders to Run More than Once in ASP.NET Core

Question: This is a tricky question which will require some deep knowledge of the ASP.NET Core framework. I'll first explain what is happening in our application in the MVC 3 implementation.
There was a complex requirement which needed to be solved involving the ModelMetaData for our ViewModels on a particular view. This is a highly configurable application. So, for one "Journal Type", a property may be mandatory, whereas for another, the exact same property may be non-mandatory. Moreover, it may be a radio-button for one "Journal Type" and a select list for another. As there was a huge number of combinations, mixing and matching for all these configuration options, it was not practical to create a separate ViewModel type for each and every possible permutation. So, there was one ViewModel type and the ModelMetaData was set on the properties of that type dynamically.
This was done by creating a custom ModelMetadataProvider (by inheriting DataAnnotationsModelMetadataProvider).
Smash-cut to now, where we are upgrading the application and writing the server stuff in ASP.NET Core. I have identified that implementing IDisplayMetadataProvider is the equivalent way of modifying Model Metadata in ASP.NET Core.
The problem is, the framework has caching built into it and any class which implements IDisplayMetadataProvider only runs once. I discovered this while debugging the ASP.NET Core framework and this comment confirms my finding. Our requirement will no longer be met with such caching, as the first time the ViewModel type is accessed, the MetadataDetailsProvider will run and the result will be cached. But, as mentioned above, owing to the highly dynamic configuration, I need it to run prior to every ModelBinding. Otherwise, we will not be able to take advantage of ModelState. The first time that endpoint is hit, the meta-data is set in stone for all future requests.
And we kinda need to leverage that recursive process of going through all the properties using reflection to set the meta-data, as we don't want to have to do that ourselves (a massive endeavour beyond my pay-scale).
So, if anyone thinks there's something in the new Core framework which I have missed, by all means let me know. Even if it is as simple as removing that caching feature of ModelBinders and IDisplayMetadataProviders (that is what I'll be looking into over the next couple of days by going through the ASP.NET source).
Answer: Model Metadata is cached due to performance considerations. Class DefaultModelMetadataProvider, which is default implementation of IModelMetadataProvider interface, is responsible for this caching. If your application logic requires that metadata is rebuilt on every request, you should substitute this implementation with your own.
You will make your life easier if you inherit your implementation from DefaultModelMetadataProvider and override bare minimum for achieving your goal. Seems like GetMetadataForType(Type modelType) should be enough:
public class CustomModelMetadataProvider : DefaultModelMetadataProvider
{
    public CustomModelMetadataProvider(ICompositeMetadataDetailsProvider detailsProvider)
        : base(detailsProvider)
    {
    }

    public CustomModelMetadataProvider(ICompositeMetadataDetailsProvider detailsProvider, IOptions<MvcOptions> optionsAccessor)
        : base(detailsProvider, optionsAccessor)
    {
    }

    public override ModelMetadata GetMetadataForType(Type modelType)
    {
        //  Optimization for intensively used System.Object
        if (modelType == typeof(object))
        {
            return base.GetMetadataForType(modelType);
        }

        var identity = ModelMetadataIdentity.ForType(modelType);
        DefaultMetadataDetails details = CreateTypeDetails(identity);

        //  This part contains the same logic as DefaultModelMetadata.DisplayMetadata property
        //  See https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultModelMetadata.cs

        var context = new DisplayMetadataProviderContext(identity, details.ModelAttributes);
        //  Here your implementation of IDisplayMetadataProvider will be called
        DetailsProvider.CreateDisplayMetadata(context);
        details.DisplayMetadata = context.DisplayMetadata;

        return CreateModelMetadata(details);
    }
}

To replace DefaultModelMetadataProvider with your CustomModelMetadataProvider add following in ConfigureServices():
services.AddSingleton<IModelMetadataProvider, CustomModelMetadataProvider>();

Comment: Tremendous! I don't know how I missed that! It's one of the few classes that I did not scrutinize. Perhaps I'll build in some smarts so that the caching stays in tact for all ModelTypes except the one which needs the run-every-time logic. Thanks very much.
Comment: They've made things so much harder to figure out. In the old version, you just set IsRequired to false and done. That's a getter only now and all the attribute lists are Readonly collections. Figuring out how to dynamically set whether a Property or not is required is proving to be a massive time-sink.
Comment: Think I have figured that part out. Need to implement IValidationMetadataProvider and I can set IsRequired in that. Hopefully that gets me all the way now.
Comment: @onefootswill Would be nice if you'd post your final solution as an answer, for posterity.
Comment: @IanKemp Hi Ian. I'll have to try and dig that code up. I'd be happy to post it here if I can find it. I'll need a bit of time though, as we are in the midst of a looming deadline.
Comment: @onefootswill so if I want to rebuild metadata on every request for [Display(...)] I should override DefaultModelMEtadataProvider and If I want to override [Required(ErrorMessage="")] I should use IValidationMetaDataProvider ? I am trying to use this for localization. Can't use default provider cause it caches it and reuse everytime and if a client customize the string it won't take effect....
Comment: Mad how many differently-worded Google searches it took before I found this! The link to the .NET source code for `DefaultModelMetadataProvider` is broken. You can now find it [here](https://source.dot.net/#Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/DefaultModelMetadataProvider.cs,d40147c1660b8a5b).
Comment: If I only want to rebuild the metadata sometimes - i.e. if _a thing_ has changed - is there a way to clear the cached metadata, rather than have to implement a custom `DefaultModelMetadataProvider` and rebuild the metadata every time, even if nothing has changed?


30 ampere machine

Question: I have a machine tha takes input of 30 ampere, and my power socket iof only 16amps, please advice wha chnges i will have to make??
Comment: Not to forget you likely would loose every kind of insurance you might have and will be personal liable for this.
Comment: Just changing the receptacle could be extremely dangerous.  You are likely to overload the circuit, and in the worst case cause a fire, or damage your equipment.
Comment: You're assuming its a computer. :) Might be shredding cars !
Comment: Install a 30a plug. point.
Comment: isn't it unlikely that he has a machine that takes 30 amps in the first place?
Answer: Call an electrician. That is the only sane thing.

30 ampere machine


javax.el - Implementação da Glassfish

Question: Há uma API da JSR-000341(Expression Language - EL) na versão 3.0.0.
Dependência Maven da API javax.el:
<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>3.0.0</version>
</dependency>

Mas quanto a implementação eu vou usar a da glassfish, mas existe as seguintes implementações:
Do org.glassfish (última versão):
<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.el</artifactId>
    <version>3.0.0</version>
</dependency>

E org.glassfish.web (última versão):
<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>javax.el</artifactId>
    <version>2.2.6</version>
</dependency>

Tem alguma diferença entre a implementação da org.glassfish e org.glassfish.web, desconsiderando a versão das duas implementações?
Comment: Preciso investigar melhor para te dar uma resposta, mas o [site da UEL](https://uel.java.net/download.html) recomenda o uso do artefato em `org.glassfish.web`.
Comment: Por outro lado [no site da JSR](https://java.net/projects/el-spec/downloads) está sendo recomendado a implementação `org.glassfish.javax.el`. Isso tem cara de RI que mudou com o tempo.
Comment: RI? Não sei o que significa. Mas chutando, você quer dizer que os desenvolvedores da implementação javax.el da glassfish passaram a colocar a implementação no **org.glassfish** ao invés da **org.glassfish.web**?
Comment: RI = Implementação de Referência (da especificação). E sim, foi isso mesmo. Elaborei o assunto e tentei explicar cada nuncia na resposta. Se tiver alguma dúvida me avise.
Answer: Para aplicações web típicas
Utilize a implementação disponível no servidor de aplicação.
Se você está desenvolvendo uma aplicação web para ser publicada no GlassFish (ou qualquer outro servidor de aplicação), você não precisa de uma implementação da EL, apenas da API (em escopo provided). O próprio GlassFish irá disponibilizar a implementação:
<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>3.0.0</version>
    <scope>provided</scope>
</dependency>

Na prática porém dificilmente incluímos uma dependência para essa API diretamente, geralmente trabalhamos em um nível de granularidade maior. Aplicações web são consumidoras das principais APIS do Java EE (incluindo Servlets, JSP, JSF, Expression Language, etc):
<dependency>
   <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>7.0</version>
    <scope>provided</scope>
</dependency>

Não se esqueça também das APIS endorsed, ou seja, atualizações para APIs do JDK necessárias para o container (especialmente relevantes para JAXB, JAX-WS, etc):
<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>7.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>

    </plugins>
</build>

Et voilà:

Hello World! ${((x, y) -> x + y)(3, 4)}

É basicamente isso que o arquétipo webapp-javaee7 faz.

Disponibilizando a API fora do App Server
Dito isso, sua pergunta faz sentido caso você precise disponibilizar uma implementação de EL junto com sua aplicação. Por exemplo, se você está utilizando um embedded container e quer disponibilizar a implementação de referência (RI) da Expression Language.
EL 3.0 / Java EE 7
Para a versão 3.0 da EL utilize a seguinte combinação de dependências:

<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>3.0.0</version>
</dependency>

<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.el</artifactId>
    <version>3.0.0</version>
    <scope>runtime</scope>
</dependency>

EL 2.2 / Java EE 6
O GlassFish também mantém um projeto com versões standalone da EL 2.2.x:

<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>2.2.5</version>
</dependency>

<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>javax.el</artifactId>
    <version>2.2.5</version>
    <scope>runtime</scope>
</dependency>

Na época do Tomcat 6 / Jetty 6 esse tipo de arranjo era comum para habilitar a EL 2.2 (eis um tutorial). Hoje em dia ambos os containers (Tomcat 8 / Jetty 9.1) já disponibilizam EL 3.0.

Por que existem pacotes diferentes? Pois os desenvolvedores do GlassFish mudaram a convenção para nomes de grupos e artefatos do maven.

Na versão 3.x do GlassFish os artefatos relacionados com desenvolvimento web eram agrupados em org.glassfish.web.
Na versão 4.x os artefatos foram reagrupados em org.glassfish (ou seja, você encontrará versões recentes das implementações nesse grupo). Os nomes dos artefatos também foram repensados para coincidir com o pacote raiz do serviço que implementam.

Coincidentemente a JSR 341 (EL 3.0) foi a primeira especificação separada da Expression Language. A versão 2.2 da API fazia parte da JSR 245 (JavaServer Pages).
Comment: Hmm entendi, qualquer servidor de aplicação que esteja de acordo com o Java EE fornecerá alguma implementação de todas as suas especificações. Assim só preciso me preocupar em usar as APIs da Java EE como **provided** no Maven durante o desenvolvimento.
Comment: Anthony, obrigado pelo interesse em minha pergunta e obrigado por essa resposta, você respondeu muito claramente a minha pergunta e ainda me ensinou algumas coisas muito úteis à respeito das dependências do maven. Eu gostaria que você me dissesse mais uma coisa, onde nas documentações dos servidores de aplicação posso consultar quais implementações eles fornecem, pois preciso saber se o tomcat 8 atende a todas as necessidades durante o desenvolvimento de aplicações web em java.
Comment: Um servidor de aplicação de fato (como GlassFish, JBoss, Weblogic, Websphere, etc) implementa, e é comumente certificado contra uma versão do Java EE. Nesse caso ele deve disponibilizar ao menos [todas as tecnologias](http://www.oracle.com/technetwork/java/javaee/tech/index.html) da versão do Java EE que implementa. O Tomcat por outro lado não é um servidor de aplicação, é apenas um *cotainer* para Servlets e JSP; você encontra as APIs implementadas [nessa página](http://wiki.apache.org/tomcat/Specifications) (veja também a [tabela de versões](http://tomcat.apache.org/whichversion.html)).

javax.el - Implementação da Glassfish


php string gets truncated when retried from mysql

Question: the original string is around 9000+ characters.
but after mysql_fetch_object();
the $obj->attr only have 8000+ characters, with all the characters at the end of the string truncated. Is it because the string is too long?
Comment: what's the type of your field in the db?Are you sure that in the db it's stored correctly?
Answer: Sounds like a problem with your database design. Compare the string in the database to the string on the screen, if they match there's a problem when saving the data, if not, then you might want to supply us with your PHP+SQL code in order to see if there lies a problem.


How to use RXJs Subject like store variable in Svelte

Question: How to use RXJs Subject like store variable in Svelte? You can use the Subject variable in Svelte with $ prefix. But when you bind the variable to input it throws an exception: "Error: name.set is not a function" because the Subject type has not a set method.
Answer: You can use RxJs Subject like a store variable in Svelte as in the example below.

Hello {$name}!

But if you try to use the name variable with a bind directive it throws an exception: "Error: name.set is not a function".

Hello {$name}!

<input bind:value={$name} />

To solve this issue, you can add a set method to the Subject class with a simple trick :).

Hello {$name}!

<input bind:value={$name} />

Comment: Example code in [Svelte REPL](https://svelte.dev/repl/2780007481384d678fbdf5089cb041a1?version=3.38.2)


How do I disable auto-indent in Eclipse Helios (Java)?

Question: I swear I looked everywhere, and disabled almost everything (insertion of matching brackets etc), but when I type an opening brace and hit enter, it auto-indents the next line with a tab. Is there a way to disable this "handy" "commodity"?
Comment: After years of coding in text editors like Gedit/Medit and IDE's simpler than Eclipse, I've developed a habit of indenting manually. I'm still using Medit for PHP/HTML/Javascript so I don't feel like breaking the habit.
Comment: eh.. why? You want to write unindented code?
Answer:
From the menu go to Project > Properties
Select Java Code Style > Formatter
Check the box for Enable project specific settings OR click Configure Workspace Settings
Click the Edit... button for the active profile
On the Indentation tab uncheck all of the Indent options
Comment: Thank you!! I was looking only in Window > Preferences, didn't know they could be somewhere else.
Comment: No problem. It's actually in Window > Preferences as well. Under Java > Code Style > Formatter. As Bozho mentions the search box is excellent for finding these things, it can be hard to find them otherwise.
Answer: White Fang gave you the correct answer, but I will give you a guide how to find options that you need:

Open Window > Preferences (or Project > Properties)
Type the word you need in the search box.

The search in settings is extremely useful. When you type "indent", it would filter the irrelevant items in the tree.
Answer: The right thing to do here is to disable smart insert mode completely (Edit > Smart Insert Mode), or configure the Smart Insert Mode (Windows > Preferences > Java > Editor > Typing).


db_or() returns a SelectQuery-object

Question: In my module, I was trying to make use of db_or() in this way...
$filterSparten = db_select($this->tbl_hat_sparte, 'hs')
  ->fields('hs', array('hat_AID'));

$or = db_or();

foreach($_GET['tags'] as $tag) {
  $or->condition('hat_KID', $tag);
 }

 $filterSparten->condition($or)
  ->execute()
  ->fetchAssoc();

...which, unfortunately, only returns a SelectQuery-object:
SelectQuery Object
(
    [fields:protected] => Array
        (
            [hat_AID] => Array
                (...

Why doesn't my code return a fetched results-object? I have compared it several times with the examples on the Drupal-pages, but I can't help myself with it.
Comment: No, I was not asking **how** to use db_or, but **why** it returns a SelectQuery-object, not a results-object?!
Comment: where you put this code? and when you try it wihout `db_or` is it return correctly?
Comment: What are you dumping here, exactly? You seem to never save what you fetch to any variable...
Answer: Assuming an unchanged core codebase, and assuming you mean that your final line is returning a SelectQuery (not the db_or(), which returns a DatabaseCondition), the only way you could be seeing a SelectQuery is if you're inspecting the wrong variable, i.e. $filterSparten. The query will remain a query, you need to assign the results to something else:
$results = $filterSparten->condition($or)
  ->execute()
  ->fetchAssoc();

Inspecting $results should give you what you're expecting.
Comment: This actually solved it, great thx...  :)

db_or() returns a SelectQuery-object


Comparing two vector of pecentages

Question: Say, I have two vector of percentages (in this particular case, percentages represent a proportion of certain cell types in blood samples). Both vectors sum up to 1.
For example, there are vectors
    A = [0.1, 0.15, 0.15, 0.20, 0.25, 0.15] and
    B = [0.05, 0.2, 0.15, 0.15, 0.2, 0.25], where A[1] and B[1] represent a proportion of cell type #1, etc.
What I want to do here is to find out whether the "composition" of cell types is similar between A and B. What would be the right statistical test to do this?
Answer: The data you have is two probability distributions over the 6 categories: they are all non-negative and they sum up to 1.
To tell if two distributions are the same over a set of categories (this is what you can call 'similar') you can use the Chi-squared test:
https://en.wikipedia.org/wiki/Chi-squared_test#Example_chi-squared_test_for_categorical_data
Comment: @sus_mlm: But please notice that you will need to know the size of the samples.

Comparing two vector of pecentages


Does an instrument variable become exogenous if its values are random?

Question: In order to use an instrument variable it has to be exogenous.
My question:
Does IV become exogenous if its values have been randomized? Ex. finding people with diabetes by pulling names from resident register randomly.
Exogenity as I understand it is when the variable does not correlate with the residuals. Basically the variable should not correlate with what is unexplained in the model.
If the values of the IV are random, then the chance of "pulling" a person with diabetes should not correlate with things like sugar intake.
Answer: Exogeneity is defined as the absence of correlation between a random variable and $\pmb{\varepsilon}$ (error term) .
Note that a variable can be endogenous even though it might be uncorrelated with residuals (estimates of $\pmb{\varepsilon}$). For the following example, note that while the error term is expressed as $\pmb{\varepsilon}$, residuals will be represented by $\textbf{e}$.
Let us estimate the following Regression model:
$$\textbf{y} = \text{E}[\textbf{y}|\textbf{X}] + \pmb{\varepsilon}$$
For which the following assumptions hold:

A.1: $\text{E}[\textbf{y}|\textbf{X}] = \textbf{X}\pmb{\beta} \,\,\,\,\,$ (linearity)

A.2: $\Pr(\text{rank}(\textbf{X}) = K) = 1, \,\,\, \textbf{X} \in \mathfrak{R}^{n\times K} \,\, \,$ (no perfect multicollinearity)

Further assume that there exists some covariates $\textbf{W} \in \mathfrak{R}^{n \times p}$ that also explain some variability in $\textbf{y}$ but we did not include them in our specification (omitted variables).
OLS estimation minimizes the sum of squared residuals $\textbf{e}'\textbf{e}$, where the residual vector is $\textbf{e} \equiv \textbf{y} - \textbf{X}\textbf{b}$.
This yields the following FOC:
$$\textbf{X}'\textbf{X}\tilde{\pmb{\beta}} = \textbf{X}'\textbf{y}$$
Where $\tilde{\pmb{\beta}}$ is a running parameter, different from the true parameter $\pmb{\beta}$ and the OLS estimator $\textbf{b}$. Only when $\tilde{\pmb{\beta}}$ satisfies the first-order conditions it becomes $\textbf{b}$.
Then:
$$\begin{align} \textbf{X}'\textbf{y} - \textbf{X}'\textbf{X}\textbf{b} & = \textbf{0} \\
\textbf{X}'(\textbf{y} - \textbf{X}\textbf{b}) & = \textbf{0} \\
\textbf{X}'\textbf{e} & = \textbf{0} \,\,\,\, \normalsize (\text{since} \,\, \textbf{e} = \textbf{y} - \textbf{X}\textbf{b})\end{align}$$
These are called the Normal Equations and show that $\textbf{X}$ is uncorrelated with the residuals. However, since $\textbf{W}$ is a relevant matrix of covariates that was not included in our specification, omitted variable bias arises and so we know that $\text{Cov}(\textbf{X}, \pmb{\varepsilon}) \neq \textbf{0}$. Consequently, $\textbf{X}$ is uncorrelated with the residuals but not with the error term, namely, $\textbf{X}$ is endogenous even though $\text{Cov}(\textbf{X}, \textbf{e}) = \textbf{0}$.
Having cleared that out, note that there two assumptions required for an instrumental variable to be valid: exogeneity and relevance. It is also vital that such instrumental variable affects the dependent variable only through the endogeneous variable.
In your example only one of these assumptions is satisfied (exogeneity). Nevertheless, it is pretty unlikely that certain names are correlated with any factor you might be interested in studying its casual effect on diabetes (lack of relevance).
Assume there are available some instrumental variables $\textbf{z}_i$ for each of the endogeneous regressors $\textbf{x}_i$ such that we have #exogenous variables = #regressors. It goes without saying that $\text{E}[\textbf{z}_i\varepsilon_i] = \textbf{0}$ should hold.
Our model still satisfies linearity and no perfect multicollinearity, thus:
$$y_i = \textbf{x}_i'\pmb{\beta} + \varepsilon_i$$
Multiply by $\textbf{z}_i$ on both sides and take expectations:
$$\begin{align} \text{E}[\textbf{z}_iy_i] & = \text{E}[\textbf{z}_i\textbf{x}_i']\pmb{\beta} + \textbf{E}[\textbf{z}_i\varepsilon_i] \\
\text{E}[\textbf{z}_iy_i] & = \text{E}[\textbf{z}_i\textbf{x}_i']\pmb{\beta} \\
\pmb{\beta} & = (\text{E}[\textbf{z}_i\textbf{x}_i'])^{-1}\text{E}[\textbf{z}_iy_i] \end{align}$$
It is needed to assume that $\text{E}[\textbf{z}_i\textbf{x}_i']$ is nonsingular (invertible).
Note that if $\text{Cov}(\textbf{z}_i, \textbf{x}_i) = \textbf{0}$, then we are in trouble since $\pmb{\beta}$ could not be estimated (we would be 'dividing' by zeros!).
This is precisely what happens in your example. Your instrument might be exogenous, but I doubt it is relevant.


NSDate issue with NSJSONSerialization when using Mantle library

Question: I have an issue serialising core data managed object into JSON object. I am using Mantle to do this and this is related NSDate. I am getting this error.
'Invalid type in JSON write (__NSDate)'

This is where this exception is throwing. It is fine until code line 4 (NSDictionary *jDict ....)
        //NSManagedObject from Core Data
        Memo *newMemo = [self fetchMemo:memo.uuid];

        NSError *errorMantle;

        //MTLModel model
        BSMemo *memooo = [MTLManagedObjectAdapter modelOfClass:[BSMemo class] fromManagedObject:newMemo error:&errorMantle];

        NSDictionary *jDict = [MTLJSONAdapter JSONDictionaryFromModel:memooo];

        //Serialising using NSJSONSerialization
        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jDict options:NSJSONWritingPrettyPrinted error:&error];

This is how I am formatting the NSDate in MTLModel
+ (NSValueTransformer *)dateJSONTransformer {
    static dispatch_once_t onceToken;
    static NSDateFormatter *dateFormatter;

    dispatch_once(&onceToken, ^{
        dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"YYYY-MM-dd'T'HH:mm:ssZZZ"];

    });

    return [MTLValueTransformer transformerWithBlock:^id(NSString *string) {
        return [dateFormatter dateFromString:string];
    }];
}

+ (NSValueTransformer *)createdJSONTransformer {
    return [self dateJSONTransformer];
}

JSON parsing fine and this is only happen when try to genarate JSON string from core data. I have tried with different date format. But no luck. Could you please help me how to overcome this?
Updated block
+ (NSValueTransformer *)dateJSONTransformer {
    __block dispatch_once_t onceToken;
    __block NSDateFormatter *dateFormatter;

    dispatch_once(&onceToken, ^{

        dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"YYYY-MM-dd'T'HH:mm:ssZZZ"];
    });

    return [MTLValueTransformer transformerWithBlock:^id(NSString *string) {
        return [dateFormatter dateFromString:string];
    }];
}

I am downloading some data from Rest JSON API and save into core data. Because my app has to be work offline. When try to push data back to the server, I need to convert core data in to JSON and attached with HTTP POST. So I am using Mantle to simplify this process.
Comment: Your original code was fine; you don't need `__block` with `static` variables (else all the singleton examples on this site would be wrong).
Comment: It seems like `BSMemo` has an `NSDate` property
Comment: Wrong use of block? this is the issue you are having.
Comment: @borrrden Yes it is. Is that wrong ?
Comment: @Retro, could you please explain me what is wrong with use of block ?
Comment: dateFormatter used in block without __block prefix and its value wont be able to read outside the block, dont use the block make it simple
Comment: @Retro, I have changed and still no luck.
Comment: share your updated code? let me ask you what you are trying to do is to get the JASON responce and insert object into Coredata or viseVersa?
Comment: Well when the error message says invalid type of NSDate, that seems pretty suspect don't you think?  What are you doing to inform the serializer that the date transformer should be used to the NSDate property?
Comment: @borrrden but how can I convert JSON date string into core data field without using NSDate. If you look at https://github.com/Mantle/Mantle you can see here, it uses NSDate.
Comment: Also don't use YYYY always use yyyy unless you really want that oddball year format.
Answer: I just thought to post above answer in a way we can use when Mantle is used. (hoping this will help others)
+ (NSValueTransformer *)dateJSONTransformer {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"YYYY-MM-dd'T'HH:mm:ssZZZ"];

    return [MTLValueTransformer reversibleTransformerWithForwardBlock:^(NSString *str) {
        NSDate *date = [dateFormatter dateFromString:str];
        return date;
    } reverseBlock:^(NSDate *date) {
        return [dateFormatter stringFromDate:date];
    }];
}

Then call whenever you need to use NSDate as follows
+ (NSValueTransformer *)createdJSONTransformer {
    return [self dateJSONTransformer];
}

Comment: Create date formatter only once, it is very expensive operation.
Answer: Try like this
+ (NSDate*)dateJSONTransformer:(NSString*)dateString {
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"YYYY-MM-dd'T'HH:mm:ssZZZ"];
        return [dateFormatter dateFromString:dateString];
}

Comment: It's a mystery how this answer has been accepted as correct.  It breaks away from the `NSValueTransformer` model of the original code and merely shows how to convert an `NSDate` to an string, and there are a million examples of that on this site.
Comment: Return type? `NSValueTransformer != NSDate`.
Comment: @Retro I have updated your answer. Because there 'string' was unknown.
Comment: Indeed - the issue was reverse transformation, from NSDate to NSString
Answer: I know it's an old question, but here is my answer.
From de documentation page, we can found how to deal with NSDate in MTLModel :
GHIssue.h
@interface GHIssue : MTLModel <MTLJSONSerializing>

...
@property (nonatomic, copy, readonly) NSDate *updatedAt;
...

@end

GHIssue.m
@implementation GHIssue

+ (NSDateFormatter *)dateFormatter {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
    dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss'Z'";
    return dateFormatter;
}

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    return @{
        ...
        @"updatedAt": @"updated_at"
    };
}

+ (NSValueTransformer *)updatedAtJSONTransformer {
    return [MTLValueTransformer transformerUsingForwardBlock:^id(NSString *dateString, BOOL *success, NSError *__autoreleasing *error) {
        return [self.dateFormatter dateFromString:dateString];
    } reverseBlock:^id(NSDate *date, BOOL *success, NSError *__autoreleasing *error) {
        return [self.dateFormatter stringFromDate:date];
    }];
}

Documentation link : https://github.com/Mantle/Mantle#mtlmodel


Redirecting users with JavaScript disabled

Question: So, given the following markup, if a users browser has JavaScript disabled, they will be redirected to an alternate page that either attempts to emulate the sites functionality without JavaScript (perhaps a dynamically rendered page), or a warning page, informing the user that JavaScript must be enabled to use the site
<!doctype html>

        <meta http-equiv="refresh" content="5; url=/warning.html"/>

    <title>
        Page Title
    </title>

Judging by this html5 validator as well as the w3c validator it would appear that the above is valid html5. I'm considering using this technique to manage users that do not have JavaScript enabled and thereby cannot use the single page application I'm planning, but I haven't seen it before and was wondering if
(a) has anyone used this technique in production before and care to share their experiences
(b) can anyone offer up any valuable criticism as to why I shouldn't consider using this technique?
Right now its looking like a viable option to me, but I'm not wholly confident of the potential side effects (such as the conditions under which a browser would NOT respect the redirect).
Comment: Related question [ redirection](http://stackoverflow.com/q/1665089/851811)
Answer:
can anyone offer up any valuable criticism as to why I shouldn't consider using this technique?

You have a very fragile system. If the JS fails for any reason, it will break completely. Search engines could spider both versions of the site and link people to the "wrong" one.
So don't do that. Use feature detection and build on things that work.
Comment: Just to clarify, I'm assuming that you do not mean that you think that the JavaScript failing will cause the noscript redirect to be invoked (which it won't), and rather that you're espousing a development methodology, right? The SEO point is great- thanks for that!
Comment: Correct. If the JS fails then you will get the JS-only version with the JS not working.
Answer: I use this technique and it works perfectly well. I just add this line to the no JavaScript page:
<META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">

I used to disagree with this approach and recommend progressive enhancement but it just doesn't make sense to do this any more because:
1: About 1% of users will disable JavaScript, its a lot more than 1% more work to support them.
(last years stats see: http://developer.yahoo.com/blogs/ydn/posts/2010/10/how-many-users-have-javascript-disabled/)
2: There isn't always any alternative to javascript.
Comment: Close to two years later and... that is an excellent point. I am in fact going to stick with noscript redirect as its valid HTML and will handle browser clients, while the robor meta tag you provided will handle the case of search engine indexing. Thanks Lee :)


MDS-CS in blackberry

Question: When I run my simulator I obtain an error that java 1.6 cannot found for launching MDS-CS
Can any one help me ? What should I add to run MDS-CS?
Comment: did you add your java home directory to the "Environment Variables" ?
Comment: Did you mean this C:\Program Files\Java\jre6\bin in Path ?
Comment: no try C:\Program Files\Java\jre6\bin in PATH
and    C:\Program Files\Java\jdk1.7\bin in JAVA_PATH
Answer: open command prompt and type java. If you get "java not recognized as an internal or external command" , you havent set the path. MDS-CS needs JDK path to be set. So as Farid farhat told you,set the path in environment variables to point to bin folder in JDK.

MDS-CS in blackberry


What does the output of flexsurvreg, for a Gompertz proportional hazards model, mean?

Question: I am estimating a Gompertz proportional hazards model in R using the package "flexsurvreg", but I'm having a hard time understanding the output of this function. My dataset is collected from skeletal remains, so my event is estimated age at death and my explanatory variable in community dwelling- either in monastic or urban communities during the medieval period in the UK. In the past, I've used the Cox proportional hazards model from the "survival" package, but the standard in my field is a Gompertz model. The problem is that the output of flexsurvreg is different than the coxph function so I don't know how to interpret the results.
Here's the output from flexsurvreg:
Call:
flexsurvreg(formula = Surv(age) ~ monastery, data = dat, dist = "gompertz")

Estimates:
                data mean  est       L95%      U95%      se        exp(est)  L95%
shape                 NA   0.072851  0.069204  0.076498  0.001861        NA        NA
rate                  NA   0.002167  0.001817  0.002584  0.000194        NA        NA
monasteryUrban  0.322643   0.338239  0.205303  0.471174  0.067826  1.402475  1.227897
                U95%
shape                 NA
rate                  NA
monasteryUrban  1.601874

N = 1029,  Events: 1029,  Censored: 0
Total time at risk: 42770.5
Log-likelihood = -4113.269, df = 3
AIC = 8232.537

And here's the output from coxph on the same data
Call:
coxph(formula = Surv(age) ~ monastery, data = dat)

  n= 1029, number of events= 1029

                  coef exp(coef) se(coef)    z Pr(>|z|)
monasteryUrban 0.21742   1.24286  0.06753 3.22  0.00128 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

               exp(coef) exp(-coef) lower .95 upper .95
monasteryUrban     1.243     0.8046     1.089     1.419

Concordance= 0.531  (se = 0.011 )
Likelihood ratio test= 10.11  on 1 df,   p=0.001
Wald test            = 10.37  on 1 df,   p=0.001
Score (logrank) test = 10.41  on 1 df,   p=0.001

For the flexsurvreg output, how do I interpret the overall performance of the model- is log-likelihood the same thing as a likelihood ratio test? How can I tell whether the hazards between my two groups (monastic vs. urban dwellers) are significantly different?
Answer: Unlike the Cox model, the model based on the Gompertz distribution estimates parameter values describing the shape of the baseline hazard as well as the association of your covariate with survival. So the first two rows of output represent the estimated shape and rate of the underlying Gompertz distribution, which (unlike some other distributions) is compatible with proportional hazards; see the flexsurvreg() and dgompertz() documentation in the flexsurv package.
The third row represents results for the regression coefficient and corresponding hazard ratio (HR), exp(est), associated with your covariate, monastery. That's for the difference (resp. HR) between the Urban category and the reference category (presumably monastic-dwelling). That's analogous to the coefficient and HR for the Cox model. The 95% confidence intervals for that coefficient show that it's significantly different from 0 (and that the associated HR is different from 1), the usual criterion for significance as in the Cox model.
With a parametric model you should show that the data fit the modeled shape of the curve adequately. As you have expectations particular to your field of study you should follow its standard procedures for documenting the adequacy of the shape of the fit.


Proving a result in Baire categories

Question: If $A\subset X$ is a $G_\delta$ set and dense in $X$, then what I want to show is that  $X\setminus A$ is of the first Baire category.
Where the meaning of first category is that I can write
$$X\setminus A= \bigcup_n^{\infty}E_n$$
and the sets $E_n \subset X$ are nowhere dense ($X\setminus \overline{E_{n}}$ is dense or $\forall \epsilon>0  $ and $x \in X$ $B_{\epsilon }(x) \nsubseteq \overline{A}$)

My attempt

Then we can write
$$A=\bigcap_{n=1}^{\infty}C_{n} $$
where $C_{n}$ is open for all $n$, this is because $A$ is $G_{\delta}$ so what  I was triying to show that each of the $C_n$ should be dense and then conclude that since I can write the complement using DeMorgan's laws as
$$X\setminus A= \bigcup X\setminus C_n$$
I can get that the complements $X\setminus (X\setminus C_n)$ are dense but  So I think it won't help because this is in fact $C_n$.
So can someone help me to fix this idea (If I am in the right track of course) or provide a different proof of this please?

Edition

I want to conclude that I can
$$X\setminus A= \bigcup_n^{\infty}E_n$$
where the sets $E_n \subset X$ are nowhere dense.
To do that we use the fact that since $A$ is $G_{\delta}$
$$A=\bigcap_{n=1}^{\infty}C_{n} $$
and given that $A$ is dense we have that eah $C_n$ is dense too. So now we may write (By DeMorgan's laws)
$$X\setminus A= \bigcup_n^{\infty} X \setminus C_n$$
So we only need to prove that $X \setminus (X \setminus C_n)$ is dense, but $X \setminus (X \setminus C_n)=C_n$ that is dense, therefore $X \setminus A$ is of first category.
Am I right?
Thanks a lot in advance for your help.
Answer: Since $A$ is dense and $A \subset C_n$, it follows that $C_n$ is dense.
Now show that the complement of a dense open set is a (closed) nowhere dense set.
Comment: Thanks a lot @NateEldredge the thing is that it is the problem, that, ok, we know $X \setminus C_n$ is closed but according to my nowhere dense definition I need to show that $X \setminus (\overline{X \setminus C_n})$ is dense right, ooo but wait a minute this is $C_n$ that you have show that is dense right?
Comment: @user162343: Right.
Comment: jajaja so it is done isn't?
Answer: Let $A^c=X\setminus A$ be complement of $A$, $\overline{A}$ be closure of $A$ and $A^o$ be interior of $A$.
We define:
1). $A$ is dense iff $\overline{A}=X$.
2). $A$ is nowhere dense iff $\overline{A}^o=\varnothing$.
In this problem, we will prove that $C_n^c$ is nowhere dense.
First since $A\subset C_n$ and $\overline{A}=X$, there is
$$
\overline{C_n}\supset \overline{A}=X\quad\text{Thus}\quad \overline{C_n}=X
$$
So $C_n$ is dense. Clearly $\overline{C_n}^c=\varnothing$. Moreover
$$
\overline{C_n}^c=(((C_n^{c})^o)^c)^c=(C_n^{c})^o=\varnothing
$$
Since $C_n$ is open,  $C_n^c$ is closed. So $\overline{C_n^c}=C_n^c$. Thus we have
$$
\overline{C_n^c}^o=(C_n^c)^o=\varnothing
$$
i.e. $C_n^c$ is nowhere dense.
Comment: Thanks a lot for your answers, and I am sorry for the delay :), but how do you see my above answer(well my idea fixed with Nate's answer)? Is it right?
Comment: Why is it not complete ? is because I have read your proof and I think is awesome but those things you used I think are a little bit fancy :)
Comment: No I mean Nate's answer because I think with that it is done right? or what else do I need to prove, because I haven't  seen that two definitions you gave :)
Comment: Nate's answer didn't show that the complement of a dense open set is a (closed) nowhere dense set, which I proved. I use the definition of dense and no nowhere dense set that may not commonly used, but is a standard. A is dense iff closure of A is X. A is nowhere dense iff closure of A has no interior. I think you are on the same direction for you use $X∖(X∖Cn)$.
Comment: Ok let me write my whole proof so you can verify it right? Thnks in advance
Comment: What do you think (I have edited my post ) ?
Comment: Right but I only need to check that $X \setminus (X \setminus C_n)=C_n$ is dense an it is right :)?
Comment: Well as I point it out in my post my definition of nowhere dense is that the complement of the closure is dense, but $X \setminus C_n$ is closed already because $G_\delta $ implies $C_n$ open :) right?
Comment: Yes. Your definition  that $X\setminus \overline{E_{n}}$ is dense is consistent with $\overline{X\setminus E_{n}}$ has no interior as latter part of definition suggest.
Comment: Then what do you think about my proof? :)
Comment: Yes, your proof is right.
Comment: Thanks a lot :) and thanks for your really awesome proof too :)

Proving a result in Baire categories


Nesting a View in a View... or something like that

Question: THE SETUP
I have a View set up to create a page out of a particular content type called "enticements". For context, an enticement is something that would make a guest want to stay at a hotel. Things like local attractions and dining.
So my view uses the content types [machine_name] in this order

Image [field_image]
Title [title]
External URL [field_link]
Body [body]

All fields are set to hidden because I want them to be arranged just so, all within the [body]. The body rewrite result looks like this:

    [field_image]

[field_link]

[title]

    [body]

THE QUESTION
This all works fine except that the [field_image] can be one or more images, but no matter what I try it only shows the first image. Even when I tried telling views to show the [field_image] with "Multiple Field Settings" set to "Display all values in the same row" in an unordered list,  it still just shows the first image.
Why only the first image?
Is there a way to get Views to use every image in the rewrite?
Or can I somehow nest a Slideshow View inside the Enticement view?
Comment: I discovered that the reason only the first image was showing is that my "Multiple Field Settings" had a "1" set for "Display ___ values".  But I'm still curious to know if you can nest views.
Comment: Can you explain a little bit more what you're trying to do? There are ways to do at least some of what you're asking with say views relationships or manually embedding a view, but I'm struggling with what outcome you want.
Comment: The most fundamental thing I'm asking is how to insert a Slideshow View as a "field" in another View (or View Display).
Answer: Check out the Views Field View module.  I have not used it, but it is supposed to embed a view in another one.  Please post back if it works.
Comment: Is there a version of this that is more stable for Drupal 7?
Answer: I was trying to figure this out for an embarrassingly long time.  I have a situation where I am trying to do a many to many relationship between two taxonomies (you could do this with content types too).  I realize taxonomy can do this by default for just term names but I have image and other fields on my taxonomy terms that I wanted to use in a custom sub-view:
Page 1
Locations

Location A

Activity A (including title, image, descrip, etc...)
Activity C

Location B

Activity A
Activity B

Page2
Activities

Activity A

Location A
Location B

Activity B

Location B
Location Z

On the Location Page's view I used the views_field_view module to embed a secondary view of Activities inside the first view.  The secondary view is set up as a block which has a relationship with a field-based reference to the Location's terms. (So each Location has many activities stored in a term reference field.)  The block also has a contextual filter for Taxonomy Term ID that uses this relationship to point to the Location's tid.  On the main view I have the Taxonomy Term ID field setup and excluded from display so we can use it as a token replacement.  The views field is set up with the secondary view with a contextual filter for [!tid].  This way each Location row passes in its tid to the secondary Activity view which uses it in a reference to the Locations terms.
Hope this helps someone out!
Answer: I found a solution for making a nested unordered list of content (or content titles) with a view, basing the list results on hierarchical taxonomy. If that is helpful, you'll find it 3/4 down [this page][1].

Set up your hierarchical vocabulary
Add it to any selected content type
Create a view listing nodes from that content type, displayed as an HTML list of the type "unordered list", with one of these contextual filters:

"Content: Has taxonomy term ID", if you want to list only nodes assigned to specific term
"Content: Has taxonomy term ID (with depth)", if you want to list nodes assigned to a specific term as well as to its child terms.

In this case, in filter configuration you need to set the depth, how many levels below (or above) you want this filter to work.
This will give you an unordered list of the entire hierarchy of node content (titles or whatever) in whatever sort order you have established.  I have not yet discovered a way to display that listing as a hierarchical unordered list. It seems there must be a way; if I find it I will add it here.


Probability of choosing 6 from 49 where no numbers are next to each other

Question: What is a probability that when we choose 6 numbers form 1 to 49, we won't get adjacent numbers. In another we can't get a pair from those choosen 6 numbers whose difference equals 1.
What i have tried:
Well ${49 \choose 6}$ is a number of ways in which we can choose 6 from 49.
We have got $49-1=48$ adjacent pairs of numbers from 1 to 49.
We can choose pair of numbers from (1 to 49) in $49 \choose 2$ ways.
So probability that a two numbers choosen from 1 to 49 are adjacent is:
$\frac{48}{49 \choose 2} = \frac{2}{49}$
So probability that 2 choosen numbers won't be adjacent is $\frac{47}{49}$
From 6 numbers i can make:
${6 \choose 2}$ = 15 pairs.
Till now everything i have written is true.
And now something that i have made up but i am not sure about.
So is probability that i am trying to calculate equal ${\frac{47}{49}}^{15}$
Comment: The last step can not be done, because the probabilities that the 15 pairs are adjacent are not independent.
Comment: In the last step, if it were correct, you would want $1-\left(\frac {47}{49}\right)^{15}$ for the question you ask.  This would be correct if the probabilities were independent and very close if $\frac {47}{49}$ were very close to $1$ (if you had lots more than $49$ numbers)
Comment: Ok so is there any way to join somehow probability of those independent pairs with those 15.
Answer: In general, how many sets of $k$  numbers $x_j$ from $\{1,2,\dots, n\}$
 with $x_1<x_2<\cdots <x_k$
have no consecutive values? We can use the bijection
$$(x_1,x_2,\dots, x_k)\quad \longleftrightarrow \quad  (x_1,x_2-1,\dots, x_k-(k-1))$$
where $x_j-(j-1)$'s are distinct values from $\{1,2,\dots,  n-(k-1)\}$.
 The number of different ways  is therefore  ${n-k+1\choose k}$.
For Lotto 6-49 the answer is ${44\choose 6}$,
so the required probability is ${{44\choose 6}/ {49\choose 6}}=.5048.$


Is standardizing data necessary for glasso?

Question: I am wondering, if it is necessary to standardize data (mean zero and stddev eq. 1) for glasso. In many papers on glasso this is mentioned to have data with mean=0 and stddev 1, while using covarience matrix of the data for variable selection through glasso. However, in book "Using R! by Gentleman et al (Editors) covarience matrix is converted to correlation matrix and then glasso is applied without standardizing data.
Would appreciate explaination about it i.e. whether starndardization is necessary for glasso and if yes then why.
Comment: I am not sure to follow: using the covariance of standardized variables is the same as using the correlation matrix, no?
Comment: What you have asked is a different question. My question is do we need to standardize data before glasso. In literature several papers say to have mean zero and covarience matrix sigma before running glasso. Several papers explicitly say to standardize data. However, in other places it is not done. Like in Book "USE R" Thibshirani is one of the authers and they don't normalize data before running glasso. Now I am confused do we need to starndize data or not?
Comment: sorry authers are Søren Højsgaard, David Edwards et al and not Thibshirani
Answer: LASSO implements a penalty on the sum of the magnitudes of the coefficients relating predictor variables to the outcome. So unless some type of standardization is done, the variables retained by LASSO will depend on the relative scaling of each of the predictor variables. For example, it might matter whether you express a time variable in minutes versus hours. Transforming a covariance matrix to a correlation matrix is one type of scaling.
Comment: great answer. I was looking for this explaination. In the book I have refered "USE R-Graphical Methods" Søren Højsgaard, David Edwards et al, used raw data to determine covarience but then converted the covarience matrix to correlation matrix before running glasso. I was wondering why didn't they standardize and why did they converted cov. matrix to correlation matrix.  Could you comment. whether there will be any difference between standardizing data before determining covarience matrix and running glasso vs using correlation matrix before glasso. Thank You
Comment: I don't think so, but I don't have experience specifically with `glasso`. Try it both ways (on a data subset if there are issues with time/cost of computation) and see if it makes a difference.
Comment: Converting covariance to correlation and standardizing are *the same thing*, it's easy to show.


How to configurate EventTrackerStatusChangeListener in Spring Boot

Question: We're using Spring Boot + Axon Framework + Mongo (as eventsource, cqrs view)
Now I have to understand that reply of all my event is done. As I saw in documentation:
https://docs.axoniq.io/reference-guide/axon-framework/monitoring-and-metrics#event-tracker-status
EventTrackerStatusChangeListener can be configured through the TrackingEventProcessorConfiguration for a TrackingEventProcessor
we can just configure EventTrackerStatusChangeListener and that it, I can react on all reply changes that I need. But after some research and trying, I realized that it can't be configured easily for auto configured trackingEventProcessors (auto named by packages path, or using @ProcessingGroup) is'nt it?
My question is: Can I configure EventTrackerStatusChangeListener to using it for all automatically configured trackingEventProcessors and how? If it's not, what the best approach?
Answer: The EventTrackerStatusChangeListener can only be registered for a TrackingEventProcessor (TEP) through the TrackingEventProcessorConfiguration class.
If you want to define a default listener, you will currently (Axon 4.4.2) have to define a default TrackingEventProcessorConfiguration to be used.
This can be achieved by using the EventProcessingConfigurer#registerTrackingEventProcessorConfiguration method.
Do note that this means that all your TEPs will use the same TrackingEventProcessorConfiguration. If you want to define a specific TrackingEventProcessorConfiguration per TEP, you will have to use the following function for each TEP you want to define:
EventProcessingConfigurer#registerTrackingEventProcessor(
    String,
    Function<Configuration, StreamableMessageSource<TrackedEventMessage<?>>>,
    Function<Configuration, TrackingEventProcessorConfiguration>
)

The first String parameter is the name of the processor (which you could have defined with the @ProcessingGroup annotation on your event handling components for example). The second parameter defines the message source to be used by the TEP in question. You can use the Configuration given to you in the Function parameter to return the Configuration#eventStore to retrieve the configured general event store. Thirdly, you would provide your TEP specific configuration.


How close to a radiator is too close?

Question: While ideally a piano would be kept in some special room with controlled humidity and temperature, that's rarely possible. For many of us in small houses, finding Any space big enough is a challenge and often walls that are not used for furniture have inconvenient radiators on them.
I would assume that putting a piano right in front of a wall with a radiator would be a terrible thing to do to it - but what about being a couple of feet away?
Answer: You can use heat reflecting panels between radiator and piano to have some protection. This helps radiator to heat only the circulating air but not the surfaces it sees directly.
Also place a bowl of water with a wide surface (for better evaporation) under the piano and over the radiator to increase humidity during heating season.
Answer: A couple of feet is as close as you want to be. It depends also on how hot that rad gets, and how long it's on for daily. One of mine is about 3 feet away, but because it has an iron frame, it's not been a problem. Wooden framed pianos can get dehydrated causing all sorts of nasties.
Comment: Thanks. Our radiator is facing one end of the piano and when on, the piano is not noticeably warm to the touch - I hope any issues would therefore be superficial since wood is such a good insulator of the internal stuff. Realistically, it would probably get as much direct heat on a sunny day through the window!
Answer: "...walls that are not used for furniture have inconvenient radiators on them."
So put the furniture over the radiator instead!
'Too close'  is the distance at which heat from the radiator causes noticable warming of the piano.  You're not really going to be able to space the piano far enough out.  Put it where there isn't a radiator.   Sorry.
Answer: I have a century old piano that has been sadly deformed by a 1 foot away radiator, the wood buckled causing the metal back board to crack on three horizontal points, this would cost a couple of grand to put back right, and since I have no where else in our living room, I am thinking of buying an electric piano, in hope that it would not face a similar fate.  The problem with those is that they are much smaller than acoustic pianos and would never look right in that corner of the room, besides their sound and feel to the touch would never be like a live acoustic instrument.
Comment: "Look right"?  What does that mean?    And are you sure the metal frame has cracked?  If so, check that it isn't going to collapse, with strings flying everywhere!    But I suspect it's the wooden sound board that has cracked.  This isn't necessarily a disaster.  Google the subject 'piano cracked soundboard' for more information.

How close to a radiator is too close?


Haskell: show and pretty-print instance

Question: I started Intelligent System studies at a university and our first language is Haskell. I must admit that I am not really familiar with it so far. Part of this week's task is to develop an algebraic datatype Expr a which represents the basic arithmetic operations (+,-,*,/).
The solution IMO should be:
module Expression where

data Expr a
  = Number a
  | Var
  | Sum (Expr a) (Expr a)
  | Prod (Expr a) (Expr a)
  | Div (Expr a) (Expr a)
  | Pot (Expr a) a
  deriving (Show)

Okay so far. The task is to implement a pretty-instance for our function now. i.e.:
from
Plus (Pot (Var 2)) (Num 3)
to
x^2 + 3
So, I had no idea what "pretty" means. After searching the internet I found out that "pretty" only means to rewrite the output in a human readable form. Is this correct? If it is, what does it mean to my function? Do I have to replace the show function with a pretty function? I don't really know where to start.
I read several similar questions here but didn't get the point there. I would really be happy if someone could give me some hints, advice, solutions or whatever!
Comment: If you're unsure about the specification of the task, you should ask your professor to clarify.
Answer: Yes, that's what pretty print means.
Basically, you just need a function that converts an Expr a into a String:
myPrettyPrint :: Expr a -> String

Call it whatever you want, and don't try to replace show.
In order to implement this function, you'll probably want to learn about pattern matching.
Comment: @RomanGonzalez: `Show` is meant as a form of lightweight serialization. It's not meant for pretty-printing, although people often abuse it that way. In particular, if a `Read` instance is also defined, one should be able to expect that `read . show` is the identity function.
Comment: @leftaroundabout: I can agree with that to an extent, as long as you  follow the rule that `show` should be valid Haskell syntax. This is necessary for instances to cooperate properly with those of container types. For example, a `Show` instance should not return `"]foo["`, since that would break if you were to put it in a list. This does not mean that it must correspond to the compiler-derived instance. For example, the `Show` instance for `Data.Set` returns `"fromList [...]"` so that it doesn't expose the implementation-specific tree structure.
Comment: @hammar: Uhmm interesting, Why isn't there a PrettyShow classtype on Prelude so that people think about this a bit more? I've been overloading Show classtype all along for Pretty printing because I didn't know any better...
Comment: @RomanGonzalez: There are several pretty-printing packages on Hackage you can write instances for. I don't think there needs to be one in the Prelude.
Comment: @hammar: it is not meant for pretty-printing, but it certainly _is_ meant for offering a format that's not harder to comprehend than necessary. `read . show` should definitely be the identity, but that's not such a severe restriction – in fact you could often define proper pretty-printing/reading functions to also behave this way. — What `show` does not offer, and IMO you should not try to make it so, is _type_ unambiguity. So, just like `"3"` is the result of both `show(3::Int)` and `show(3::Integer)`, the result of `show $ Sum x y` shouldn't need include the _name_ of the `Sum` constructor.
Comment: Why not declare Show classtype for the Expr? just curious?
Comment: Thanks a lot for your hint Matt. The lack of knowledge about pattern matching was the problem. Function works now, wasn't even as hard as i thought before!
Answer: I'd just implement show accordingly (instead of deriving from it), which can be done quite easily at least if you don't mind it to include unnecessary parentheses:
instance (show a) => show (Expr a) where
  show (Number x) = show x
  -- ...
  show (Prod x y) = "("++show x++")*("++show y++")"
  -- ...

This can be done better and more efficient, but perhaps this solution is sufficient for you.

It was said in comments above that show should be a lightwight means of serialization and should in particular fulfill (read . show) x = x. I agree, and it means that you should, for instance, not do any actual prettyprint stuff (like outputting to LaTeX, which would certainly be a nice way of outputting such data). It does, IMO, not mean that show should always behave like the derived instance, not if this output is unratifiably less readable, longer, and/or less clear if watched without the haskell code as context.

Another point hammar made in the comments above: the output of show should be valid haskell code. To make my solution conform to that you need to make Expr an instance of Num and either Fractional or Integral.

Haskell: show and pretty-print instance


What is the recommended way to deploy a Maven module?

Question: I have a multi module Maven project, one of its modules has the main class. I want to package and deploy this module, but I have no idea what I should do now. I'm aware of this question, but I don't know if it's a good way to follow or not. Could you please show me what is the recommended way to deploy a Maven module? Thanks.
Answer:
I have a multi module Maven project, one of its modules has the main class. I want to package and deploy this module, but I have no idea what I should do now.

For the package part, I'm assuming you want to create an executable JAR including its dependencies (also known as an uberjar or megajar). There are several ways to do that:

Using the Maven Assembly Plugin and the predefined jar-with-dependencies descriptor.
Using the Maven Assembly Plugin and a custom descriptor if the predefined one doesn't suit your needs.
Using a plugin like the OneJar Maven Plugin
Using a plugin like the Maven Shade Plugin

Regarding the deploy part, it highly depends of what you mean by deploy. If what you mean is installing a package on some remote machine(s), Maven doesn't really provide any facility for that, this isn't really in the scope of Maven - which doesn't mean it can't be done at all (but this also doesn't mean it's a good idea to use Maven for that).

I'm aware of this question, but I don't know if it's a good way to follow or not.

Now that the accepted answer has been fixed (it was plain wrong during some time), it's one way. If it does the job for you, then it's a good way.


Problem targeting content to div (content is shown on new page)

Question: I have a webpage in which I have a div that I would like to repopulate.
For now the content of that div is generated with Javascript the following way:
function foo(array){
    for(i=1;i<=maxIndex;i+=1){
        document.write ("<input type='checkbox'/>" + array[i] + "\n
")
    }
}

and I populate the div the following way:

        blablabla

            <form name="myForm">

            </form>

             blahblahblah
             <form>
             <select onchange="updateDiv(myArray)">
                          <option value="1"> Test1 </option>
                          <option value="2"> Test2 </option>
                          <option value="3"> Test3 </option>
             </select>
             </form>

The reason that I would like to repopulate the div is because I would like
it to be possible for the user to choose the arrangement of the content of the div
(i.e. when the user selects a certain item from a combobox, 'myArray'
is re-sorted and then myDiv is repopulated such that the content now appears in a different order).
function updateDiv(array){
     array.sort();
     document.getElementById('myDiv').innerHTML = '<form name="myForm"></form>';

}
The problem that I am encountering is that I cannot manage to target the new
content in myDiv when the user selects the combobox.
I have tried using innerhtml, but the new content, which is outputted correctly, shows up in a completely new page instead of showing up in myDiv because of the JavaScript.
EDIT: It seems that now the problem is that innerhtml updates the code in the correct div (at least when I inspect it with firebug) but no text shows up (the JavaScript hasn't been run...?).
I looked around online and did not seem to find an appropriate solution.
It would be greatly appreciated if someone could point me in the right direction or let me
know if I am approaching this completely wrong.
Thank you
Answer: Your foo() doesn't look right... this works for me:-

HTML code:

blablabla

    <form name="myForm">

    </form>

blahblahblah

This is how it looks like:-
Answer: There are several syntax issues going on but the following works:

        blablabla

            <form name="myForm">

            </form>

        blahblahblah

Comment: Hi, thanks for the reply. Yes the code above is what I am doing with the first instance of the page. But after, when the user selects a combobox option which 1) resorts the array 2) should run foo() again such that myDiv is updated with let's say B C A instead of A B C, the new page only shows B C A and blablabla is gone. I will update my question to make it clearer.
Answer: Ok I finally figure out where the problem was: I should not have used so many document.write(), which outputs on a new page.
Instead I store everything in a string and then use document.write() only in the last step, the following way:
var astring;

function foo(array){
    for(i=1;i<array.length;i+=1){
        astring += "<input type='checkbox'/>" + array[i] + "\n
";
    }

function updateDiv(array){
     array.sort();
     document.getElementById('myDiv').innerHTML = astring;
    }


Is it possible to use BindingSource.find on multple columns?

Question: Is it possible to use BindingSource.find on multple columns?
I have a treeview and a combobox.  The combobox provides the ID that is used to build the treeview.  When I select a node in the tree view I want to display the details/child information for the ID from the combobox and the tag/ID value from the tree Node.
What is the best way to do this? I was trying to use controls bound to a binding source. I want to change the position of the binding source, but I need to search the binding source for the value from the combo as well as the tree node I just selected?????
Answer: I don't know if it is the best way to do what I was trying to accomplish, but BindingSource.Filter method works great for my scenario.


Pell's equation solution set

Question: Can we guarantee that pell equation has infinitely many solutions in positive integers without finding a non trivial solution?
Comment: One can **prove** that Pell's equation has infinitely many solutions.
Comment: A solution in integers to the Pell equation $x^2-Dy^2=1$,$D>0$, $D$ integer, $\sqrt D\not\in\Bbb Z$, induces a unit $x\pm y\sqrt D$ in the ring $R$ of integers of $\Bbb Q[\sqrt D]$. (Which is $\Bbb Z[\sqrt D]$ or slightly bigger.) We have *general* theorems about (the torsion part and) the rank of the unit group $R^\times$ of the integers $R$ of a number field, this is in terms of number of pair of complex conjugated, respectively purely real embeddings of $R$ in $\Bbb C$. https://en.wikipedia.org/wiki/Dirichlet%27s_unit_theorem . For Pell  $(r_1,r_2)=(2,0)$. If  fundamental unit $u$, $u^2$...
Answer: If you mean $$  x^2 - n y^2 = 1, $$
with fixed integer $n > 0$ but NOT an integer square, then yes, infinitely many solutions in a Fibonacci type sequence.
It is a non-trivial result that there is at least one solution, take the smallest integers $u,v > 0$ with $u^2 - n v^2 = 1.$ Call $(u,v)$ the fundamental solution.
The automorphism generator matrix is
$$
\left(
\begin{array}{cc}
u & nv \\
v & u
\end{array}
\right)
$$
which means $$ (x_{k+1}, y_{k+1}) = (u x_k + nv y_k \; , \; \; v x_k + u y_k) . $$
The sequences can be separated, $x_0 = 1, y_0 = 0,$ then $x_1 = u, y_1 = v,$ then
$$  x_{k+2} = 2u x_{k+1} - x_k \; ,  $$
$$  y_{k+2} = 2u y_{k+1} - y_k \; ,  $$

Pell's equation solution set


Minimizing Disk Space for CentOS & Vagrant VM Install

Question: I'm working on building a Base VM for use with a Vagrant, and/or Puppet.
I've done the minimal CentOS 6.3 install 32 bit. It's still a size of approx 800 mb.  From what I've found out there people have built out base vm's with approx 300 mb disk.  I've cleared the yum cache.   I see a lot of locale data, but I'm not sure if I should remove them because ultimately this will web development and internationalization might be needed.
Anyone have  some tips to help me?  I'm not finding alot.
Please note: There's no desktop installed.
Comment: Does disk space on that scale really matter?  If we assume cloud pricing and a couple backups you are only talking about $2-3 dollars for 1GB for a year.  Surely your time is more valuable, and you should spend it worrying about other things.
Comment: The only reason, I worry about diskspace is for download reasons.  Not so much cost.  1 GB installs might be pretty slow DLing.
Comment: If you are not ecessarily insisting on CentOS, you might want to give [SUSE Studio](http://susestudio.com/) a try.
Comment: @peterph that's pretty sweet, I'm playing with it right now.  Sadly the prod environment is typically RHEL, so it's better to go with CENTos
Answer: I don't think you should be worried about space or overhead. But if you are, the minimal install image is the right approach.
You mention download time. Downloading from where? If you're deploying multiple systems, it may make sense to create your own local YUM repository in your environment or use a deployment tool like Cobbler to handle the installations (and bootstrap Puppet).
Comment: I've actually switched to using veewee it's got a great assortment.
Answer: There are some prebuilt Vagrant box files for Centos 6.3 here:
http://www.vagrantbox.es/
Ranging form 310-610MB. I was like you and built my own at first (what a pain), the file size was fairly large and I hadn't even installed Puppet and other tools yet. Went ahead and downloaded one of these above and it was rock solid.
Comment: I've actually switched to using veewee it's got a great assortment.


Device to Device Notifications in iOS

Question: I'm  a newbie iOS developer and trying to implement device to device notification in iOS something to handle friend requests etc.. I'm looking for documentation that guides me in the process. I'm using firebase as my backend system but I'm cannot find any documentation about device to device notification . I also checked out One Signal but still having hard time figuring out how this is implemented , Can anyone point me in the right direction
Comment: Finding off-site tutorials is typically off-topic here on Stack Overflow. That said (shameless self-plug) you could do worse than using the approach described in this post: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html It's for Android, but the Android-specific parts are fairly small and easily portable to iOS.
Answer: You'd need to implement this logic with server-side code using one of Firebase's server SDKs. You can look their fantastic documentation to learn more.
Answer: hope it help:
OS X and iOS application and framework to play with the Apple Push Notification service (APNs)
https://github.com/noodlewerk/NWPusher

Device to Device Notifications in iOS


What is the partial derivative between two independent variables?

Question: If I have $f(x_1) = x_1^2$, what is $\frac{\partial f}{\partial x_2}$, given no other information? Is it 0?
Answer: If you want to be really proper, then it is undefined. Here, you seem to have a function $f:\Bbb{R}\to\Bbb{R}$, defined as $f(t)=t^2$ (or $f(x_1)=x_1^2$ as you write it) so you can only talk about its derivative $f'$ (or $\frac{df}{dt}$ or $\frac{df}{dx_1}$). But $\frac{\partial f}{\partial x_2}$ (which really ought to mean the partial derivative of $f$ with respect to the second entry) is just not defined.
However, what you can ask is to consider the different function, $F:\Bbb{R}^2\to\Bbb{R}$, defined as $F(x_1,x_2)=x_1^2$. Then, you can say $\frac{\partial F}{\partial x_2}=0$.
Though be warned that sometimes people abuse notation and say $f$ and $F$ are the same thing (even though they're really not), and by abuse of language and notation, write $\frac{\partial f}{\partial x_2}=0$.


Erro de Operador Logico Javascript em página JSF

Question: Tenho um pagina JSF aonde utilizo o primefaces. Quando utilizo o operador logico em minhas funções javascript, ele exibe este problema: o nome da entidade deve seguir imediatamente o '&' na referência da entidade.
Answer: Você vai precisar escapar as entidades XML.
<code><h:outputText value="Tom & Jerry" />
</code>
Este problema não está relacionado com o JSF em si, mas com a tecnologia de visualização, você precisaria garantir que o modelo é bem formado XML e que todos os carácteres especiais que devem ser representados como é, foram escapados como acima.
Lista de entidades de caracteres predefinidos que precisam ser escapados no XML sempre que você gostaria de exibi-los. São as seguintes entidades de caracteres:
<code>"     "
&     &
'     '
<     <
>     >
</code>
Comment: Eu não quero Exibi-los. Eu quero comparar duas situações em javascript: if (operador1 && operador2) { // Faça alguma coisa }
Comment: Não é só para exibi-los, mas tb em ternários dentro da interpolação do JSF ou primefaces. Atualize sua questão com os trechos de código relevante por favor. E mesmo dentro de bloco js, se a extensão do arquivo for xhtml a solução é essa. Você testou @LuizFelipe?


How to add custom opacity values to colors in tailwind css themes

Question: I am trying to learn how to do themes in tailwind CSS for a laravel project. Stuck on how to add opacity in the theme
//app.css file

@layer base {
    :root {
        /* Brand Color */
        --color-element-primary: #5754FF;
        --color-element-soft-hover: #5754FF; /* 15% */

        /* Text */
        --color-text-primary: #FFFFFF;
        --color-text-content:#FFFFFF; /* 80% */
        --color-text-muted:#7C879F; /* 45% */

Than in the tailwind.config.js file I setup things like this
extend: {
            fontFamily: {
                sans: ["General Sans", ...defaultTheme.fontFamily.sans],
            },
            colors: {
                theme: {
                    'primary': 'var(--color-element-primary)',
                    'primary-soft-hover': 'var(--color-element-primary-soft-hover)',

                }
            },
            textColor: {
                theme: {
                    primary: 'var(--color-text-primary)',
                    content: 'var(--color-text-content)',
                    muted: 'var(--color-text-muted)',
                }
            },

This allows me to use it inside the project like this

But I want to make the opacity values dynamic to the themes. Any insight on how to set this up is much appreciated :)
Comment: Look in to  on this page: https://tailwindcss.com/docs/customizing-colors
Answer: I was looking to use the a theme color with opacity utilities (like bg-primary/25) from the framework. Not sure if that is the question here?
In case it is I came across this functions, which works for me:
const getColor = (colorVar, { opacityVariable, opacityValue }) => {
  if (opacityValue !== undefined) {
    return `rgb(var(${colorVar})/${opacityValue})`;
  }
  if (opacityVariable !== undefined) {
    return `rgb(var(${colorVar})/var(${opacityVariable}, 1))`;
  }

  return `rgb(var(${colorVar}))`;
};

and apply it like so in your source tailwind.config.js
theme: {
  colors: {
    primary: (params) => getColor("--color-primary", params)
  }
}

Now you can define the --color-primary variable in your css file and it will change accordingly.
Answer: as @Gabe pointed out
https://tailwindcss.com/docs/customizing-colors#using-css-variables
Need to first convert hex to RGB https://www.rapidtables.com/convert/color/hex-to-rgb.html and set that up in the app.css
--color-element-primary: 87 84 255;

Than in the tailwind.config.js
'primary': 'rgb(var(--color-element-primary) / .10)',


Drawing a circle in android with opengl-es results in a square

Question: I am trying to draw a circle in opengl-es using the following code. It creates a number of points around a circle. If I print out the values in the vertex array it can be seen that they form points around a circle.
// Create verticies for a circle

points=40;
vertices = new float[(points+1)*3];

//CENTER OF CIRCLE
vertices[0]=0.0f;
vertices[1]=0.0f;
vertices[2]=0.0f;

for (int i = 3; i<(points+1)*3; i+=3){
    double rad = deg2rad(i*360/points);
    vertices[i] = (float) (Math.cos(rad));
    vertices[i+1] = (float) (Math.sin(rad));
    vertices[i+2] = 0;
}

// vertexBuffer is filled with verticies

And the calls to opengl in my drawing function:
// IN MY DRAWING FUNCTION:
gl.glPushMatrix();
gl.glTranslatef(x, y, 0);
gl.glScalef(size, size, 1.0f);
gl.glColor4f(1.0f,1.0f,1.0f, 1.0f);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glPopMatrix();

However I never get a circle drawn to the screen, only ever a square. I am very confused, any help is appreciated :)
Comment: For others reading this question, they should consider that a way to debug this might be to reduce the number of iterations in the loop (even to one iteration) and see what happens and how it goes wrong with more and more iterations.
Answer: one thing that looks wrong is the calculation of rad.  Try modifying it to something like:
double rad = deg2rad(i*360/(points*3));

You need to divide it by points*3 because the i counter is getting incremented by 3 on each iteration.  You should print out the value of rad on each iteration and verify that you're getting values incrementing between 0 and 2 * PI
EDIT: you may also need to change the direction of the circle (i'm not sure at the top of my head).  but if the above doesn't render anything, try reversing it:
double rad = deg2rad(360.0 - i*360/(points*3));

Also, it looks like you're only rendering half the points in the glDrawArrays call.
Comment: All good points, but no of which explain why it's drawing a square :(
Comment: does it *still* draw a square after these changes?  is it a perfect square or jaggy edges?
Answer:
//...vertex and index buffers...

int VERTICES=180; // more than needed  // changed variable name
float coords[] = new float[VERTICES * 3];
float theta = 0;

for (int i = 0; i < VERTICES * 3; i += 3) {
  coords[i + 0] = (float) Math.cos(theta);
  coords[i + 1] = (float) Math.sin(theta);
  coords[i + 2] = 0;
  vertexBuffer.put(coords[i + 0]);
  vertexBuffer.put(coords[i + 1]);
  vertexBuffer.put(coords[i + 2]);
  theta += Math.PI / 90;
}

// ....set buffer positions to zero...

protected void draw(GL10 gl) {
  gl.glColor4f(0, 0, 1, 0.5f);
  gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
  gl.glDrawElements(GL10.GL_TRIANGLE_FAN, VERTICES,
    GL10.GL_UNSIGNED_SHORT, indexBuffer);
    }
}

Easy breezy.