See what the Stackoverflow community is most excited about today.
Date: 2018-01-18
-
Can (a ==1 && a== 2 && a==3) ever evaluate to true?
tags: javascript, ecmascript-6
1191 votes, 27 answers and 213905 views
\r\n Is it ever possible that (a ==1 && a== 2 && a==3) could evaluate to true, in JavaScript?\n\nThis is interview question asked by a major tech company. My answer was that it's impossible. ...\r\n
-
How to change the value of attribute in appSettings section with Web.config transformation
tags: c#, asp.net, .net, web-config
188 votes, 2 answers and 65615 views
\r\n Is it possible to transform the following Web.config appSettings file:\n\n\n \n <add key="developmentMode" value="true"...\r\n
-
How do I convert a String to an int in Java?
tags: java, string, int, type-conversion
2287 votes, 31 answers and 4812305 views
\r\n How can I convert a String to an int in Java?\n\nMy String contains only numbers, and I want to return the number it represents.\n\nFor example, given the string "1234" the result should be the number ...\r\n
-
How do I delete (unset) an exported environment variable?
tags: linux, environment-variables, unset
967 votes, 3 answers and 547486 views
\r\n Before installing gnuplot I set the environment variable GNUPLOT_DRIVER_DIR = /home/gnuplot/build/src.\n\nDuring the installation something went wrong; now I want to remove the GNUPLOT_DRIVER_DIR ...\r\n
-
Extract value of attribute node via XPath
tags: xml, xpath
186 votes, 6 answers and 290319 views
\r\n How can I extract the value of an attribute node via XPath?\n\nA sample XML file is:\n\n\n \n \n &...\r\n
-
Cancellation token in Task constructor: why?
tags: c#, .net-4.0, task-parallel-library, cancellation-token
188 votes, 4 answers and 46405 views
\r\n Certain System.Threading.Tasks.Task constructors take a CancellationToken as a parameter:\n\nCancellationTokenSource source = new CancellationTokenSource();\nTask t = new Task (/* method */, source.Token)...\r\n
-
Schema for a multilanguage database
tags: database-design, localization, multilingual
186 votes, 10 answers and 73627 views
\r\n I'm developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with ...\r\n
-
Mockito: Trying to spy on method is calling the original method
tags: java, junit, mockito
192 votes, 5 answers and 115683 views
\r\n I'm using Mockito 1.9.0. I want mock the behaviour for a single method of a class in a JUnit test, so I have\n\nfinal MyClass myClassSpy = Mockito.spy(myInstance);\nMockito.when(myClassSpy.method1())....\r\n
-
What is thread safe or non-thread safe in PHP?
tags: php, multithreading, thread-safety, packages, threadcontext
631 votes, 5 answers and 274606 views
\r\n I saw different binaries for PHP, like non-thread or thread safe? What does this mean? What is the difference between these packages?\r\n
-
How can Python iterate over dictionaries with 'for' loops using only the dict keys?
tags: python, python-2.7, dictionary, key, iteration
1657 votes, 12 answers and 2233477 views
\r\n I am a bit puzzled by the following code:\n\nd = {'x': 1, 'y': 2, 'z': 3} \nfor key in d:\n print key, 'corresponds to', d[key]\r\nWhat I don't understand is the key portion. How does Python recognize ...\r\n