Tutorial by Examples: add

Suppose you have defined the following Person class: public class Person { String name; int age; public Person (int age, String name) { this.age = age; this.name = name; } } If you instantiate a new Person object: Person person = new Person(25, &qu...
Govendor is a tool that is used to import 3rd party packages into your code repository in a way that is compatible with golang's vendoring. Say for example that you are using a 3rd party package bosun.org/slog: package main import "bosun.org/slog" func main() { slog.Infof(&quo...
ALTER TABLE Employees ADD CONSTRAINT DefaultSalary DEFAULT ((100)) FOR [Salary] This adds a constraint called DefaultSalary which specifies a default of 100 for the Salary column. A constraint can be added at the table level. Types of constraints Primary Key - prevents a duplicate record in...
slice1 := []string{"!"} slice2 := []string{"Hello", "world"} slice := append(slice1, slice2...) Run in the Go Playground
Write the following command in your terminal: adb shell getprop This will print all available information in the form of key/value pairs. You can just read specific information by appending the name of a specific key to the command. For example: adb shell getprop ro.product.model Here are a...
Python 2.x2.6 The format() method can be used to change the alignment of the string. You have to do it with a format expression of the form :[fill_char][align_operator][width] where align_operator is one of: < forces the field to be left-aligned within width. > forces the field to be righ...
To add a new column name to the users table, run the command: rails generate migration AddNameToUsers name This generates the following migration: class AddNameToUsers < ActiveRecord::Migration[5.0] def change add_column :users, :name, :string end end When the migration name i...
To add a new indexed column email to the users table, run the command: rails generate migration AddEmailToUsers email:string:index This will generate the following migration: class AddEmailToUsers < ActiveRecord::Migration[5.0] def change add_column :users, :email, :string add_i...
To add a reference to a team to the users table, run this command: $ rails generate migration AddTeamRefToUsers team:references This generates the following migration: class AddTeamRefToUsers < ActiveRecord::Migration[5.0] def change add_reference :users, :team, foreign_key: true ...
To add multiple columns to a table, separate field:type pairs with spaces when using rails generate migration command. The general syntax is: rails generate migration NAME [field[:type][:index] field[:type][:index]] [options] For example, the following will add name, salary and email fields to ...
From the official documentation: With Gradle: repositories { mavenCentral() // jcenter() works as well because it pulls from Maven Central } dependencies { compile 'com.github.bumptech.glide:glide:4.0.0' compile 'com.android.support:support-v4:25.3.1' annotationProcessor 'com.githu...
type person = {Name: string; Age: int} with // Defines person record member this.print() = printfn "%s, %i" this.Name this.Age let user = {Name = "John Doe"; Age = 27} // creates a new person user.print() // John Doe, 27
function Invoke-MyCmdlet { [CmdletBinding(SupportsShouldProcess = $true)] param() # ... }
DT[where, select|update|do, by] syntax is used to work with columns of a data.table. The "where" part is the i argument The "select|update|do" part is the j argument These two arguments are usually passed by position instead of by name. Our example data below is mtcars =...
Swift label1.layer.shadowOffset = CGSize(width: 3, height: 3) label1.layer.shadowOpacity = 0.7 label1.layer.shadowRadius = 2 Swift 3 label1.layer.shadowOffset = CGSize(width: 3, height: 3) label1.layer.shadowOpacity = 0.7 label1.layer.shadowRadius = 2 Objective-C label1.layer.shadowOffs...
The padding property sets the padding space on all sides of an element. The padding area is the space between the content of the element and its border. Negative values are not allowed. You can specify a side individually: padding-top padding-right padding-bottom padding-left The following...
The padding property sets the padding space on all sides of an element. The padding area is the space between the content of the element and its border. Negative values are not allowed. To save adding padding to each side individually (using padding-top, padding-left etc) can you write it as a shor...
Agents can be added to a JVM at runtime. To load an agent you will need to use the Attach API's VirtualMachine.attatch(String id). You can then load a compiled agent jar with the following method: public static void loadAgent(String agentPath) { String vmName = ManagementFactory.getRuntimeMXBe...
9.0 // Since the anchor system simply returns constraints, you still need to add them somewhere. View.AddConstraints( new[] { someLabel.TopAnchor.ConstraintEqualTo(TopLayoutGuide.GetBottomAnchor()), anotherLabel.TopAnchor.ConstraintEqualTo(someLabel.BottomAnchor, 6), ...
// Using Visual Format Language requires a special look-up dictionary of names<->views. var views = new NSDictionary( nameof(someLabel), someLabel, nameof(anotherLabel), anotherLabel, nameof(oneMoreLabel), oneMoreLabel ); // It can also take a look-up dictionary for metrics (...

Page 3 of 32