The difference between mode 1 and mode 2 start thread? Method 1: I use the same Runnable object to start multiple threads Method 2: I use different Runnable objects to start multiple threads package com.hbase.a;  public class MyThreadB implements Runnable {     private  int tik = 100;      public void run() {        //do ...     }        public static void main(String[] args) {         // method-1          MyThreadB myThreadB = new MyThreadB();         new Thread(myThreadB).start();         new Thread(myThreadB).start();         new Thread(myThreadB).start();         new Thread(myThreadB).start();                 // method -2          new Thread(new MyThreadB()).start();         new Thread(new MyThreadB()).start();         new Thread(new MyThreadB()).start();         new Thread(new MyThreadB()).start();      } }
From what time I've spent with threads in Java, I've found these two ways to write threads:  With implements Runnable:  public class MyRunnable implements Runnable {     public void run() {         //Code     } } //Started with a "new Thread(new MyRunnable()).start()" call   Or, with extends Thread:  public class MyThread extends Thread {     public MyThread() {         super("MyThread");     }     public void run() {         //Code     } } //Started with a "new MyThread().start()" call   Is there any significant difference in these two blocks of code ?
I am trying to write a condition into a SQL WHERE clause that forces the column comparison to a variable to be compared in lowercase. However the addExpression function isn't accomplishing this (since that is putting the expression in the field selection, not the where clause.  Here is what I have tried:  $category = 'mobile wifi'; $query = db_select('taxonomy_term_data', 'ttd')     -&gt;fields('ttd', array('tid')); $query-&gt;innerJoin('taxonomy_vocabulary', 'tv', 'ttd.vid = tv.vid'); $query-&gt;addExpression("LOWER(ttd.name) = $category"); $result = $query-&gt;condition('machine_name', 'images_cat', '=')     -&gt;execute()     -&gt;fetchAssoc();   And this:  $category = 'mobile wifi'; $query = db_select('taxonomy_term_data', 'ttd')     -&gt;fields('ttd', array('tid')); $query-&gt;innerJoin('taxonomy_vocabulary', 'tv', 'ttd.vid = tv.vid'); $result = $query-&gt;condition('machine_name', 'images_cat', '=')     -&gt;condition('LOWER(ttd.name)', $category, '=')     -&gt;execute()     -&gt;fetchAssoc();   The second one becomes invalid and the first one causes the problem I mentioned above. Any thoughts or suggestions?  Thanks, Patrick Is propagation of uncertainties linear? Why pendulum does not follow SHM for larger angular displacement? Considering an ideal case(neglecting drag of air, damping etc.), a pendulum follows SHM if the angular displacement is small (upto 10 degrees). But, for large angular displacement(more than 10 degree), it does not follow SHM. Why? What force cause the pendulum not to follow SHM? What are the units of entropy of a normal distribution? I have a random process that follows a normal distribution. It's parameters are mean = 35 units, std.dev. = 8 units. I've seen from the  for the normal distribution that there is a formula to calculate the entropy. So plugging in the figures as:- $$     .5\log\left(2\pi e^1 8\cdot 8\right) $$ I get a value of 1.52, which I take to be  per sample.  My question is what are these units?  What thing do I have 1.52 of?    is (typically) measured in units of bits, after Claude Shannon's definition.  So can I take it that each sample generates 1.52 bits of entropy?  Clearly recording those samples generates information and therefore occupies a real and discrete amount of storage space. Ergo entropy cannot be unit less. Short story where time is accelerated and characters have to get back to ship? Looking for a short story where time is accelerated on a planet.  The characters are actually born at the beginning of the story and then grow up quickly and inadvertently learn that their forebears came from a rocket ship nearby.  After having aged to "teenagers" they try to reach the ship?  At some point there is a war between confused aging survivors.  I think it was in a compilation which included a story called "Cousins". Cap colour in IPL If a player is the highest run scorer and at the same time is the highest wicket taker in IPL, which colour cap would he wear? . It is a mathematical expression/sequence/set of numbers with the arrow exactly under any one of the numbers (with or without n= 0). How to do it in latex? Any of the up arrow types (single line or double line) shown in the figure is okay. Roots of unity filter, identity involving $\sum_{k \ge 0} \binom{n}{3k}$ How do I see that$$\sum_{k \ge 0} \binom{n}{3k} = (1 + 1)^n + (\omega + 1)^n + (\omega^2 + 1)^n,$$where $\omega = \text{exp}\left({2\over3}\pi i\right)$? What is the underlying intuition behind this equality? Any situation, any time; this person has always something negative to say about it.  It should be a noun or an adjective to describe a person who is a damp cloud walking over every sunshine situations at the cubicle, hoping to drench other people with his miserable comments.    I considered "sourpuss" but would prefer something more important sounding, like "misogynist." $\displaystyle\sum_{n=1}^\infty \frac{1}{n^s}$ only converges to $\zeta(s)$ if $\text{Re}(s) &gt; 1$.  Why should analytically continuing to $\zeta(-1)$ give the right answer? Can we have a list of all the Stack Exchange domains somewhere, for firewall purposes? I work behind an really annoying firewall, and I just want the net admin to add all the SE websites to the whitelist. Right now I've lost access to Stack Overflow's authentication, but not Meta's... so I have to come here before I log in there.  It's driving me nuts. Basically I just want to add an exclusion rule for all SE domains; not only the website domains, but also the content domains such as gravatar.com, quantserve.com, the domain that holds static content, etc... Why Do Glueballs Have Mass, When Individual Gluons Are Massless? Perform feature normalization before or within model validation? A common good practice in Machine Learning is to do feature normalization or data standardization of the predictor variables, that's it, center the data substracting the mean and normalize it dividing by the variance (or standard deviation too). For self containment and to my understanding we do this to achieve two main things:   Avoid extra small model weights for the purpose of numerical stability. Ensure quick convergence of optimization algorithms like e.g. Conjugate Gradient so that the large magnitude of one predictor dimension w.r.t. the others doesn't lead to slow convergence.   We usually split the data into training, validation and testing sets. In the literature we usually see that to do feature normalization they take the mean and variance (or standard deviation) over the whole set of predictor variables. The big flaw I see here is that if you do that, you are in fact introducing future information into the training predictor variables namely the future information contained in the mean and variance.  Therefore, I do feature normalization over the training data and save the mean and variance. Then I apply feature normalization to the predictor variables of the validation and test data sets using the training mean and variances. Are there any fundamental flaws with this? can anyone recommend a better alternative? Can I submit/ArXiv without my advisor? I am being blocked from publishing my work I joined a research group of a faculty member in 201x, and worked with her for three years. During that time, I collaborated with a large hospital to perform research in the domain of medical informatics. I spoke about my research at two conferences; one was a talk, and the other was a poster presentation. My advisor asked me to write up the research in a paper around the second year, which I did. Around the third year, I decided to switch research groups, because of the relationship between me and my advisor going sour, and not having funding from her (I used to work part-time to fund my PhD research).  Once this happened, she withdrew her support from me publishing my paper and ordered that I give up my work to a fellow grad student. I told her, that my manuscript is in its Nth revision, and that I would like to take it to completion as first author. She was dismissive and didn’t offer any comments on my work. I told her, that, should I pass on my work, I would like to discuss authorship issues in advance, which she wasn’t ready to discuss. She ganged up my new advisor against me, and together they forced me to give up my code, results, paper drafts. I had to then leave the university without a degree.  Fast forward couple of years, I receive an email from a student in her lab (the student whom I had to hand over my work to), saying that they are publishing a paper, and have decided I am the fourth author. I read the paper and found out that it uses my experimental setup and design, data collection, and one of the ideas I had presented (the idea wasn’t the main crux of my paper, but I believe it was novel).  I want to   Publish my original draft in ArXiv/BioArXiv, as first author. Request my advisor to cite my work in their publication.    Given how she behaved with me, I know that despite what I am asking for sounds fair, she is likely to object.  I am asking the community: Can I go ahead and ArXiv it without her permission? I could add her as an author, but not take her permission. Also, if you have any other ideas on how to deal with this situation please let me know.  (For the record, this was at a top-10 school in the US in an engineering department). A lot of my scripts stopped working after installing Ubuntu 15.10 and I have trouble remembering this new name as I was used to ethx and wlanx for years. Is there a reason for this change? Do I have to get used to this or can I just rename it and go back to good old eth0?  $ ifconfig  enp0s25   Link encap:Ethernet  HWaddr 77:5a:5e:a6:86:d5         inet addr:192.168.31.239  Bcast:192.168.31.255  Mask:255.255.255.0       inet6 addr: fe80::725a:b6ff:fea6:86d7/64 Scope:Link       UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1       RX packets:4833 errors:1332 dropped:0 overruns:0 frame:666       TX packets:5589 errors:0 dropped:0 overruns:0 carrier:0       collisions:0 txqueuelen:1000        RX bytes:3266446 (3.2 MB)  TX bytes:1046654 (1.0 MB)       Interrupt:20 Memory:d3500000-d3520000 Sometimes it is convenient to use an absolute path to include a preamble. To do so, I use the following "hack":  \documentclass[a4paper, 12pt]{article} \newcommand{\folder}{/path/to/folder} \input{\folder/preamble}  \begin{document} \end{document}   Now my question is, whether there is a more elegant way to do this, especially a way which is compatible with one of the flatten scripts from  ? Posting and answering questions you have already found the answer to Sometimes you spend a day or more solving a technical problem, and when you finally solve it, you may want to post it on your blog (if you have one) to share with the community.  However, most developers don't have a lot of time to update their blogs, and that is why personal blogs are not ranked very highly on Google/Bing.  So even if you describe a brilliant idea, chances are that, except a few of your friends, nobody will ever find it. This is a common reason why some developers start their blogs and soon give up; it is not interesting to write for the community if you have no feedback on your posts.  Unlike personal blogs, Stack Exchange sites are highly ranked in Google (I was amazed when I saw that a question asked on SO just an hour ago appeared 3rd in my Google search!), so if your question and answer are valuable for others, they will be rated highly and will be visible for other developers.  With this in mind, is it good practice to post a question and answer it yourself immediately when you want to share an idea with the community? Indefinite integral of secant cubed I need to calculate the following indefinite integral:  $$I=\int \frac{1}{\cos^3(x)}dx$$  I know what the result is (from Mathematica):  $$I=\tanh^{-1}(\tan(x/2))+(1/2)\sec(x)\tan(x)$$  but I don't know how to integrate it myself. I have been trying some substitutions to no avail.   Equivalently, I need to know how to compute:  $$I=\int \sqrt{1+z^2}dz$$  which follows after making the change of variables $z=\tan x$. Since I installed TeXLive 2016 I cannot build documents with the standalone document class any more using LuaLaTeX (PDFLaTeX works fine). For example:  \documentclass{standalone} \begin{document} hi \end{document}   Gives me:  ! Undefined control sequence. \sa@placebox -&gt;\newpage \global \pdfpagewidth                                                =\wd \sa@box \global \pdfpageh...  l.4 \end{document}   How to fix that? Shape of the universe? What is the exact shape of the universe? I know of the balloon analogy, and the bread with raisins in it. These clarify some points, like how the universe can have no centre, and how it can expand equally everywhere in all directions. But they also raise some questions, like if you are on the surface of a balloon and travel in 1 direction, you will eventually return to your starting point, is it possible our universe have this feature?  If it has, or had, would this be a symmetry of sorts ($\psi(x)=\psi(x+R)$), and as such have a conserved quantity associated with it (by Noether)? Assuming "small curled up dimensions" wouldn't these dimensions have this type of symmetry, what are the associated conserved quantities? Is it known exactly what the geometrical shape of the universe is? (on a large scale) (I am not talking about only the observable universe). How does one define the "size" of a dimension, is this scale only applicable to curled up ones? Is it possible to describe to a layman the shape of the universe without resorting to inept analogies?