I'm curious to know if it's possible to bind an array of values to a placeholder using PDO. The use case here is attempting to pass an array of values for use with an IN() condition.
I'm not very good at explaining, so here's some psuedocode to demonstrate... I'd like to be able to do something like this:
<?php
$ids=array(1,2,3,7,8,9);...
I come from a php background and in php, there is an array_size() function which tells you how many elements in the array are used. Is there a similar method for a String[] array?
thanks
...
I'm fairly new to C++ and don't quite understand function parameters with pointers and references. I have an array of Cards that I want to shuffle using the Fisher-Yates shuffle. The deck is declared as
Card *deck[deckSize];
where deckSize has been declared as 24. The array is then initialized.
I then call the shuffle function:
v...
Here's the thing:
object[] arrayText = new object[1];
if (arrayText[1] == null)
{
MessageBox.Show("Is null");
}
We know that is going to be null, but it throws an exception, but I don't want to handle it in a try/catch block because that is nested in a loop and try/catch will slow it down, also it doesn't look really good:
objec...
I'm sorry about the naive question. I have the following:
public Array Values
{
get;
set;
}
public List<object> CategoriesToList()
{
List<object> vals = new List<object>();
vals.AddRange(this.Values);
return vals;
}
But this won't work because I can't type the array. Is there any way to easily fix the code above or, in g...
Hi,
when i serialize an array of Int32 using the BinaryFormatter, i get about 400MB/s (100 million items in one second), but when i try to serialize an array of DateTime, i get only a throughput of about 27MB/s (100 million items in 30 seconds). One DateTime occupies eight bytes in serialized form. I guess that the BinaryFormatter uses ...
Is there a way of iterating through an array but performing an operation on every other element?
ie If I have an array with 13 elements how do I do something to only elements 2,4,6,8,10 and 12?
...
I've always wanted to be able to use the line below but the C# compiler won't let me. To me it seems obvious and unambiguos as to what I want.
myString.Trim({'[', ']'});
I can acheive my goal using:
myString.Trim(new char[]{'[', ']'});
So I don't die wondering is there any other way to do it that is closer to the first approach?
...
I got thousands of data inside the array that was parsed from xml.. My concern is the processing time of my script, Does it affect the processing time of my script since I have a hundred thousand records to be inserted in the database? I there a way that I process the insertion of the data to the database in batch?
...
Hi there. I'm writing an app that revolves around getting sets of numerical data from a file. However, since the data is acquired in string form, I have to convert it to floats, which is where the fun starts. The relevant section of my code is as shown (lines 65-73):
ft = []
puts "File Name: #{ARGV[0]}"
File.open(ARGV[0], "r...
I want to combine the [word] part of each array with " ",the array structure as follows:
Array ( [0] => Array ( [word] => Hello [off] => 0 [len] => 5 [idf] => 4.0235948562622 [attr] => en ) [1] => Array ( [word] => , [off] => 5 [len] => 1 [idf] => 0 [attr] => un ) [2] => Array ( [word] => long [off] => 6 [len] => 4 [idf] => 3.4657359123...
Hi,
I have a class and I want to have some bit masks with values 0,1,3,7,15,...
So essentially i want to declare an array of constant int's such as:
class A{
const int masks[] = {0,1,3,5,7,....}
}
but the compiler will always complain.
I tried:
static const int masks[] = {0,1...}
static const int masks[9]; // then initializing ...
How do I check for a string occurance in an array? I mean sure I can loop, but is there a standard function?
at first I did:
if(str in ["first", "second", "third"])
but it complained that in only works with associative arrays.
I tried to quickly lookup the phobos docs but didn't find any module related to arrays.
So is there anythi...
I have an alphanumeric string like below,
$string_1 = "a4nas60dj71wiena15sdl1131kg12b"
and would like to change it to something like below,
$string_2 = "a4NaS60dJ71wIeNa15Sdl1131Kg12B"
How would I go about doing this? I have tried the below code, but it doesn't work.
$lenght = strlen($string_1);
for ( $i = 0; $i <= $length - 1; ...
I'm getting the error Invalid argument supplied for foreach() even though the array being supplied appears to be a valid array. Here's my code:
print_r($keywords);
extract($product);
foreach ($keywords as $k=>$v)
{
//stuff here
}
Here's some of the output from the print_r:
Array
(
[0] => Array
(
[text] => v...
I have an array that has keys and values. For eg:
Array (
[name] => aalaap
[age] => 29
[location] => mumbai
)
I want to convert the keys from this into values, but I want the values to apear right after the keys. For eg:
Array (
[0] => name
[1] => aalaap
[2] => age
[3] => 29
[4] => location
[5] => ...
Hi,
I am writing some small games in Python with Pygame & Pyglet as hobby projects.
A class for 2D array would be very handy. I use py2exe to send the games to relatives/friends and numpy is just too big and most of it's features are unnecessary for my requirements.
Could you suggest a Python module/recipe I could use for this.
-- C...
I was wondering if it was possible to apply effects to retrieved elements within an array.
I know I can output the contents of the array via the: .text() or the .html() functions in jQuery. But I have been trying to fadeIn() the content, and it never works.
How can I accomplish this?
...
Hi, I'm a noob and wrote a whole program without knowing the easy way to find an element in an array...
my_array.indexOf("find this value");
Is indexOf a lot better than storing how many elements are in an array, and looping through the array until you find the element you want? I could have simplified my code alot.
I tried to make ...
I'm trying to sort a pair of int arrays (int[] a; int[] b;)
If I use Array.Sort(a,b) then the performance is great.
However, I'd prefer to use a List<> and load the int pairs in a struct.
I can get this to work using Array.Sort() with an overload that provides a simple comparer for the struct but it's about 4 times slower than the Arra...