Stack Overflow Weekly Newsletter
Stack Overflow Weekly Newsletter

Top new questions this week:

Times two faster than bit shift?

I was looking at the source of sorted_containers and was surprised to see this line: self._load, self._twice, self._half = load, load * 2, load >> 1 Here load is an integer. Why use bit shift ...

python performance python-3.x bit-shift  
asked by Yakym Pirozhenko 70 votes
answered by Dan Getz 74 votes

Why would one use MACRO+0 !=0

In my current codebase I see this following pattern: #if SOMETHING_SUPPORTED+0 != 0 ... #endif Unfortunately this is a very old codebase and nobody knows how and why it started. I think it started ...

c++ c  
asked by Felics 42 votes
answered by Kaz 37 votes

vsim does not accept -modelsimini parameter on Windows

I'm using the command line argument -modelsimini <modelsim.ini> to specify my own modelsim.ini file for most QuestaSim / ModelSim executables. This works perfectly fine on Linux for vcom and ...

vhdl modelsim questasim  
asked by Paebbels 31 votes
answered by Martin Zabel 4 votes

Are side effects everything that cannot be found in a pure function?

Is it safe to say that the following dichotomy holds: Each given function is either pure or has side effects If so, side effects (of a function) are anything that can't be found in a pure ...

scala haskell f# functional-programming purely-functional  
asked by Aleksey Bykov 28 votes
answered by Tomas Petricek 54 votes

What is the order of destruction of function arguments?

If some function f with parameters p_1, ..., p_n of types T_1, ..., T_n respectively is called with arguments a_1, ..., a_n and its body throws an exception, finishes or returns, in what order are the ...

c++ function arguments language-lawyer  
asked by jotik 26 votes
answered by 6502 13 votes

Shortest way to iterate over non-list?

Suppose I have 3 Scanner instances which I want to close. I could do sc.close() for each of the Scanners. Or I could do something like for (Scanner sc: new Scanner[]{sc1,sc2,sc3}) { ...

java java-8  
asked by E. Sundin 23 votes
answered by Gerald Mücke 53 votes

How to evaluate zero sets fast?

This recent code golfing post asked the possibilities of fast implementation in C the following (assuming n is an unsigned integer): if (n==6 || n==8 || n==10 || n==12 || n==14 || n==16 || n==18 || ...

c++ c performance sorting search  
asked by Matsmath 23 votes
answered by thiru 24 votes

Greatest hits from previous weeks:

Generating random integers in a specific range

I am trying to generate a random intvalue with Java, but in a specific range. For example: My range is 5-10, meaning that 5 is the smallest possible value and 10 is the biggest. Any other number in ...

java random integer range  
asked by user42155 1797 votes
answered by Greg Case 1998 votes

How to read a file line by line into a list with Python

How do I read every line of a file in Python and store each line as an element in an array? I want to read the file line by line and each line is appended to the end of the array.

python string file  
asked by Julie Raswick 735 votes
answered by SilentGhost 786 votes

Can you answer these?

Get app-engine's current instance id in node.js

Is there any way to get the current instance id from app-engine in node.js? I found solutions only for java and python but nothing for node.

javascript node.js google-app-engine gcloud gcloud-node  
asked by Michele Pini 6 votes

How can i terminate myself if i run too long?

I have a application that runs periodically (it's a scheduled task). The task is launched once a minute, and normally only takes a few seconds to do its business, then exits. But there's a ~1 in ...

windows winapi process watchdog reliability  
asked by Ian Boyd 5 votes

GET tables method is not supported for this dataset - not implemented

I am trying to use the API to query the set of tables associated with a given dataset. This works correctly on the sample dataset and on the dataset I 'created' through the API. But, it does not ...

c# powerbi  
asked by Turgut Kanceltik 6 votes
Subscribe to more Stack Exchange newsletters


Unsubscribe from this newsletter or change your email preferences by visiting your subscriptions page on stackexchange.com.

Questions? Comments? Let us know on our feedback site. If you no longer want to receive mail from Stack Exchange, unsubscribe from all stackexchange.com emails.

Stack Exchange, Inc. 110 William St, 28th Floor, NY NY 10038 <3