for-loop

how to use nodemailer in nodejs for bulk data sending?

我是研究僧i 提交于 2021-02-11 06:08:16
问题 i have nodemailer code below, its fine and working.My problem is to send individual data to individual email. id_array have two emails and no_array have two individual data, How do i send "1" to prayag@cybrosys.in and "2" to blockchain@cybrosys.net? var id_array = ["prayag@cybrosys.in","blockchain@cybrosys.net"]; var no_array = ["1","2"]; var mailer = require("nodemailer"); // Use Smtp Protocol to send Email var smtpTransport = mailer.createTransport({ service: "Gmail", auth: { user: "mymail

How to extract all matching patterns (words in a string) in a dataframe column?

妖精的绣舞 提交于 2021-02-11 06:05:49
问题 I have two dataframes. one ( txt.df ) has a column with a text I want to extract phrases from ( text ). The other ( wrd.df ) has a column with the phrases ( phrase ). both are big dataframes with complex texts and strings but lets say: txt.df <- data.frame(id = c(1, 2, 3, 4, 5), text = c("they love cats and dogs", "he is drinking juice", "the child is having a nap on the bed", "they jump on the bed and break it", "the cat is sleeping on the bed")) wrd.df <- data.frame(label = c('a', 'b', 'c',

Batch script multiple choice menu

我只是一个虾纸丫 提交于 2021-02-11 00:20:07
问题 I have multimedia file viewing software that I call in a batch script to load files using an /LOADFILES argument. This argument accepts multiple files separated by semicolons ";". What I would like is a menu from which I can select the files I want to open. For example : Sample_01 Sample_02 Sample_03 Sample_04 Sample_05 All What is your choice ? And what we have selected ends up stored in a variable which is interpreted by the /LOADFILES argument. For now, my script is able to open all the

Sum Values of Every Column in Data Frame with Conditional For Loop

喜你入骨 提交于 2021-02-10 23:27:32
问题 So I want to go through a data set and sum the values from each column based on the condition of my first column. The data and my code so far looks like this: x v1 v2 v3 1 0 1 5 2 4 2 10 3 5 3 15 4 1 4 20 for(i in colnames(data)){ if(data$x>2){ x1 <-sum(data[[i]]) } else{ x2 <-sum(data[[i]]) } } My assumption was that the for loop would call each column by name from the data and then sum the values in each column based on whether they matched the condition of column x. I want to sum half the

PHP for loop adding commas

岁酱吖の 提交于 2021-02-10 21:25:37
问题 I have this for loop: for($i=0; $i < $N; $i++) $require_1 .= $require[$i] . " "; I would like it to place a comma on the end of the first word, if there's 2 words in the string. However if there's only 1 word in the string I want it left alone. I understand I need to use an if statement, based on $i . However I'm not sure how I do this. 回答1: This is a trick I use a lot to make strings like that, $require_1 = ""; for ($i = 0; $i < $N; $i++) { if ($require_1 == '' || $require_1 == '&') {

PHP for loop adding commas

南楼画角 提交于 2021-02-10 21:21:38
问题 I have this for loop: for($i=0; $i < $N; $i++) $require_1 .= $require[$i] . " "; I would like it to place a comma on the end of the first word, if there's 2 words in the string. However if there's only 1 word in the string I want it left alone. I understand I need to use an if statement, based on $i . However I'm not sure how I do this. 回答1: This is a trick I use a lot to make strings like that, $require_1 = ""; for ($i = 0; $i < $N; $i++) { if ($require_1 == '' || $require_1 == '&') {

PHP for loop adding commas

心不动则不痛 提交于 2021-02-10 21:20:34
问题 I have this for loop: for($i=0; $i < $N; $i++) $require_1 .= $require[$i] . " "; I would like it to place a comma on the end of the first word, if there's 2 words in the string. However if there's only 1 word in the string I want it left alone. I understand I need to use an if statement, based on $i . However I'm not sure how I do this. 回答1: This is a trick I use a lot to make strings like that, $require_1 = ""; for ($i = 0; $i < $N; $i++) { if ($require_1 == '' || $require_1 == '&') {

Loop through dataset to calculate diveristy

心不动则不痛 提交于 2021-02-10 20:01:35
问题 I have a dataset like so: set.seed(1345) df<-data.frame(month= c(rep(1,10), rep(2, 10), rep(3, 10)), species=sample(LETTERS[1:10], 30, replace= TRUE)) I would like to loop through each month and calculate species diversity. I am aware of functions like diversity in library("vegan") , and know solutions to my question using that route (code provided below), but as an exercise for myself with loops I am trying to create a for loop or function that shows the specific calculations for Shannons

R - how to filter data with a list of arguments to produce multiple data frames and graphs

自闭症网瘾萝莉.ら 提交于 2021-02-10 18:30:43
问题 I am looking for a way to use a list of filter arguments to produce different objects. I have a data set for which I want to make several graphs. However, I want all these graphs based on subsets of the dataset. For illustrative purposes I have made the following data. df <- data.frame(type = c("b1", "b2", "b1", "b2"), yield = c("15", "10", "5", "0"), temperature = c("2", "21", "26", "13"), Season = c("Winter", "Summer", "Summer", "Autumn"), profit = c(TRUE, TRUE, FALSE, FALSE)) Also, I have

Converting “for” loop to “while” loop

╄→尐↘猪︶ㄣ 提交于 2021-02-10 18:12:06
问题 I´m currently working on my semester work and this is a piece of my code. As you can see there is a for loop with some if statements where I am working with a structure. I was thinking of converting this for loop onto a while loop but I´m not quite sure how. Maybe someone may give me a hint? for(X = 1; X <= 100; X++) { if(structure[X].number == -1) { structure[X].number = number; structure[X].first_info = position; structure[X].second_info = position; break; } if(structure[X].number == number