concatenation

Simplify std::string construction involving concatenating integers in C++

做~自己de王妃 提交于 2019-12-12 02:18:13
问题 Looking for a more elegant shortcut to the following: for (int i=1; i<=maxNum; i++) { std::ostringstream s; s << i; std::string group1 = "group1_" + s.str(); std::string group2 = "group2_" + s.str(); . . . val = conf->read(group1.c_str()); . . . } Can anyone think of an elegant way like: conf->read({SOMEMACRO or function}("group1_", i)); Can this be done in place with a built-in C++ facility? Btw, boost is not an option. 回答1: Why not something like: inline std::string construct_group_id(int n

PHP Concatenating of image link in echo

独自空忆成欢 提交于 2019-12-12 01:56:37
问题 I want to echo the image such that the variables $CatSelected will be the folder of the images and $char and $i are part of the img names : e.g echo "<img src =\"Images/product/".$CatSelected."/".$char$i."s0.jpg"\>"; 回答1: echo "<img src =\"Images/product/".$CatSelected."/".$char.$i."s0.jpg\"\>"; ^ ^ 1) You forgot to concatenate $char and $i . 2) You forgot to escape the double quotes. 回答2: try this echo "<img src ='Images/product/'".$CatSelected."/".$char$i."'s0.jpg'\>"; 来源: https:/

Undefined variable when declaring with concatenation [duplicate]

自闭症网瘾萝莉.ら 提交于 2019-12-12 01:53:50
问题 This question already has answers here : PHP: Right way to declare variable before use in loop (4 answers) Closed 4 years ago . I get an undefined variable $ar, $pr and $af. $sql = mysqli_query($connection, "Select empno, username, password, access_level from personaltab where access_level='ADMIN'"); $cnt = mysqli_num_rows($sql); $i=0; while ($r=mysqli_fetch_array($sql)){ $md = md5($r['username']."!@#$%^&*()_+|"); $ar .= $md.", "; $mdp = md5($r['password']."|+_)(*&^%$#@!<>?:{}[]=-"); $pr .=

Merging multi-dimentional arrays

夙愿已清 提交于 2019-12-12 01:53:24
问题 How would I go about and merge a few multidimentional arrays to one large one, using C#? How things are set up right now i eventually get one large 2d-array that holds a a few other 2d-arrays, and I need a good way to piece the arrays together. To explain a bit better i have one array: Object[,] largeArray and each Object hold another array: Grid[,] smallArray And I want to create a large grid from the content in the smallArrays, keeping the position they had in the largeArray. So the grid at

Concatenation php string to javascript string

非 Y 不嫁゛ 提交于 2019-12-12 00:56:37
问题 I have some question about concatenation php string to javascript string ... for example: php variable $man = "Jamse"; and have javascript function <script> if (document.getElementById("fname").value == "") { q = false; msg = <?php echo 'Please fill first name'.$formErrors['fname'].'\n' ?>; } </script> i want to do something like this can anyone help me ? 回答1: alert('my name is: <?php echo $man; ?>' ); 回答2: alert('my name is: <?= $man; ?>'); Since PHP will insert $man on the server side, it's

Concatenation of Vectors in MATLAB

喜夏-厌秋 提交于 2019-12-12 00:18:36
问题 I have these 10 vectors in MATLAB, mean(alltmws{l}'), where l is from 1 to 10. The size of each of these vectors is 1X10001. Now I want to store all these values in one vector, one after the other, so that I can calculate and plot the overall mean. How can I do this concatenation? Any help will be greatly appreciated. 回答1: If you have, for example, a{1} = rand(10,1); a{2} = rand(10,1); a{3} = rand(10,1); You can do A = [a{:}]; A = A(:) EDIT: The question is ambiguous, but if it is the means

gstreamer: write both video and audo streams into a single MP4 container after concat

与世无争的帅哥 提交于 2019-12-12 00:05:49
问题 Good day, I have two mp4 files (a.mp4 and b.mp4), each of them includes video and audio streams, and I need to concatenate them into a single mp4 container (c.mp4) using gstreamer (this question is connected to the previous one) In other words, the following pipeline concatenates the content of a.mp4 and b.mp4 and then outputs the result into autovideosink and alsasink: GST_DEBUG=3 gst-launch-1.0 concat name=c2 ! videoconvert ! videorate ! autovideosink concat name=c ! audioconvert !

Can a loop cause issues with assignment in C

穿精又带淫゛_ 提交于 2019-12-11 22:55:34
问题 (This is related to a previous issue I had.) In trying to assign values from one character array to another, I'm facing a weird problem where the correct values aren't being copied but only when I use a loop. I commented out the loop and wrote out its iterations manually and it worked as I wanted it to. What could be causing this issue? //Causes incorrect data transfer for(int q=0; q<4; q++){ directory[q] = malloc(sizeof(char) * (1 + strlen(temp[q]))); strcpy(directory[q],temp[q]); } //But

Error in Querying Concatenation of 2 fields in LibreOffice Base SQL

喜欢而已 提交于 2019-12-11 18:58:59
问题 My apologies for wrong terminilogies, I am not actually a programmer, just a Base user confronted with a problem. I'm having trouble querying a column which is supposed to be a concatenation of two fields of two separate tables. I'm using LibreOffice Base Version 1:3.6.2 and it has the default HSQL engine. My two tables are as follows: Table 1 is named "Prefectures" and has the following fields: ID, "Prefecture Name" , and "State" Table 2 is named "Ward" and has the following fields: ID,

How to create one dataframe from multiple csv files in a folder

匆匆过客 提交于 2019-12-11 18:53:39
问题 I have a list of CSV files(A1.csv, A2.csv........D10.csv) in a folder which contains data two columns but several rows. Basically, I want to extract the values of last row and 2nd column from all the csv files See the picture to understand better and create a data frame which will contain file name in 1st column and the extracted values(C) in the second column. Now, I can do it by creating another list of CSV files and concatenate them later into one data frame. Is it possible to store each