Loops how to count the sum of the list of products prices ( ColdFusion )

here is the query: <cfquery name="GET_SHIP_ROW" datasource="#DSN2#"> SELECT SR.*, S.STOCK_CODE FROM SHIP_ROW SR, #dsn3_alias#.STOCKS S WHERE SR.STOCK_ID = S.STOCK_ID AND SR.SHIP_ID = #attributes.ship_id# ORDER BY SR.SHIP_ROW_ID </cfquery> for example i have a loop code of the prices: <cfloop from="#satir_start#" to="#satir_end#" index="i"> <cfif i lte get_ship_row.recordcount> <c

Profiling cycle time jitter in loops

I'm having a little problem while making a game, and while the problem is not limited to game-programming as such, I'll express it with the specific example I'm experiencing: As expected, I'm running the game code in a loop, controlling game logic and drawing a frame each cycle. However, I'm experiencing quite some amount of jitter in the amount of time it takes to complete each cycle. The normal cycle time varies by about a factor of two between the shortest and longest measured time, and some

Loops DOS batch - Print names of files (exclude certain extensions)

The question is about actual DOS batch files, not Windows cmd.exe script files. How do I exclude files with specific extensions from being processed in a for loop? @echo off set myExtension= for /r C:\ %%i in (*) do ( ::notDesirableExtension if myExtension != gif or jpg ... echo myFiles >> F:\list.txt )

Loops Batch File to Extract values when variable names change in each file

OK, I have hundred of files that have a text header in them that includes one or more entries for a set of eight different variables (name, host, year, month, hour, minute, second). The first time the value is displayed it looks like: @name 4 10 3 4 DHARLAN Every time after this (and the variable sets can appear 1 to 100 times per file) it shows up only as: 3 4 DHARLAN The problem comes in that what happens to be a 4 in this case can be any value between 1 & 99. So in the next file it

Loops Serial loop issue on Arduino Leonardo

Can I have Serial and Serial1 working at the same time? void setup() { Serial.begin(9600); while (!Serial); // while not open, do nothing Serial1.begin(9600); } void loop() { while (Serial.available() > 0) { // if at least one char is available /* CODE */ //Serial.write(Serial.read()); } while (Serial1.available() > 0) { /* CODE */ //Serial.write(Serial1.read()); } } When I open the Serial Monitor the first while works good b

Loops Looping through all images within multiple directories in ColdFusion

I'm working on an image manipulation script to create smaller thumbnail images of the images that are already on the server. The directory structure that I need to search through is as follows: Content -Att1 -image1 -imgA1_1.png -imgA1_1_large.png -image2 -imgA1_2.png -imgA2_large.png -image3 -imgA1_3.png -imgA1_3_large.png -Att2 -image1 -imgA2_1.png -imgA2_1_

Loops I'm trying to create a paging system.This is not the complete code. Getting "path doesn't exist " when running the code

I'm new to powershell, any idea on why i'm getting the error? Yesterday_Date = (get-date).AddDays(-1).ToString("yyyMMdd") $jsb={ $file = 'C:\Users\d1\Documents\Batch\path\$Yesterday_Date1\page.log' Get-Content $file -Wait | ForEach-Object -Begin { $counter = 1 $lines = @(Get-Content $file).Count } -Process { if ($counter++ -gt $lines) { write-host $_ } } } Start-Job $jsb -name Dum do{ Receive-Job -Name Dum | out-file C:\Users\path\pager.txt -append }while(

Loops JSTL Break out of loop

I am trying to retrieve 20 records from my list of friends with their name starting with 'J'. However, I realized there is no break in JSTL. So I tried to use a count to keep track of the records. I hit into error 'PWC6031: Unterminated <c:set tag' <c:set var="count" value="0" scope="page"> <c:forEach items="${friendsList}" var="user"> <c:if test="${count < 20}"> <c:set var="string1" value="${fn:substring(user.name, 0, 1)}" /> &

Loops Excel macro loop through rows and copy to another sheet

I'm new to VBA and trying to acheive this in Excel: I have a sheet1 where there are rows with values. I have created a button which executes and copy the first row of data to another sheet(Sheet2), into some predefined cells (i.e. value in Cell A1 goes into for instance B3). Then I'm going to save that into a pdf. Now I want my code to be more dynamic and do this for each of the rows in Sheet1. So first all values in A1-D1 gets copied to sheet2, create pdf, then next row (A2-D2) to sheet 2, cr

Loops Psexec commands to remotely delete files in a few computers and looping of txt file

Hi I am New to scripting . I have to remotely execute a PSEXEC command to delete al files in a certain drive in a few computers. I do have a TXT file with every ip address of all the computers. Is there a way to use PSEXEC to cmd command all the computers to delete the folders by executing every command for every IP in my txt file? currently i am using this line whereby i need to manually enter the ip address in the command line for eg . PsTools>PsExec.exe \ , cmd /c rmdir /S /Q

Loops Continuous Non-updating Loop

I am no longer "new" to Python, but am now moving into unchartered territory. Recently I was dissecting some logic circuit code found here. I learned a lot about the practical use of inheritance from this code. Good stuff. Not much happens in this code until one changes the inputs on a gate, so the interpreter must be used to manipulate the inputs. I got tired of using the interpreter, and so I investigated ways to create a continuous loop that would not rerun the initial code. I found that Tk

Loops For /f batch loop fails with error ") was unexpected at this time."

I'm writing what I thought would be a simple batch which will cycle through a .txt input file via a "FOR /F" to check a number of PC's for 3 file locations which will determine the OS or App version, Set a couple of Variable then rename a file and copy a new file in it's place..But I can't get it to work. The batch fails with ) was unexpected at this time Any assistance would be greatly appreciated. Here's the batch content CD /D "C:\Win32app\Scripts\SEPXML" FOR /f "Tokens=1" %%a IN (List.txt)

Loops Looping Variables in a session

I am trying to loop variables through a session. On the previous page I have a dropdown that lets the user select 1 thru 5 which is set as variable pcount. Depending on what the user chooses the form on the next page duplicates that many times(pcount). I need to be able to loop the variables through the session so it knows "firstname_1" "firstname_2" etc... and then displav on my last screen as session #session.checkout.info.firstname_#Peoplecount#. I can not figure out how to properly write var

Loops Skip an item in an Ansible task loop

Let's say I have a group var named show_canada which is a boolean. I have the following task: - name: install conf file template: src="example.conf.j2" dest="/etc/{{ item }}/example.conf" sudo: yes with_items: - usa - brazil - canada - japan - turkey How can I have the task skip the canada item depending on the value of the show_canada boolean? I guess I can have a when field that checks if the item == 'canada' and show_canada is t

Loops Can I use for loop in verilog `define statement?

I need to include a rather complex computation in a verilog macro. Can I use for loop in Macro definition? Below is given the example of my code `define CLOGB2(depth) \ integer width \ for(width=0;depth>0;width=width+1) \ depth = depth >> 1; \ return width module test #(parameter MEMDEPTH = 16) ( // Input-output port declaration ); parameter MEMWIDTH = `CLOGB2(MEMDEPTH); $display("Calculated width : %d\n",MEMWIDTH); ...

Loops How to get out of an infinite loop in Prolog using an accumulator

Knowledge base I'm using: connected(1,2). connected(3,4). connected(5,6). connected(7,8). connected(9,10). connected(12,13). connected(13,14). connected(15,16). connected(17,18). connected(19,20). connected(4,1). connected(6,3). connected(4,7). connected(6,11). connected(14,9). connected(11,15). connected(16,12). connected(14,17). connected(16,19). The question I'm trying to solve: Suppose that you add "connected(4,3)" immediately below the fact "connected(3,4)". Running t

Loops Step size in macro's do loop in sas

So I want to run nested loop for my macro function. Here's my code, it seem like SAS doesn't like by -1. Is there anyway I code this to let the second loop decrease step by -1? In this case, my yearMix = 1982 and yearMax = 1994. %Macro theLoop; %Do I = &yearMin+1 %to &YearMax-1; %Do J = &YearMax-1 %to &I by -1; %Meaw; %END; %END; %MEND theLoop; %theLoop; I got this error: ERROR: A character operand was found in the %EVAL function or %IF

Having a hard time to understand loops

Yeah...that is easy to understand loops. I know what each loop does. But the problem with me is that each new problem creates new troubles for me. I get stucked and if somehow I can solve one, there is always a better solution on web and that discourages me. Every problem related to loops is confusing. I would like to clear that I am a beginner but is that really normal for a beginner? What would you expect from a beginner who started learning c++ from the last month?

Loops `break` and `continue` in `forEach` in Kotlin

Kotlin has very nice iterating functions, like forEach or repeat, but I am not able to make the break and continue operators work with them (both local and non-local): repeat(5) { break } (1..5).forEach { continue@forEach } The goal is to mimic usual loops with the functional syntax as close as it might be. It was definitely possible in some older versions of Kotlin, but I struggle to reproduce the syntax. The problem might be a bug with labels (M12), but I think that the first exa

Understanding recurrence relations with function calls inside loops

The recurrence relation in the solution is given as : Solving this is easy, I got the answer to be 51. The doubt is why the '1' (underlined in red) is outside the summation? I understand if it were asymptotic analysis, we would consider it constant time because we only need to know the nature of growth, but since here we need an accurate answer. Since this line x + fun(k) * fun(n – k) in inside the loop, x also loops, so why is it outside summation?

Loops SAS Using a DO loop to read in multiple files but need to append the table in each iteration to prevent losing data

When I run my macros to input data from multiple files into one SAS table, it is replacing each dataset that is being read in once the next iteration begins. Thus, the only data that I am left with in my final table is the last file that I read in with the loop. How can I append my output table at the end of each read in iteration to prevent losing data each time I move to the next file? Current Code: %let type=40; %let year=2015; %let months =07; %let days = 01 02 03 04 05 06 07 08 09

Loops Iterate over infinispan Cache object

I am using the infinispan cache map in a java project to store my values in key/value format. Can we iterate over these cache map like we iterate java Maps. I need these cache map values/keys later for different operations.

Loops Verilog vector inner product

I am trying to implement a synthesizable verilog module, which produces a vector product of 2 vector/arrays, each containing eight 16-bit unsigned integers. Design Compiler reported error that symbol i must be a constant or parameter. I don't know how to fix it. Here's my code. module VecMul16bit (a, b, c, clk, rst); // Two vector inner product, each has 8 elements // Each element is 16 bits // So the Output should be at least 2^32*2^3 = 2^35 in order to // prevent overflow // Output is 35 bit

Loops While loop executing once(?)

I've been writing this hangman program in Pascal and I've been looking at this problem for a while and getting nowhere. I originally thought the input was reading a \n too, but a bit of write() later and that wasn't the case. what happens when I type in a, it goes through the loop and does everything right, but then it goes through again with nothing or a new line character or something that isn't visible. I've tried ensuring that guess is only getting one character, but that made it loop numero

I have just started learning loops in c programming, and have attempted to create a simple program to test my knowledge but it will not work

I simply want a program that has the user input a value for a and b, and will ask the user to repeat this process if the value a is less than b. Here is my program: #include <stdio.h> #include <math.h> int main(void) { int a, b ,c; while (a<=b) { printf("Please enter a value for a:\n"); scanf("%d", &a); printf("Please enter a value for b:\n"); scanf("%d", &b); if (a<=b) printf("a must be greater than b

Loops Export frequencies tables and histogram to excel sheets in macro

I'm trying to export the table and histogram created through a loop, each to different excel sheets. It works, but only the first histogram gets exported even though all of them get created in different result windows. In the rest of the sheets an "image currently unavailable" message appears, but the table part is saved properly. These are the macros: DEFINE create (!POS !CHAREND('/')) !DO !i !IN (!1) OUTPUT NEW. OUTPUT NAME !i. FREQUENCIES VARIABLES=!i /FORMAT=NOTABLE /PERCENTILE

Loops Python looping when there is only one item in the list

Hello i need to loop over a few accounts but sometimes there is only one account. What is the best way to do that please? Here is what i tried but this fails when there is only one account in the list. accounts = ('X123456','Y325252') for account in accounts: do stuff Sorry about the beginners question.

Loops For loop in functional style

In functional programming books, a recurring theme is that FP means telling computer what to do, not how to do. And some code example is give, like: val newNumbers = oldNumbers.map(_ * 2) Explanation is given that we dont implement this using traditional for-loop, but we rather use map. But isn't map internally implementing for loop. So we have just moved for loop from our code to some other part. So how exactly it makes FP better than imperative style?

Loops I want to write a number, then make an operation (if N is even,then N/2, or if N is odd,then (N*3) +1) and do it until the new number is equal to 1

I wanna make an algorithm that can take a number that I write and then make an operation, then take the answer, and repeat with the new number until the number is equal to 1 import java.util.Scanner; public class Nombres { public static void main(String args[]) { int amount; Scanner keyboard = new Scanner(System.in); System.out.print("Inscrivez un nombre"); amount = keyboard.nextInt(); while (amount != 1) { if (amount % 2 > 0) { Syst

Loops Trying to create a .csv file with Ansbile Copy module, content option, but it only writes last iteration of loop

I am trying to create a csv file with the following Ansible playbook: - name: Find Fex Enclosure hosts: MAQ gather_facts: no connection: local tasks: - name: GET VENDOR & OS OF THE EQUIPEMENT snmp_device_version: host={{ inventory_hostname }} version=3 integrity=xxxx level=authPriv privacy=xxxx username=xxxxxx authkey=xxxxxxx privkey=xxxxxxx - name: SHOW FEX

Loops Ansible dictionary lookup

I'm trying to generate some nginx config to implement a reverse proxy setup for various docker containers. The nginx config generation is, tentatively, generated using the below ansible playbooks. The first block is a dictionary which contains some metadata for my containers. The second block is a list of task which is included (see third block) and looped over. I can see, at the level of my second debug msg, that I have an issue with my rproxy_fe record since the debug returns nothing. net

Loops How to sort categories alphabetically with liquid?

I am trying to sort post categories alphabetically rather than chronologically in Jekyll. Each attempt I make to do so results in string to integer errors. Any suggestions? <div> {% for category in site.categories %} <div class="archive-group"> {% capture category_name %}{{ category | first }}{% endcapture %} <div id="#{{ category_name | slugize }}"></div> <h3 class="category-head"><small>{{ category_name }}</small></h3> <a

Loops How do i use a loop in maxima to plot multiple vectors?

I am trying to plot some vectors of the form [x,-y] for any point (x,y) so I tried this: for i:1 while i<=21 do (for j:1 while j<=21 do (draw2d( xrange=[0,50], yrange=[0,50], vector([i,j],[i,-j]) ) )); But the gnuplot window is gets refreshed on each iteration so I tried to put the two loops after draw2d and right before "vector" but that didn't work either.

Loops looping a ffmpeg command that joins two files

Command ffmpeg -i file-1.mp4 -vf ass=file-1a.ass burned-1.mp4 works to burn file-1a.ass subtitles on file-1.mp4 video. But each time I have to reiterate the same command on over 40 different videos and subtitles and each time I have to wait for rendering the output. So perhaps there is a way to automatically reiterate the same command on all the files. Looking for a reply found the loop command for f in *; do ffmpeg $f; But I am confused how to use it with 2 files, the .mp4 and the .ass file, an

Loops saltstack jinja for loop in parallel

hope to find you well and healthy :) I have one jinja loop which is working, unfortunately not the way I would like :| Short story: Using salt-run for orchestration, minion targeting is accomplished by passing the pre-defined nodegroup as a pillar {% set minions = salt.saltutil.runner('cache.mine', tgt=nodegroup,tgt_type='nodegroup').keys() %} {% for minion_id in minions %} patch-n1-{{ minion_id }}: salt.state: - tgt: {{ minion_id }} - sls: - patching.patch-n1 - pillar:

Loops Compare 2 lists and spot differences in google apps script

I am trying to compare 2 lists and get the value difference between them list1 = [01-0161045, 01-0161046, 01-0158587, 01-0158647, 01-0158262, 01-0158264] list2 = [01-0161045, 01-0161046, 01-0158587, 01-0158647, 01-0158262, 01-0158263, 01-0158265] In the above 2 lists, first I need to compare list2 with list1 and differences are "01-0158263" and "01-0158265". This difference needs to be spitted to a different list (say list3) list3 = [01-0158263, 01-0158265] Next, I compar

Loops Loop Through Each Character in Golang

I have a variable string in Go. How can I check if current character equals to next character? My code like this, but still error: message := "hhappy" for i, v := range message { if v[i] == v[i+1] { //print something } }

Loops What is the difference between these two blocks of Clojure code?

While working on the Clojure Koans, I had to calculate the factorial of a number iterativly, I did find the solution, but I have a question about the difference between 2 solutions, one that works and one that doens't, although I don't understand why: The one that works: (defn factorial [n] (loop [n n acc 1] (if (zero? n) acc (recur (dec n) (* n acc ))) ) The one that desn't: (defn factorial [n] (loop [n n acc 1] (if (zero? n) 1 (re

Loops Value of Fortran DO loop index after the loop

How do DO loops work exactly? Let's say you have the following loop: do i=1,10 ...code... end do write(*,*)I why is the printed I 11, and not 10? But when the loop stops due to an if(something) exit the I is as expected (for example i=7, exit because some other value reached it's limit).

Loops Arduino Leonardo stuck in a loop with infinite keyboard emulation

My Arduino is constantly spitting out keyboard commands after making an accidental error with my code. Keyboard.write('l'); Now I can't upload any new sketches. I have already tried common Arduino loops solutions like the one from here: How can I "reset" an Arduino board? The errors I get when trying to upload just before the keyboard starts shooting out code is: avrdude: stk500_getsync(): not in sync: resp=0x3f or avrdude: stk500_recv(): programmer is not responding It would

Issue with nested loops addressing separate (non-nested) hash tables

I'm having an issue figuring out how to specifically address one of two possible hash tables. Let me be clear - these hash tables are not nested, however there are two loops, one per hash table. Those loops ARE nested. Within the inner loop - the one that is iterating through the keys in WWPNTable, I want to access the current key of the hash table being iterated by the outer loop. Given the current approach (I'm reasonably new to this), I've always just used $_, however that approach is very

Loops Simple Loop In Assembly (Branch Unconditionally)

I'm trying to create a simple loop in assembly to perform an instruction until a certain condition is met. For example, I want to implement this C code in assembly: int compute_sum(int n) { i = 2; sum = 0; while(i <= n) { sum = sum + i; i = i + 4; } } The outline I made for myself is this: / ADD (compute sum) / Increment to keep track of # times passed through loop / SNA (skip if difference between user input and number is < 0) / BUN xxx (repeat) I read in user input and have

Nested table loops to format data, PL/SQL

I am trying to format data returned from a cursor to JSON by looping through the records and columns without having to explicitly call on each column name. From what I've researched this vary well may not be a simple task or at least as simple as I'm trying to make it. I'm wondering if anyone else has tried a similar approach and if they had any luck. declare type type_cur_tab is table of employees%rowtype index by PLS_integer; type type_col_tab is table of varchar2(1000) index by

Loops Continue script after do/until loop

I'm trying to create a script where an executable is installed then a batch file will add a property to a properties file of the installed program. To check for the batch file I wrote a do/until loop do { Start-Sleep -S 2 } until (Test-Path $batfile) Now it should check if the process is available and then run the .bat property cmd if ($(Get-Process -name $process -ErrorAction SilentlyContinue) -ne $null) { c:\file.bat set-property xyz true } Another idea is to check for the file until it

Loops When create different Notifications from a query in Firebase I cannot extract exactly the Title

I am able to create different notifications from different users inside a loop in firebase chat app (that update current notification correctly as messages keep coming). But as the creation of notifications are inside a loop the put.extra method of the intent to open an activity always take the last parameters.So I cannot go to the desired location from the first notification. I thought that better way is to get EXACTLY the title of the notification as exists in the notification area.This will

Loops How to get rid of trailing comma in loop?

How would I get rid of the trailing comma in this loop? outStream.print(" float on lines: "); for(int j = 0; j < intLines.length; j++){ totalFloats = totalFloats + floatLines[j]; if(floatLines[j] > 0){ outStream.printf("%d, ", floatLines[j]); } } if(totalFloats == 0){ outStream.print("none"); } outStream.println();

Nested loops in Go templates

coders. I need to render the nested struct data in go template. I wonder if it possible to do with nested loops in .gohtml template file. Here is my .gohtml code: <!DOCTYPE html> <html> <head> <meta charser="utf-8" /> <title>Go templates</title> </head> <body> <ul> {{range $city := .}} <li> name: {{$city.name}} hotels:

  1    2   3   4   5   6  ... 下一页 最后一页 共 22 页