Tutorial by Examples: field

public string Foobar { get { return _foobar; } set { _foobar = value; } } private string _foobar = "xyz";
Gradle (Module:app) Configuration android { .... dataBinding { enabled = true } } Data model public class Item { public String name; public String description; public Item(String name, String description) { this.name = name; this.descr...
All Javadoc comments begin with a block comment followed by an asterisk (/**) and end when the block comment does (*/). Optionally, each line can begin with arbitrary whitespace and a single asterisk; these are ignored when the documentation files are generated. /** * Fields can be documented as ...
add() and roll() can be used to increase/decrease Calendar fields. Calendar calendar = new GregorianCalendar(2016, Calendar.MARCH, 31); // 31 March 2016 The add() method affects all fields, and behaves effectively if one were to add or subtract actual dates from the calendar calendar.add(Calend...
Annotation @XmlAccessorType determines whether fields/properties will be automatically serialized to XML. Note, that field and method annotations @XmlElement, @XmlAttribute or @XmlTransient take precedence over the default settings. public class XmlAccessTypeExample { @XmlAccessorType(XmlAccessT...
Annotations @XmlElement, @XmlAttribute or @XmlTransient and other in package javax.xml.bind.annotation allow the programmer to specify which and how marked fields or properties should be serialized. @XmlAccessorType(XmlAccessType.NONE) // we want no automatic field/property marshalling public cla...
Struct fields whose names begin with an uppercase letter are exported. All other names are unexported. type Account struct { UserID int // exported accessToken string // unexported } Unexported fields can only be accessed by code within the same package. As such, if you are ev...
lsstat returns various summary stats per bucket for the specified field. The field must be numeric in elastic. rStat can be one of avg, min, max, sum, sum_of_squares, variance, std_deviation. The rest of the fields behave the same as lscount, except that there is no division based on bucketDuratio...
BuildConfigField Gradle allows buildConfigField lines to define constants. These constants will be accessible at runtime as static fields of the BuildConfig class. This can be used to create flavors by defining all fields within the defaultConfig block, then overriding them for individual build fla...
Using the Reflection API, it is possible to change or get the value of a field at runtime. For example, you could use it in an API to retrieve different fields based on a factor, like the OS. You can also remove modifiers like final to allow modifing fields that are final. To do so, you will need t...
Lets assume we have some Film model: public class Film { public string Title { get; set; } public string Category { get; set; } public int Year { get; set; } } Group by Category property: foreach (var grp in films.GroupBy(f => f.Category)) { var groupCategory = grp.Key; ...
models.py : from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager, PermissionsMixin) from django.utils import timezone from django.utils.translation import ugettext_lazy as _ class UserManage...
Swift let alert = UIAlertController(title: "Hello", message: "Welcome to the world of iOS", preferredStyle: UIAlertControllerStyle.alert) let defaultAction = UIAlertAction(title: "OK", style: UIAlertActionS...
<?php namespace models; use yii\db\ActiveRecord; use yii\behaviors\TimestampBehavior; class Post extends ActiveRecord { public static function tableName() { return 'post'; } public function rules() { ...
If you want to get rid of the username field and use email as unique user identifier, you will have to create a custom User model extending AbstractBaseUser instead of AbstractUser. Indeed, username and email are defined in AbstractUser and you can't override them. This means you will also have to r...
Swift let frame = CGRect(x: 0, y: 0, width: 100, height: 100) let textField = UITextField(frame: frame) Objective-C CGRect *frame = CGRectMake(0, 0, 100, 100); UITextField *textField = [[UITextField alloc] initWithFrame:frame]; Interface Builder You can also add a UITextField to a storybo...
To create a PostgreSQL ArrayField, we should give ArrayField the type of data we want it to store as a field as its first argument. Since we'll be storing book ratings, we will use FloatField. from django.db import models, FloatField from django.contrib.postgres.fields import ArrayField cla...
from django.db import models, IntegerField from django.contrib.postgres.fields import ArrayField class IceCream(models.Model): scoops = ArrayField(IntegerField() # we'll use numbers to ID the scoops , size=6) # our parlor only lets you have 6 scoops When you us...
This query returns all cones with a chocolate scoop and a vanilla scoop. VANILLA, CHOCOLATE, MINT, STRAWBERRY = 1, 2, 3, 4 # constants for flavors choco_vanilla_cones = IceCream.objects.filter(scoops__contains=[CHOCOLATE, VANILLA]) Don't forget to import the IceCream model from your models.py ...
You can nest ArrayFields by passing another ArrayField as it's base_field. from django.db import models, IntegerField from django.contrib.postgres.fields import ArrayField class SudokuBoard(models.Model): numbers = ArrayField( ArrayField( models.IntegerField(), ...

Page 1 of 11