Questions tagged [field]

In computer science a field is a smaller piece of data from a larger collection.

In computer science, data that has several parts can be divided into fields. Relational databases arrange data as sets of database records, also called rows or tuples. Each record consists of several fields, also called attributes; the fields of all records form the columns.

In object-oriented programming, field (also called data member or member variable) is the data encapsulated within a class or object. In the case of a regular field (also called instance variable), for each instance of the object there is an instance variable: for example, an Employee class has a Name field and there is one distinct name per employee. A static field (also called class variable) is one variable, which is shared by all instances.

Source: Field (Computer Science) - Wikipedia article

Related tags:

5904 questions
64
votes
3 answers

How can I store a lambda expression as a field of a class in C++11?

I'd like to create a class where the client can store a lambda expression like []() -> void {} as a field of the class, but I can't figure out how to do so. One answer suggested using decltype, which I tried with no success. Here is a ideone…
user34537
60
votes
3 answers

IP address storing in MySQL database using PHP

what is the right field type for IP address in mysql? and what is the right way of storing it using PHP?
user552828
  • 769
  • 1
  • 8
  • 17
60
votes
4 answers

Mysql Compare two datetime fields

I want to compare two dates with time, I want all the results from tbl where date1 > date2 Select * From temp where mydate > '2009-06-29 04:00:44'; but it is just comparing dates not time. it is giving me all the result set of today's…
MySQL DBA
  • 5,692
  • 21
  • 54
  • 71
56
votes
2 answers

Java: Static transient fields

I just found out in Java you can declare a field 'static transient' - the compiler doesn't complain. This doesn't seem to be useful in any way since static fields are not serialized, as we all know. But I wonder, is there actually a case where…
python dude
  • 7,980
  • 11
  • 40
  • 53
56
votes
5 answers

Django: Make certain fields in a ModelForm required=False

How do I make certain fields in a ModelForm required=False? If I have: class ThatForm(ModelForm): class Meta: widgets = {"text": Textarea(required=False)} Or if I have: class ThatForm(ModelForm): text = Textarea(required=False) Django…
Synthead
  • 2,162
  • 5
  • 22
  • 25
55
votes
3 answers

MySQL: unique field needs to be an index?

I have one UNIQUE field in my table, and I need to search over it quickly. Do I need to index it? Do searches over unique fields and indexed fields vary in speed or resource usage?
TomSawyer
  • 3,711
  • 6
  • 44
  • 79
53
votes
6 answers

c# - How to iterate through classes fields and set properties

I am not sure if this is possible but I want to iterate through a class and set a field member property without referring to the field object explicitly: public class Employee { public Person _person = new Person(); public void…
Petras
  • 4,686
  • 14
  • 57
  • 89
52
votes
8 answers

Flutter dropdown text field

I am still new to Flutter. Is there an example of a material dropdown list text field? I saw the example on Material Text Field but I didn't find anywhere in the documentation on how to implement this. Thanks for your help on this.
Edmand Looi
  • 3,331
  • 6
  • 19
  • 21
52
votes
5 answers

Set field value with reflection

I'm working with one project which is not opensource and I need to modify one or more its classes. In one class is following collection: private Map ttp = new HashMap<>(); All what I need to do is use reflection and use…
user2749903
  • 1,275
  • 1
  • 10
  • 20
52
votes
5 answers

Events aren't fields - I don't get it

In C# in depth (an excellent book thus far), Skeet explains events aren't fields. I read this section many times and I don't understand why the distinction makes any difference. I am one of those developers that confuse events and delegate…
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
51
votes
3 answers
50
votes
11 answers

Java reflection - access protected field

How can I access an inherited protected field from an object by reflection?
Moro
  • 2,088
  • 6
  • 25
  • 34
49
votes
25 answers

Why shouldn't I prefix my fields?

I've never been a fan of Hungarian notation, I've always found it pretty useless unless you're doing some really low level programming, but in every C++ project I've worked on some kind of Hungarian notation policy was enforced, and with it the use…
Trap
  • 12,050
  • 15
  • 55
  • 67
49
votes
10 answers

How do I enable saving of filled-in fields on a PDF form?

Some PDF forms can be saved, including all filled-in field data: Some others can not be saved, and all filled-in field data are lost: How do I enable saving of filled-in fields on my PDF form?
eleven81
  • 6,301
  • 11
  • 37
  • 48
47
votes
13 answers

Why ever use fields instead of properties?

I'm fairly new to C#, and I think properties are a wonderful thing. So wonderful, in fact, that I can't see any real advantage to using fields, instead. Even for private fields, it seems like the flexibility and modularity that properties offer can…
Matthew
  • 28,056
  • 26
  • 104
  • 170