I was learning linked list and created every field as static but it was not working so I thought I should try to create on simple static object and check if it works or not and I can see the address of static object. Why it is not working with the linked list. This is the code to check the static object.     class A{     static A obj = new A(); } public class Temp {      public static void main(String... h) {         A a = new A();         System.out.println(a.obj);     }  }  This is the code of linked list:- public class Node {     static int data;     static Node next; }  public class LinkedList {     Node head;      public void insertAtTheEnd(int data) {         Node node = new Node();                    node.data = data;             node.next = null;                  if (head == null) {                 head = node;             } else {                 Node n = head;                 while (n.next != null) {                     n = n.next;                 }                 n.next = node;             }             }       public void show() {     Node node = head;      while (node.next != null) {         System.out.println(node.data);         node = node.next;     }     System.out.println(node.data); }} public class Testing {  public static void main(String[] args) {     LinkedList list = new LinkedList();         list.insertAtTheEnd(6);         list.insertAtTheEnd(7);         list.insertAtTheEnd(8);          list.show();     }  }
To be specific, I was trying this code:  package hello;  public class Hello {      Clock clock = new Clock();      public static void main(String args[]) {         clock.sayTime();     } }   But it gave the error      Cannot access non-static field in static method main   So I changed the declaration of clock to this:  static Clock clock = new Clock();   And it worked. What does it mean to put that keyword before the declaration? What exactly will it do and/or restrict in terms of what can be done to that object?
Value of $\lim_{n\to \infty}\frac{1^n+2^n+\cdots+(n-1)^n}{n^n}$ I remember that a couple of years ago a friend showed me and some other people the following expression:  $$\lim_{n\to \infty}\frac{1^n+2^n+\cdots+(n-1)^n}{n^n}.$$  As shown below, I can prove that this limit exists by the monotone convergence theorem. I also remember that my friend gave a very dubious "proof" that the value of the limit is $\frac{1}{e-1}$. I cannot remember the details of the proof, but I am fairly certain that it made the common error of treating $n$ as a variable in some places at some times and as a constant in other places at other times. Nevertheless, numerical analysis suggests that the value my friend gave was correct, even if his methods were flawed. My question is then:  What is the value of this limit and how do we prove it rigorously?  (Also, for bonus points, What might my friend's original proof have been and what exactly was his error, if any?)  I give my convergence proof below in two parts. In both parts, I define the sequence $a_n$ by $a_n=\frac{1^n+2^n+\cdots+(n-1)^n}{n^n}$ for all integers $n\ge 2$. First, I prove that $a_n$ is bounded above by $1$. Second, I prove that $a_n$ is increasing.   (1) The sequence $a_n$ satisfies $a_n&lt;1$ for all $n\ge 2$.  Note that $a_n&lt;1$ is equivalent to $1^n+2^n+\cdots+(n-1)^n&lt;n^n$. I prove this second statement by induction. Observe that $1^2=1&lt;4=2^2$. Now suppose that $1^n+2^n+\cdots+(n-1)^n&lt;n^n$ for some integer $n\ge 2$. Then  $$1^{n+1}+2^{n+1}+\cdots+(n-1)^{n+1}+n^{n+1}\le(n-1)(1^n+2^n+\cdots+(n-1)^n)+n^{n+1}&lt;(n-1)n^n+n^{n+1}&lt;(n+1)n^n+n^{n+1}\le n^{n+1}+(n+1)n^n+\binom{n+1}{2}n^{n-1}+\cdots+1=(n+1)^{n+1}.$$  (2) The sequence $a_n$ is increasing for all $n\ge 2$.  We must first prove the following preliminary proposition. (I'm not sure if "lemma" is appropriate for this.)  (2a) For all integers $n\ge 2$ and $2\le k\le n$, $\left(\frac{k-1}{k}\right)^n\le\left(\frac{k}{k+1}\right)^{n+1}$.  We observe that $k^2-1\le kn$, so upon division by $k(k^2-1)$, we get $\frac{1}{k}\le\frac{n}{k^2-1}$. By , we may find:  $$\frac{k+1}{k}\le 1+\frac{n}{k^2-1}\le\left(1+\frac{1}{k^2-1}\right)^n=\left(\frac{k^2}{k^2-1}\right)^n.$$  A little multiplication and we arrive at $\left(\frac{k-1}{k}\right)^n\le\left(\frac{k}{k+1}\right)^{n+1}$.  We may now first apply this to see that $\left(\frac{n-1}{n}\right)^n\le\left(\frac{n}{n+1}\right)^{n+1}$. Then we suppose that for some integer $2\le k\le n$, we have $\left(\frac{k}{n}\right)^n\le\left(\frac{k+1}{n+1}\right)^{n+1}$. Then:  $$\left(\frac{k-1}{n}\right)^n=\left(\frac{k}{n}\right)^n\left(\frac{k-1}{k}\right)^n\le\left(\frac{k+1}{n+1}\right)^{n+1}\left(\frac{k}{k+1}\right)^{n+1}=\left(\frac{k}{n+1}\right)^{n+1}.$$  By backwards (finite) induction from $n$, we have that $\left(\frac{k}{n}\right)^n\le\left(\frac{k+1}{n+1}\right)^{n+1}$ for all integers $1\le k\le n$, so:  $$a_n=\left(\frac{1}{n}\right)^n+\left(\frac{2}{n}\right)^n+\cdots+\left(\frac{n-1}{n}\right)^n\le\left(\frac{2}{n+1}\right)^{n+1}+\left(\frac{3}{n+1}\right)^{n+1}+\cdots+\left(\frac{n}{n+1}\right)^{n+1}&lt;\left(\frac{1}{n+1}\right)^{n+1}+\left(\frac{2}{n+1}\right)^{n+1}+\left(\frac{3}{n+1}\right)^{n+1}+\cdots+\left(\frac{n}{n+1}\right)^{n+1}=a_{n+1}.$$  (In fact, this proves that $a_n$ is strictly increasing.) By the monotone convergence theorem, $a_n$ converges.  I should note that I am not especially well-practiced in proving these sorts of inequalities, so I may have given a significantly more complicated proof than necessary. If this is the case, feel free to explain in a comment or in your answer. I'd love to get a better grip on these inequalities in addition to finding out what the limit is.  Thanks! There are two directories shown by 'ls'.  Normally directories anywhere are blue on black background.  But the first one is blue on green and impossible to read.  Why is this?  How to make it blue on black, or at least something light on something dark?  This is on Ubuntu 12.04, using bash in Gnome Terminal.  In Konsole, the blue is slightly darker, and possible to read, though could be way better. If my Schengen visa starts on the day of arrival which is one day ahead of departure, would they let me get into the plane? SqlServer: can one table's PK be the FK of two table's? I have three tables project, users and proj_user. The PK of proj_user table is the FK of project and users table's pk e.g.(project_id,user_id)  My question is, is it possible if the project_id and user_id's data is different  like project_id = '12345' and user_id = 'abc987'  Please reply  kind regards Vivek Why does shell ignore quoting characters in arguments passed to it through variables? Comments are useful. Many, many posts need some small amount of meta discussion, and comments fulfill this need.   Comments are also noisy and distracting. Occasionally, someone will post an insightful and informative comment that complements the post its attached to... But more often, they're tangential, quickly irrelevant and in the way: stale comments show up first, making newer comments less visible.  The guidance here for a long time has been that comments are transient, . And yet, some do hang around for months or years because .   So let's fix that.   I propose that all comments older than 7 days be hidden by default unless the comment has been up-voted in the past 30 days. Hidden comments should be indicated by a note below the post ("add / show 3 more comments") and made visible to anyone who cares to click it.   This doesn't destroy anything, but it would get it out of the way of most readers - and hopefully encourage folks to edit it into the actual answers as a result.  Note: I previously suggested this . Other  have been . However, I'm not suggesting that comments be automatically deleted, and they should be hidden based purely on the age / activity of the comment itself, not of the post to which they're attached. what could cause a script to fail to find python when it has `#!/usr/bin/env python` in the first line? Trying to get casperjs running on Ubuntu 12.04. After installing it when I run I get:   09:20 $ ll /usr/local/bin/casperjs lrwxrwxrwx 1 root root 26 Nov  6 16:49 /usr/local/bin/casperjs -&gt; /opt/casperjs/bin/casperjs  09:20 $ /usr/bin/env python --version Python 2.7.3  09:20 $ cat /opt/casperjs/bin/casperjs | head -4  #!/usr/bin/env python  import os import sys  09:20 $ casperjs : No such file or directory  09: 22 $ python Python 2.7.3 (default, Sep 26 2013, 20:03:06)  [GCC 4.6.3] on linux2   So Python is present and runnable, casperjs is pointing to the right place and it is a python script. But when I run it I get "No such file".   I can fix it by changing the first line of the casperjs python file from:    #!/usr/bin/env python   to:   #!/usr/bin/python   Result:   $ casperjs --version 1.1.0-DEV   I managed to fix it, but I'm wondering why it didn't work with #!/usr/bin/env python, since that seems to be a normal interpreter line. Do I have something configured wrong?   Here are the steps to get casperjs:   $ git clone git://github.com/n1k0/casperjs.git $ cd casperjs $ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs $ casperjs : No such file or directory In The Force Awakens, Finn and Poe steal and escape in a TIE wearing no personal life support apparatus. TIEs have been upgraded with shields, hyperdrives (for "/sf"), weapons etc, but as far as I know they weren't upgraded with built in life support.   Finn and Poe should have frozen and/or suffocated after hitting space in the TIE. In the Rebels series, Sabine did the same thing. I've looked at what Wookieepedia states about the TIE as well as the old video game Star Wars "TIE Fighter".  Does the movie or any other work explain how Poe and Finn survived? I tried the following code to replace QQ with ZZ, but it doesn't do what I want:  var1=QQ sed -i 's/$var1/ZZ/g' $file   However, this code does what I want:  sed -i 's/QQ/ZZ/g' $file   How do I use variables in sed? Parse a Json Array in to a class in c# Configure HAProxy to include host headers for different backends I am exploring the use of HAProxy as a balancer in front of a set of web apis that run on IIS.   node1.myapp.mycompany.com node2.myapp.mycomapny.com   We are currently using Host Headers to correctly resolve the right web application on IIS.  For example, we may have otherapp.mycompany.com running on the same server/port, but using Host Headers IIS knows which one to serve up.  My initial attempt at HAProxy left me with 404 errors, because I was not including the host headers in my request, and so IIS was serving back the default site bound to the given IP, and not resolving by host name.    The fix left me with something like this:  frontend localnodes     bind *:80     mode http     default_backend nodes  backend nodes     mode http     balance roundrobin     option forwardfor     reqirep ^Host: Host:\ node1.myapp.mycompany.com     server web01 node1.myapp.mycompany.com:80   This works great for a single backend, but I am left scracthing my head on how to include the correct host headers depending on which backend is serving up the request:  backend nodes     mode http     balance roundrobin     option forwardfor     reqirep ^Host: Host:\ node1.myapp.mycompany.com     server web01 node1.myapp.mycompany.com:80     server web02 node2.myapp.mycompany.com:80   The above does not work whenever node2 is used because it doesn't resolve correctly in IIS (node2 in this case is on a different server, and therefore different IP.  In fact, if they were running on the same server/ip I suspect the request work "work", but they would all be served by node1 per the host header).     Is it possible to set the host based on the url of the backend used to serve up the request? If so, this implies my checks also need to provide the correct host header based on backend, how would that be done?   Edit: Am using HA-Proxy version 1.7.9 2017/08/18  Let me give this just a little more background.  We used to have just myapp.mycompany.com serving up api requests.  We need to expand it.  Our clients will still call myapp.mycompany.com, but that will just point to the HAProxy, which will balance it out to node1.myapp.mycompany.com and node2.myapp.mycompany.com.  Our current server configurations have us binding a single IP address on each server, so we use host headers to resolve. Matrices $B$ that commute with every matrix commuting with $A$ One of our SQL Server 2014 database transaction logs is growing very fast and I cannot find the root cause for this.  Database in Simple recovery mode. During full backup the log file grows to its limits (800GB) and backup fails.  I checked the transactions during the backup and did not find anything strange.  All transactions are our regular loading and no maintenance jobs (index rebuilds etc.)  I am aware of that backup keep the log from reuse but this mean 800GB changes during the backup period and this does not make any sense.  I had compared this DB to similar DB size, loading and backup duration. The second DB Log is not growing more than 400GB.  DB size is 7TB. Backup time is ~20H. The only time log is growing is during backup. Log_reuse shows correct Backup_Restore. No long running transactions.  The problem is the "speed" of log growth - compared to similar sites with same load and same backup duration, the log is 4 time less. Steam doesn't start after upgrade to Ubuntu 16.04 After upgrade to Ubuntu 16.04, Steam doesn't start. When I execute it from the command line, I get the following error:  $ steam Running Steam on ubuntu 16.04 64-bit STEAM_RUNTIME is enabled automatically grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc Installing breakpad exception handler for appid(steam)/version(1459463254) prove $\lim_{n\to\infty}{\frac{a^n}{n!}}=0$ I have the proof but i don't understand one part. The proof (for $a&gt;1$) goes as follows:  there exists $k \in N$ such that$a&lt;k, \frac{a}{k}&lt;1$ and since $\frac{a}{k+i}&lt;\frac{a}{k}, i \in N$ $$\frac{a^n}{n!}=\frac{a}{1} \cdot \frac{a}{2} \cdot...\cdot\frac{a}{k}\cdot\frac{a}{k+1}\cdot...\cdot\frac{a}{n}&lt;\frac{a^k}{k!}(\frac{a}{k})^{n-k}=\frac{a^k}{k!}\cdot \frac{a^na^{-k}}{k^nk^{-k}}$$  $$0&lt;\frac{a^n}{n!}&lt;\frac{k^k}{k!}(\frac{a}{k})^n$$  then $$0 \leq \lim_{n\to\infty}{\frac{a^n}{n!}}\le\frac{k^k}{k!}\lim_{n\to\infty}{(\frac{a}{k})^n}$$  Now, the part I don't understand is in the expansion of $\frac{a^n}{n!}$. How does one come with $&lt;\frac{a^k}{k!}(\frac{a}{k})^{n-k}$ part, to be more precise, how does one come up with $(\frac{a}{k})^{n-k}$ part of the inequality? How do I get permissions to edit system configuration files? What are "Community Wiki" posts? As we all know, going near a black hole (Gargantua in this case) slows down time, according to the theory of relativity.  So when Cooper comes out of the black hole, after spending a fair bit of time there, shouldn't he be much older than Brand who hasn't gone inside Gargantua? Why is my animation not keeping location and rotation correctly? I am currently 3d modeling a twisty puzzle and trying to animate it. I have the puzzle done but when I try to animate it, it randomly twists and turns the individual objects in different directions before converging back to their original form at the end of the animation.  The screencast of me attempting to animate this is here:   File at the end of the screencast:    This is the original file. Just delete the 2 keyframes that are there:    I did make this with a tutorial. It is by rcpongo and I have very slightly edited his design. All credit goes to him for my design. How can I prevent SQL injection in PHP?