Questions tagged [name-value]
49 questions
89
votes
5 answers
What characters are allowed in an HTML attribute name?
In HTML attribute name=value pairs, what are the characters allowed for the 'name' portion? ..... Looking at some common attributes it appears that only letters (a-z and A-Z) are used, but what other chars could be allowed as well?... maybe digits…

Robin Rodricks
- 110,798
- 141
- 398
- 607
72
votes
15 answers
How to deal with name/value pairs of function arguments in MATLAB
I have a function that takes optional arguments as name/value pairs.
function example(varargin)
% Lots of set up stuff
vargs = varargin;
nargs = length(vargs);
names = vargs(1:2:nargs);
values = vargs(2:2:nargs);
validnames = {'foo', 'bar', 'baz'};…

Richie Cotton
- 118,240
- 47
- 247
- 360
15
votes
4 answers
Convert an array to an array of objects
How I can convert an array to an array of JavaScript objects.
For example I have an array as
data = [
["fruits","frozen","fresh","rotten"],
["apples",884,494,494],
["oranges",4848,494,4949],
["kiwi",848,33,33]
]
I want to convert…

user3084017
- 177
- 1
- 2
- 9
12
votes
4 answers
Improve querying fields exist in MongoDB
I'm in progress with estimation of MongoDB for our customers. Per requirements we need associate with some entity ent variable set of name-value pairs.
db.ent.insert({'a':5775, 'b':'b1'})
db.ent.insert({'c':'its a c',…

Dewfy
- 23,277
- 13
- 73
- 121
9
votes
4 answers
Turning a hash into a string of name-value pairs
If I'm turning a ruby hash into a string of name-value pairs (to be used in HTTP params, for example), is this the best way?
# Define the hash
fields = {"a" => "foo", "b" => "bar"}
# Turn it into the name-value string
http_params = fields.map{|k,v|…

jerhinesmith
- 15,214
- 17
- 62
- 89
4
votes
4 answers
Properties or Enums or static final
When it comes to declare predefined constants in a name-value pair, I have been randomly choosing between 'java.util.Properties', 'enums' or a separate class with 'public static final' values.
For future reference, I need some guidelines over which…

dev
- 11,071
- 22
- 74
- 122
4
votes
5 answers
Javascript accessing name/value pairs
I'm getting JSON name/value pairs that looks like this:
{
"Name":"parentid",
"Value":"blah"
},
{
"Name":"siteid",
"Value":"blah"
},
{
"Name":"sitename",
"Value":"blah"
}
But I would like to access the "name" value as the KEY, and…

resopollution
- 19,600
- 10
- 40
- 49
3
votes
2 answers
XSD: is there a way to build an enumeration from name/value pairs?
I would like to have an enumeration in my XSD that specifies a set of name/value pairs corresponding to error codes and associated descriptions. E.g.:
101 Syntax error
102 Illegal operation
103 Service not available
And so on. I can build a…

Edward Hamlin
- 101
- 1
- 3
3
votes
1 answer
Sending Name Value Pair in POST using Jersey Client
How can i pass name value pairs as body to a POST ReST Service in Jersey. Something similar to the code below using Apache Commons PostMethod
final PostMethod post = new PostMethod(url);
post.setRequestBody(new NameValuePair[] {
…

basiljames
- 4,777
- 4
- 24
- 41
2
votes
2 answers
Can I avoid to use the "value" attribute to actually retrieve the value of an element in an Enum?
Imagine a class that works like a container of database table information (table names and columns).
This is an implementation.
class TABLES(Enum):
class TABLE1:
""" documentation for first table """
NAME = "My First Table"
…

chattershuts
- 366
- 2
- 10
2
votes
1 answer
Oracle query, need one row output by id for multiple rows (name/value pairs)
I've been trying to figure this out for a while. I have a table where there are multiple rows containing name value pairs, type, and date (not included for simplicity). They are all tied by an id. I would like to output all data related to the…

Laurie
- 21
- 2
2
votes
2 answers
Converting non-delimited text into name/value pairs in Delphi
I've got a text file that arrives at my application as many lines of the following form:

robsoft
- 5,525
- 4
- 35
- 47
2
votes
4 answers
How to convert Object to NameValuePair ArrayList in Java?
Lets say we have an object of Class Person with all String parameters :
Class Person {
String name;
String email;
}
Person p = new Person();
p.name = "ABC";
p.email = "abc@xyz.com";
How do we convert object p to ArrayList of NameValue Pair :…

Parth mehta
- 1,468
- 2
- 23
- 33
1
vote
2 answers
Any tradeoffs for putting a set of name value pairs in a single field rather than each in their own field
We have a set of user data that is made up of name/value pairs represented in a single document. We are using mongodb to store that data and are thinking to just put the document of name/value pairs as a string within a single field in a collection…

Vinae
- 13
- 2
1
vote
1 answer
Parse Email Body with Multiple Lines
How would I go about parsing a email body with multiple lines in javascript?
Example
Employee:
123456789
Name:
John Doe
This is what I'm using right now.
var emailObj = {};
var body_text = inputs.email.replace(/<\/?[^>]+(>|$)/g, "");
var regEx…

Dan Chan
- 7
- 5