Questions tagged [field-names]

83 questions
84
votes
5 answers

Pythonic way to sorting list of namedtuples by field name

I want to sort a list of named tuples without having to remember the index of the fieldname. My solution seems rather awkward and was hoping someone would have a more elegant solution. from operator import itemgetter from collections import…
Nick
  • 873
  • 1
  • 6
  • 7
11
votes
6 answers

Java/Scala obtain a Field reference in a typesafe way

Java claims to be object oriented and typesafe, and Scala even more so. Internal Class fields are represented by class called Field, which you can obtain a reference to via the Reflection API. My question: do these languages provide any way to…
Magnus
  • 10,736
  • 5
  • 44
  • 57
8
votes
2 answers

Golang get string representation of specific struct field name

I really want a way to print the string representation of a field name in go. It has several use cases, but here is an example: lets say I have a struct type Test struct { Field string `bson:"Field" json:"field"` OtherField int …
Fuzzerker
  • 249
  • 1
  • 6
  • 15
6
votes
2 answers

Concatenate structs: Update struct fields without overwriting existing fields

I would like to know the easiest way to update a Matlab structure from another structure with different fields. Please see my example to understand what I mean. I have two structures S1 and S2 with different fieldnames which I want to combine. S1.a…
oro777
  • 1,110
  • 1
  • 14
  • 29
4
votes
2 answers

Variable fieldnames in Julia mutable structs

I would like to able to get fields from a mutable struct in Julia using a variable. e.g. mutable struct myType my_field1::Int = 1 my_field2::Int = 2 my_field3::Int = 3 end And then let's imagine you declare a particular instance of this…
Conor
  • 691
  • 5
  • 14
4
votes
4 answers

naming suggestions for database timestamp field

When creating database tables I'm often stumped when trying to name my time/date/timestamp fields. Sometimes it's easy, like edit_date and expiration_date... but often it's not as easy. I don't like repeating the table name in the field names…
Ty W
  • 6,694
  • 4
  • 28
  • 36
3
votes
1 answer

mysql to CSV with column names on first row inserted dynamically

I'm revising my original question significantly... This works perfectly for dumping your table to a CSV with the field names on the first row. SELECT 'field1', 'field2', 'field3' UNION SELECT * INTO OUTFILE '/var/tmp/table_name.csv' FIELDS…
user1295563
  • 39
  • 1
  • 1
  • 3
3
votes
1 answer

Django: Can't access model attributes

Lately I started using my existing mysql database in Django. Implementing it worked The database settings looks like this DATABASES = { 'default': { 'NAME': 'app_data', 'ENGINE': 'django.db.backends.sqlite3', }, 'users': { 'NAME':…
3
votes
1 answer

Accessing record field by reference

I have to use records in Lazarus (due to TVirtualStringTree). If I have a simple record: type myrec = record name: string; end; Is there a way how to access the field by reference? i.e. to make a function: getField('name',…
hugo
  • 76
  • 6
2
votes
1 answer

How to get field name in android

I'm creating camera app and I want to log infos about camera state. Now I'm using: Log.i("AF state", String.valueOf(result.get(CaptureResult.CONTROL_AF_STATE))); It returns values like: I/AF state: 1 It is hard to read and I'm curious if there is…
2
votes
1 answer

AngularJS get json field name

I started learning AngularJS a few days ago, and I wonder how do I get the name of a field in a JSON file. {contador: "1159273", Code: "TCP_MISS/200", $$hashKey: "object:12"} Thats one line of the json file, and I want to get the "contador" and…
2
votes
2 answers

Mysql naming convention: Should i use past tense in the field name?

Im getting confused on this day fixing the database for having the consistent field name. When i want to name the field to explain: the name of the one who locked, or hidden the post. What's the field should i use? locked_by_username ,…
TomSawyer
  • 3,711
  • 6
  • 44
  • 79
2
votes
2 answers

SQL Query for field name, field type, and field value

Let's say I have a table like the one below pp_refno pp_rectype _pp_account pp_empid pp_dept --------------------------------------------------------- 90221 contractor 061509864 C00001121 1111000139 Is there a query that could be…
Todd Miller
  • 189
  • 2
  • 9
2
votes
2 answers

Delete field's machine-name in Drupal 7

I'm trying to create a new field, but Drupal came up with the well-known error: The machine-readable name is already in use. It must be unique I'm sure that the field doesn't exist anymore (I checked the fields' list and it doesn't show up). I…
vkytefree
  • 31
  • 4
2
votes
2 answers

Get names of the available members of a Java class

I'm trying to get the member names of a class in Java. For instance, let's say I have the class: class Dog { private int legs = 4; private int ears = 2; } Is there anyway I can get a list of field names along with their types, such as {…
Jason
  • 13,563
  • 15
  • 74
  • 125
1
2 3 4 5 6