If then else using javascript
Which equals operator (== vs ===) should be used in JavaScript comparisons?
How to install updates via command line? When I log into my web server via SSH I see the information:  88 packages can be updated. 80 updates are security updates   I tried apt-get update then apt-get upgrade but each time I log in I still see the message about updates. How do I install them? What gifts would be welcome for a Swedish host family? Just like you can see in the screenshot above, sometimes the clock &amp; date won't show up on boot. I have to log off to make it appear again.   Is that because I have a custom-time format in dconf editor ( %a, %d. %h  %H:%M ) ? Logistic regression cost surface not convex I am building a simple logistic regression model on 2D data. Here is the input I use.    I built a logistic regression model using this data and it successfully is able to find the discriminating line between these two classes. Here is the separating line found by my program:    Also, just for debugging, I plotted number of iterations vs J(theta), which also looks fine:    Now, confusing part comes into play. I am investigating the cost surface of this model that the logistic regressions is doing the gradient descent on. I am considering three different loss functions. Sum-of-squared loss, hinge-loss, log-loss.  Hinge loss:    Log-loss:    Sum-of-squared loss:    As far as I know, both hinge loss, sum-of-squared loss and log-loss should produce a convex surface. When I look at my surfaces, however, sum-of-squared surface does not look convex to me. Why is that the case?  For convenience, here is the two critical functions from my code:  function retval = J(X, y, theta)     M = size(y, 1);     % sum of squared error     retval = (1/(2*M)) * sum((h(X, theta) - y).^2);  endfunction  function retval = h (X, theta)     % logistic     retval =  1 ./ (1+ exp(-1 * (X * theta))); endfunction # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. # see /usr/share/doc/bash/examples/startup-files for examples. # the files are located in the bash-doc package.  # the default umask is set in /etc/profile; for setting the umask # for ssh logins, install and configure the libpam-umask package. #umask 022  # if running bash if [ -n "$BASH_VERSION" ]; then     # include .bashrc if it exists     if [ -f "$HOME/.bashrc" ]; then     . "$HOME/.bashrc"     fi fi  # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then     PATH="$HOME/bin:$PATH" fi   Can anyone explain the contents of the ~/.profile file? So when you enter into the ~/.profile file what does all the writing mean? Proving $ \binom n 0 ^2 + \binom n 1 ^2 + \dots + \binom n n ^2 = \binom { 2n} n $ without induction I have to prove that: $$ \binom n 0 ^2  + \binom n 1 ^2  + \dots + \binom n n ^2 = \binom { 2n} n $$  I don't want a complete solution, but only a hint. Do computer viruses affect all user accounts on a computer? Do computer viruses affect all user accounts on a computer?  IF a virus affects a local user will that effect administrator account and vise-versa? Possible Duplicate:          This is a line spoken by the . I always wondered if this is grammatically correct.  Luke says something like "You are mistaken ..." which the Emperor answers with     No, it is you who are mistaken!   Why wouldn't he say     No, it is you who is mistaken!   instead?  I don't know what rules apply here but my stomach tells me the latter is (at least also) correct, although you would say "you are mistaken". It feels as if he should be referring to "you" in the third person.  Could you please shed some light? Are both correct or – if not – which one is correct? And why? Let $a$ and $b$ be positive reals. Show that $$\lim\limits_{n\to\infty} \left(\frac{a^{\frac{1}{n}}+b^{\frac{1}{n}}}{2}\right)^n =\sqrt{ab}$$ Working with systems with Perfect Multicollinearity I am working with a time-series dataset that is based on demand-supply dynamics with several variables.  THe sample data for one time period is: &gt; data # A tibble: 19 x 6    Pred_error_A Pred_error_B  Pred_error_C  Pred_error_D  Pred_error_E  Pred_error_Target                  &lt;dbl&gt;         &lt;dbl&gt;          &lt;dbl&gt;      &lt;dbl&gt;      &lt;dbl&gt;           &lt;dbl&gt;  1            -0.45           1.72          -0.170      1.85       -0.01          -0.7    2            -0.45           1.72          -0.170      2.35       -0.01          -1.2    3            -0.45           1.92          -0.170      2.35       -0.01          -1      4            -0.0500         0.37          -0.12       1.65       -0.01          -1.5    5             0             -0.840         -0.12       0.950      -0.01          -1.7    6             0             -0.200         -0.12       1.35       -0.01          -1.5    7             0             -0.460         -0.12       1.35       -0.01          -1.8    8             0             -0.520         -0.12       1.05       -0.01          -1.5    9             0             -0.340         -0.12       1.05       -0.01          -1.4   10             0             -0.340         -0.12       1.35       -0.01          -1.7   11             0             -0.110         -0.12       1.05       -0.01          -1.2   12             0             -0.110         -0.12       0.850      -0.01          -1     13             0              0             -0.12       0.350      -0.01          -0.4   14             0              0             -0.12      -0.15       -0.01           0.100 15             0              0             -0.12      -0.350      -0.01           0.300 16             0              0             -0.02       0          -0.01          -0.1   17             0              0              0          0           0              0     18             0              0              0          0           0              0     19             0              0              0          0           0              0   I was working on a regression for each time period with data and wanted to find the relative importance of regressors in explaining the target variable ( Pred_error_A through E and dependent variable is Pred_error_Target ) using relaimpo package in R. However, I soon realized I can't use regression setting because of near to perfect collinearity and hence no relative importance values. Is there a way to go around this? Or, can I use any other method (instead of regression)? Any suggestions will be useful. The predictors are near to perfect and each one is important. I can't exclude any single one and I need the relative importance of all 5 regressors. I am also trying XGBoost as an alternative. However, I am not sure if it takes care of multicollinearity. Plain integer partitions of $n$ using $r$ parts Division of number $n$ on parts $a_1,...,a_r$ where $a_1 \le ... \le a_r$ we call a plain if $a_1 = 1$ and $a_i - a_{i-1} \le 1$ for $2 \le i \le r$. Find enumerator (generating function) for plain divisions.  my try  The hint was to use bijection between plain divisions and some commonly know enumerator. I tried to use enumerator of divisions on different parts: $$ (1+x)(1+x^2)...(1+x^r)$$ where number of plain divisions is  $$[x^n](1+x)(1+x^2)...(1+x^r) $$ let function  $$f(n,r) = [x^n](1+x)(1+x^2)...(1+x^r) $$  For some first divisions it works. For example: $$f(4,3) = 1 $$ $$f(6,3) = 1 $$ $$f(11,5) = 2$$ But when I tried to find bijection, I failed. I found that this function isn't correct because $f(15,6) = 4$ but should be equal to $3$ because: $$15 = 1,1, 2, 3, 4, 4 \\ 15 = 1, 2, 2, 3, 3, 4\\ 15 = 1, 2, 3, 3, 3, 3 $$. There I stucked. TikZ: Draw angle with label between lines Similar to this question  and an fellow up on this one    What was the official reason by Canonical to axed the project when it was love by some many of their users and innovative? When —the bartender at the Cantina at Mos Eisley spaceport in the first Star Wars—says:     “We don’t serve their kind here.”   In reference to C-3PO and R2-D2 entering the bar, it’s certainly a bit prejudicial, but are these commonly held views in this universe? We don’t see it happen anywhere else in the films but is it implied elsewhere? Training N classifiers for N labels vs one classifier with N labels I have a classification problem which is multi-label with N labels. I would like to know which method would be the better choice? Training N classifiers (1 for each label) or a single classifier which use K-hot encoding. I'm using a neural network for this with a softmax at the last layer. (Is there any chance that the softmax would cause a problem?) I'm using tensorflow for the model. Why $\lim\limits_{n\to \infty}\left(1+\frac{1}{n}\right)^n$ doesn't evaluate to 1? I am trying to identify what the flaw is exactly when reasoning about a limit such as the definition of $\mathbf e$:  $$ \lim_{n\rightarrow \infty}\left(1+\frac{1}{n}\right)^n={e} $$  Now, I know there are ways of proving this limit, such as by considering the binomial expansion of $(1+\frac{1}{n})^n$ and comparing that to the Maclaurin series of $e$. So to make this clear, I am not looking for a proof of the limit definition of $e$.  I tried searching for "limit laws/rules" but none of the rules I found described the above case. Hence, I am looking for a specific rule (or perhaps a certain perspective) that will help me realize why the above does not in fact evaluate to 1.  My train of thought is as follows: at a first glance, if I wasn't already familiar with what the limit evaluates to, I probably would evaluate the expression inside the brackets first, and then apply the limit to the power. So, $$\displaystyle\lim_{n\to\infty}\frac{1}{n}=0\quad\text{and then}$$  $$\displaystyle\lim_{n\rightarrow \infty}\left(1+0\right)^n=\lim_{n\to\infty}1^n=1$$  Why is my reasoning flawed? Why are the Ringwraiths fearful of coming into contact with water? At least twice in The Lord of the Rings: The Fellowship of the Ring, Ringwraiths cower away from bodies of water.  The second time (the ford of Bruinen) can be explained away by their fear of some Elvish magical trap through the enchantment of the water; but what about the first time, at the ferry? One of the Nazgûl could have easily made the jump onto the barge and quickly dispatched those pesky Hobbitsses. Generic constraints, where T : struct and where T : class Add the ability to add "top questions" to Careers 2.0 Profile Allow me to add my own "top questions" too! I know, I know, the site should be more heavily weighted to answering, but sometimes, how and what people ask is important too! For example I recently asked  which I think is a fairly good question. Clearly I'm going to avoid questions where I've asked something very simple, but I know of a user or two who are implementing their own C standard libraries and the depth of those questions is important/ought to be on show.  Of course, the argument I can just look at their profile holds, but that awesome q/a might have been from a year or so ago in which case finding it is difficult. What apps to sync movie subtitles easily are available for Ubuntu? I have a subtitle file that is about 3 to 4 seconds behind. What tools can I use to automatically move all the times in the subtitle file so they are correct with the time of the movie? Something that I can for example just add the time I want to add and it will add this time to the synced times in the subtitle files without having to edit each line individually.