Tutorial by Examples: a

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) say, speak = method.to_s.split("_") if say == "say" && speak return speak.upcase if args.first == "shout" speak else super end end end => Animal.new....
FrameLayout is designed to block out an area on the screen to display a single item. You can, however, add multiple children to a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity attribute. Generally, FrameLayout is ...
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...
#include <stdio.h> /* for perror(), fopen(), fputs() and fclose() */ #include <stdlib.h> /* for the EXIT_* macros */ int main(int argc, char **argv) { int e = EXIT_SUCCESS; /* Get path from argument to main else default to output.txt */ char *path = (argc > 1...
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...
Installation Installing Codename One In NetBeans These instructions assume you have downloaded a recent version of NetBeans (at this time 8.x), installed and launched it. Select the Tools->Plugins menu option Select the Available Plugins Tab Check The CodenameOne Plugin ...
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
Detailed instructions on getting Verilog set up or installed is dependent on the tool you use since there are many Verilog tools.
What is AJAX? AJAX stands for Asynchronous JavaScript and XML. In a nutshell, it is the use of the XMLHttpRequest object to communicate with server-side scripts. It can send as well as receive information in a variety of formats, including JSON, XML, HTML, and even text files. -Mozilla Devel...
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...
CommandDescriptionaAppend text following current cursor positionAAppend text at the end of current lineiInsert text before the current cursor positionIInsert text before first non-blank character of current linegIInsert text in first column of cursor linegiInsert text at same position where it was l...
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 run migrations in the test environment, run this shell command: rake db:migrate RAILS_ENV=test 5.0 Starting in Rails 5.0, you can use rails instead of rake: rails db:migrate RAILS_ENV=test

Page 108 of 1099