concatenation

Can I concatenate environment variables in apache config?

主宰稳场 提交于 2019-12-01 07:28:10
问题 I have two environment variables in apache config, I want to concatenate them into one new environment variable. Is this possible? I realise this doesn't work, but it demonstrates the sort of thing I'm after: SetEnv one foo SetEnv two bar SetEnv three one+two ...and then 'three' would have the value "foobar" 回答1: Use a mod_rewrite regular expression with two wildcard backreferences to access the environment variables and concatenate the strings: #This will be true for any user agent

Arithmetic operation within string concatenation without parenthesis causes strange result

浪尽此生 提交于 2019-12-01 07:13:01
Consider the following line of code: <?php $x = 10; $y = 7; echo '10 - 7 = '.$x-$y; ?> The output of that is 3, which is the expected result of the calculation $x-$y. However, the expected output is: 10 - 7 = 3 My question therefore is, what happened to the string that I'm concatenating with the calculation? I know that in order to produce the result I expected, I need to enclose the arithmetic operation in parenthesis: <?php $x = 10; $y = 7; echo '10 - 7 = '.($x-$y); ?> outputs 10 - 7 = 3 But since PHP does not complain about the original code, I'm left wondering what the logic behind the

MATLAB Concatenate matrices with unequal dimensions

泄露秘密 提交于 2019-12-01 07:03:24
问题 Is there any easy way to concatenate matrices with unequal dimensions using zero padding? short = [1 2 3]'; long = [4 5 6 7]'; desiredResult = horzcat(short, long); I would like something like: desiredResult = 1 4 2 5 3 6 0 7 回答1: Matrices in MATLAB are automatically grown and padded with zeroes when you assign to indices outside the current bounds of the matrix. For example: >> short = [1 2 3]'; >> long = [4 5 6 7]'; >> desiredResult(1:numel(short),1) = short; %# Add short to column 1 >>

CSS attr() concatenation with url path [duplicate]

那年仲夏 提交于 2019-12-01 06:36:09
This question already has an answer here: string concatenation in css 5 answers How can I concatenate the CSS attr() selector with static text in a url() field? The HTML I use: <div image='/Require/static.png'></div> //Example 2 <div image='static.png'></div> //Example 3, 4, 5 For example: //image attribute contains the image name (and prefix location when needed, see example 2) div[image]:before { background-image: url('/Image/static.png'); //Works background-image: url(attr(image)); // Works background-image: url('/Image/' attr(image)); //Fails background-image: url('/Image/' #attr(image));

np.concatenate a ND tensor/array with a 1D array

邮差的信 提交于 2019-12-01 06:23:52
问题 I have two arrays a & b a.shape (5, 4, 3) array([[[ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0.10772717, 0.604584 , 0.41664413]], [[ 0. , 0. , 0. ], [ 0. , 0. , 0. ], [ 0.10772717, 0.604584 , 0.41664413], [ 0.95879616, 0.85575133, 0.46135877]], [[ 0. , 0. , 0. ], [ 0.10772717, 0.604584 , 0.41664413], [ 0.95879616, 0.85575133, 0.46135877], [ 0.70442301, 0.74126523, 0.88965603]], [[ 0.10772717, 0.604584 , 0.41664413], [ 0.95879616, 0.85575133, 0.46135877], [ 0.70442301, 0.74126523,

Javascript - set a variable using concatenation of strings [duplicate]

心已入冬 提交于 2019-12-01 05:47:51
This question already has an answer here: Use dynamic variable names in JavaScript 15 answers Is it possible to set a variable by concatenating two strings together to form the name? If at all possible I'd like to determine what variable to set based on the class names of the objects that the user clicks. I know I can hard code a bunch of if/else if statements, but it would be really cool if I could reference the variables indirectly. I was thinking something like this: var owner_read; var group_read; function setVariableIndirectly(object){ var second = object.className; // returns "read" var

How do I save a 3D Python/NumPy array as a text file?

与世无争的帅哥 提交于 2019-12-01 05:45:22
问题 I have to launch a great number of calculations, and I have to save a 2D file text each time, so I would like to store results in "real-time" as a 3D text file with each slice corresponding to one calculation result. The first calculation is OK, but when I do the second calculation, during the "np.loadtxt" step, the array dimensions become 2D... So I can't reach my aim... and I can't do a reshape when I begin to dimensions (... , ... , 1) #MY FIRST RESULTS test1 = open("C:/test.txt", "r")

How can I concatenate two files in hadoop into one using Hadoop FS shell?

旧城冷巷雨未停 提交于 2019-12-01 05:10:15
I am working with Hadoop 0.20.2 and would like to concatenate two files into one using the -cat shell command if possible (source: http://hadoop.apache.org/common/docs/r0.19.2/hdfs_shell.html ) Here is the command I'm submitting (names have been changed): **/path/path/path/hadoop-0.20.2> bin/hadoop fs -cat /user/username/folder/csv1.csv /user/username/folder/csv2.csv > /user/username/folder/outputdirectory/** It returns bash: /user/username/folder/outputdirectory/: No such file or directory I also tried creating that directory and then running it again -- i still got the 'no such file or

how can I concatenate two arrays in javascript?

微笑、不失礼 提交于 2019-12-01 04:37:52
I saw this response for extending one array with another so I tried: console.log(['a', 'b'].push.apply(['c', 'd'])); but it prints: 2 shouldn't it print: ['a', 'b', 'c', 'd'] if not what was i doing wrong? Felix Kling if not what was i doing wrong? First of all, .push returns the new length of the array: var arr = [1, 1, 1]; console.log(arr.push(1)); // 4 console.log(arr); // [1, 1, 1, 1] Second, .apply needs two arguments: The object you want to apply the function to, and an array of arguments. You only pass a single argument, so your code is basically equivalent to: ['c', 'd'].push() I.e.

Accomplishing MYSQL's Group_Concat in SQL Server [duplicate]

拜拜、爱过 提交于 2019-12-01 04:25:46
This question already has an answer here: How to concatenate text from multiple rows into a single text string in SQL server? 47 answers I'm porting an application I originally wrote to run on Apache using PHP and a MySQL database. One of the queries used the MySQL functions of Concat_WS and Group_Concat to first concatenate a few different columns into one string, and then concatenate all items that were grouped together by the Group_By clause. As an example: ID Name Candy 1 John M&Ms 1 John KitKat The query: Select Group_Concat(Concat_WS('-',Name, Candy) Separator '00--00') as UserCandy From