I have a largish table of data pulled from my database (~1500 rows, each with 10-15 fields) and I'm doing a number of filters and generating some stats and storing these in an excel spreadsheet for the user to download.
Rather than hit the database with the same fairly-complicated query over and over with only minor modifications (to th...
Hi,
I want to split a string in C# that looks like
a : b : "c:d"
so that the resultant array will have
Array[0] = "a"
Array[1] = "b"
Array[2] = "c:d"
what regexp do I use to achieve the required result.
Many Thanks
...
I want to be able to effectively search an array for the contents of a string.
Example:
dim arr() as string={"ravi","Kumar","Ravi","Ramesh"}
I pass the value is "ra" and I want it to return the index of 2 and 3.
How can I do this in VB.NET?
...
Let's say I have an array, and I want to do a LINQ query against a varchar that returns any records that have an element of the array anywhere in the varchar.
Something like this would be sweet.
string[] industries = { "airline", "railroad" }
var query = from c in contacts where c.industry.LikeAnyElement(industries) select c
Any id...
Hey,
Say I am echoing a large amount of variables in PHP and I wont to make it simple how do i do this? Currently my code is as follows but it is very tedious work to write out all the different variable names.
echo $variable1;
echo $variable2;
echo $variable3;
echo $variable4;
echo $variable5;
You will notice the variable name is th...
My understand has always been that when I declare an array on the stack with a size that comes in as a variable or parameter, I should get an error.
However, I noticed that I do not get any error if I do not explicitly initialize the array (yes, it won't be on the stack, but I'm wondering about the lack of error).
For example, the foll...
Is there an easy way to reference a column in a 2-D array as a separate 1-D array in plain old C (not C++ or C#)? It's easy to do this for a row. Asssume I have 2 functions:
double doSomethingWithARow( double theRow[3] );
double doSomethingWithACol( double theCol[100] );
Then, I might use the first one like this:
double matrix[100][3...
The program is supposed to calculate the number of arguments, iterate over the list of arguments, for each argument convert the argument to an integer and copy it to an array, iterate over the elements of the array, adding the value of each one to a variable (this computes the sum of elements), and print the sum. There will not be more t...
Hi all,
I must convert a char into a byte or a byte array. In other languages I know that a char is just a single byte. However, looking at the Java Character class, its min value is \u0000 and its max value is \uFFFF. This makes it seem like a char is 2 bytes long.
Will I be able to store it as a byte or do I need to store it as ...
Hi, how to compare value in an array?
I have array named list which contains 12 elements. I see if value in index 0 is equal or not equal to value in index 2.
I have tried this code but it doesnt seems to work.
if ((list.get(0)==list.get(2) && list.get(1)==list.get(3))
{
System.out.println("equal")
}
...
This is valid code:
void func(IEnumerable<string> strings){
foreach(string s in strings){
Console.WriteLine(s);
}
}
string[] ss = new string[]{"asdf", "fdsa"};
func(ss);
What I want to know is, how does the implicit conversion string[] -> IEnumerable<string> work?
...
I have an array of arrays - information about selection in Excel using VSTO, where each element means start and end selection position.
For example,
int[][] selection = {
new int[] { 1 }, // column A
new int[] { 6 }, // column F
new int[] { 6 }, // column F
new int[] { 8, 9 } // columns H:I
new int[] { 8, 9 } // columns H:I
new int[] ...
I asked a question yesterday about comparing ranges for overlap and its been stuck in my throat ever since.
The consensus seems to be that my preferred answer which involves using the array intersection operator (&), is inefficient because comparing arrays is costly.
I wonder then, why this feature is in the language? Could it be that ...
I have problem with comparing the value of array elements.
e.g. I wanted to compare the value of index 0 and index 2, and index 1 to index 3 and so on.
With the code below I suppose to get the result of numOfdifferentShape is 2 but I get 3.
How can I solve this problem? :-(
int numOfdifferentShape=0;
myArray = {40.0, 40.0, 40.0, 40.0,...
I have a series of checkboxes and input type="text" areas, wherein I need to have the state of the checkbox set to true when the value in the text area changes. Simple enough. I've done this successfully:
<input name="fixed" type="checkbox">
<input name="stuff" type="text" onchange="this.form.fixed.checked=true">
Which works fine. ...
int A = 300;
int B = 400;
int C = 1000;
int D = 500;
int []abcd = {A,B,C,D};
Arrays.sort(abcd); // the sequence of array elements will be {300, 400, 500,1000}
I wanted to change the value of the variables A,B,C,D according to their location in the array after sorting.
e.g variable A is located at index 0, so the value of A change t...
Alright, I think we all agree that what happens with the following code is undefined, depending on what is passed
void deleteForMe(int* pointer)
{
delete[] pointer;
}
The pointer could be all sorts of different things, and so performing an unconditional delete[] on it is undefined. However, let's assume that we are indeed passing...
if i have an array. can i populate a generic list from that array:
Foo[] fooList . . . (assume populated array)
// This doesn't seem to work
List<Foo> newList = new List<Foo>(fooList);
...
I am trying to return a binary from the DB using linq for display in the browser. The method below using ado.net works but I am trying to ypgrade to linq but the linq version returned the error.
Public Sub ProcessRequest(ByVal context As System.Web.HttpContext)
Dim imageId As String = context.Request.QueryString("id")
Dim r...
I'm working on a small little thing here for school. After hours of researching, and a ton of errors and logic reworking I've almost completed my little program here.
I'm trying to take user input, store it into the string, get a character array from the string ( dont ask why, I just have to put this into a character array ), then get t...