8 is int The above line of code statement shows false. Even though 8 is an int. How does this work? I would like to know how is operator works in this case. Thank you.
What is the best way to check whether a given object is of a given type? How about checking whether the object inherits from a given type?  Let's say I have an object o. How do I check whether it's a str?
What is a more efficient way to draw this tree? I have drawn the following tree in TikZ. What I don't like about it is   that I have to manually adjust the sibling distance for each level; and the syntax is too cumbersome.   It has been suggested to me by @percusse and @AlanMunn that using tikz-qtree and/or forest may be a more efficient way to produce the same result. But I don't have experience in using either package.   It would be nice if someone can reproduce my example using either of these packages, so that I can have quick example to learn from instead of reading a 150-page manual trying to find an answer.    \documentclass{standalone} \usepackage{tikz} \usepackage{amsmath}  \begin{document}  \tikzset{   % Two node styles for game trees: solid and hollow   solid node/.style={circle,draw,inner sep=1.2,fill=black},   hollow node/.style={circle,draw,inner sep=1.2}, }  % macro for entering payoffs \newcommand\payoff[1]{   $\begin{pmatrix} #1 \end{pmatrix}$ }  \begin{tikzpicture}[font=\footnotesize]   \tikzset{     level 1/.style={level distance=15mm,sibling distance=65mm},     level 2/.style={level distance=15mm,sibling distance=30mm},     level 3/.style={level distance=15mm,sibling distance=15mm},     level 4/.style={level distance=15mm,sibling distance=10mm},   }    \node[hollow node,label=above:{Nature}]{}     child{node[solid node,label=left:{P1}]{}       child{node(l1)[solid node]{}         child{node[solid node,label=below:{\payoff{1\\-1}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[right]{R}}         edge from parent node[left]{U}       }       child{node(l2)[solid node]{}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{2\\-2}}]{}edge from parent node[right]{R}}         edge from parent node[right]{D}       }       edge from parent node[left,xshift=-10]{A}     }     child{node[solid node,label=right:{P1}]{}       child{node(r1)[solid node]{}         child{node[solid node,label=below:{\payoff{-2\\2}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[right]{R}}         edge from parent node[left]{U}       }       child{node(r2)[solid node]{}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{-1\\1}}]{}edge from parent node[right]{R}}         edge from parent node[right]{D}       }       edge from parent node[right,xshift=10]{B}     }   ;    \draw[dashed](l1)--(l2)--node[midway,above]{P2}(r1)--(r2); \end{tikzpicture}  \end{document} Deriving Chinese Remainder Theorem from gcd Bezout identity We want to find the solution $x$ to the congruence system  $$\begin{align} x &amp;\equiv r_1 \!\!\!\pmod{\!m_1}\\ x &amp;\equiv r_2 \!\!\!\pmod{\!m_2}\end{align},\ \ {\rm where}\ \  \gcd(m_1, m_2) = 1$$  These can be rewritten as  $$\begin{align} x &amp;= r_1 + m_1 j\\ x &amp;= r_2 - m_2k\end{align}$$  for unknown integers $j, k$. So we set those two equations as equal and rearrange them to  $$m_1j + m_2k = r_2 - r_1$$  Now assume we perform $\text{egcd}(m_1, m_2)$, which gives us the solution to  $$m_1u + m_2v = \gcd(m_1, m_2)$$  Let the integer $\,h\,$ make $\,h \gcd(m_1, m_2) = r_2 - r_1$.  Then $\qquad hm_1u + hm_2v = h\gcd(m_1, m_2) =  r_2 - r_1 = m_1j + m_2k$  At this point I am lost because I don't think we can just assume  $hm_1u = m_1j$ and extract $j = hu$.   How do I get the values of $j$ or $k$ so I can get the value of $x$? My interest in Blender comes from wanting to use it to model physical structures and produce architectural drawings; what I have so far is really impressive, but there doesn't seem to be too much information about my particular interest.   Are there any (Blender-) resources that would be particularly useful for architects? E.g. packages of standard 'elements' like windows, doors, roofs or whatever, or perhaps a discussion group specifically for architects? When overriding equals in Java, why does it not work to use a parameter other than Object? I ran into an interesting behavior recently.  It seems that if I override .equals() to take a parameter other than Object, it doesn't get called.  Can anyone explain to me why this is happening?  It seems to violate my understanding of polymorphism in OOP, but maybe I'm missing something.  Here's much simpler code that shows what I'm seeing:  public class MyClass {   private int x;   public MyClass(int n) { x = n; }   public boolean equals(Object o) { return false; }   public boolean equals(MyClass mc) { return x == mc.x; }   public static void main(String[] args) {     List&lt;MyClass&gt; list = new ArrayList&lt;MyClass&gt;();     list.add(new MyClass(3));     System.out.println("Contains 3? " + list.contains(new MyClass(3)));   } }   When this is run, it prints "Contains 3? false".  It looks like the equals(Object) function is called, even though there is another that would work.  By contrast, if I write equals like this the code works as expected:  public boolean equals(Object o) {   if(!(o instanceof MyClass))     return false;   MyClass mc = (MyClass)o;   return x == mc.x; }   Why isn't it figuring out which version of the function to call based on the type of the parameter? Are there any tools for Windows 7 that will allow me to enable/disable monitors from the command-line?  For example, my GTX 480 has three outputs (2x DVI and 1x HDMI) but only two displays can be active at any given time.  I'd like for a command-line to allow me to disable one of the DVI monitors and enable the HDMI monitor, etc.  (I've found NirCmd which is an amazing utility but it doesn't seem to support this...)  EDIT: UltraMon seems capable of doing this but I really hoping for a more light-weight command-line solution... Converting Raw HTTP Request into HTTPWebRequest Object Alternatives to one-way ANOVA for heteroskedastic data Intersection of Adiabatic curves Can paths of two adiabatic process intersect on a plot? This question is for both reversible and irreversible processes. There are some , but they mostly address only for reversible adiabatic processes. Also, I want a physical interpretation of the processes that is, if they don't intersect then why don't and what it would be like, physically for a system. What's the difference between cards, panels, and tiles? It seems as if with some of the modern front-end development frameworks there is a blur between the different types of 'container' elements. Whether this is an attempt to abstract the design from implementation or if this is due to there not being any standardization of terminologies I am not sure, but it leads to the fact that in some design frameworks I see the term panels being used but not cards (e.g. Bootstrap 3) while in others the term cards exists but not panels (e.g. Iconic), and perhaps both exist in others?  From a design perspective, it seems that both cards and panels are just containers, and since there's nothing that defines how big a card can get and how small a panel can be, I am wondering whether there's really any difference. From an implementation perspective, it seems that cards should be used for smaller size design elements and are preferred on mobile specific applications, whereas panels are used for a wider range of design elements and are preferred on desktop specific applications.  Is there any evidence/reference/examples that will help to illustrate or highlight the (lack of) differences? For some reason I think cards and tiles are more closely related to each other, and that panels seem to be in a slightly different class/family?  If we take the argument that there are no differences, then it is hard to understand why people associate 'tiles' with Microsoft 'Metro' style home pages, while on Google and Android apps it is 'cards' and for Java and Gnome applications it is 'panels'. Perhaps there are some contextual or implementation differences?  UPDATE: with the release of Bootstrap 4, it seems like cards are basically equivalent to panels (since one component has replaced the other), but with this comes the cost of having to maintain a more flexible container that will make it difficult to implement consistently. According to Bootstrap:      A flexible and extensible content container. It includes options for   headers and footers, a wide variety of content, contextual background   colors, and powerful display options.   FURTHER UPDATE: It seems as if Bootstrap 5 and Material.io have adopted the card UI component in the new world of responsive and mobile first/multi-device ecosystem design systems while "tiles" have a very specific meaning in the Microsoft Fluent Design System:      A tile is an app's representation on the Start menu. Every app has a tile. When you create a new Universal Windows Platform (UWP) app project in Microsoft Visual Studio, it includes a default tile that displays your app's name and logo   Panels don't seem to be part of the vocabulary anymore, as least in terms of a UI component, but in the Microsoft and Java world it still represents an abstract concept of organisation layouts of UI components. What could cause exposure problems after my camera got wet? I had an unfortunate accident where my DSLR camera (and me) briefly ended up in a river. The camera wasn't fully submerged but it did get very wet. It still works, sort of, although the electrics are doing some random things. I'm hoping that's just a bit of dampness doing that, that will fix itself when it dries out fully.  More concerning is that the documents exposure metering seems to be all wrong when using the viewfinder. Pictures are extremely overexposed and nearly white. But if I use live view, then they are fine.  Why could cause this? I assume the light is routed a different way when using the viewfinder and maybe it is going through something with water/condensation on it? Is "The empty set is a subset of any set" a convention? Recently I learned that for any set A, we have $\varnothing\subset A$.  I found some explanation of why it holds.     $\varnothing\subset A$ means "for every object $x$, if $x$ belongs to the empty set, then $x$ also belongs to the set A". This is a vacuous truth, because the antecedent ($x$ belongs to the empty set) could never be true, so the conclusion always holds ($x$ also belongs to the set A). So $\varnothing\subset A$ holds.   What confused me was that, the following expression was also a vacuous truth.     For every object  $x$, if $x$ belongs to the empty set, then $x$ doesn't belong to the set A.   According to the definition of the vacuous truth, the conclusion ($x$ doesn't belong to the set A) holds, so $\varnothing\not\subset A$ would be true, too.  Which one is correct? Or is it just a convention to let $\varnothing\subset A$? short view distance in 3d view? Why use static_cast(x) instead of (int)x? I've heard that the static_cast function should be preferred to C-style or simple function-style casting.  Is this true?  Why? Does the new guidance on duplicate questions suggest closing a question as duplicate, if the original answers the OP's question? In other words, should we now look at the content of the answers when we are evaluating questions for possible duplication?  Is it sufficient to say "Your answer can be found in this question over here, therefore your question is a duplicate?"  The new guidance is here:    Among other things, it describes the new close banner:     This question already has an answer here:   Link to the Duplicate Question   ... which seems to suggest that, if some other question in the system answers the OP's question, then the OP's question can be closed as a duplicate on that basis (even if the question itself is not necessarily duplicated).  Example Here:    Note the comments below the question, where I dispute the assertion made there that it is a duplicate question.  The original question doesn't mention unit testing. Why do hard links exist? How do I use sudo to redirect output to a location I don't have permission to write to? Differences between Verb + to be + adjectives and Verb + adjective My non-native English speaking friend just asked me: "Data is..." or "Data are..."?  I said both but that's because I've been desensitized from reading/writing both (especially from writing code and adding quick comments).  My question: Is it acceptable to utilize either for a university paper? Or is one safer than the other (when confronted with stickler professors)?    Related questions: prove $\sqrt{a_n b_n}$ and $\frac{1}{2}(a_n+b_n)$ have same limit I'm looking for a library in Python which will provide at and cron like functionality.  I'd quite like have a pure Python solution, rather than relying on tools installed on the box; this way I run on machines with no cron.  For those unfamiliar with cron: you can schedule tasks based upon an expression like:    0 2 * * 7 /usr/bin/run-backup # run the backups at 0200 on Every Sunday  0 9-17/2 * * 1-5 /usr/bin/purge-temps # run the purge temps command, every 2 hours between 9am and 5pm on Mondays to Fridays.   The cron time expression syntax is less important, but I would like to have something with this sort of flexibility.   If there isn't something that does this for me out-the-box, any suggestions for the building blocks to make something like this would be gratefully received.  Edit I'm not interested in launching processes, just "jobs" also written in Python - python functions. By necessity I think this would be a different thread, but not in a different process.  To this end, I'm looking for the expressivity of the cron time expression, but in Python.   Cron has been around for years, but I'm trying to be as portable as possible. I cannot rely on its presence.