96,659 questions
3
votes
3
answers
64
views
awk command to subtract constant from a column and print results
I was working on a one-liner to subtract a constant value (e.g. 100 in this case) from a specific column using awk. So far I can manage to get to where I can print the last iteration only – which ...
1
vote
0
answers
61
views
Jacobi Method on Python stopping at 3rd iteration [closed]
I am trying to code a jacobi algorithm w/o using matrices on python. The code I came up with looks fine but it stops at 3rd iteration even though the error is still pretty much large.
ps. I am not an ...
0
votes
0
answers
145
views
As part of a function, how could I create a variable number of sums one inside another based on a parameter?
I'm currently struggling on an assignment (probability class) which require creating a function (VBA excel) that contains a variable number of sums one inside the other based on a parameter. I'm not ...
-1
votes
0
answers
63
views
Python list of tuples while iterating unable to see an element but when printing it can see the element [closed]
I am using regular expression to get the filenames and count from a SAS log using Python. Pattern I am using
pattern = re.compile(r'filename="([^"]+_\d{8})".*?Note:\s+There were (\d+)', ...
Advice
1
vote
8
replies
133
views
Making a palindrome out of a string of random letters (or any given value type inputs)
Found this code exercise on W3R. Been trying to figure out the relationship between the outer and inner loop (i and j), but can't seem to wrap my head around it. If anyone could walk me through this ...
Best practices
1
vote
0
replies
66
views
Ansible: mysql_query loop and some rows for each
How can I manage a mysql_query result when query is looping a list and if each queries iteration returns some rows?
I want the results to be stored in a dictionary. Then I will check if each perm is ...
Best practices
0
votes
2
replies
125
views
Looping Datasets in R
Essentially I am trying to create a dataset that is dependent on prior rows to generate values for any given row. I then would like to run this loop over many IDs for an entire dataset. Current set up ...
0
votes
2
answers
107
views
Excel Macro Loop. Looking for code to loop through entire workbook
I am new to making macros and have basically no experience with VBA. However, I have managed to cobble together the code below.
The code is supposed to load data from a worksheet (the name of which I ...
3
votes
0
answers
98
views
How can I plot diagonals of matrix?
I want to plot all the diagonals of a matrix. In the matrix row 1 contains information of time 1, row 2 of time 2 etc etc. Each diagonal presents the evolution of the number of fishes in a cohort that ...
Advice
0
votes
4
replies
75
views
Calculating resistance and resilience of a soil microbial community
I want to calculate resistance and resilience of the soil microbial community in my experiment.
I have an experimental design with 4 treatments: ambient (control), drought, warmed, and warmed & ...
3
votes
1
answer
126
views
How to write an accumulative recursive function in J without looping
At the risk of asking a question with an obvious solution: if I have a function in J that takes two arguments and returns two arguments and I want to accumulate the answer's second argument and to use ...
0
votes
1
answer
84
views
How can I create triangles and squares with a for loop?
I used this method to draw squares and triangles on the paint box:
procedure squarClick(Sender: TObject);
begin
canvas.Pen.Color := clgreen;
canvas.Pen.Style := psSolid;
canvas.Pen.Width :...
0
votes
0
answers
81
views
Plotting xts object in loop fails [duplicate]
I want to plot several time series (xts) in R in a loop. However, that does not work, I only get "empty" devices. So I wrote a little test:
library('xts')
testdata <- c(1:100)
testdata....
1
vote
1
answer
72
views
Scheme: calling `define-syntax-rule` in a loop
I wonder whether it is possible to call define-syntax-rule in a loop-like construction like for-each. I explicitly say 'loop-like' because I know that normal Scheme evaluation comes after macro ...
-3
votes
1
answer
131
views
Console.ReadLine in a Task causing side effects [duplicate]
I want to loop and ask user if he wants to continue. If no answer for a while, loop anyway.
while (true)
{
Console.WriteLine("\nDo you want to continue? (Type 'no' or 'exit' to break, or wait ...