loops

Wordpress loop with different bootstrap columns

ぐ巨炮叔叔 提交于 2021-02-11 15:33:03
问题 i need to create a wordpress loop where the first post will be col-md-12 and the next 4 posts will be col-md-6 <div class= "col-md-12"> </div> <div class= "col-md-6"> </div> <div class= "col-md-6"> </div> <div class= "col-md-6"> </div> <div class= "col-md-6"> </div> and then <div class= "col-md-12"> </div> <div class= "col-md-6"> </div> <div class= "col-md-6"> </div> <div class= "col-md-6"> </div> <div class= "col-md-6"> </div> 回答1: may be this can help : <?php if ( have_posts() ) { $counter

Add wait between loop controllers in jmeter

梦想与她 提交于 2021-02-11 15:02:31
问题 How to add wait of 30 sec. in between 2 loop controller? Each loop controller has loop count 10. Scenario: 1.No. of threads=5 2.For each user, No. of loop controllers=5 Loop_controller_1(count=10, i.e. 10 HTTP request) Wait for 10 sec Loop_controller_2(count=10 i.e. 10 HTTP request) wait for 10 sec Loop_controller_3(count=10 i.e. 10 HTTP request) wait for 10 sec Loop_controller_4(count=10 i.e. 10 HTTP request) wait for 10 sec Loop_controller_5(count=10 i.e. 10 HTTP request) wait for 10 sec

Can there be an efficient way for the dual loops?

拈花ヽ惹草 提交于 2021-02-11 14:22:53
问题 I got a question in exam where I was given an array a a = [9,8,10,2] what I need to do is cross iterate the array on itself and get the concatenation of all the possible elements i.e a*a Once all elements are concatenated in that order, then I need to sum them up. My code is in the snippet: Also tried in PHP function sumIt($a) { $totalSum = 0; $len1 = count($a); for($i = 0; $i < $len1; $i++){ for($ii = 0; $ii < $len1; $ii++) { $totalSum += $a[$i].''.$a[$ii]; } } return $totalSum; } The input

Python switching multiple positions in string each to multiple letters

亡梦爱人 提交于 2021-02-11 14:20:20
问题 I am trying to write a python code that finds restriction enzyme sites within a sequence of DNA. Restriction enzymes cut at specific DNA sequences, however some are not so strict, for example XmnI cuts this sequence: GAANNNNTTC Where N can be any nucleotide (A, C, G, or T). If my math is right thats 4^4 = 256 unique sequences that it can cut. I want to make a list of these 256 short sequences, then check each one against a (longer) input DNA sequence. However, I'm having a hard time

How to use a loop to delete all rows with negative values in R

大城市里の小女人 提交于 2021-02-11 13:56:26
问题 I am new to loops. I have an unwieldy data frame that I want to cut down so that only observations (rows) without negative numbers remain. Here is where I'm stuck. This creates a null value every time instead of a trimmed down data frame. mydata=for (i in names(df)) { subset(df, df[[ paste(i)]]>=0) } 回答1: How about a purely vectorised solution: DF[!rowSums(DF < 0), ] # ID Items Sequence #1 1 D 1 #2 1 A 2 #5 2 B 2 Data DF=structure(list(ID = c(1, 1, 1, -1, 2), Items = c("D", "A", "A", "A", "B"

Ansible Loop and Update Dict

社会主义新天地 提交于 2021-02-11 13:53:47
问题 I'm trying to use Ansible to loop through a nested dict and add a new key:value. I'm able to add a value using combine to the top-level dict but unsure how to update the value dict. I see that loop can be used to iterate through the dict but how can update be done at the same time? My Dict {'host-a': {'os': 'Linux', 'port': '22', 'status': 'Running'}, 'host-b': {'os': 'Linux', 'port': '22', 'status': 'Running'}, 'host-c': {'os': 'Linux', 'port': '22', 'status': 'Running'}} I'm able to append

Replace values in a column with specific row value from same column using loop

落爺英雄遲暮 提交于 2021-02-11 13:50:09
问题 I have data obtained from a survey that lists the recipient's name and whether or not they selected a specific county in the state. The survey structure outputs an off for any county not selected and an for the selected county. The state has about 100 counties so there end up being a lot of columns that really correspond to the same question. What I am looking to do is replace any cells with on with the county name and any cells with off with a blank. From there I can basically unite many

how to loop to create subplots in Plotly, where each subplot has a few curves on it?

筅森魡賤 提交于 2021-02-11 13:46:34
问题 I already wrote below nested loops to generate 21 charts with success (one chart for each country, for example german gas austrian gas) dfs is a dict with 21 countries names as keys and their respective gas storage dfs as values for country in list(dfs_storage.keys()): df_country=dfs_storage[country] month = list(set(df_country['month'])) fig = go.Figure() for year in set(df_country['year']): workingGasVolume_peryear=df_country.loc[df_country['year']==year,'workingGasVolume'] gasInStorage

how to loop to create subplots in Plotly, where each subplot has a few curves on it?

旧时模样 提交于 2021-02-11 13:45:16
问题 I already wrote below nested loops to generate 21 charts with success (one chart for each country, for example german gas austrian gas) dfs is a dict with 21 countries names as keys and their respective gas storage dfs as values for country in list(dfs_storage.keys()): df_country=dfs_storage[country] month = list(set(df_country['month'])) fig = go.Figure() for year in set(df_country['year']): workingGasVolume_peryear=df_country.loc[df_country['year']==year,'workingGasVolume'] gasInStorage

Discord py more than one tasks.loop at the same time?

柔情痞子 提交于 2021-02-11 13:30:49
问题 How can I have more than one loop running ate the same time using the same function but using different parameters like: @tasks.loop(seconds = 10) async def loop(name): Print(name) loop.start("Jon") loop.start("Joseph") Is this how u pass parameters to loops? 回答1: You need to create a new Loop object for each loop. You can do this by using regular function calling repeatedly instead of the decorator: async def loop(name): print(name) names = ["Jon", "Joseph"] loops = {name: tasks.loop(seconds