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
148
votes
7 answers

How to add additional fields to form before submit?

Is there a way to use javascript and JQuery to add some additional fields to be sent from a HTTP form using POST? I mean:
Spook
  • 25,318
  • 18
  • 90
  • 167
143
votes
10 answers

Difference between Property and Field in C# 3.0+

I realize that it seems to be a duplicate of What is the difference between a Field and a Property in C#? but my question has a slight difference (from my point of view): Once I know that I will not use my class with "techniques that only works on…
p4bl0
  • 5,354
  • 5
  • 24
  • 25
129
votes
17 answers

HTML text input field with currency symbol

I would like to have a text input field containing the "$" sign in the very beginning, and no matter what editing occurs to the field, for the sign to be persistent. I would be good if only numbers were accepted for input, but that's just a fancy…
User3419
  • 1,716
  • 2
  • 14
  • 16
128
votes
9 answers

Can I change a private readonly field in C# using reflection?

I am wondering, since a lot of things can be done using reflection, can I change a private readonly field after the constructor completed its execution? (note: just curiosity) public class Foo { private readonly int bar; public Foo(int num) { …
Ron Klein
  • 9,178
  • 9
  • 55
  • 88
125
votes
5 answers

Why not abstract fields?

Why can't Java classes have abstract fields like they can with abstract methods? For example: I have two classes that extend the same abstract base class. These two classes each have a method that is identical except for a String constant, which…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
114
votes
6 answers

String field value length in mongoDB

The data type of the field is String. I would like to fetch the data where character length of field name is greater than 40. I tried these queries but returning error. 1. db.usercollection.find( {$where: "(this.name.length >…
SURYA GOKARAJU
  • 1,315
  • 3
  • 10
  • 7
98
votes
8 answers

What is the difference between "::" "." and "->" in c++

I created a class called Kwadrat. The class has three int fields. My Development Environment suggests that I access the fields from Kwadrat created objects via the :: & -> operators. I tried both operators, and found that the -> operator is able to…
Yoda
  • 17,363
  • 67
  • 204
  • 344
95
votes
7 answers

How to avoid sending input fields which are hidden by display:none to a server?

Imagine you have a form where you switch visibility of several fields. And if the field is not displayed you don't want its value to be in request. How do you handle this situation?
glaz666
  • 8,707
  • 19
  • 56
  • 75
91
votes
8 answers

Searching for value of any field in MongoDB without explicitly naming it

I looked through the MongoDB documentation and googled this question but couldn't really find a suitable answer. So, here is what I'm looking for. Assume I have a collection with elements like this: { "foo" : "bar", "test" : "test", "key"…
Max L.
  • 911
  • 1
  • 6
  • 3
91
votes
9 answers

Best way to handle multiple constructors in Java

I've been wondering what the best (i.e. cleanest/safest/most efficient) way of handling multiple constructors in Java is? Especially when in one or more constructors not all fields are specified: public class Book { private String title; …
Peter
86
votes
6 answers

Get all private fields using reflection

I wonder is there a way to get all private fields of some class in Java and their type. For example lets suppose I have a class: class SomeClass { private String aaa; private SomeOtherClass bbb; private double ccc; } Now I would like to…
user2152361
  • 863
  • 1
  • 6
  • 4
80
votes
18 answers

Auto-implemented getters and setters vs. public fields

I see a lot of example code for C# classes that does this: public class Point { public int x { get; set; } public int y { get; set; } } Or, in older code, the same with an explicit private backing value and without the new auto-implemented…
tclem
  • 828
  • 1
  • 7
  • 9
70
votes
2 answers

Pandas: join DataFrames on field with different names?

According to this documentation I can only make a join between fields having the same name. Do you know if it's possible to join two DataFrames on a field having different names? The equivalent in SQL would be: SELECT * FROM df1 LEFT OUTER JOIN df2 …
woshitom
  • 4,811
  • 8
  • 38
  • 62
67
votes
13 answers

When have you come upon the halting problem in the field?

When have you ever personally come upon the halting problem in the field? This can be when a co-worker / boss suggested a solution which would violate the fundamental limits of computation, or when you realized yourself that a problem you were…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
66
votes
3 answers

Get distinct values of Queryset by field

I've got this model: class Visit(models.Model): timestamp = models.DateTimeField(editable=False) ip_address = models.IPAddressField(editable=False) If a user visits multiple times in one day, how can I filter for unique rows based on the…
Scott
  • 3,204
  • 3
  • 31
  • 41