ColdFusion datasource error: can't connect to database login failed

Question: I keep getting the same error:  Connection verification failed for data source: estimates
java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot open database "estimates" requested by the login. The login failed.
I have checked in Sql Server Configuration Manager and TCP/IP is enabled in all of the SQL Server settings, and I'm using Windows Authentication only to access the SQL Server DB on my local server.
Can someone help fix this so I can set up a DSN, please?  Thank you!
Comment: Check the SQL Server error log. It should have more specifics on the reason for the login failed.
Comment: Have you given ColdFusion a Windows account?
Answer: Likely a SQL configuration issue.   Once you add the Login to the server, go back to the database and add the user to it.  You'll need to add a role, as well, usually dbo for simplicity, but not necessarily security.
If you've restored the database from another source, you might need to run this command:
<code>USE [yourdb]
EXEC sp_change_users_login 'Auto_Fix', 'theLoginName'
</code>
Comment: How do I add the Login to the server?
Comment: This is more of a Microsoft SQL Question, but you use the SQL Studio:
https://www.guru99.com/sql-server-create-user.html
Comment: I am not able to log in with user 'sa' because it's disabled.    Enable Login. failed for Login 'sa'.  (Microsoft.SqlServer.Smo)  Cannot alter the login 'sa', because it does not exist or you do not have permission. (Microsoft SQL Server, Error: 15151)
Comment: In the error log, I found this.  Does this mean anything to anyone?  2022-07-24 07:38:12.80 Server      The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/DESKTOP-94SV1LK ] for the SQL Server service. Windows return code: 0xffffffff, state: 63. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.
Comment: You might take these issues to the SQL Server area:  https://stackoverflow.com/questions/tagged/sql-server
Comment: Thanks, Will.  I will look for a SQL server specific forum.
Comment: I did add a user and gave it all permissions, but I still can't connect.  I might have to try a ColdFusion or Dreamweaver specific forum.  Thank you.


Editable fields in views

Question: I am hiding a field using hook_form_alter, because I only want to be able to edit this field in views. then, I used the Editable Views Module to display this field. Now, my problem is that when I press the save button, all of my nodes are saved.
Is there any way to only save nodes where this field has been edited?
Answer: Seems you're looking for the jEditable inline content editing module. I tried this module for one of my project and working fine.
Using this module you can do inline edits for individual fields. you can make inline edits at node output and views output too.
Note: Right now There is only dev version available  for Drupal 7x so make sure to install and test on local instance first.
Answer: In Drupal 8, there's Views Entity Form Field.  There's an issue with patches for what you're trying to do.
However, jEditable inline content editing is still available in Drupal 8.  So choose the one that works better for your use case.

Editable fields in views


Cannot load HTML file with QWebEngineView.setHtml()

Question: The solution of my problem is probably very simple but yet out of my understanding. I am trying to load an HTML file into a QWebEngineView with PyQt5. The way I am doing it is:
self.webView = QtWebEngineWidgets.QWebEngineView(self.splitter)
html = r"C:\DATI\git\webgis\map.html"
self.webView.setHtml(html)

The only thing I get is a string representing the path and name of my HTML file:

C:\DATI\git\webgis\map.html

My map.html looks like this:

    <title>Simple Map</title>
    <link rel="stylesheet" href="https://openlayers.org/en/v4.5.0/css/ol.css" type="text/css">

Strangely (to me at least), if I do self.webView.setHtml("
ciao
"), this will render the HTML properly.
What am I missing?
Answer: The setHtml method does exactly what its name suggests: it loads html content from a string. What you are trying to do is load a url, so for that, you need to use the load method:
url = QtCore.QUrl.fromLocalFile(r"C:\DATI\git\webgis\map.html")
self.webView.load(url)


Why is MLS having 9AM matches?

Question: The Toronto FC and DC United were scheduled for a match at 9AM on July 12, 2020 during MLS is back tournament. The match was however postponed due to potential COVID-19 positive tests.
What I find shocking is to have a game at 9AM, to me this is unheard of. Once you take into account time spent before the game to eat, rest and warm up, you're looking at players needing to wake up before sunrise for a game!
While this might be normal for some other sports, it's something you never see for soccer. It must throw off the players bodies to play at a time they're not used to competing.
And looking at the schedule of the tournament, there are more 9AM games to come, so this is not just a 1 off.
Most of the US wouldn't even be awake to watch the game considering the matches start 6AM on the west coast. It makes me wonder if MLS is targeting non local targets. So is MLS trying to please the Asian markets (where it would be evening or night time) with such weird schedule? Hard to believe other parts of the world would want to watch the MLS while only few hours later you could watch far higher quality European leagues.
None of the non-morning games are scheduled before 8PM, so this makes it even more confusing. At first I thought MLS is hosting tons of games per day and so games start at 9AM and go all the way to the night, but there are no games between 9AM to 8PM.
The only thing I can think of is to blame the heat and humidity in Orlando, and so not wanting to schedule games around noon or during the afternoon. Then why not have games at 7,9, and 11 PM? Even if a game starts at midnight, most Americans will be awake considering west coast is 3 hours behind the east.
Or even better yet, why not have games happening at the same time? That's what happens during a normal season anyway.
Is MLS using only 1 field to play all their matches at the Disney World?
It'll be hard to believe that they limited themselves to just one field for 20+ teams. What if the field suffers damages? Also don't you want to have games scheduled simultaneously for the last round of the group stage to preserve integrity and fair play? I have hard time believing MLS brought the league back to a location where there is only 1 field for all matches. And also have a hard time believing anyone would be interested to wake up for 9AM game on a Sunday.
So why is MLS having such bizarrely early game times?
Answer: From this ESPN article, the reason for the weird times (9am, 8pm, 10:30pm) is to avoid the heat:

The kickoff times are weird. Why is that?

At first glance, the schedule certainly seems bizarre. The games will be held at 9 a.m. ET, 8 p.m. ET, and 10:30 p.m. ET (2 p.m. GMT, 1 a.m. GMT and 3 a.m. GMT). The reasoning is simple: it will avoid playing games in the midday blast furnace -- average high temperatures are 92 degrees, with an average low of 78 degrees -- that is high summer in Florida.

As to why not 7/9/11, I can only guess; they have 2.5 hours between games, so perhaps they decided that 6/8:30/11 would be too far, but I don't believe they've communicated that information specifically (or at least not as far as I can find).
Comment: 0900 ET (NB: not EST) games also fit pretty well with the very large European soccer market (14:00-15:00) and are in prime-time for the very large South-East Asian market.
Comment: While the Florida heat is an issue, this sounds like an excuse from the MLS. As I mentioned on the question, if it's the heat, why not games at 7, 9, 11 or overlapping games?
Comment: @alamoot I don't see why you see some sort of malicious behavior on their part - I have to think they'd make the games as visible as possible to their viewers, and this is what they came up with.  This is their stated reason, in any event, I'm not sure you'd get anything better even if there is some sort of underhanded reason for it...
Comment: oh I don't think there is a malicious behavior. I just find it super curious. Wouldn't midnight EST games have more American viewers than 9AM EST games? Did the players have a say at this? I'm not sure if there's a PA in the MLS. Again it kinda suggests to me they only have 1 field available to them (not having overlapping games), and that's hard to believe they risk bringing 20+ teams to play on only 1 field.
Comment: I don't have any stats to argue with, but I can 100% guarantee you that ESPN and MLS do have those stats and made the decision based on them.  MLS Players Association undoubtedly had some say in it, but probably not as much as  MLBPA would have given their relative strengths and their members' relative ability to forgo paychecks.
Comment: Absolutely, though I leave it out of the answer as that would be speculation on my part.

Why is MLS having 9AM matches?


O que devo fazer para fazer upload de arquivo com símbolos de depuração no flutter?

Question: Estou publicando um app feito com Flutter e estou recebendo uma mensagem de aviso da PlayStore dizendo o seguinte:
"Este App Bundle contém código nativo, e você não fez upload dos símbolos de depuração. Recomendamos que você faça upload de um arquivo de símbolo para facilitar a análise e a depuração de falhas e ANRs."
Eu criei o arquivo AppBundle com a assinatura e não recebi nenhuma mensagem de erro no processo de upar o app pra loja, mas recebi essa mensagem de aviso e estou sem saber o que devo fazer para arrumar
este é meu arquivo Build.gradle
Eu vi algo sobre ter um arquivo que seria referenciado no build.gradle, mas não entendi muito bem
android {
    compileSdkVersion 31

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.ifmgsje.ifmap"
        minSdkVersion 20
        targetSdkVersion 30
        versionCode 1
        versionName 'Version 1.0.0+1'
    }

       signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }
}

O que devo fazer?
Comment: Veja a documentação de suporte do Google [Desofuscar ou simbolizar stack traces de falhas](https://support.google.com/googleplay/android-developer/answer/9848633?hl=pt-BR#zippy=%2Cc%C3%B3digo-nativo-gerar-um-arquivo-de-s%C3%ADmbolos-de-depura%C3%A7%C3%A3o%2Cfazer-upload-de-arquivos-usando-o-play-console%2Cfazer-upload-de-arquivos-com-a-api-google-play-developer)
Answer: Não sei se vc ainda tá com esse aviso aparecendo... é q eu passei pelo mesmo problema, mas depois de várias tentativas frustradas consegui resolver assim:

Instalei o NDK: https://developer.android.com/studio/projects/install-ndk
No arquivo android/app/build.gradle adicionei o NDK à sessão defaultConfig defaultConfig { ... ndk { debugSymbolLevel } }
E por último, fiz o upload do arquivo de símbolos: Esse vídeo aqui mostra o passo a passo como fazer https://youtu.be/wiEZZ-30CbM.
Comment: Links a recursos externos são bem-vindos, mas lembre-se de fornecer um contexto para cada link, para que seus colegas usuários possam ter uma ideia do que se trata e por que está aqui. Sempre destaque a parte mais relevante de um link importante, caso o site de destino esteja inacessível ou fique permanentemente off-line.


getcwd() returns NULL after new pointer is created

Question: I've just started learning linux and C, please don't judge me strictly.
I'm trying to find a current working directory and to open file in this directory to find a specific word. It gives correct cwd if I find only cwd, but when I added while loop cwd is null.
#include <unistd.h>
#include <stdio.h>
#include <limits.h>
main(){
char *buff;
char *currentDir =getcwd(buff,PATH_MAX);

printf("Current directory: %s\n",currentDir);

FILE *file;
char *filename = "profile";
file = fopen(filename,"r");
if(file == NULL)
{
fprintf(stderr,"File %s wasn't found\n",filename);
}

while(1)
{
    char buffer[80];
    char *token;
    fgets(buffer,80,file);
    if(feof(file))
    {break;}
    else{
    *token = strtok(buffer,"=");
        if(strcmp(token,"HOME")==1);
        {
        printf("HOME token is found");
        }
    }
free(token);
}

fclose(file);
}

The output:
Current directory: (null)
Segmentation fault
Comment: install ddd debugger it'll help you
Comment: also you cannot declare FILE* char * etc after printf statement
Comment: @BhavikShah You've been able to mix variable declarations and code in standard C since C99 (and before that as an extension on many compilers).
Comment: I rolled back you latest edit, as it rendered my answer ununderstandable.
Answer: buff is pointing to random memory.
You might like to declare buff like so:
char buff[PATH_MAX] = "";

If on Linux then one can alternatively let getcwd() allocate the memory needed by doing so:
char * currentDir = getcwd(NULL, 0);

currentDir needs to be passed to free() when done with it, and buff is not needed then.
Comment: `buffer` is initialized with the call to `fgets()`. So, no problem there.
Comment: Pardon me, what are you referring too, please? @OlafDietsche
Comment: Sorry, my fault. I mixed up `buff` and `buffer`. But the same holds here. No need to initialize with `= ""`, because `buff` is initialized with the call to `getcwd()`.
Comment: `buff` might be left uninitialised if `getcwd()` failed. @OlafDietsche
Answer: Remove the line:

free(token);

token points into buffer, which is on the stack. So, no need to free it.
Another bug is:

*token = strtok(buffer,"=");

strtok() returns a char*, so this should read:
token = strtok(buffer,"=");

You should also modify your loop to:
#include <string.h>

...
char buffer[80];
while (fgets(buffer,80,file)) {
    char *token = strtok(buffer,"=");
    if (strcmp(token,"HOME") == 0);
    {
        printf("HOME token is found");
    }
...

Comment: thanks Olaf. I see why I have bug with token initialisation. I edited it, but compiler says that the line  "char *token = strtok(buffer,"=");" assignment makes pointer from integer without a cast
Comment: Ok, I missed that. You need to include `string.h`. Also change your `strcmp()` to `== 0`, because 1 means greater, 0 equal and -1 less than.
Comment: `#include ` includes the declarations for `strtok(), strcmp(), ...`. If you use a function without declaration, the compiler assumes the return value is `int`, which is wrong in this case: `char*strtok(char*, const char*)`.
Answer: Small function to get current directory:
void get_working_dir(void)
{
    char buf[PATH_MAX];

    if (getcwd(buf, sizeof(buf)) == NULL) {
       fprintf(stderr, "Err.:(%d) - %s: curr. workdir\n", errno,strerror(errno));
       exit(EXIT_FAILURE);
    }

    /* print current directory */
    printf("%s\n", buf);
}

Invoke function with:
get_working_dir();

Comment: Calling exit on failure is not an expected behavior - I would not recommend doing so without a good reason.
Answer: I was facing the same problem so i took a look to the man pages where is was said that the getcpw() syscall will malloc the buffer if it is NULL.
I think the problem is that your buffer is not nulled so try to initiallize it with the NULL pointer
    char *buff=NULL;
    buff=getcwd(buff,PATH_MAX);


Cardinal Exponentiation Inequality

Question: Let $\lambda, \kappa$ be infinite cardinals with $\lambda<\kappa$, what is known about $\kappa^\lambda$? specially in the case either $\kappa$ is regular. Or is there very little that can be answered about this question under ZFC (Again I'm mostly interested in the case $\kappa$ is regular)?
As you have probably guessed by now, I'm more interested in the results from ZFC with $\kappa$ regular. But I would be interested to know other results (independence results for example). I would also like to know a good source for cardinal arithmetic in general.
Edit1: Also I would like to know when $\kappa^\lambda<2^\kappa$.
Answer: Well, here is the other side of the coin. What happens when $\kappa$ is singular? For instance, what is $\aleph_\omega^{\aleph_0}$? While this question is independent of $\mathbf{ZFC}$, we do know the an upper bound if $\aleph_\omega^{\aleph_0} \neq 2^{\aleph_0}$.
The 'result' is that when $\aleph_\omega^{\aleph_0} \neq 2^{\aleph_0}$, we have that ${\aleph_\omega^{\aleph_0}}< \aleph_{\omega_4}$.
This result was proven by Shelah and uses PCF theory. This paper has a section dedicated to trying to explain why the hell it is 4.
Comment: 4 is the least integer that has two cardinals between 1 and itself. :-)
Comment: @AsafKaragila: Dima Sinapova actually tried to explain it explain it to me once... I think I remember her saying that this was probably a hard bound, but I don't recall if that's true. Do you know?
Comment: This is *the* open problem of PCF. We (me, Yair Hayut, and Shimon Garti) had a discussion about this a couple of days ago in the hallway. Which is exactly why I wrote the comment above. One of the postdocs showed me a proof of something where you force $\sf MA+2^{\aleph_0}=\aleph_3$, because you really need the fact that $\aleph_2<2^{\aleph_0}$. So here it really has the same thing the $\omega_4$ is really just an artifact of the proof, that you can't really squeeze down with currently known methods.
Answer: If GCH holds, then if $\lambda < \kappa$ and $\kappa$ is regular, then $\kappa^\lambda = \kappa$.
By Easton theorem (or use product forcing), there is a model of $\mathsf{ZFC}$ such that $2^{\aleph_0} = \aleph_2$ and $2^{\aleph_1} = \aleph_3$. Then $(\aleph_2)^{\aleph_1} = (2^{\aleph_0})^{\aleph_1} = 2^{\aleph_0 \times \aleph_1} = 2^{\aleph_1} = \aleph_3$.

Cardinal Exponentiation Inequality


How does the default t-test in R tell you that the relationship between independent and dependent variables is curvilinear?

Question: How does the default t-tests in R tell you that the relationship between an independent variable and a dependent variable is curvilinear?
So far I have fitted 2 models using the lm function on one data set. For one of the models I used polynomial regression. I also found the summary for the 2 models. Is the default t-test found in the summary? In which model should I look for the curvilinear relationship; the normal model or the model done with polynomial regression?
Comment: You might be interested in the [Ramsey RESET test](https://en.wikipedia.org/wiki/Ramsey_RESET_test).
Answer: The actual t.test function in R does not have a method for lm objects. However, if you look at the coefficient summary using summary on the lm object, the printed output shows the results of a significance test which, like the t-test, takes the regression coefficient, divides by its standard error, compares the Z-statistic to the normal 0,1 distribution, and produces a p-value. Since the regression coefficient is a mean difference, it is often considered a type of t-test. However, the correct terminology for this test is a Wald test.
To test for the presence of non-linearity, you can inspect the statistical significance of the non-linear terms in the polynomial model. For instance, if I adjust for x and x^2 in a model and the x^2 term is significant, this quadratic term is detecting some of the departure from linearity.
Using the lmtest package, you can also apply a likelihood ratio test (LRT) since these are nested models. The command lrtest(model1, model2), will simultaneously test all the non-linear polynomial terms in the second model, and this will be an omnibus for non-linearity.


Proof / derivation of skewness and kurtosis formulas

Question: Can anyone explain to me where the formula of skewness or kurtosis comes from? (I mean its derivation.) What's the logic behind it? Who proved it?
Comment: In what sense would someone 'prove' a measure of something? It would be like trying to 'prove' the mean. It's not clear what that could mean. Please clarify. Also note that there's more than one measure of these notions. Are you after the measures based on third and fourth moments?
Comment: @gung The third moment is rarely equated to the skewness, which is typically a third moment for *standardized* data or an estimator thereof.
Comment: In addition to @Glen_b's points, be aware that there have been several formulas for skewness, eg. The most common one in textbooks, I'd think, is the 3rd moment.
Comment: @whuber, you're right. I should have said 3rd *standardized* moment.
Comment: Thank You Very Much All of Your for all your wonderful answers and explanation, and Yeh I meant the third moment. What i mean to say is that why the Skewness is defined as Third central moment, and not Fifth or any other number? Whats the logic behind it. The only explanation i found out was that since Mean is center of the data and raising it to the odd power would cancel the term and final answer will be Zero if it data distribution is symmetric and not zero if it is not symmetric. IS this true?
Answer: You should not expect proof, since skewness and kurtosis are somewhat vague notions.
Symmetry is mathematically precise, but skewness by contrast is surprisingly slippery. Kurtosis is perhaps even more so.
There have been a fairly large number of attempts to give measures corresponding to these notions, but these often-useful measures can be surprisingly counter-intuitive at times. For example, the moment-based skewness can be zero when the distribution is asymmetric (contradicting an assertion one can surprisingly often find when reading elementary texts which discuss skewness).

Can anyone explain to me where the formula of skewness or kurtosis comes from?

Both skewness and kurtosis are somewhat vague terms with several different measures.
These days people mostly mean the moment-based measures, based on standardized third and fourth moments respectively.

Some history
The term "skewness" as applied to a probability distribution seems from an initial look to originate with Karl Pearson, 1895$^{\text{[1]}}$. He begins by talking about asymmetry.
The term "kurtosis" as applied to a probability distribution seems to also originate with Karl Pearson, 1905$^{\text{[2]}}$.
Pearson has formulas for the moment-kurtosis and the square of the moment skewness ($\beta_2$ and $\beta_1$) in his 1895 paper, and they're being used in some sense to help describe shape, even though the notion of kurtosis is not particularly developed there.
However, the idea that higher (standardized) moments than the second can be thought of as some measure of shape or at least of deviation from normality appears to be older than this.
Note, in particular, the historical information contained in Nick Cox's article$^{\text{[3]}}$, here, which makes clear we should give much of the priority to Thiele (1889)$^{\text{[4]}}$.
However, there are other measures than the moment-based quantities. For example, in the case of skewness, there's Pearson's first and second skewness coefficients, which are based on the simple notion of scaling the difference between the mean-and-mode and the mean-and-median respectively. (I think these also date to the 1895 paper but I haven't checked this.)
These different measures relating to the same underlying notion can suggest quite different things (even be opposite in sign). e.g. see here. A reason to be cautious about over-interpreting the moment-kurtosis can be seen here

Edit: Additional information --
It seems that the entries on skewness and kurtosis in Earliest Known Uses of
Some of the Words of Mathematics, by Miller et al.$^{[5]}$ agrees with me that it seems they originate with Karl Pearson in 1895 and 1905 respectively.
Nice to have some degree of confirmation.

What I mean to say is that why the skewness is defined as third central moment, and not fifth or any other number? What's the logic behind it?

Okay, so we're specifically dealing with moment skewness.
First, why the third moment makes some sense. Let's begin by thinking of skewness in a somewhat intuitive way rather than rely on a formal definition and see what it might imply.
Recall that $\sigma$ represents a kind of "typical" distance of observations from the mean, and consider what happens when we take a symmetric-looking distribution and make it more right-skew (while trying to keep the area, $\mu$ and $\sigma$ constant):

Here we divide up the axis into four regions - roughly placed at more than one standard deviation below the mean, less than a standard deviation below the mean, less than a standard deviation above the mean and more than a standard deviation above the mean - sections $A$ to $D$ respectively.
For a slight increase in skewness, we tend to see relatively more of the probability immediately to the left of the mean (region $B$) and far above the mean (region $D$), while seeing less immediately above the mean (region $C$) and far below (region $A$).
Indeed, by trying to keep the area constant, if we lift the far tail (the right end of $D$), we're forced to have less probability elsewhere. But if we want to keep the mean constant we must have more probability somewhere lower down. If we put the compensating probability into "$A$" (lowering $B$ and $C$) we could keep the area and mean constant, but we'd end up with a symmetric change (effectively, we would be increasing the variance, not making it more skew).
We can't lift $C$ because lifting both $C$ and $D$ would shift the mean up.
So if we lift the right tail ($D$), while holding the area, mean and standard deviation constant, we can lift the probability in $B$ as well, and reduce the other two -- if we get the relative amounts and positions right within those regions. Keeping $\sigma$ nearly constant constrains what we do more than I have really described (the diagram is slightly inaccurate and as drawn suggests an increase in $\sigma$).
So to make it look a little more right skew, we would tend to shift as described in roughly those areas.
But what does that imply if we try to construct a simple moment-based measure? Note that with third central moments, more area in $A$ or $B$ will tend to reduce it while more area in $C$ or $D$ would tend to increase it (other things being equal), but as we saw, we can't add area without taking it away somewhere else. Cubing things above 1 pulls them out more than cubing things below 1 can "pull them in", so if we add to $D$ while taking away from $C$, the third moment will still increase. Similarly if we add to $B$ while taking away from $A$, the third moment will again tend to increase. That is, the rough-sense "increase in skewness" we just arrived at seems to correspond quite nicely to the third moment.
Now this discussion doesn't rule out fifth and higher moments at all - indeed an increase in third moment will also tend to increase the fifth (unless you do it very carefully indeed), but the (standardized) third moment will be about the simplest way of capturing the notion of skewness using a moment-based measure; while fifth moments are more complex and can move in ways that don't capture our sense of skewness as well as the third moment does.
The third standardized moment doesn't correspond perfectly to our sense of skewness, but it's a pretty good, simple measure that does mostly correspond to it.

The only explanation I found out was that since the mean is center of the data and raising it to the odd power would cancel the term and final answer will be Zero if it data distribution is symmetric and not zero if it is not symmetric. Is this true?

1) In spite of such comments being very easy to find in elementary treatments**, strictly speaking, in respect of probability distributions, neither part is actually true.
a) It's possible for a distribution to be symmetric but not have zero third moment. A simple counterexample is any t-distribution with 3 or fewer degrees of freedom. In samples, however, symmetry implies zero third moment - but samples are almost never perfectly symmetric, so it's not much use there either.
b) It's possible for an asymmetric distribution to have zero third moment.
So symmetry doesn't necessarily imply zero third moment and zero third moment doesn't necessarily imply symmetry.
2) In any case, that wouldn't explain "why third moment rather than fifth", since the fifth power would be just as odd as the third.
** (indeed since I am often asked whether I'd recommend a particular book, the second part (i.e. a claim that $\gamma_1=0$ implies symmetry) is one of several 'quick tests' I use when evaluating whether an elementary book is worth examining more closely -- if a text stumbles over two or more of the common basic errors I tend to see, I don't bother wasting further time looking.)

References
[1]: Pearson, K. (1895),
"Contributions to the Mathematical Theory of Evolution, II: Skew Variation in Homogeneous Material,"
Philosophical Transactions of the Royal Society, Series A, 186, 343-414
[Out of copyright. Freely available here]
[2]: Pearson, K. (1905),
"Das Fehlergesetz und Seine Verallgemeinerungen Durch Fechner und Pearson.", a rejoinder (Skew variation, a rejoinder),
Biometrika, 4 (1905), pp. 169–212.
[While this is also well out of copyright (I can find copies of a Biometrika from 3 years later, for example), I can't locate a copy of this I can link you to. Oxford Journals wants to charge $38 for one day of access to something that is long out of copyright. If you don't have institutional access to one of the places that supply access to it you may be out of luck on this one.]
[3]: Cox, N. J. (2010),
"Speaking Stata: The limits of sample skewness and kurtosis",
The Stata Journal, 10, Number 3, pp. 482–495
(available online here)
[4]: Thiele, T. N. (1889),
Forlæsinger over Almindelig Iagttagelseslære: Sandsynlighedsregning og Mindste Kvadraters Methode,
Copenhagen: C. A. Reitzel.
[Out of copyright. There's an English translation - see the Thiele reference in [3].]
[5]:  Miller, Jeff; et al., (Accessed 16 August 2014),
Earliest Known Uses of Some of the Words of Mathematics,
See here
Comment: Various historical comments are sprinkled throughout my paper, Cox, N.J. 2010. The limits of sample skewness and kurtosis. _Stata Journal_ 10: 482-495  accessible to all at http://www.stata-journal.com/sjpdf.html?articlenum=st0204 @Glen_b is correct that there is a history before Karl Pearson, who was less than gracious, and less than candid, in acknowledging the prior work of T.N. Thiele.
Comment: (mean $-$ median) / SD has the interesting and at first sight surprising property that it lies in $[-1,1]$, something periodically rediscovered. Although necessarily no single measure can capture all that might be desired, it deserves a little more use as a descriptive measure. It will occasionally have the "wrong" sign, as will any such measure. L-moments deserve more use for describing distribution shape.
Comment: Indeed: Lauritzen's book on Thiele contains fascinating material. See http://ukcatalogue.oup.com/product/9780198509721.do but be warned that it is expensive.
Comment: @Nick - thanks especially for the mention of Thiele; your article is well worth reading -- indeed I will put a link in my answer. I had occasion to consult Lauritzen's work many years ago when I was writing a small item in part about Thiele's work on a (slightly) more basic form of what we now call the Kalman filter, but I could only have the book for a couple of hours and focused only on the sections I needed; I obviously missed much of importance. Thiele was - and continues to be - terribly under-appreciated.
Comment: _Biometrika_ is accessible via www.jstor.org if you have access to that.
Comment: Thanks for the fix @NickCox - that's what I get for being lazy and copy-pasting the reference without looking carefully enough. I know Phil. Trans. Roy. Soc. but didn't spot the transposition in the reference.
Comment: Thank You Very Much All of Your for all your wonderful answers and explanation, and Yeh I meant the third moment. What i mean to say is that why the Skewness is defined as Third central moment, and not Fifth or any other number? Whats the logic behind it. The only explanation i found out was that since Mean is center of the data and raising it to the odd power would cancel the term and final answer will be Zero if it data distribution is symmetric and not zero if it is not symmetric. IS this true?
Comment: I have responded in an edit to my answer.


makefile for cppunit

Question: this is my makefile :
#Makefile
CC=g++
CFLAGS=-lcppunit
OBJS=Money.o MoneyTest.o

all : $(OBJS)
    $(CC) $(OBJS) -o TestUnitaire

#création des objets
Money.o: Money.cpp Money.hpp
    $(CC) -c Money.cpp $(CFLAGS)

MoneyTest.o: MoneyTest.cpp Money.hpp MoneyTest.hpp
    $(CC) -c MoneyTest.cpp $(CFLAGS)

clean:
    rm *.o $(EXEC)

when i run this makefile, i get errors like those :

g++ Money.o MoneyTest.o -o TestUnitaire
  Money.o: In function main':
  Money.cpp:(.text+0x3c): undefined reference toCppUnit::TestFactoryRegistry::getRegistry(std::basic_string, std::allocator > const&)'
  Money.cpp:(.text+0x78): undefined reference to CppUnit::TextTestRunner::TextTestRunner(CppUnit::Outputter*)'
  Money.cpp:(.text+0x8c): undefined reference toCppUnit::TestRunner::addTest(CppUnit::Test*)'
  Money.cpp:(.text+0x98): undefined reference to CppUnit::TextTestRunner::result() const'
  Money.cpp:(.text+0xec): undefined reference toCppUnit::CompilerOutputter::CompilerOutputter(CppUnit::TestResultCollector*, std::basic_ostream >&, std::basic_string, std::allocator > const&)'
  Money.cpp:(.text+0xfc): undefined reference to CppUnit::TextTestRunner::setOutputter(CppUnit::Outputter*)'
  Money.cpp:(.text+0x168): undefined reference toCppUnit::TextTestRunner::run(std::basic_string, std::allocator >, bool, bool, bool)'
  Money.cpp:(.text+0x1a5): undefined reference to CppUnit::TextTestRunner::~TextTestRunner()'
  Money.cpp:(.text+0x233): undefined reference toCppUnit::TextTestRunner::~TextTestRunner()'

It's seems to be that there no link between my class. What's the trouble ?
Answer: The -lcppunit flag is not correct in CFLAGS, which is where you put C compiler flags.  You are (a) compiling C++ programs, not C programs, and (b) the -l flag is a linker flag, not a compiler flag.  Also, the CC variable holds the C compiler.  You should use the CXX variable for the C++ compiler.  Your makefile should look something like:
#Makefile
CXX = g++
LDLIBS = -lcppunit
OBJS = Money.o MoneyTest.o

all : TestUnitaire

TestUnitaire: $(OBJS)
        $(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)

#création des objets
%.o : %.cpp
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<

Money.o: Money.hpp
MoneyTest.o: Money.hpp MoneyTest.hpp

clean:
        rm *.o $(EXEC)

makefile for cppunit


Proper way to set an AlpineJs variable using value from a select tag

Question: I need to change the value of myData variable to whatever is the current value of the select tag.
I am currently using this and it works but is there a cleaner way in Alpine for doing this?

    <select id="mySelect" @change="myData = document.getElementById('mySelect').value">
        <option>2021</option>
        <option>2022</option>
    </select>

Answer: Figured it out using x-model. So the cleaner version of the above code is simply:

    <select x-model="myData">
        <option>2021</option>
        <option>2022</option>
    </select>


ngCordova Error Keeps Occurring

Question: So I am using this plugin: http://ngcordova.com/docs/plugins/pushNotificationsV5/ Which is cordovaPushV5 and I am trying to get my device token to send to my nodejs server. Here is my code:

angular.module('starter', ['ionic', 'ngCordova'])

.run(function($http, $cordovaPushV5) {

  var options = {
   android: {
     senderID: "12345679"
   },
    ios: {
      alert: "true",
      badge: "true",
      sound: "true"
    },
    windows: {}
  };

  // initialize
  $cordovaPushV5.initialize(options).then(function() {
    // start listening for new notifications
    $cordovaPushV5.onNotification();
    // start listening for errors
    $cordovaPushV5.onError();

    // register to get registrationId
    $cordovaPushV5.register().then(function(data) {
      // `data.registrationId` save it somewhere;
    })
  });

  // triggered every time notification received
  $rootScope.$on('$cordovaPushV5:notificationReceived', function(event, data){
    // data.message,
    // data.title,
    // data.count,
    // data.sound,
    // data.image,
    // data.additionalData
  });

  // triggered every time error occurs
  $rootScope.$on('$cordovaPushV5:errorOcurred', function(event, e){
    // e.message
  });

});

    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <ion-pane>
      <ion-header-bar class="bar-stable">

Ionic Blank Starter

      </ion-header-bar>
      <ion-content>
      </ion-content>
    </ion-pane>

When I run it in ionic serve (browser) i get this console error: ReferenceError: Can't find variable: PushNotification
Does anyone know what this means?
Comment: You can't run that module in your browser. It has to be run on the device.
Answer: Comment above was 100% correct. That error only shows in the browser because this plugin only works on devices

ngCordova Error Keeps Occurring


RMI Application

Question: I am working on a development of a paperless system for leaves application and for asking queries and for scheduling meetings.  It will have 3 categories of users namely Admin side, staffs and students. I am using eclipse to write an RMI application. It comprises of :

Admin - Consist of the screens the admin will be using
Admin_Main - This is the Main Server which bind the interfaces in the registry
Common - Common screens used by both admin, staff and student side
Implementation - The development of the methods defined in the Interfaces
Interfaces - The methods that will be used by admin, staff and student are defined here
Staff - The screens used by the staffs
Student - the screen used by the student

Also in a few interfaces in my RMI application, i am using org.eclipse.swt to display calendar, to allow users to input date just by choosing on the calendar. When I tried to run it in command prompt, but it is not recognizing the  org.eclipse.swt package.
So my question is how can i deploy my whole RMI application to make it run without eclipse, and i want to deploy it separately, that is staff, admin and student separately to be able to make it work on a real network. If i run these on eclipse using an RMI plugin, it is working fine.
Answer: You're writing a client/server application, where the two share a common interface.
Eclipse is hiding some of those deployment details from you, but you'll have to sort them out to deploy without it.
You have to have client and server JARs, with all their separate dependencies available, plus a common JAR for the classes they share.
You have to have an RMI container that's listening for RMI requests from clients on a port of your choosing.
Have you written your server to use one thread per request or non-blocking IO?  You should know if there will be lots of clients simultaneously accessing your server.
Comment: Hi.. Yes many clients will be accessing the server simultaneously. But i don't know how to make the jars..
Comment: I have been able to generate the jar. I have installed a Fat-Jar Plugin on Eclipse. I have done only for admin part so far (Just trying fro now). I've tried to export the all the folders to be used by the admin side in one jar..(Admin, Admin_Main, Interface, Common, Implementation). My main class consist of codes to bind the methods in the registry and a code to show the login screen for the admin. When i deployed all these, it showed a java icon, but when i try to run it, it shows an empty screen, I don't know may be it is not recognizing the codes to bind the methods in the registry?
Comment: No, go back to your other comment: I don't know how to make the JARs.  You are having much more fundamental problems.  I would recommend abandoning Eclipse - it's only getting in the way.  Learn how to use the jar.exe tool - it's bundled in with your javac.exe and java.exe in the JDK /bin folder.  Think about what goes into each of the client, server, and common JARs and use jar.exe to make it so.
Answer: Have you tried deploying your RMI application on Apache Tomcat with the RMI plugin?
Im not too good with RMI, but did a unit on it last year at university, and to deploy it, we used Apache Tomcat (http://tomcat.apache.org/)

RMI Application


Missing lots of ipv4 traffic after dns switch to a new server

Question: I've been migrating a traffic-heavy (https://jsonip.com) service I've run for a number of years to an upgraded server over the last week. Before the dns switch, I was averaging 9mb/s ipv4 inbound. After the switch, its barely 1mb/s on the new server. My inbound ipv6 traffic seems to be unaffected.
I'm trying get some suggestions as to what might be happening.
These graphs represent the before and after.
Old server: https://www.dropbox.com/s/y3wso9y7k6ijvwf/Screenshot%202016-07-31%2016.56.49.png?dl=0

New server: https://www.dropbox.com/s/ahjvhy70vnmlxzf/Screenshot%202016-07-31%2016.57.54.png?dl=0

The first image shows ipv4(top) and ipv6(bottom) traffic for the last 30 days on the old server. The second image is the last 30 days on the new server. You can see where the switchover happened a few days ago. (Notice that the blue line is inbound traffic and green is outbound. The new server is now showing high outbound traffic because I enabled https via LetsEncrypt yesterday and http traffic is being 301'd to https now. So this is expected and not related to the inbound traffic problem.)
When I noticed this happening a couple days ago, I immediately started checking for dns propagation problems. As far as I have been able to tell through multiple global propagation checking sites the rollout has been complete.
I've checked with my host provider and basically got the "looks normal on our end" brushoff.
One pattern I see is that inbound traffic is always much higher than outbound. This is because the inbound traffic contains lots of headers based on the traffic source, and the outbound is always a json object and a few CORS headers that's roughly always the same size. But after the switch over, the graph shows a nearly 1-1 ratio of inbound and outbound traffic. This makes me suspicious that the host's reporting daemon isn't 100% to be trusted.
If anyone more familiar with this part of server networking has some clues as to what's happening, I'd be really grateful.
Comment: Please, really, save everyone the trouble and upload them here.
Comment: Please upload your images here, so that people do not have to register to a third party web site to view them.
Comment: @MichaelHampton You don't have to signup to view those images.
Comment: Really? It tells me I have to sign in to Dropbox...
Comment: @MichaelHampton yeah, you just dismiss the modal. I went ahead and added direct links as imgs anyway. It's a better idea.
Comment: Your links still do not work. Please, as Michael requested upload them using the image upload facility in the editor.
Comment: @Iain Sorry, but what image upload utility? When I edit the question, I don't see anything like that.
Comment: Uploaded via imgur, should hopefully be visible now.
Answer: Perhaps your other server was compromised. I don't suppose you still have access to the logs and can check what was being requested and by whom ?
Comment: This was a good idea. I just spent the last hour or so going through various app logs but nothing looks out of the ordinary.


Proving $M_p$ is maximal in $C[0,1]$

Question: Let $M_p$ be the ideal of those continuous functions of $C[0,1]$ which have $p\in [0,1]$ as a zero. It is a commonly known fact that $M_p$ is a maximal ideal. However, the proof is generally non-trivial. I was wondering if the proof I am about to present is accurate. I feel it is much simpler than the one books generally prescribe, and hence there must be something wrong in it.
Let $f(x)\notin M_p$. Hence $f(p)=c$, where $c\neq 0$. Clearly, the continuous function $g(x)=(f(x)-c)\in M_p$. Now $f(x)-g(x)=c\in (M_p,f(x))$, which is a unit. Hence, $(M_p,f(x))=R$
Is the proof correct?
The proof books generally give: Let $f(x)\notin M_p$. Then for any $g(x)\in M_p$, where the only zero of $g(x) \in [0,1]$ is $p$, $f^2+g^2\notin M_p$, and also a unit. Hence, $(M_p,f(x))=R$. I have seen this proof in multiple books.
Comment: You are correct. But this is not the hard part of the characterisation. The non-trivial statement is usually ... *all* maximal ideals of $C[0,1]$ are of the form $M_p$.
Comment: I am not sure which proof you have seen. Noting that the quotient is isomorphic to $\mathbb{R}$ (with an obvious map) seems pretty easy to me.
Comment: Yes. In other words, $C([0,1])/M_p \cong \mathbb{C}$ (or $\cong \mathbb{R}$ if you're considering only real-valued functions), so $C([0,1])/M_p$ is a field, hence $M_p$ is maximal. What proof do the books generally give?
Comment: @DanielFischer- I have edited the question with the proof books generally give. I feel constructing $f^2+g^2$ is less straightforward than my proof.
Comment: @DanielFischer- Sorry $g(x)$ has the special property that its only zero in $[0,1]$ is $p$.
Answer: The proof is trivial. If $X$ is any space, $p \in X$ and $C(X)$ is the ring of (say) $\mathbb{C}$-valued continuous functions on $X$, then $C(X) \to \mathbb{C}$, $f \mapsto f(p)$ is a ring homomorphism (clear) which is surjective (consider constant functions) and the kernel is (by definition) $M_p$. Hence $C(X)/M_p \cong \mathbb{C}$ is a field, i.e. $M_p$ is maximal.
(The mentioned proof in freebird's question just repeats the characterization of maximal ideals by quotient rings.)

Proving $M_p$ is maximal in $C[0,1]$


ROC analysis and death/recurrence as binary marker

Question: I am doing ROC-curve analysis on my patient cohort, and I am wondering if it is statistically ok to use "death" and "recurrence" as the binary marker, even though these parameters will be influenced by time? Or do I have to do time-dependent ROC-analysis? (Does anyone here have experience with SurvivalRoc?)
So OS and RFS and the factors influencing them I have investigated using the KM-method and cox regression. The only factor significantly influencing OS and RFS is the variable/test I want to investigate further using ROC-curves (high test-score indicates worse prognosis.) I want to find the optimal cut-off of the test, and I am wondering if I can use "recurrence" or "death" as the binary marker. I will not use the ROC-curves to look at survival, but as a tool to find the optimal cut-off value for what patients should receive further treatment.
Answer: If you wait long enough we all die, so using "death" as a binary marker doesn't really make much sense in survival analysis. One might make an argument that "recurrence" would be OK as a binary marker, but then you're throwing out information about time to recurrence.
The survivalROC package in R, as you note, will do what you want for a specified predict.time. To work with censored data there has to be some smoothing to ensure a monotonic ROC, so you have to specify the method and parameter values for the smoothing. I found it easiest to specify a span value, effectively the fraction of the data, ranked ordered by the predictor, over which smoothing is done. Read the paper to understand the details.
Recognize, however, that a ROC does not represent the most appropriate way to evaluate or use a survival model. This Cross Validated page provides a good entry into discussion of alternatives.
In response to paragraph added in revised question
Your proposed use of an ROC curve to choose treatments of patients based on results of a single test is problematic in several ways.
First, if "The only factor significantly influencing OS and RFS is the variable/test I want to investigate," then you have a data sample whose results might be difficult to generalize to a different set of patients. Studies typically find relations of multiple clinical variables to overall survival (OS) or tumor recurrence-free survival (RFS). Such variables include age, smoking history, tumor grade, and cancer staging. If you found that none of these was "significantly influencing OS and RFS," then you seem to have had a very small data set or one that was otherwise restricted, for example a relatively homogeneous sample with respect to these clinically important variables.
Second, your focus on a single "significant" variable is extremely poor practice for prognostication. For prognostication you should not remove a variable from consideration just because it failed a test of statistical significance in a particular data set. This issue has been discussed extensively on this site, for example here.
Third, choosing an "optimal cut-off value" is fraught with danger, even if you move from your single-test result to a more realistic predictor combining multiple prognostic variables. Presumably there is some cost or danger to the proposed treatment for those at high risk, or it would be offered to all regardless of risk. What is the cost-benefit tradeoff, both from the clinician's and from the patient's perspective? As @FrankHarrell has put it, "ROC curves are not informative in 99% of the cases I've seen over the past few years." What you need is a way to estimate risk for a patient, in a way that can be combined with other clinical, personal, and practical considerations to inform a choice of treatment. A simple yes/no classification based on an "optimal cut-off value" does not accomplish this.
Fourth, your wish to use "recurrence" or "death" as binary variables without respect to time only makes sense in limited circumstances, and throws out all of the useful information about time to recurrence or death. Maybe you could consider this if you had essentially complete follow-up data on all patients up through a time by which, based on prior knowledge about this disease, almost all recurrences or disease-related deaths are likely to occur. But that's not often the case in cancer. Even in that case, why not use the tools provided by survival analysis to learn from all the information that you have?
You will be much better off moving away from your ROC curves toward the more complete survival modeling provided by tools like those in the rms package in R. These tools can be used to calibrate and validate your survival model and to produce nomograms that combine multiple variables for prognostication. Links from this answer provide related resources.
Comment: Thank you! I want to do ROC-curve analysis in addition to the Kaplan-Meier method and cox regression (determining OS and DFS, and the factors influencing them), to find the optimal cut-off for a specific test used to see what patients should be treated. I want to see the test's ability to predict recurrence in particular (AUC 0.82 when just plotting recurrence and not taking time into account). Is it ok to do that in this setting?
Comment: It's risky to throw away information, and what you propose seems to throw away information both about time and about clinical variables other than your specific test. There are much better ways to accomplish what you want. Please edit your question to include the information from your comment (comments can be lost, unlike questions), and also say how many recurrences and deaths are in your data set, and how many other clinical variables are typically considered in this situation. I'll revise this answer accordingly. In the meantime read about alternatives in the CV page I linked in the answer.
Comment: I have installed R with SurvivalROC, and done the analysis, but I am having trouble finding what span value to use (trouble finding an answer in the literature too), and I therefore wonder if you could explain the following sentence from you previous answer: "I found it easiest to specify a span value, effectively the fraction of the data, ranked ordered by the predictor, over which smoothing is done."?
Comment: The default "NNE" method requires a choice of span or window. If you can use 'method= "KM"' (Kaplan-Meier) in the call to the function, you don't need to specify a span. Read the paper linked in the second paragraph of my answer to understand the difference between methods and how the NNE smoothing works. The example in the help page uses 'span = 0.25*nobs^(-0.20)', where `nobs` is the number of cases. You want to smooth just enough to avoid the problems introduced by censoring; evaluate in your own data set. And do consider the limitations of focusing too much on the ROC curve.


can't get the classpath right

Question: i'm trying to compile this slick2d example (first one) but i can't get it to work. here's the code:
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
/**
 * @author panos
 */
public class WizardGame extends BasicGame
{
    public WizardGame()
    {
        super("Wizard game");
    }

    public static void main(String[] arguments)
    {
        try
        {
            AppGameContainer app = new AppGameContainer(new WizardGame());
            app.setDisplayMode(500, 400, false);
            app.start();
        }
        catch (SlickException e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void init(GameContainer container) throws SlickException
    {
    }

    @Override
    public void update(GameContainer container, int delta) throws SlickException
    {
    }

    public void render(GameContainer container, Graphics g) throws SlickException
    {
    }
}

i've put lwjgl.jar, slick.jar and ibxm.jar in the directory as instructed. then i tried:
javac -classpath .;full path\slick.jar.;full path\lwjgl.jar;full path\ibxm.jar
then
java WizardGame
but i get errors that the jar classes aren't defined, which means something must be wrong when i'm setting the classpaths. i'm not sure what i'm doing wrong though.
i've also tried
javac -classpath .;.\slick.jar.;.\lwjgl.jar;.\ibxm.jar
either way, shouldn't the jvm find out about the .jar files on its own if they're on the same directory as the source code? in my case, i've set up the 3 jars in the same directory as WizardGame.java. if i try compiling without the -classpath arguments it doesn't work though.
edit:
i did as instructed, but now it's telling me "no lwjgl in java.library.path"
i examined my lwjgl.jar with winrar and saw that it contains two folders: meta-inf and org, and then inside org there is lwjgl. is it supposed to be like that? because if it is, i dunno what's wrong.
edit 2:
created the manifest with what you said, then used:
jar cfm test.jar manifest.txt
this created a jar file, then i used
java -jar test.jar
and then it told me it didn't find the definition for the class WizardGame.
Answer: You have to add the -classpath option to the java command also. Not only to the compiler.
like:
javac -classpath .;lib\myjar.jar MyClass.java

and then
java -classpath .;lib\myjar.jar MyClass

Otherwise the interpreter ( java ) won't know where to find the classes needed.
Answer: Oscar is bang on - you need the -classpath on the java command too.
Another thing you can look at (it is overkill for what you are doing now, but you should still do it for the experience) is to create a JAR file.  In the JAR file you can provide a manifest.mf file that tells the java command where to find the other JAR files as well as what the main class is.
You would then run your program via "java -jar foo.jar"

http://java.sun.com/docs/books/tutorial/deployment/jar/manifestindex.html
http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html
http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html

I believe that the following manifest.m file will do what you want (note you have to have a blank line at the end or it will not work):

Main-Class: WizardGame
Class-Path: slick.jar lwjgl.jar ibxm.jar

That assumes that all JAR files (foo.jar and the other three) are in the same directory.
Comment: Probably as "advanced topics" but is worth to learn this since the beginning
Comment: For actual distribution, this is the better answer.

can't get the classpath right


Suggestions for transition from 6/8 to 4/4 (Piano accompaniment)

Question: I am playing an accompaniment for a choir on piano with one song in 6/8 and another in 4/4. The choir insists that I shouldn't leave a gap between the two songs and I should try to play continuously. Any suggestions for the transition I shall be playing?
Clarification: The 6/8 song ends with a C chord and the 4/4 starts with an Fmaj7 chord.
Comment: The key change is going in a better direction, up a fourth, so that's good.What we don't know is how long the last bar of 6/8 will last. One oft used idea is to take two bars at the new tempo/key, a I and a V. If you are also in the role of M.D., it should be down to you. To go directly into the F song (sounds appropriate...) then YOU count them in, maybe after one or two bars' gap in silence. Or everyone can count in silence, if they don't want simple.
Comment: Is a fermata acceptable? i.e. Can you hold the last chord of one song then start playing the next song?
Comment: @Dom I have already tried that but the choir said it was too simple.
Answer: Metrically, I'd start breaking each three of the 6/8 into two dotted 8th notes, increasingly emphasizing the new rhythm.  You could do this either in the melody first (I'm presuming that to be in the right hand), or you could continue with the melody or chords in the right hand while shifting the left hand's rhythm in this way beneath it.
Eventually, the dotted 8ths will be the 4 quarter notes.  You can transition your tempo as needed (speed up or slow down to match the second piece).
During this you can introduce a Bb to your C chord and swell dynamically in anticipation of a key shift to the F major of the second piece.  If your segue takes time, you may want to hint toward the F before adding the Bb, to give the listener a taste of leaning F-ward and further set up the shift.
Comment: Of course everything depends on the tempo and the specifics, but generally I would expect it to be much simpler to convert 6/8 beats into 4/4 beats, so two bars of 6/8 merges into one bar of 4/4.
Answer: I suggest that you play the last bar of the first song, then immediately play the introduction of the second.  Or don't bother with an introduction, as long as the singers have time to take breath.   C and F are closely-related keys.   You wouldn't baulk if a song in C moved directly to an F chord (how would it do it NOT directly?).  Don't over-think this.  They don't want a gap, but they ARE two different songs, in different tempos.  At some point the music will have to change.  Just do it!


"does not name a type" simple program Error

Question: What's the problem here?
Why there is an error ? Im a beginner :P
#include <iostream>

int var = 3;
int *Pointer;
Pointer = &var; // Error here: "Pointer does not name a type"

int main ()
{

  std::cout << Pointer;
}

Answer: Pointer = &var;

This is a statement that performs an action (rather than declaring a thing).
You can't have it floating about in random space. It must be in a function, so that your computer knows when to execute it.
Either:

move that assignment statement into main, or
replace it, and the previous line, with an initialisation so that it may be part of the initial declaration:
int* Pointer = &val;


Selectively convert list items in python

Question: So I have a list of lists in Python, where all the items are supposed to be numbers except when the list has three items. In this case, the last item is supposed to remain a string which I convert from a string. The code is as follows:
special_ops = [6]
program = [ line for line in temp.split(";") ]
for i in range(len(program)):
    line = [ int(p) for p in program[i].split(",")[:2] ]
    if ( line[0] in special_ops ):
        line.append( program[i].split(",")[2] )
    program[i] = line

The structure of the pre-parsed string looks like this:
0,1;2,1;2,0;3,2;6,1,a string

This doesn't seem very Pythonic to me so I was hoping for a more concise version of this code. Any help would be appreciated.
Comment: If your code is 'ok' and you want some advices, you should ask at [CodeReview](http://codereview.stackexchange.com/).
Comment: What's exactly your question? Please take a look here: [MCVE](http://stackoverflow.com/help/mcve).
Comment: I think the real problem is storing data in a non-standard format that requires a custom parser.  If you want to store data in a structured format, you're better off storing it using `json`, or `pickle`, or even saving out the data to a standardized format like `.csv` that is easily parsed by existing libraries.
Comment: There are definitely several things you could do to make this more concise. Here's an obvious one: `[ line for line in temp.split(';') ]` is **exactly equivalent** to `temp.split(';')`. Why create a new list via a comprehension when you are not transforming any of the members?
Comment: @BrendanAbel I wanted to avoid having to write to a file as I have to create this structure many times and the I/O would become significant. Furthermore, the storage was supposed to be entirely internal and the parsing was necessary for data retrieval from remote servers.
Comment: @Woody1193 json and pickle data don't have to be written to file.  They are perfectly suitable for serializing data between servers (considering this is basically how most web pages work).
Comment: @BrendanAbel Consider me enlightened then. I will have to consider one or the other if this gets any more complicated than it already has. Thanks for the information
Answer: >>> a = [x.split(',') for x in temp.split(';')]
>>> [[int(x) for x in lst] if len(lst)==2 else [int(lst[0]), int(lst[1]), lst[2]] for lst in a]
[[0, 1], [2, 1], [2, 0], [3, 2], [6, 1, 'a string']]

How it works
The first statement just splits up temp in a convenient list of lists of strings:
>>> a = [x.split(',') for x in temp.split(';')]
>>> a
[['0', '1'], ['2', '1'], ['2', '0'], ['3', '2'], ['6', '1', 'a string']]

The second command uses a ternary statement to treat the length-2 lists differently from the length-3 lists.  Just looking at the ternary part:
>>> lst = ['0', '1']
>>> [int(x) for x in lst] if len(lst)==2 else [int(lst[0]), int(lst[1]), lst[2]]
[0, 1]

>>> lst = [6, 1, 'a string']
>>> [int(x) for x in lst] if len(lst)==2 else [int(lst[0]), int(lst[1]), lst[2]]
[6, 1, 'a string']

All as one command
If one wants to avoid the intermediate variable, then the two commands above can be merged into one:
>>> [[int(x) for x in lst] if len(lst)==2 else [int(lst[0]), int(lst[1]), lst[2]] for lst in [x.split(',') for x in temp.split(';')]]
[[0, 1], [2, 1], [2, 0], [3, 2], [6, 1, 'a string']]

Comment: I was typing this up and noticed you beat me to it.


How do I use arguments with the Path Breadcrumb module?

Question: I am using the Path Breadcrumbs module to create breadcrumbs. I don't fully understand how to use arguments and selection rules, and thus I'm not sure how to create the following breadcrumb:
On the gallery node page (/gallery/%node), I want to use home > events >[event-name] > schedule as breadcrumbs.
Every Event node contains a node reference to a gallery node. I am trying to add this event name to the breadcrumbs. I already have retrieved the event name from $variables, following  How do I retrieve node data for a referenced node in a template file?
Answer: As an last option you can implement theme_breadcrumb() in your theme template.php
Something like below sample code.
function themename_breadcrumb($variables) {
  if (arg(0) == "galery" && is_numeric(arg(1))) {

    // Get event title of the  event
    $event_nids = mymodulename_get_back_refernce_value(arg(1));

    // Note since a gallery can be referred by multiple event nodes so you have add logic which one you need to pick here, for now I am picking with array index as 0
    $event_node = node_load($events_nids[0]);

    $links[0] = l(t('Home'), '<front>');

   // inplace of 'events' add internal link path to events page.
    $links[1] = l(t('Events'),'events');
    $links[2] = l(t($event_node->title),'node/'.$event_node->nid);
    $links[3] = t('schedule');
    drupal_set_breadcrumb($links);
  }
}

Comment: I tried your code, with a few changes - if (arg(0) == "gallery") - and - $event_nids = get_back_reference_value($variables['node']->nid); but nothing happened. I changed the name to my theme name and flushed the cache, but I don't think the code is ever being picked up. I tried a drupal_set_message and it never displayed either.
Comment: do you have devel installed?
Comment: @user1015214 can you join this chat room http://chat.stackexchange.com/rooms/11070/breadcrumb
Answer: The Path Breadcrumbs module works with system paths. For nodes system path looks like node/%, you can read more in the module FAQ and documentation.
The main problem with your example is that your Gallery content type doesn't have a reference field to Event, so other modules don't know if this Gallery node is referenced from that Event node.
There is a list of modules which may help with it on How do I implement two-way node references? (I didn't test them.)
Another way is to provide a computed entity property "Event" for Gallery content type with hook_entity_property_info_alter(). Doing so, your property will be available as a token in Path Breadcrumbs.


Erro cypress integration feature ParseError Unexpected token

Question: Quando eu clico no Cypress para executar um teste simples ele gera erro. Por favor veja o exemplo abaixo;

Esse é o erro:

Minhas steps de teste estão todas elas retornando true, não era para gerar erro como você podem ver no arquivo abaixo;
import { Given } from "cypress-cucumber-preprocessor/steps";
import { When } from "cypress-cucumber-preprocessor/steps";
import { Then } from "cypress-cucumber-preprocessor/steps";

Given(/^eu acesso o sistema$/, () => {
    cy.visit('https://www.facebook.com/')
});

When(/^clico no menu de acesso$/, () => {
    return true;
});

When(/^preencho o formulário$/, () => {
    return true;
});

When(/^finalio o formulário$/, () => {
    return true;
});

Then(/^verifico a mensagem de sucesso$/, () => {
    return true;
});

Estou achando que o problema é de configurações do projeto, vou deixar meu arquivo do GitHub para vocês verem como estar configurado. Toda ajuda e bem vinda, estarei esperando um retorno.
https://github.com/wladyband/testCypress
OBS: Se trata de um projeto Cypress com a tentativa que implementar o BDD
Esse é o arquivo Feature.
Feature: frontEnd

    Como usuario, desejo utilizar o sistema dese
    Wladimir

Scenario: Realizar lancamentos no sistema
    Given eu acesso o sistema
    And clico no menu de acesso
    When preencho o formulário
    And finalio o formulário
    Then verifico a mensagem de sucesso

Answer: Cara, isso é um problema de sintaxe javascript, não consegui ver seu código pois seu repositório é privado.
Seu erro é Unexpected Token e qual é o token inesperado? Como usuario, dejeso utilizar o sistema dese que é bem parecido com o texto que você colocou.
Outro problema é que o arquivo é .feature e não sei se o cypress utiliza esse tipo de arquivo, meus testes estão sempre .spec.js
O mais provável é que você esqueceu de colocar o texto como comentário ao salvar o arquivo, um // em cada linha pode resolver, ou um atalho como SHIFT + ALT + A no Visual Studio Code.
Aqui um exemplo de como eu faço meus testes: https://github.com/vitorgamer58/AluraPic/blob/master/cypress/integration/app.spec.js


Django Rest Framework Nested Serializer required=False error

Question: In DRF v3.1, I have a nested serializer much like the one detailed in the docs - http://www.django-rest-framework.org/api-guide/serializers/#dealing-with-nested-objects
class SerializerA(serializers.Serializer):
    details = DetailsSerializer(required=False)

However, when trying to use this serializer and not supplying the details, I receive the following:
{u'details': [u'This field may not be null.']}

This seems incorrect given the docs?
Has anyone else come across this or can verify this as a bug?
Comment: What is the relevant output of `repr(SerializerA())`? You probably want to set `allow_null` for `DetailsSerializer`.
Comment: Hi, the output is `SerializerA():
    details = DetailsSerializer(required=False):
        a = CharField(max_length=100, min_length=1, required=True)`
Comment: Also, according to the docs, If a nested representation may optionally accept the None value you should pass the required=False flag to the nested serializer. To me this means I don't require the allow_null param?
Answer: Ok, so Kevin Browns comment is correct. I needed to add allow_null=True.
class SerializerA(serializers.Serializer):
    details = DetailsSerializer(required=False, allow_null=True)

The reason for this is that having required=False allows the field details to be absent from the data when constructing the serializer.
e.g.
s = SerializerA(data={})
whereas allow_null permits the the param to be specified but be null.
e.g.
s = SerializerA(data={'details': None})
This opens up another issue with DRF Browsable API, but i'll ask that in a different question.
Comment: Man I'm struggling with this error for a couple of hours. Thanks! By the way, where can I find this serializer docs?
Comment: If you have a 1:N relation, setting required=False is not enough. You have to pass many=true to the serializer.
```
class CustomerSerializer(serializers.ModelSerializer):
    contact = ContactSerializer(many=True, read_only=True)
```
Got here through Google, so I hope, someone will read this comment


Find out the users accessing given exe file

Question: Is there any way of find out the users who are currently running a given .exe file.
For example we can find the current user of the application using Environment.UserName.
Does it need any modification in program or anyway of achieving this?
Update
Basically, I gave an exe file sitting on a network drive. I want to find out the users who are currently using the exe file.
Comment: You need to explain what you are trying to do in better detail. If you are looking to see if a `Process` you would have to loop through all the running processes.  The problem with this, if your looking to watch the Process for certain events is that are dozens of ways to end a process, that Windows will not report back to the event as the programming ending.  You will just have reference to a `Process` that is no longer running.
Comment: If this is off topic, please let me know why? and what is the right place to ask?
Comment: I think this is much better suited for http://superuser.com/
Comment: @huMptyduMpty - Its off topic because you asked "should this be done" and provided no code.  The information you want will be difficult to retreieve considering I know of now mechanic in Windows that will track this information.
Comment: The answer given [here](http://serverfault.com/q/424627/53676) may help you.
Answer: as Ramhound suggested, you can use the System.Diagnostics.Process Class to monitor the processes on your system (appropriate privileges assumed)
System.Diagnostics.Process.GetProcesses() will give you an array of Process objects refering to of all local processes ...
you can loop through this array and have a nested loop to go through the Modules Property
the Modules Property of a Process object will gibe you all ProcessModule objects belonging to this process (your exe file will be one of them) ... ProcessModule.FileName will contain the full path to the loaded module


Use 0 values too in a function

Question: I'm trying to use the 0 on a function execution too.
For example, when a function start with 0 and a value, it will only use the values started after 0.
function test(X){
 console.log(X)
}

when executing
test(01)

it will only print "1", but no "01".
I need to use this because I'm trying to use a function with a ZIP/postal code.
Comment: JavaScript will be just using a Numeric value when you pass in `01` you should really use strings `"01"`
Comment: why not use test('01')?
Comment: Yep, that's working, thanks ^^
Answer: Use strings:
function test(X){
  console.log(X)
}

test("01"); -> "01"

And if you want to conver it back to int:
parseInt("01"); -> 1

Answer: You need to enclose with '' or ""

function test(X) {
  console.log(X)
}
test('01');

Use 0 values too in a function


If a subsequence of $(a_n)$ converges to a limit $L$, prove that $(a_n)$, which is non-decreasing, also converges to $L$

Question: I know that if a sequence converges to $L$, its subsequences also converge to $L$. However, I'm not sure how to show the converse in this case, given $a_n$ is monotonic.
If I show somehow that $a_n$ is bounded, can I say that by the monotone convergence theorem $a_n$ converges to L because its subsequence does? If so, how would I begin in proving $a_n$ is bounded? Thanks for any advice
Comment: Let the subsequence be $(a_{n_k})$. Given $\epsilon\gt 0$, there is a $W$ such that if $k\gt W$, then $L-\epsilon\lt a_{n_k}\le L$. By monotonicity, if $n\gt n_W$, then $L-\epsilon\lt a_n\le L$.
Comment: A monotone sequence (your original sequence $(a_n)$) has a unique limit in $[-\infty,\infty]$. Any subsequence must have the same limit. So, *all* subsequences have this common limit. And, given this limit of any subsequence, it is necessarily the limit of the sequence.
Comment: @AndréNicolas how do you prove that if $a_{n_k}<\epsilon+l\Rightarrow a_{n_k}\le l$, with $l\in\mathbb{R}$?
Comment: The proof I sketched in the above comment does not use that,  thatès a separate question, versions of which hhave been answered several times on MSE. (We must assume that the inequality holds for all positive $àepsilon$.)  Unfortunately, MSE is hard to search, so I cannot give you a link.
Answer: This can proved by contradiction.  Suppose $(a_{n})$ is a real, non-decreasing sequence which has a subsequence converging to limit $L$.  We want to prove $a_{n}$ converges to $L$.
Suppose by contradiction that $a_{n}$ does not converge to $L$.  That means $\exists \epsilon > 0$ such that $\forall N \in \Bbb N$, $\exists m \geq N$ with $a_{m} \not \in (L - \epsilon, L + \epsilon)$.  Denote the subsequence that converges to $L$ by $(a_{n_{k}})$.  We know since $a_{n_{k}} \to L$, there is $K \in \Bbb N$ such that $k \geq K$ implies $a_{n_{k}} \in (L - \epsilon, L + \epsilon)$.
Since the sequence in non-decreasing, and $a_{n_{k}} \in (L - \epsilon, L + \epsilon)$, and $(a_{n})$ doesn't converge to $L$ by assumption, then there is some $m'$ such that $a_{m'} \geq L + \epsilon$.  But we have $\forall k \geq K$, $a_{n_{k}} \in (L - \epsilon, L + \epsilon)$, and for some $k$, $n_{k} > m'$ )(which implies $a_{m'} \leq a_{n_{k}}$ since $(a_{n})$ is non-decreasing).  But then $a_{n_{k}} < L + \epsilon \leq a_{m'}$, which implies $a_{n_{k}} < a_{m'}$ even though $m' < n_{k}$, which contradicts the fact that the sequence is non-decreasing.
So, the sequence $(a_{n})$ must converge to $L$.


C++ Identify different of operator =

Question: MyClass& operator=(const MyClass& other)
{
   //Implement
   return *this;
}
MyClass operator=(const MyClass& other)
{
   //Implement
   return *this;
}
void operator=(const MyClass& other)
{
    //Implement
}

When I test these methods, the result is the same. In almost book I see that the first method(MyClass&) is used more than the second method. what's different between them? Which method is really right and fast? One method return address and the second return value.
Comment: [What is the difference between returing by reference vs returning by value?](http://stackoverflow.com/questions/15847889/difference-between-returning-reference-vs-returning-value-c)
Comment: Also, you cannot overload by return value, the compiler should be complaining that those function calls are ambiguous.
Comment: oh yeah, I just test in turn with them. Not the same time :D
Comment: Okay, that's what I suspected as well. :)
Comment: Function signature does not differ from return values.
Answer:
When I test these methods, the result is the same.

it depends on how you test your class, ie.:
void foo (MyClass& a);

MyClass a1;
MyClass a2;

foo(a1 = a2);

in case of second operator implementation (returning MyClass), above code (inside foo) will not modify a1 instance, but a temporary value.

In almost book I see that the first method(MyClass&) is used more than
  the second method.

and thats correct, its more correct to return reference to *this in assignment operator

what's different between them? Which method is really right and fast?

first version is faster and correct because it does not do any copy of your object, also its more proper because thats how primitive types behave, ie:
int n = 0;
int k = 10;
(n = k) = 1;
std::cout << n;

here on output you will get 1, because (n = k) returns reference to n.

C++ Identify different of operator =


Syntax error when using Office UI Fabric in a ScriptLab' JavaScript project

Question: In a new ScriptLab's JavaScript project, I added the following library to get Office UI Fabric functionality:
https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.2.0/js/fabric.min.js

So I wrote this script (just pay attention to the fabric word):
var ChoiceFieldGroupElements = document.querySelectorAll(".ms-ChoiceFieldGroup");
        for (var i = 0; i < ChoiceFieldGroupElements.length; i++) {
        new fabric['ChoiceFieldGroup'](ChoiceFieldGroupElements[i]);
    }

I get red lines of error syntax in the fabric keywords. I know that if the project were a TypeScript instead of a JavaScript one, I could write this in the top of the script to prevent this:
declare var fabric: any

However, what should I write in the top of JavaScript sections?
I should add that the project runs normally, tough.
Answer: Actually, you can do just that:  add declare var fabric: any.
Script Lab uses both TypeScript and JavaScript (in the sense that it actually is always TypeScript; but with TS being a superset of JS, both work).
So just go ahead and put this somewhere within the Script section, and the red squiggly line will disappear, and the code will continue to function properly.
By the way, this is precisely what one of the Word samples does:
Comment: Thanks for clarifying! Also, it is a good idea to explore other Office applications Script Lab samples.


How to rename file tabs in Sublime Text 3

Question: When working with an MVC framework, my controllers and models have similar names which can sometimes cause confusion when I have a controller and model files open and they are similarly named.
I looked through many settings and couldn't find any option to rename the tabs or group them together. There used to be a package for it however it was for Sublime Text 2.
I understand that I can simply rename the files themselves but I want them to be as closely named to the controller as possible.
Also in case anyone asks, I am using a self-made framework that we use for in-house internal systems.
Is there a way to accomplish this, or a method to better organise the file tabs so I can have all my models, controller, view and other files in some sort of tab-group? Or perhaps there is a view/layout that would address this issue?
Comment: "[Stack Overflow question checklist](https://meta.stackoverflow.com/questions/260648)"
and "[Writing The Perfect Question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/)" are highly recommend pages to read. It's really important to show the effort you put into solving your problem. Without that we have to make assumptions about your knowledge or where you searched or what you tried, which wastes all our time. Also, "[ask]" is important. Grammar is important on SO; The site isn't a message board or a forum, it's more like a reference book.
Answer: I found the old RenameTab plugin for Sublime Text 2 and made a few little changes.
Create RenameTab.py and save it in the Packages/User folder:
import sublime
import sublime_plugin

class RenameTabCommand(sublime_plugin.TextCommand):
  def run(self, edit):
    self.view.window().show_input_panel("Tab Name:", self.view.name(), self.on_done, None, None)

  def on_done(self, input):
    self.view.set_name(input)

Create Tab Context.sublime-menu and save it in the Packages/User folder:
[
  { "command": "rename_tab", "caption": "Rename Tab" }
]

Add this to the Sublime Keybindings settings (re-map it to whatever key you want):
 { "keys": ["alt+w"], "command": "rename_tab", "context":
    [
      { "key": "setting.is_widget", "operator": "equal", "operand": false }
    ]
  }

Right-click on the file tab at the top and press "Rename Tab" in the context menu and it will prompt you to create a new name. This won't change the filename, just the name of the tab for easy viewing/reading/organising.
RenameTab was written by frozenice, however he hasn't changed it since 2012, or tested it for Sublime Text 3. I changed the layout of the import sublime and import sublime_plugin. (I'm not even sure if that made a difference.)
Comment: If `view.set_name` is set, it will cause the buffer to be disconnected from the disk file, and `view.file_name()` returns empty.


How to use "android:inputMethod" attribute?

Question: I need to use custom input method for specific edit texts inside my app.
Input method successfully works with all apps (when I select it from the system menus). So all OK with the method.
But when I tries to force its use explicitly:
<EditText
    android:id="@+id/edit"
    android:inputMethod="tx.android.softkeyboard.TXSoftKeyboard"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

it triggers ClassNotFoundException
Caused by: java.lang.ClassNotFoundException: tx.android.softkeyboard.TXSoftKeyboard
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:400)
        at java.lang.Class.forName(Class.java:326)
        at android.widget.TextView.<init>(TextView.java:1233)
        at android.widget.EditText.<init>(EditText.java:64)

Class tx.android.softkeyboard.TXSoftKeyboard exists of course.
In another topic user m0skit0 reported similar behaviour but no solutions..
Comment: Just to double check: are you using ProGuard or R8? Also, have you checked your resulting APK with "Analyze APK..." option from Android Studio to make extra-sure that the class is there and that the name hasn't been obfuscated or something similar?
Comment: Input method works (both this app and other apps), so declared class _can_ be found by the class loader in another cases.
Comment: I know, but my suspicion is more that maybe is available in other (separated) process for the same app, and that's why it can be found by the system, but not directly from inside your app. I would check "Analyze APK..." tool output to see if there's something there. Also, check AndroidManifest.xml with the same tool to see how it looks after compilation (mainly to look for added information about your IME that may hint that it's in a separated process or DEX file).
Comment: classes.dex - ok. Manifest - ok.

Class _can_ be loaded by the app in another cases (on button press, for example):
`try { Class c = Class.forName("tx.android.softkeyboard.TXSoftKeyboard");    } catch (ClassNotFoundException ex) {throw new RuntimeException(ex); }`

does not throws exception
Answer: I've checked in AOSP and in TextView you can clearly see that the value of the attribute is not modified (it's easy to follow, in line 1034 the attribute is fetched and later is used in the following piece of code):
    if (inputMethod != null) {
        Class<?> c;
        try {
            c = Class.forName(inputMethod.toString());
        } catch (ClassNotFoundException ex) {
            throw new RuntimeException(ex);
        }
        try {
            createEditorIfNeeded();
            mEditor.mKeyListener = (KeyListener) c.newInstance();
        } catch (InstantiationException ex) {
            throw new RuntimeException(ex);
        } catch (IllegalAccessException ex) {
            throw new RuntimeException(ex);
        }
        try {
            mEditor.mInputType = inputType != EditorInfo.TYPE_NULL
                    ? inputType
                    : mEditor.mKeyListener.getInputType();
        } catch (IncompatibleClassChangeError e) {
            mEditor.mInputType = EditorInfo.TYPE_CLASS_TEXT;
        }
    }

So, the closest we can get to work around this is calling TextView#setKeyListener() (that basically is what this piece of code is doing, notice the cast after creating the instance of the class once it is loaded mEditor.mKeyListener = (KeyListener) c.newInstance();). That being said, from my limited understanding of this topic, KeyListener is not what you're looking for.


sql server case problem

Question: I have a table product having 3 columns
maker holding values{'HCL','ACER',HP}
model_no   PK
type        {PC,Printer,laptop}
I want to produce result set in following columns maker,pc,printer,laptop
if a maker has prouct of the above category display yes in respective column
else No
The following code displays yes to all even if maker has no products
It is req to use while and break statements.Please help me
select maker,'PC'=
 case type
when 'pc' then 'Yes'
when 'printer' then 'Yes'
when 'Laptop' then 'Yes'
else 'No'
end,
'Laptop'=
case type
when 'pc' then 'Yes'
when 'printer' then 'Yes'
when 'Laptop' then 'Yes'
else 'No'
end,'Printer'=
case type
when 'pc' then 'Yes'
when 'printer' then 'Yes'
when 'Laptop' then 'Yes'
else 'No'
end  from product where maker='ACER'

Comment: Is this homework? (if so, please use the homework tag)
Answer: select maker,
 case when type IN ('PC','Workstation','Server') THEN 'Yes' ELSE 'No' END AS PC,
 case when type IN ('Laptop','Tablet','Something') THEN 'Yes' ELSE 'No' END AS Laptop,
 case when type IN ('Printer','Plotter','Inkjet') THEN 'Yes' ELSE 'No' END AS Printer

from product
where maker='ACER'

I took the liberty of changing your logic around. Put whatever conditions that valid a 'Yes' in each IN statement, then add as many as you need/wish.
Comment: I'm sorry, i had forgotten a "WHEN" between case and type, when you use CASE and a column name afterwards, it expects a WHEN 'value' - the code above should run fine, using IN is perfectly valid in a CASE statement.
Comment: -1 Your code does not work. `Incorrect syntax near the keyword 'IN'`. I guess you cant use `IN` in a `case` statement like that.
Answer: select
  maker,
  case [type] when 'pc'      then 'yes' else 'no' end as PC,
  case [type] when 'Laptop'  then 'yes' else 'no' end as Laptop,
  case [type] when 'Printer' then 'yes' else 'no' end as Printer
from product
where maker = 'ACER'

Answer: Try this:
        select maker,
        case type when 'pc' then 'Yes'  when 'printer' then 'Yes' when 'Laptop' then 'Yes'      else 'No' end AS PC,
case type when 'pc' then 'Yes'  when 'printer' then 'Yes' when 'Laptop' then 'Yes' else 'No' end AS Laptop,
case type when 'pc' then 'Yes' when 'printer' then 'Yes' when 'Laptop' then 'Yes' else 'No' end AS Printer

from product where maker='ACER'

sql server case problem


n value in the calculation of BIC

Question: This question is building on this post, and on the general formula for BIC.
<code>BIC = kln(n) - 2ln(L)
</code>
I need a bit of help understanding what the term number of observations/number of data points/sample size (n) means.
Scenario 1:
Imagine I aim to compare two models, where M1 has 6 parameters (thus, k = 6) and M2 has 7 parameters (thus, k = 7). Both models are fitted on data from 239 participants who provided 65 data points each. If I want to calculate BIC on a sample level, would n be 239 or some other value (e.g., 65 x 239)?
Scenario 2:
Alternatively, imagine I fitted two models for each participant individually to get participant-level parameter estimates. Now I would like to calculate BIC on a participant level to ultimately see how many participants have M1 as a better-fitting model and how many have M2 as a better-fitting model. When calculating BIC to compare the two models within each participant, would n be 1 or some other value (e.g., 65)?
Any help is much appreciated, thank you!
Answer: $n$ goes for the number of samples, so if you have 65 samples per participant and 239 participants, it's 65 x 239, and in the second scenario it's just 65. $n$ is usually the number of rows in your data or the number of individual data points you collected. If your log-likelihood is
$$
\ln \mathcal{L} = \sum_{i=1}^n \ln f(X_i; \Theta)
$$
it's the same $n$ as in the summation.

n value in the calculation of BIC


Não ajustar menu quando submenu aparecer

Question: Estou iniciando com o flexbox, gostaria de fazer um menu que não fique ajustando a largura quando os submenus aparecem:

/* Navigation - menu style */
nav ul {
    padding: 0;
}
nav ul li {
    list-style: none;
    flex-direction: column;
}
nav > ul {
    justify-content: space-evenly;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}
nav > ul, nav > ul > li, nav > ul > li:hover > ul > li {
    display: flex;
}
nav > ul > li > ul > li {
    display: none;
}

Home

Usuários

Conectar

Cadastrar

Meu perfil

ITEM MUITO LARGO

UFEF

Tentei algumas coisas, mas sem sucesso
Answer: Bastava adicionar a propriedade flex nos menus. Para manter o alinhamento das palavras no centro adicionar text-align: center;:

/* Navigation - menu style */
nav ul {
    padding: 0;
}
nav ul li {
    list-style: none;
    flex-direction: column;
    text-align: center;
}
nav > ul {
    justify-content: space-evenly;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}
nav > ul > li {
    flex: 1;
}
nav > ul, nav > ul > li, nav > ul > li:hover > ul > li {
    display: flex;
}
nav > ul > li > ul > li {
    display: none;
}

Home

Usuários

Conectar

Cadastrar

Meu perfil

ITEM MUITO LARGO

UFEF


Why does monitor show no tests found when there are tests in each GET/POST request?

Question: When I run my Postman monitor it says there are no tests available, even though I have created a single test in the request.
Is this referring to some other type of test?
Have attached both images
Postman monitor error
Developed test
Comment: make sure your reqeust are saved
Answer: I have the similar issue.
Monitor is an online feature and is only available in workspaces.
I suspect the workspace is in Postman so it has issues to invoke my company's network which is protected with firewall. I tried to turn on and off the proxy but still have the issues.
I feel the newman may work which needs more efforts to implement.
Comment: I just got the ability to comment :-) Didn't have enough power to comment.
Comment: This can be a comment to an answer.
Comment: I will try newman but looks like it needs more efforts on programming so an BA can't do that.
I will also try JMeter - if will definitely work but also not a very quick and easy way.
Comment: This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31219856)
Comment: [Update] There are lots of limitations on Postman monitor and newman, especially if you have proxies. I finally resolved it with cURL, batch script and Jenkins pipeline. Hope it helps.
Answer: There are a few reasons. The reasons are mentioned well in official doc.
https://learning.postman.com/docs/monitoring-your-api/troubleshooting-monitors/
According to my experience, you should not define "pm.response.json()" command as globally, you need to define it in test function (pm.test()) because saved global variables are not supported in monitors.