Tutorial by Examples

A Sub is a procedure that performs a specific task but does not return a specific value. Sub ProcedureName ([argument_list]) [statements] End Sub If no access modifier is specified, a procedure is Public by default. A Function is a procedure that is given data and returns a value, ideally...
SRXMPPDemo Download the example and all the classes here - https://github.com/SahebRoy92/SRXMPPDemo A demo on XMPP in Objective C, with various simple and complex features implemented in it. All the features of XMPP is done by "in band" xmpp functions. Few features this project contains...
Slices are the typical way go programmers store lists of data. To declare a slice variable use the []Type syntax. var a []int To declare and initialize a slice variable in one line use the []Type{values} syntax. var a []int = []int{3, 1, 4, 1, 5, 9} Another way to initialize a slice is with...
A class designed to be inherited-from is called a Base class. Care should be taken with the special member functions of such a class. A class designed to be used polymorphically at run-time (through a pointer to the base class) should declare the destructor virtual. This allows the derived parts of...
Bear in mind that declaring a destructor inhibits the compiler from generating implicit move constructors and move assignment operators. If you declare a destructor, remember to also add appropriate definitions for the move operations. Furthermore, declaring move operations will suppress the genera...
When creating a recyclerview with a gridlayout layout manager you have to specify the span count in the constructor. Span count refers to the number of columns. This is fairly clunky and doesn't take into account larger screen sizes or screen orientation. One approach is to create multiple layouts f...
To add a header to a recyclerview with a gridlayout, first the adapter needs to be told that the header view is the first position - rather than the standard cell used for the content. Next, the layout manager must be told that the first position should have a span equal to the *span count of the e...
Using the Array::new constructor, your can initialize an array with a given size and a new array in each of its slots. The inner arrays can also be given a size and and initial value. For instance, to create a 3x4 array of zeros: array = Array.new(3) { Array.new(4) { 0 } } The array generated a...
Define your class that will represent your custom error. public class ErrorDto { public int Code { get; set; } public string Message { get; set; } // other fields public override string ToString() { return JsonConvert.SerializeObject(this); } } Then put nex...
The idea is to use HttpContext.Response.OnStarting callback, as this is the last event that is fired before the headers are sent. Add the following to your middleware Invoke method. public async Task Invoke(HttpContext context) { context.Response.OnStarting((state) => { if ...
A shell script is a very versatile way to extend your build to basically anything you can think of. As an exmaple, here is a simple script to compile protobuf files and add the result java files to the source directory for further compilation: def compilePb() { exec { // NOTICE: grad...
With the rgdal package it is possible to import and export shapfiles with R. The function readOGR can be used to imports shapfiles. If you want to import a file from e.g. ArcGIS the first argument dsn is the path to the folder which contains the shapefile. layer is the name of the shapefile without...
The packages foreign and haven can be used to import and export files from a variety of other statistical packages like Stata, SPSS and SAS and related software. There is a read function for each of the supported data types to import the files. # loading the packages library(foreign) library(have...
The class we are going to test is: public class Service { private Collaborator collaborator; public Service(Collaborator collaborator) { this.collaborator = collaborator; } public String performService(String input) { return collaborator.transformStri...
The class we are going to test is: public class Service{ private Collaborator collaborator; public Service(Collaborator collaborator){ this.collaborator = collaborator; } public String performService(String input){ return collaborator.transformS...
Enumerable is the most popular module in Ruby. Its purpose is to provide you with iterable methods like map, select, reduce, etc. Classes that use Enumerable include Array, Hash, Range. To use it, you have to include Enumerable and implement each. class NaturalNumbers include Enumerable de...
The following prints the message Hello, World! to console public void hello() { Observable.just("Hello, World!") // create new observable .subscribe(new Action1<String>() { // subscribe and perform action @Override public void call(String st) { Sy...
The core concepts of RxJava are its Observables and Subscribers. An Observable emits objects, while a Subscriber consumes them. Observable Observable is a class that implements the reactive design pattern. These Observables provide methods that allow consumers to subscribe to event changes. The ev...
Comparable is one of the most popular modules in Ruby. Its purpose is to provide with convenience comparison methods. To use it, you have to include Comparable and define the space-ship operator (<=>): class Rectangle include Comparable def initialize(a, b) @a = a @b = b ...
angular.module("app") .service("counterService", function(){ var service = { number: 0 }; return service; });

Page 182 of 1336