Accessing the index in 'for' loops?

How do I access the index in a for loop like the following? ints = [8, 23, 45, 12, 78] for i in ints: print('item #{} = {}'.format(???, i)) I want to get this output: item #1 = 8 item #2 =...

Python: How to tell the for loop to continue from a function?

Sometimes I need the following pattern within a for loop. At times more than once in the same loop: try: # attempt to do something that may diversely fail except Exception as e: ...

sql - insert if not exists

I am having trouble with a sql query. I need to insert a row if the same row does not exist already. This is what I have so far: DECLARE BEGIN FOR FOLDER_ROW IN (SELECT FOLDERID, USERID FROM...

single line for statement: %%i 'unexpected at this time'

for /r %%i in (*) do (echo %%i) Results in %%i was unexpected at this time Why?

Looping through the elements of a path variable in Bash

I want to loop through a path list that I have gotten from an echo $VARIABLE command. For example: echo $MANPATH will return /usr/lib:/usr/sfw/lib:/usr/info So that is three different paths, each...

R: putting a function and for loop together to create a function

I'm trying to reverse and invert to see if the digits to see if they are the same when the numbers are upside down I got up to this far and im confused... revdigits = function(n)...

How to copy an array in Bash?

I have an array of applications, initialized like this: depends=$(cat ~/Depends.txt) When I try to parse the list and copy it to a new array using, for i in "${depends[@]}"; do if [ $i #isn't...

Inverting audio in Java

I am new to Java and I want to know how to invert audio (fixed voice inversion) coming from the input through a loopback to the output after a delay. How and where would I do this, and would I be...

Python: subprocess.popen: read each line of output

I'm having trouble reading my subprocess output by line. The subprocess simply greps the contents of a file against another file. The output, which should be a two column file, prints to stdout...

Using for loop to move files from subdirectories to parent directories

I just made the switch to linux and I am trying to write my first bash script. I have a folder that contains numerous folders, all with subfolders containing files. Something...

SpriteKit Animations

I have this code that does the animation that I want to be executed over the entire time I'm holding down a button that I've created. However I would like this to repeat while the button is being...

How to downgrade all ports on FreeBSD

I have FreeBSD 7.2 on my server. Trying to install some archiver, I upgraded all ports with commands portsnap fetch, portsnap extract. And now when I try to compile any program with make, I get a...

Insert picture corresponding to cell value using excel macro

I'm using the macro below to insert the picture corresponding to the value in Cell P2 into cell Q2. This works for the one cell selected (P2 in this case). I want to create a loop to do the same...

Infinite for loops possible in Python?

Is it possible to get an infinite loop in for loop? My guess is that there can be an infinite for loop in Python. I'd like to know this for future references.

Append existing excel sheet with new dataframe using python pandas

I currently have this code. It works perfectly. It loops through excel files in a folder, removes the first 2 rows, then saves them as individual excel files, and it also saves the files in the...

How do I annotate types in a for-loop

I want to annotate a type of a variable in a for-loop. I tried this: for i: int in range(5): pass But it didn't work, obviously. What I expect is working autocomplete in PyCharm...

How to change log level only for current thread with Logback

In Logback, the log level of a logger can be changed with setLevel() method. But in Logback, because the loggers are singleton, the call of setLevel() method will affect to all other threads that...

Splitting multiple columns at once in R

I am trying to split my data frame which has 354 (a1-a354) columns. Example: a1 a2 1 aa aa 2 bb bb 3 cc cc Currently, I am using the following code: df1<- extract(df1,1, c("D","M"),...

How to calculate rank from total points in aggregate pipeline for gaming application

I am working on gaming application will have thousands of users. My current aggregate pipeline output [ { "USERID": "U0004", "Total_Points": 10 }, { "USERID":...

Need help reading shift register via SPI

I am trying to decode the signals going to shift registers in my washing machine. The registers are STP16CPC05 which also happen to be LED drivers. I am trying to get status from my washing...

Adding roles to a mentioned user in JDA

I want to be able to run a command that begins with !suspend, mentions a user, then determines a time length and adds a role named 'Suspended' to the mentioned user for the specified time length. ...

Pygame drawing not showing in Pygame window

So I was testing out pygame and I wanted to draw a simple rectangle. There are no error messages when I run the code but the rectangle doesn't show up in the window. What I see is a blank white...

SetState using the foreach loop does not work

I am trying to update the state using the following code: handleCheckBox = () => { this.setState(({isCheckd}) => ({isCheckd: !isCheckd, isEnable: !isCheckd}), () => ...

Never entering in cursor.moveToNext() in Android SQLite

I'm trying Official Documentation for Android this article. Creating Database, Table and inserting data is working fine. But I'm unable to get data from database. Here is the piece of code to...

Using Multiple Asyncio Queues Effectively

I am currently building a project that requires multiple requests made to various endpoints. I am wrapping these requests in Aiohttp to allow for async. The problem: I have three Queues: queue1,...

React Native localhost Another debugger is already connected

Not sure if anyone had this problem, since I could not look it up anywhere but I cannot see any logs for react native app because the browser console tells me that "Another debugger is already...

How to access $children in Vue 3 for creating a Tabs component?

I'm trying to create a Tabs component in Vue 3 similar to this question here. <tabs> <tab title="one">content</tab> <tab title="two" v-if="show">content</tab> <!-- this fails --> <tab...

How to check if an array is in sequential and consecutive order in elixir

I want to know if there's a way I could find out if an array is in sequential order and consecutive. For example arr=[1,2,3,4,5] Arr would return true since it is sequential and...

Issue with WiFiNINA to get JSON data

I'm trying to do a GET request to my weather forecast API service with an Arduino nano 33 IoT but I can't parse JSON data because the code output also other information inside the string, is there...

Provided region_name '"$region"' doesn't match a supported format for Windows (CMD)

I am trying to deploy ECS using Terraform and it's throwing the above error while I am Provisioning the ECR this is happening. It tried removing the double quotes, then enabled trace for...