Questions tagged [attributes]

The attributes tag should be used for any issues relating to a property of an object, element, or file, etc.

In computing, an attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such.

For clarity, attributes should more correctly be considered metadata. An attribute is frequently and generally a property of a property.

However, in actual usage, the term attribute can and is often treated as equivalent to a property, depending on the technology being discussed.

An attribute of an object usually consists of a name and a value; of an element, a type or class name; of a file, a name and extension.

  • Each named attribute has an associated set of rules called operations: one doesn't sum characters or manipulate and process an integer array as an image object — one doesn't process text as type floating point (decimal numbers).
  • It follows that an object definition can be extended by imposing data typing: a representation format, a default value, and legal operations (rules) and restrictions ("Division by zero is not to be tolerated!") are all potentially involved in defining an attribute, or conversely, may be spoken of as attributes of that object's type. A JPEG file is not decoded by the same operations (however similar they may be—these are all graphics data formats) as a PNG or BMP file, nor is a floating point typed number operated upon by the rules applied to typed long integers.

See also:

13044 questions
91
votes
6 answers

Can someone explain the attr?

I am looking at the Honeycomb Gallery sample code (here) and I ran across the following code while trying to add action items in my own app:
FuegoFingers
  • 2,181
  • 6
  • 27
  • 36
91
votes
5 answers

Jquery - How to get the style display attribute "none / block"

Is there a way to get the style: display attribute which would have either none or block? DIV :

Murtaza Mandvi
  • 10,708
  • 23
  • 74
  • 109
91
votes
5 answers

Storing and Accessing node attributes python networkx

I have a network of nodes created using python networkx. i want to store information in nodes such that i can access the information later based on the node label (the name of the node) and the field that in which the information has been stored…
user1295112
  • 1,013
  • 1
  • 8
  • 4
90
votes
5 answers

What's the difference between a global variable and a 'window.variable' in JavaScript?

I'm reading the Backbone.js documents and am seeing a lot of code that assigns attributes to the window object: window.something = "whatever"; What's the difference between calling this code, and just assigning the variable and creating a global…
Derick Bailey
  • 72,004
  • 22
  • 206
  • 219
90
votes
5 answers

use decimal values as attribute params in c#?

I've been trying to use decimal values as params for a field attribute but I get a compiler error. I found this blog post link saying it wasn't possible in .NET to use then, does anybody know why they choose this or how can I use decimal params?
rjlopes
  • 2,430
  • 4
  • 21
  • 23
90
votes
7 answers

What is initial scale, user-scalable, minimum-scale, maximum-scale attribute in meta tag?

I was going through the source code of a website and found this piece of code. I want to know what this initial scale,…
user3483724
89
votes
12 answers

In Python, how can I make unassignable attributes (like ones marked with `final` in Java)?

Is there anything in Python that works like the final keyword in Java - i.e., to disallow assigning to a specific attribute of the instances of a class, after those instances have been created? I couldn't find anything like this in the…
Jason Coon
  • 17,601
  • 10
  • 42
  • 50
87
votes
4 answers

Which is the best way to check for the existence of an attribute?

Which is a better way to check for the existence of an attribute? Jarret Hardie provided this answer: if hasattr(a, 'property'): a.property I see that it can also be done this way: if 'property' in a.__dict__: a.property Is one approach…
Andrew Halloran
  • 1,518
  • 1
  • 14
  • 16
86
votes
8 answers

How do you tell if a checkbox is selected in Selenium for Java?

I am using Selenium in Java to test the checking of a checkbox in a webapp. Here's the code: private boolean isChecked; private WebElement e; I declare e and assign it to the area where the checkbox is. isChecked =…
jamesfzhang
  • 4,403
  • 8
  • 32
  • 43
86
votes
4 answers

Objective C - Assign, Copy, Retain

I'm new to Objective C. I have basic knowledge in C, including the concept of pointers. I have two basic questions: Can someone explain the difference between assign,copy, and retain with some analogy? How do you handle a function which returns…
Sabha B
  • 2,079
  • 3
  • 28
  • 40
85
votes
3 answers

Python string to attribute

How can I achieve such job: def get_foo(someobject, foostring): return someobject.foostring IE: if I do get_foo(obj, "name") it should be calling obj.name (see input as string but I call it as an attritube. Thanks
Hellnar
  • 62,315
  • 79
  • 204
  • 279
85
votes
4 answers

When is a custom attribute's constructor run?

When is it run? Does it run for each object to which I apply it, or just once? Can it do anything, or its actions are restricted?
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
84
votes
5 answers

How to add an attribute to a property at runtime

//Get PropertyDescriptor object for the given property name var propDesc = TypeDescriptor.GetProperties(typeof(T))[propName]; //Get FillAttributes methodinfo delegate var methodInfo = propDesc.GetType().GetMethods(BindingFlags.Instance |…
Thiru kumaran
  • 1,262
  • 1
  • 10
  • 10
83
votes
4 answers

What is AttributeSet and how can i use it?

What is AttributeSet in Android? How can i use it for my custom view?
Premier
  • 4,160
  • 6
  • 44
  • 58
82
votes
13 answers

Magento Product Attribute Get Value

How to get specific product attribute value if i know product ID without loading whole product?
Denis Óbukhov
  • 4,129
  • 4
  • 20
  • 27