concatenation

Sanity Check - Concatenating Date Values - SQL Injection

We currently receive parameters of values as VARCHAR's, and then build a date from them. I am wanting to confirm that the method below would stop the possibility of SQL injection from this statement: select CONVERT(datetime, '2010' + '-' + '02' + '-' + '21' + ' ' + '15:11:38.990') Another note is that the actual parameters being passe...

How do I concatenate 2 strings in NSIS

How do I concatenate 2 strings in NSIS? ...

how can i get the total from the four different table in single query

In each table have many number of rows with amount. Like this i have different numbers of amount in each table. Each tables field name is different. How can i get the total of all values in the four tables in a single query? Any way is there? ...

Why does concatenating strings in the argument of EXEC sometimes cause a syntax error in T-SQL?

In MS SQL Server Management Studio 2005, running this code EXEC('SELECT * FROM employees WHERE employeeID = ' + CAST(3 AS VARCHAR)) gives this error: Incorrect syntax near 'CAST' However, if I do this, it works: DECLARE @temp VARCHAR(4000) SET @temp = 'SELECT * FROM employees WHERE employeeID = ' + CAST(3 AS VARCHAR) EXEC(@temp) I...

Can't concatenate 2 arrays in PHP

I've recently learned how to join 2 arrays using the + operator in PHP. But consider this code... $array = array('Item 1'); $array += array('Item 2'); var_dump($array); Output is array(1) { [0]=> string(6) "Item 1" } Why does this not work? Skipping the shorthand and using $array = $array + array('Item 2') does not work...

Help in debugging the string concatenation code

I have a code to concatenate strings. However, for some reason, the final string is not a combination of the required strings. Consider the following code : //cusEmail is of type String[] String toList = ""; for(i=0; i < cusEmail.length - 1; i++) { toList.concat(cusEmail[i]); toList.concat("; "); System.out.println(cusEmail[...

Stringification of a macro value

I faced a problem - I need to use a macro value both as string and as integer. #define RECORDS_PER_PAGE 10 /*... */ #define REQUEST_RECORDS \ "SELECT Fields FROM Table WHERE Conditions" \ " OFFSET %d * " #RECORDS_PER_PAGE \ " LIMIT " #RECORDS_PER_PAGE ";" char result_buffer[RECORDS_PER_PAGE][MAX_RECORD_LEN]; /...

How do concatenation and indexing differ for cells and arrays in MATLAB?

I am a little confused about the usage of cells and arrays in MATLAB and would like some clarification on a few points. Here are my observations: An array can dynamically adjust its own memory to allow for a dynamic number of elements, while cells seem to not act in the same way: a=[]; a=[a 1]; b={}; b={b 1}; Several elements can be ...

How to concatenate int values in java?

hi, I have the following values: int a=1; int b=0; int c=2; int d=2; int e=1; How do i concatenate these values so that i end up with a String that is 10221; please note that multiplying a by 10000, b by 1000.....and e by 1 will not working since b=0 and therefore i will lose it when i add the values up. Thnks you in advance. ...

How do you concatenate the rows of a matrix into a vector in MATLAB?

For an m-by-m (square) array, how do you concatenate all the rows into a column vector with size m^2 ? ...

Char * reallocation in C++

Hi, I need to store a certain amount of data in the "char *" in C++, because I want to avoid std::string to run out of memory, when exceeding max_size(). But the data comes in data blocks from the network so I need to use reallocation every time I get the data block. Is there any elegant solution for char * reallocation and concatenatio...

Using C preprocessor to construct a string literal for scanf?

I'm attempting to create an sscanf string literal to aid in buffer overrun prevention in C99. The goal is something like: #define MAX_ARG_LEN 16 char arg[MAX_ARG_LEN] = ""; if (sscanf(arg, "%"(MAX_ARG_LEN-1)"X", &input) > 0) The obvious "manual" solution is something like: #define MAX_ARG_LEN 16 #define MAX_ARG_CHARS "15" char...

R: how can I concatenate a vector?

I'm trying to produce a single variable which is a concatenation of two chars e.g to go from "p30s4" "p28s4" to "p30s4 p28s4". I've tried cat and paste as shown below. Both return empty variables. What am I doing wrong? > blah = c("p30s4","p28s4") > blah [1] "p30s4" "p28s4" > foo = cat(blah) p30s4 p28s4 > foo NULL > foo = paste(c...

concatenate string and running index into string within a loop

To use a given graphic package I need to define, book and fill histogram. How can I get the name of the histogram which is a string to concatenate with 2 integer as a string ( hts_i_j ) in 3 for loop instead. That has to be done in c++ See the exemple below to define TH1F* hts_5_53; TH1F* hts_5_54; …… TH1F* hts_5_69; to book hts...

Compose path (with boost::filesystem)

I have a file that describes input data, which is split into several other files. In my descriptor file, I first give the path A that tells where all the other files are found. The originator may set either a relative (to location of the descriptor file) or absolute path. When my program is called, the user gives the name of the descri...

A Tkinter StringVar() Question

I would like to create a StringVar() that looks something like this: someText = "The Spanish Inquisition" #Here's a normal variable whose value I will change eventually TkEquivalent = StringVar() #and here's the StringVar() TkEquivalent.set(string(someText)) #and here I set it equal to the normal variable. When someText changes, t...

Array Concatenation in C#

1- How to smartly initialize an Array with 2 (or more) other arrays in C#? double[] d1=new double[5]; double[] d2=new double[3]; double[] dTotal=new double[8];// I need this to be {d1 then d2} 2- Another question: How to concatenate C# arrays efficiently? Thanks ...

Speed vs security vs compatibility over methods to do string concatenation in Python

Similar questions have been brought (good speed comparison there) on this same subject. Hopefully this question is different and updated to Python 2.6 and 3.0. So far I believe the faster and most compatible method (among different Python versions) is the plain simple + sign: text = "whatever" + " you " + SAY But I keep hearing and r...

C++ Preprocessor string literal concatenation

I found this regarding how the C preprocessor should handle string literal concatenation (phase 6). However, I can not find anything regarding how this is handled in C++ (does C++ use the C preprocessor?). The reason I ask is that I have the following: const char * Foo::encoding = "\0" "1234567890\0abcdefg"; where encoding is a stati...

[Python]String and integer concatenation

Hi, I want to create string in a for. # Create string0, string1 ..... string10 for i in range [1,10]: string="string"+i But I have returned an error because i is not a string but integer. How I can do it? Thanks. ...