Most voted "attributes" questions
Attributes can be used to define the structure of a class in OO. Attributes are also, the additional information placed in the start tags in HTML, consisting of two parts: name and attribute value
Learn more…112 questions
Sort by count of
-
37
votes3
answers8360
viewsProperty x Attribute
One propriedade of a class is not the same thing as a atributo? What’s the real difference between them? Or propriedade is a synonym for atributo or vice versa? Or varies according to the…
oop terminology characteristic-language property attributesasked 9 years, 4 months ago MeuChapeu 5,875 -
28
votes5
answers1775
viewsWhy is it bad practice to have int attributes?
I saw in the answer to that question /questions/17015/qual-o-uso-de-uma-variável-estática-ou-final-em-java/17136#17136, that: It is bad practice to have int attributes, unless they are "constant" or…
-
28
votes6
answers4346
viewsWhat is the difference between attribute and field in the classes?
When I am studying object-oriented programming, at times I hear about fields and attributes of a class, but the two seem to be different definitions to refer to the same thing. What’s the…
-
21
votes2
answers11055
viewsWhat is the advantage of using the ENUM type?
When I should use the guy ENUM because even today where I saw this guy being used he could be replaced by VARCHAR or even for a simple CHAR, I can’t see a case where in it it really becomes…
-
12
votes2
answers141
viewsDynamic declaration in attribute property
As part of a microplataforma ORM I’m developing, I’m defining a generic class that implements exclusively tight Coupling (1 record x 1 object). public class Course : MicroEntity<Course> {…
-
12
votes2
answers200
viewsWhat are attributes in PHP? (Annotations/Attributes/Decorators)
Lately I have come across some snippets of code that I can’t understand their purpose, are usually used within comments, which doesn’t make much sense to me. Doing research on this subject falls in…
-
10
votes3
answers667
viewsWhat are these attributes in the properties?
What are the names of these "attributes" and what are they used for? Examples: in the declaration of a class: [ComVisibleAttribute(true)] public sealed class SerializableAttribute : Attribute in the…
-
10
votes1
answer479
viewsValidate array type attribute in an annotation
When using the annotation Ordem would like to make your attribute valores mandatory. By mandatory I mean that the value of your attribute should not accept an empty array, or an array with an empty…
-
9
votes2
answers2594
viewsWhat does it mean and how does an Enum work with the [Flags] attribute?
I was seeing how the class works FileInfo and came across an Enum: [Serializable] [ComVisible(true)] [Flags] public enum FileAttributes { ReadOnly = 1, Hidden = 2, System = 4, Directory = 16,…
-
9
votes3
answers8723
viewsDifference between "Attribute" and "Instance Variable"
Reading some books and articles about introduction to Java and OO I realized that these terms are not well defined. Looking deeper I found different definitions in different sources on the subject.…
-
8
votes1
answer2897
viewsWhat is Bind(Include = "Property") used for?
By creating a CRUD with scalfold in ASP.NET MVC, in POST, we have the following code: public ActionResult Create([Bind(Include = "Id,Nome")] Grupo grupo) {...} What’s this one used for [Bind]? When…
-
8
votes5
answers993
viewsWhat is the difference between referencing an attribute directly or by get/set
As an example I have a private String atributo, so I can have two ways of referencing the same, this internally in the class: this.atributo And also: this.getAtributo(); It’s correct to say it’s…
-
7
votes2
answers22499
viewsAdd attribute to an element
In Javascript we can add the attributes to a given element with at least two ways: var div = document.createElement('div'); div.id = 'meuId'; or var div = document.createElement('div');…
-
7
votes3
answers454
viewsWhy was the parameterized class attribute <T> not instantiated?
I have this class that implements the IDAO interface package DAO; import java.util.ArrayList; public class BdApp<T> implements IDAO<T> { ArrayList<T> lst = new…
-
7
votes1
answer457
viewsHow to create a Custom Attribute?
For some time I’ve been trying to understand the concept of custom attribute of C#. I think it kind of looks like the system of decorators from Python. But I’m not getting it very well. I read in a…
-
7
votes1
answer102
viewsWhat are the differences between Decorators and Attributes?
I asked a question recently about the use of attributes that was introduced in PHP 8. Attributes to me end up not sounding like novelty, because I remember seeing something like that when I worked…
-
6
votes1
answer474
viewsIs it correct to name html tag attributes arbitrarily?
I would like to know about creating and manipulating attributes in html that are created. We have the attributes already known as the id, class, etc. that we put in the tags so we can manipulate…
-
6
votes3
answers1767
viewsAttribute in Dataannotations for Currency
I would like to format with Dataannotation currency but standard in the model: [Column("cur_mensalidade")] [DataType(DataType.Currency)] [DisplayFormat(DataFormatString = "{0:C0}")] public decimal?…
-
6
votes2
answers2605
viewsHow to insert an HTML file with [innerHtml] and maintain Angular attributes
In my Componente i receive an HTML in the form of String and use [innerHtml] to insert this HTML in the Component View. Component: test(){ alert('Teste :D'); } html_string = '<input type="button"…
-
5
votes1
answer135
viewsWhen and why use the Obsolete attribute?
At least in the projects I’ve worked on, I see no point in using the attribute Obsolete in methods that are no longer used. What I do, and I see people doing is removing or commenting on codes that…
-
5
votes3
answers325
viewsIs it possible to override a base class property?
I have a class Cliente, which is the basis. In it I have the property Celular with Data Annotation "Required". I wonder if it is possible to use a property Cellular in class ClientePersonalizado,…
-
5
votes1
answer194
viewsHow is the scope of an Event Listener defined in any attribute in HTML created?
According to the documentation, when the Listener event is assigned as an HTML attribute, the specified code (in the attribute value) is wrapped in a function, with the following parameters: event -…
-
4
votes2
answers55
viewsGet information stored in an "attribute"
In the ORM I use, classes are mapped using Attributes. I need to recover the value stored in them. Ex.: [Table("CADASTRO_CLIENTE")] public class Cliente { [Property("Id")] public int Id { get; set;…
-
4
votes2
answers37
viewsContenteditable attribute does not work
<input type="email" name="email-empresa" id="email-empresa" placeholder="ex: seuemail@domínio.com" class="txt-input" contenteditable="false" value="[email protected]"> I’m having trouble…
-
3
votes1
answer383
viewsError in relation statement 1 to 1 in EF with code-first and attributes!
I have the following classes where I want to make a relationship 1 to 1: User: [Table("Usuario")] public class Usuario { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id {…
-
3
votes4
answers3411
viewsSet generic "date - * " attributes with javascript;
I need to retrieve all my date attributes, and set the information in a specific date attribute. Example: <div class="box_campo"> <input type="text" data-valor="0"> <ul>…
-
3
votes4
answers1114
viewsCreate string array in C#
There is a way to create an array of string constant? Something like: class Teste { public const string[] Array = new string[] {"a","b"}; } But this one doesn’t compile. In this case nay would…
-
3
votes1
answer356
viewsHow can I change file attributes in windows with python?
I am trying to keep a file . txt hidden. How can I do this using python command line?
-
3
votes3
answers350
viewsSelecting src from an input using ID in Jquery
if(!$("#src-img[src='']")){ }else{ }; I would like to know what is wrong with this if selection, in which case I want, if a value is set in the src attribute, it to execute if, otherwise Else.…
-
3
votes1
answer159
viewsRun an Attribute constructor
How do I call the constructor of an attribute before the constructor of the decorated class? For example, I have my attribute: using System; namespace T.WinForm { public class TesteAttribute :…
-
3
votes2
answers4079
viewsJavascript required HTML attribute
I’d like to know how to do that, when the activeBtn were checked, the ordenadorBanners win the attribute required, I tried the model below but it didn’t work, I would like to know how to do it, and…
-
2
votes2
answers2640
viewsTake data attribute value and apply as text in another html element
I have a series of checkboxes in an interface that are already configured to display/hide other elements of the interface conditionally. In this same interface I have a div set to display messages…
-
2
votes1
answer1323
viewsRead XML attribute
I am reading an XML file with the command simplexml_load_file() which has the following structure: <nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00"> <NFe></NFe>…
-
2
votes1
answer60
viewsSelect element through part of attribute contained in it
I have an element, for example: <div class="teste" data-info="isflaolatesteum"></div> And to select it, I could do it this way: $(".teste[data-info='isflaolatesteum']")... However, I…
-
2
votes2
answers159
viewsWhen should an attribute be a table or vice versa?
Example: I have an Orders table, the order has some status, new, delivered, canceled etc. When the status is canceled I will give the option of the user to tell the reason that was canceled, this…
-
2
votes2
answers119
viewsWhat is the name of these parameters in ASP.NET MVC?
What is the name of these parameters between brackets used to restrict some access or define the protocol used, as in the example: [Authorize] and [HttpPost]. Is it possible to create a custom…
-
2
votes2
answers43
viewsProblem with '.data()' and its value within an if
I’m creating some If's not to lose the habit of using them, but when trying something a little different from what I usually do, an error occurs, the if does not work. How can I fix ? I tried in the…
-
2
votes2
answers8681
viewsHow to add and remove required input with jQuery?
I have a select with two option, when I select the first option I want him to show me a input field with the required attribute and when I select the second option I want him to do the same, only by…
-
2
votes2
answers5648
viewsHow to change the name of a column in a select in the database?
I am making a database for a college activity and was asked to display the table by changing the name of attributes(columns) to "Nome do Cliente" and "Endereco do Cliente". How can I do that?…
-
2
votes1
answer237
viewsWhat is Guidattribute for and why?
I know the GUID is a 'unique' identifier, but I don’t see why your attribute application, as in the example below: [GuidAttribute("C281C7F1-4AA9-3517-961A-463CFED57E75")]…
-
2
votes1
answer103
viewsPHP: Interface type attribute
I’m doing a study of Project Standards. My first standard is Strategy, where I have an abstract class that has two attributes that should receive instances of a class that implements a certain…
-
2
votes1
answer106
viewsWhat is the purpose of the "[Bind("ID,Title,Releasedate,Genre,Price")]" feature in a method?
I am creating a project in ASP.NET Core MVC for learning purposes. In a certain part of the Microsoft guide when the technique of scaffold to generate the controller and the views corresponding to…
-
2
votes1
answer72
viewsIs it possible to obtain a parent attribute when the class defines the child attribute?
Assuming I have the following hierarchy: [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class GrandpaAttribute : Attribute { public GrandpaAttribute() {}…
-
2
votes1
answer77
viewsIs it possible to insert parameters in Filters Attributes?
I use ASP.NET and to do the access control by level, I use a filter that checks the level of permission of the user and allows access to view. [HttpPost] [AutorizacaoFilterAttribute] //Esse filtro…
-
2
votes0
answers41
views'str' Object has no attribute biopython
I’m working on the biopython. Request input of an input(): enz_name1 = input('ENZYME 1 NAME: ') enz_name2 = input('ENZYME 2 NAME: ') However, when I want to use input() to use . catalyse in this…
-
2
votes1
answer194
viewsHow to inherit a value from a given attribute in CSS?
Hello, everybody. How do I inherit a value from a given attribute in CSS? Example: <div class="flex" id="1" style="line-height: 100px; height: 100px; background-color: red;">1</div>…
-
2
votes1
answer39
viewsHow do I access an attribute(which is a list) of a class by a method outside that class in python?
I have a Shop class that one of her attributes is a list (self.products = [ ]). class Loja(Empresa): def __init__(self, nome, cnpj, razao_social): super().__init__(nome, cnpj) self._razao_social =…
-
1
votes2
answers60
viewsCan I override already existing anottation on . net?
I have the following Annotation: [XmlElement(IsNullable = true)] I’d like to see the code behind it, so I can create my own based on it Or if you can write her up…
-
1
votes1
answer1124
viewsHow to obtain the value of a property and how to obtain the property in which the attribute is declared?
Let’s say I’m creating an attribute like this: TCompareAttribute = class(TCustomAttribute) private FPropertyToCompare: string; public constructor Create(APropertyToCompare: string); function…
-
1
votes0
answers471
viewsCustomize product attributes in Woocommerce
Currently, as far as I know, the attributes are created in the product edition in "Product Data" on Woocommerce. When entering the Attribute Value: 30 | 60 | 90 | A drop-down at the front. However,…