8
голосов
2ответов
30609 просмотров

Как использовать ассоциативный массив Oracle в запросе SQL

ODP.Net предоставляет возможность передавать ассоциативные массивы в качестве параметров в хранимую процедуру Oracle из C #. Это хорошая функция, если вы не пытаетесь использовать данные, содержащиеся в этом ассоциативном массиве, в запросе sql. Причина в том, что для этого требуется переключ...

1
голосов
3ответов
128 просмотров

Использование значений ассоциативного массива из одного и того же массива

Я пытаюсь получить доступ к ключу и значению ассоциативного массива из того же массива.Если в моем массиве 3 пары.Могу ли я использовать значение, скажем, something и other в третьем another? $gar = array("something" => "something value", "other" => "other value", ...

2
голосов
5ответов
4266 просмотров

Нахождение последней пары в ассоциативном массиве

Я просматриваю ассоциативный массив с помощью foreach.Я хотел бы иметь возможность проверить, является ли обрабатываемая пара значений ключа последней, чтобы я мог уделить ей особое внимание.Есть идеи, как я могу сделать это наилучшим образом? foreach ($kvarr as $key => $value){ // I'd l...

0
голосов
4ответов
2677 просмотров

Как создать и добавить анонимные хэши к известному хешу во время выполнения скрипта?

Я попытаюсь проиллюстрировать это на примере.Возьмем общий пример хэша хешей: my %HoH = ( flintstones => { lead => "fred", pal => "barney", }, jetsons => { lead => "george", wife => "jane", "his boy" => "elroy...

1
голосов
2ответов
333 просмотров

XML против массива во Flash

При обработке данных во Flash, какой формат данных обеспечивает более высокую скорость поиска и обработки, XML или вложенные ассоциативные массивы?Это означает, что в настоящее время я отправляю данные в виде строк во Flash-клиент (я не хочу загружать XML-файл), но я не уверен, лучше ли форматир...

2
голосов
3ответов
8053 просмотров

Comparing two lists with a shell script

Suppose I have two lists of numbers in files f1, f2, each number one per line. I want to see how many numbers in the first list are not in the second and vice versa. Currently I am using grep -f f2 -v f1 and then repeating this using a shell script. This is pretty slow (quadratic time hurts). Is ...

44
голосов
6ответов
47822 просмотров

Finding the minimum value's key in an associative array

In PHP, say that you have an associative array like this: $pets = array( "cats" => 1, "dogs" => 2, "fish" => 3 ); How would I find the key with the lowest value? Here, I'd be looking for cats. Is there some built in PHP function that I've missed which does this? It would ...

3
голосов
4ответов
2091 просмотров

Java: What data structure to use to imitate PHP's associative arrays?

I want a data structure that allows me to map keys to values, like PHP's associative arrays. Each key can only exist once, but a value can be mapped to any number of keys. What am I looking for? Something in the Google Commons Collections?

1
голосов
4ответов
1346 просмотров

convert associate array to XML in php

How do i convert an associate array to an XML string? I found this but get the error 'Call to a member function addChild() on a non-object' when running the line $node = $xml->addChild($key);

3
голосов
3ответов
485 просмотров

Add an associated pair to a PHP array

I have an array, i tried writing array_push($json['Request']['Header'], "key" => "val"); but i received an error. Writing the below works but it adds an array instead of just the key/val array_push($json['Request']['Header'], array("key" => "val")); .. [0] => Array ( ...

34
голосов
8ответов
46425 просмотров

Does powershell have associative arrays?

I am writing a function that returns an id, name pair. I would like to do something like $a = get-name-id-pair() $a.Id $a.Name like is possible in javascript. Or at least $a = get-name-id-pair() $a["id"] $a["name"] like is possible in php. Can I do that with powershell?

586
голосов
15ответов
450459 просмотров

How to define hash tables in Bash?

What is the equivalent of Python dictionaries but in Bash (should work across OS X and Linux).

5
голосов
4ответов
1041 просмотров

Can I use an stl map if I plan to use arbitrary class objects as the key?

I'm new to STL. The thing stumping me about using a map to store arbitrary objects: std::map<MyClassObj, MyDataObject> MyMap; is how I find objects. How would MyMap.find (MyClassObjInstance) work for instance? Do I need to implement my own iterator and provide some standard functions w...

113
голосов
5ответов
57243 просмотров

PHP prepend associative array with literal keys?

Is it possible to prepend an associative array with literal key=>value pairs? I know that array_unshift() works with numerical keys, but I'm hoping for something that will work with literal keys. As an example I'd like to do the following: $array1 = array('fruit3'=>'apple', 'fruit4'=>'...

1
голосов
2ответов
443 просмотров

How to make an associative array in actionscript indexed by Point?

I'd like my associative array indexed by Point (or, in general, an Object) that has a semantic equality. Unfortunately var p:Point = new Point(1, 1); var q:Point = new Point(1, 1); var dict:Dictionary = new Dictionary(); dict[p] = 5; trace(dict[p]); // => 5 trace(dict[q]); // => undefined...

5
голосов
3ответов
5107 просмотров

Detecting if an Array is Indexed or Associative

Possible Duplicate: PHP Arrays: A good way to check if an array is associative or sequential? What would be the most performant way of checking if an array is associative or not in PHP?

2
голосов
5ответов
548 просмотров

PHP theres some Impact using long text in a associative array?

Im doing a database class in PHP and I want to make cache of the result of the querys in a associative array, My idea is to use the sql statment as the index of the cache array, its could be a good idea? or should I use a md5 from the sql? class DB{ const HOST = 'localhost'; //Your Database Host...

0
голосов
1ответов
444 просмотров

Sort tinytext time from mysql db query with sql or sort the array it produces using PHP

Hey guys - The problem stems from a poorly designed database used to store real estate information. I set up a template for my client to select a weekend and to display the open houses for that weekend. Open house times (ohtime1, ohtime2, ohtime3) are stored as tinytext, with no way of knowing AM...

90
голосов
4ответов
123830 просмотров

Hash Table/Associative Array in VBA

I can't seem to find the documentation explaining how to create a hash table or associative array in VBA. Is it even possible? Can you link to an article or better yet post the code?

0
голосов
1ответов
12303 просмотров

How do I access Collection keys during For Each in VB.net?

I have some code like this: Dim col As Collection = New Collection col.Add(value1, "key1") col.Add(value2, "key2") ' later... For Each item As String In col ' want to get valueX and keyX here; currently, "item" holds the value Next How can I get both the value and key within the loop? May...

4
голосов
2ответов
7123 просмотров

PHP "Warning: usort() [function.usort]: Invalid comparison function" on sorting

i have following data as an associative array array 'abc' => array 'label' => string 'abc' (length=3) 'weight' => float 3 'wsx' => array 'label' => string 'wsx' (length=3) 'weight' => float 1 'qay' => array 'label' => str...

15
голосов
8ответов
22475 просмотров

java and python equivalent of php's foreach($array as $key => $value)

In php, one can handle a list of state names and their abbreviations with an associative array like this: <?php $stateArray = array( "ALABAMA"=>"AL", "ALASKA"=>"AK", // etc... "WYOMING"=>"WY" ); foreach ($stateArray as $stateName => $st...

0
голосов
1ответов
4375 просмотров

Create an associative array with dynamic keys in Actionscript 2

for an XML file, I want to create an array in actionscript where I can reference a particular value with a key I set rather than 0, 1, 2 etc buildings = myParsedObjectFromXML; var aBuildings = new Array(); for ( building in buildings ) { var currentBuilding = buildings[building][0]; va...

27
голосов
4ответов
25658 просмотров

PHP - Merge two arrays (same-length) into one associative?

pretty straightforward question actually.. is it possible in PHP to combine two separate arrays of the same length to one associative array where the values of the first array are used as keys in the associative array? I could ofcourse do this, but I'm looking for another (built-in) functio...

0
голосов
2ответов
1602 просмотров

SimpleXML, associative arrays, and XPath

I have a question about xpath and arrays. What I was wondering was if it is possible to use xpath on some simpleXML and have it return an associative array of node names and their values. For example, say I have the following XML: <element1 page="1">blah</element1> <element2 page...

9
голосов
7ответов
9341 просмотров

Formatting associative array declaration

When declaring an associative array, how do you handle the indentation of the elements of the array? I've seen a number of different styles (PHP syntax, since that's what I've been in lately). This is a pretty picky and trivial thing, so move along if you're interested in more serious pursuits....

3
голосов
5ответов
1662 просмотров

Remove dupes/sort from a Array of Associative Arrays in PHP

I have a array of associative arrays aa[] = ('Tires'=>100, 'Oil'=>10, 'Spark Plugs'=>4 ); aa[] = ('Tires'=>454, 'Oil'=>43, 'Spark Plugs'=>3 ); aa[] = ('Tires'=>34, 'Oil'=>55, 'Spark Plugs'=>44 ); aa[] = ('Tires'=>454, 'Oil'=>43, 'Spark Plugs'=>45 ); aa[] = (...

0
голосов
3ответов
436 просмотров

Comparing Multidimensional arrays in PHP

I am trying to compare to multidimensional arrays, but I can't just use array_diff_assoc(). The arrays I am trying to compare are both associative arrays, and they are both sorted so the keys are in the same order. For the most part the arrays are identical in structure. I can't seem to figure...

0
голосов
2ответов
168 просмотров

Is there a way to order an associative array by how the keys are inserted with PHP?

Here's an example of what I mean: I have an array: array('type'=>'text', 'class'=>'input', 'name'=>'username', 'id'=>'username', 'value'=>'', 'size'=>'30', 'rows'=>'', 'cols'=>''); Then, I loop through it like so: $input =...

1
голосов
4ответов
443 просмотров

Массив с ассоциативными значениями, доступ к которым осуществляется численно

У меня есть ассоциативный массив, к которому мне может потребоваться получить числовой доступ (т.е. получить значение 5-го ключа). $data = array( 'one' => 'something', 'two' => 'else', 'three' => 'completely' ) ; Мне нужно уметь: $data['one'] и $data[0] ...