control-flow

Exit in For loop - Windows Command Processor (CMD.EXE)

依然范特西╮ 提交于 2019-12-30 09:00:19
问题 I am trying to find way to break / exit from FOR loop, if there are any error occured. Below is content of batch file. @echo on set myfile=D:\sample.txt FOR /F "tokens=1,2 delims=," %%i in (%myfile%) do call :process "%%i" :process set recfile=%1% echo %recfile% echo "Step in Test1" echo %errorlevel% pause; exit /B 0 If %errorlevel% NEQ 0 goto :fail1 :fail1 echo "Step in fail1" pause; exit /B 9993 :EOF Sample.txt has multiple records. If there are any error occured then I am expecting to exit

Limiting TCP sends with a “to-be-sent” queue and other design issues

寵の児 提交于 2019-12-29 00:41:49
问题 This question is the result of two other questions I've asked in the last few days. I'm creating a new question because I think it's related to the "next step" in my understanding of how to control the flow of my send/receive, something I didn't get a full answer to yet. The other related questions are: An IOCP documentation interpretation question - buffer ownership ambiguity Non-blocking TCP buffer issues In summary, I'm using Windows I/O Completion Ports. I have several threads that

Why use a for loop instead of a while loop? [duplicate]

风流意气都作罢 提交于 2019-12-28 04:54:08
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: Iterate with for loop or while loop? Loops in C - for() or while() - which is BEST? When should one use a for loop instead of a while loop? I think the following loops are identical, except for their syntax. If so, then why choose one over the other? int i; for (i = 0; i < arr.length; i++) { // do work } int i = 0; while (i < arr.length) { // do work i++; } 回答1: In your case, you don't gain much besides one

geoserver 2.11 as windows service with controlflow extension

こ雲淡風輕ζ 提交于 2019-12-25 09:47:46
问题 I'm trying to set up GeoServer for a production environment. I have installed GeoServer using the Windows Installer as a Service in Windows Services. I tried to add the Control Flow Module but then GeoServer won't start up anymore. A sample of the log file below. If I remove the Control Flow Module GeoServer starts up normally again. The control flow plugin works if I install GeoServer with the "run manually" option. Any ideas on how to get the Control Flow Module to work under a service

Implementation of simple polling of results file

笑着哭i 提交于 2019-12-25 07:59:25
问题 For one of my dissertation's data collection modules, I have implemented a simple polling mechanism . This is needed, because I make each data collection request (one of many) as SQL query, submitted via Web form, which is simulated by RCurl code. The server processes each request and generates a text file with results at a specific URL ( RESULTS_URL in code below). Regardless of the request, URL and file name are the same (I cannot change that). Since processing time for different data

How can you Interupt a function from a GUI callback without adding an interupt-check to the function? (MATLAB)

北慕城南 提交于 2019-12-24 11:07:13
问题 So, I've a GUI that basically allows the user to iteratively process data. Thus, there is a start/stop button and a display that shows the current state of the data. When you click the start button, the callback function calls the data processing function shown below: function result = process_data(data) result = 0; for big_loop=big_start:big_end for small_loop=small_start:small_end result = result+data; %in reality just some fancier matrix ops end end My problem is how to implement the stop

How to generate a Control Flow Graph from Assembly?

≯℡__Kan透↙ 提交于 2019-12-24 09:48:31
问题 For context, I'm attempting to write a decompiler from AVM2 (ActionScript Virtual machine 2) bytecode/assembly to high-level ActionScript 3 code. As far as I am aware, this requires me to analyze the assembly and generate resulting Control Flow Graph from this, in order to deduce structures such as loops, and conditional branching (if/else). Given some assembly like: 0 getlocal0 1 pushscope 2 findpropstrict {, private, }::trace 4 pushstring "one" 6 callproperty {, private, }::trace (1) 9 pop

Using RxJS how to buffer function calls until an other async function call has resolved

前提是你 提交于 2019-12-24 08:36:49
问题 How can I use RxJS to buffer function calls until another async function has resolved? Here is a simple example of what I'd like to accomplish function asyncFunc(time) { setTimeout(() => { console.log('asyncFunc has resolved'); }, time); } function funcToBuffer(time) { setTimeout(() => { console.log(time); }, time); } asyncFunc(3000); funcToBuffer(1000); funcToBuffer(2000); funcToBuffer(4000); funcToBuffer(5000); asyncFunc(8000); funcToBuffer(6000); funcToBuffer(7000); At the moment this code

What is the most concise way to include functions or lambdas as conditions in a Kotlin `when` statement (or other branching construct)?

自古美人都是妖i 提交于 2019-12-24 01:37:29
问题 I'm processing strings, and I came across the Regex or Wildcard answer: that one can put regular expressions in a when statement with a custom class that overrides equals. While this does effectively use the type system to shoehorn syntactic sugar into the when statement, I find the following pretty ugly, and would never do this in code that I intend to share with another developer (quoting travis): import kotlin.text.regex when (RegexWhenArgument(uri)) { Regex(/* pattern */) -> /* do stuff *

Javascript: How to use object literals instead of if and switch statements for expression-based conditions?

左心房为你撑大大i 提交于 2019-12-23 04:47:46
问题 In javascript, I want to at least consider using a nested object literal tree for my control flow instead of if statements, switch statements, etc. Below is an example of a function using if statements turned into a function using object literals to accomplish the same functionality. // if & else if function getDrink (type) { if (type === 'coke') { type = 'Coke'; } else if (type === 'pepsi') { type = 'Pepsi'; } else if (type === 'mountain dew') { type = 'Mountain Dew'; } else { // acts as our