Tutorial by Examples: c

Configure your project-level build.gradle to include the android-apt plugin: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1' } } Then, apply the android-apt plugin in your module-level build...
split allows to divide a vector or a data.frame into buckets with regards to a factor/group variables. This ventilation into buckets takes the form of a list, that can then be used to apply group-wise computation (for loops or lapply/sapply). First example shows the usage of split on a vector: Con...
The border-collapse property determines if a tables' borders should be separated or merged. Below an example of two tables with different values to the border-collapse property: The table on the left has border-collapse: separate while the one on the right has border-collapse: collapse. ValueDe...
The border-spacing property determines the spacing between cells. This has no effect unless border-collapse is set to separate. Below an example of two tables with different values to the border-spacing property: The table on the left has border-spacing: 2px (default) while the one on the right ...
3.0 In Swift 3 there are multiple access-levels. This example uses them all except for open: public struct Car { public let make: String let model: String //Optional keyword: will automatically be "internal" private let fullName: String fileprivate var otherName...
public class SuperClass { private func secretMethod() {} } internal class SubClass: SuperClass { override internal func secretMethod() { super.secretMethod() } }
class Animal def method_missing(method, *args, &block) "Cannot call #{method} on Animal" end end => Animal.new.say_moo > "Cannot call say_moo on Animal"
class Animal def method_missing(method, *args, &block) if method.to_s == 'say' block.call else super end end end => Animal.new.say{ 'moo' } => "moo"
Arrays can have the allocatable attribute: ! One dimensional allocatable array integer, dimension(:), allocatable :: foo ! Two dimensional allocatable array real, dimension(:,:), allocatable :: bar This declares the variable but does not allocate any space for it. ! We can specify the bounds...
Inheritance allows classes to define specific behaviour based on an existing class. class Animal def say_hello 'Meep!' end def eat 'Yumm!' end end class Dog < Animal def say_hello 'Woof!' end end spot = Dog.new spot.say_hello # 'Woof!' spot.eat ...
To previous view controller To pop back to the previous page you can do this: Swift navigationController?.popViewControllerAnimated(true) Objective-C [self.navigationController popViewControllerAnimated:YES]; To root view controller To pop to the root of the navigation stack, you can do...
In your storyboard select the ViewController that you want to embed into a Navigation Controller. Then navigate to Editor > Embed In > Navigation Controller And that will create your navigation controller
0 # creates the Fixnum 0 123 # creates the Fixnum 123 1_000 # creates the Fixnum 1000. You can use _ as separator for readability By default the notation is base 10. However, there are some other built-in notations for different bases: 0xFF # Hexadecimal representation of 255, s...
You can use the Integer method to convert a String to an Integer: Integer("123") # => 123 Integer("0xFF") # => 255 Integer("0b100") # => 4 Integer("0555") # => 365 You can also pass a base parameter to the Integer method to c...
Library cargo new my-library This creates a new directory called my-library containing the cargo config file and a source directory containing a single Rust source file: my-library/Cargo.toml my-library/src/lib.rs These two files will already contain the basic skeleton of a library, such th...
Debug cargo build Release Building with the --release flag enables certain compiler optimizations that aren't done when building a debug build. This makes the code run faster, but makes the compile time a bit longer too. For optimal performance, this command should be used once a release build ...
Android supports several configuration qualifiers that allow you to control how the system selects your alternative resources based on the characteristics of the current device screen. A configuration qualifier is a string that you can append to a resource directory in your Android project and speci...
To run a specific migration up or down, use db:migrate:up or db:migrate:down. Up a specific migration: 5.0 rake db:migrate:up VERSION=20090408054555 5.0 rails db:migrate:up VERSION=20090408054555 Down a specific migration: 5.0 rake db:migrate:down VERSION=20090408054555 5.0 ra...
To create a join table between students and courses, run the command: $ rails g migration CreateJoinTableStudentCourse student course This will generate the following migration: class CreateJoinTableStudentCourse < ActiveRecord::Migration[5.0] def change create_join_table :students, ...
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...

Page 80 of 826