Questions tagged [key-value]

A key-value pair is a set of two linked data items: a key which uniquely identifies some item of data, and the value, which is either the data that is identified or a pointer to the location of that data. Key-value pairs are frequently used in lookup tables, hash tables and configuration files.

A key-value pair is a set of two linked data items: a key which uniquely identifies some item of data, and the value, which is either the data that is identified or a pointer to the location of that data. Key-value pairs are frequently used in lookup tables, hash tables and configuration files.

http://searchenterprisedesktop.techtarget.com/definition/key-value-pair

A collection of key-value pairs is called an associative array.

The concept of key value pairs is applied in modern NoSQL databases for representing a storage mechanism. Key-Value is also a way to assign attributes and values to NSObject based instances in Cocoa framework (Related: Objective-C).

3201 questions
35
votes
12 answers

Is there a business proven cloud store / Key=>Value Database? (Open Source)

I have been looking for cloud computing / storage solutions for a long time (inspired by the Google Bigtable). But I can't find a easy-to-use, business-ready solution. I'm searching a simple, fault tolerant, distributed Key=>Value DB like SimpleDB…
Martin K.
  • 4,669
  • 7
  • 35
  • 49
34
votes
27 answers

How to count frequency of characters in a string?

I need to write some kind of loop that can count the frequency of each letter in a string. For example: "aasjjikkk" would count 2 'a', 1 's', 2 'j', 1 'i', 3 'k'. Ultimately id like these to end up in a map with the character as the key and the…
Bill
  • 489
  • 1
  • 4
  • 7
34
votes
5 answers

How to add a new object (key-value pair) to an array in javascript?

I have an array as : items=[{'id':1},{'id':2},{'id':3},{'id':4}]; How should I add a new pair {'id':5} to the array?
exAres
  • 4,806
  • 16
  • 53
  • 95
33
votes
8 answers

iPhone - How to detect if a key exists in NSUserDefaults standardUserDefaults

Using NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];, I use calls like BOOL boolFromPrefs = [defaults boolForKey:@"theBoolKey"]; To get a saved BOOL value. If the key is not found, NO is returned (default behaviour of…
Oliver
  • 23,072
  • 33
  • 138
  • 230
32
votes
1 answer

Ruby - getting value of hash

I have a hash like {:key1 => "value1", :key2 => "value2"} And I have a variable k which will have the value as 'key1' or 'key2'. I want to get the value of k into a variable v. Is there any way to achieve this with out using if or case? A single…
Sayuj
  • 7,464
  • 13
  • 59
  • 76
32
votes
12 answers

JavaScript: Remove duplicates of objects sharing same property value

I have an array of objects that I would like to trim down based on a specific key:value pair. I want to create an array that includes only one object per this specific key:value pair. It doesn't necessarily matter which object of the duplicates is…
Lauren F
  • 1,282
  • 4
  • 18
  • 29
29
votes
11 answers

How to search if dictionary value contains certain string with Python

I have a dictionary with key-value pair. My value contains strings. How can I search if a specific string exists in the dictionary and return the key that correspond to the key that contains the value. Let's say I want to search if the string 'Mary'…
Cryssie
  • 3,047
  • 10
  • 54
  • 81
29
votes
5 answers

What are the differences b/w Hashtable, Dictionary and KeyValuePair?

I use Dictionary in my code but my colleagues use Hashtable. MSDN says they work on Key Value pair & examples of Hashtable and dictionary are same on MSDN. Then how different are they from each other & which is the best of them or are they suited…
Nikhil Agrawal
  • 47,018
  • 22
  • 121
  • 208
28
votes
4 answers

Accessing the last key–value pair in a Ruby (1.9) hash

As of Ruby 1.9, hashes retain insertion order which is very cool. I want to know the best way to access the last key–value pair. I've written some code which does this: hash.values.last This works and is very easy to comprehend, but perhaps it's…
davidchambers
  • 23,918
  • 16
  • 76
  • 105
27
votes
2 answers

xcode error: ...this class is not key value coding-compliant for the key ibShadowedLargeTitleTextAttributes

I keep getting this error. The app worked before I used a color set. The error says something about ibShadowedLargeTitleTextAttributes. I dont have any color set for the large title shadow, I am using the default (clear). I restarted Xcode, used a…
WalterBeiter
  • 2,021
  • 3
  • 23
  • 48
27
votes
3 answers

swift: Add multiple objects to NSDictionary

I'm trying to add multiple objects to NSDictionary, like var myDict: NSDictionary = [["fname": "abc", "lname": "def"], ["fname": "ghi", "lname": "jkl"], ...] Is it even possible to do this? If not, please suggest a better way. I actually need to…
Srujan Simha
  • 3,637
  • 8
  • 42
  • 59
26
votes
1 answer

Is DynamoDB still following CAP theorem with its "Strong Consistency" promises?

Previously, DynamoDB was providing "eventual consistency" only, obeying "Availability" and "Partition Tolerance" portion of CAP theorem. But now, DynamoDB provides "strong consistency" option apart from the "eventual consistency". Does that mean…
Neeraj Gupta
  • 765
  • 1
  • 10
  • 18
26
votes
4 answers

How to update value of a key in dictionary in c#?

I have the following code in c# , basically it's a simple dictionary with some keys and their values. Dictionary dictionary = new Dictionary(); dictionary.Add("cat", 2); dictionary.Add("dog", 1); dictionary.Add("llama",…
Ahsan Ashfaq
  • 293
  • 1
  • 3
  • 7
25
votes
6 answers

jQuery get values from inputs and create an array

I have many inputs on a page. I want to create an associative array with each input's name and value using jQuery. I've tried:
Don P
  • 60,113
  • 114
  • 300
  • 432
24
votes
5 answers

how to get all keys and values in redis in javascript?

I am creating a node API using javascript. I have used redis as my key value store. I created a redis-client in my app and am able to get values for perticular key. I want to retrieve all keys along with their values. So Far I have done this…
Bhushan Gadekar
  • 13,485
  • 21
  • 82
  • 131