control-flow

Java Control Flow Graphs Library

旧街凉风 提交于 2019-12-21 20:22:25
问题 I need to manipulate control flow graphs for Java code in a project. What might be a good java library to generate control flow graphs in Java. So far I have found a couple eclipse plugins (heavily dependent on eclipse APIs) and standalone tools (cannot embed in my code). 回答1: A tool to do this stuff is Soot, and this questions is a duplicate of Tool for generating control flow in Java 回答2: Some examples: yFiles for Java (commercial) jGraph JUNG Grappa If not what you are looking for, then

How do I break out of a loop in Haskell?

牧云@^-^@ 提交于 2019-12-21 11:03:37
问题 The current version of the Pipes tutorial, uses the following two functions in one of the example: stdout :: () -> Consumer String IO r stdout () = forever $ do str <- request () lift $ putStrLn str stdin :: () -> Producer String IO () stdin () = loop where loop = do eof <- lift $ IO.hIsEOF IO.stdin unless eof $ do str <- lift getLine respond str loop As is mentinoed in the tutorial itself, P.stdin is a bit more complicated due to the need to check for the end of input. Are there any nice

What is the best control flow module for node.js?

纵饮孤独 提交于 2019-12-21 07:13:30
问题 I've used caolan's async module which is very good, however tracking errors and the varying way of passing data through for control flow causes development to sometimes be very difficult. I would like to know if there are any better options, or what is currently being used in production environments. Thanks for reading. 回答1: I use async as well. To help tracking errors it's recommended you name your functions, instead of having loads of anonymous functions: async.series([ function doSomething

Java: Exceptions as control flow?

你。 提交于 2019-12-17 04:07:47
问题 I've heard that using exceptions for control flow is bad practice. What do you think of this? public static findStringMatch(g0, g1) { int g0Left = -1; int g0Right = -1; int g1Left = -1; int g1Right = -1; //if a match is found, set the above ints to the proper indices //... //if not, the ints remain -1 try { String gL0 = g0.substring(0, g0Left); String gL1 = g1.substring(0, g1Left); String g0match = g0.substring(g0Left, g0Right); String g1match = g1.substring(g1Left, g1Right); String gR0 = g0

C++, how to control program flow with keyboard input

被刻印的时光 ゝ 提交于 2019-12-13 05:15:39
问题 I have a main routine that loops infinitely. By changing bool variables using keyboard input, I want to be able to control whether certain if{} statements within that loop are getting called. I found this thread: C non-blocking keyboard input, but it seems excessively laborious and complicated for seemingly basic functionality. Is there an easier way to do it? 回答1: You'll have to use the OS/Firmware/Framework/environment API to get input events, or use a library that do this for you. Anyway,

How do I use document.write() to write an event unless it is already written?

跟風遠走 提交于 2019-12-13 04:50:58
问题 I've created an array containing: [Event Location, Date, Event Name]. I am using a forEach loop to iterate through each event and using document.write to print out the details. That part is going well. However, I don't want to print out the event's title every time. I want to print out the title only once and then the details beneath it. To clarify I want it to visually look something like this: Meet and Greet Boston November New York December Concord May Cincinnati October Drink Coffee Texas

Cleanly and optionally redirect stderr or stdout to file

女生的网名这么多〃 提交于 2019-12-12 04:59:40
问题 I have a Python3 script and I want to optionally redirect stdout and stderr to a file. Something like this: # variable declarations if log_output: output_file = open('output.txt', 'w') sys.stdout = output_file if log_errors: errors_file = open('errors.txt', 'w') sys.stderr = errors_file # code that uses variables declared above but may exit suddenly #at the end if log_output: output_file.close() if log_errors: errors_file.close() This works, unless my code in the middle decides to quit. Then

execute multiple processes from a master process

六月ゝ 毕业季﹏ 提交于 2019-12-11 18:33:13
问题 I want to create multiple processes from one master process. I know I want to use a function from the exec family, but it does not seem to be preforming in the way I intended it to. It seems that exec() is a blocking call, or maybe I am just using it wrong. Anyway, on to the code: const char* ROUTERLOCATION = "../../router"; int main(int argc, char** argv) { manager manager; vector<string> instructions = manager.readFile(argv[1]); ... //file gives me the number of proceses i want to spawn and

Understanding JavaScript setTimeout and setInterval

ぐ巨炮叔叔 提交于 2019-12-11 03:20:18
问题 I need a bit of help understanding and learning how to control these functions to do what I intend for them to do So basically I'm coming from a Java background and diving into JavaScript with a "Pong game" project. I have managed to get the game running with setInteval calling my main game loop every 20ms, so that's all ok. However I'm trying to implement a "countdown-to-begin-round" type of feature that basically makes a hidden div visible between rounds, sets it's innerHTML = "3" // then

Tools for generating a control flow graph from source code

杀马特。学长 韩版系。学妹 提交于 2019-12-10 22:09:34
问题 I need a tool to generate a control flow graph from java source code. Are there such tools available? Is there a possibility to also generate source code if I have a control flow graph? 回答1: See my company's (Semantic Designs) Java Front End. It will compute control flow graphs for methods from source code. The Java Front End is built on top of DMS Software Reengineering Toolkit, which provides generic machinery for manipulating (parsing, analyzing [e.g., extracting control flow graphs]),