Tutorial by Examples

MATLAB code can be saved in m-files to be reused. m-files have the .m extension which is automatically associated with MATLAB. An m-file can contain either a script or functions. Scripts Scripts are simply program files that execute a series of MATLAB commands in a predefined order. Scripts do no...
--- trim: a string-trimming module for Lua -- Author, date, perhaps a nice license too -- -- The code here is taken or adapted from material in -- Programming in Lua, 3rd ed., Roberto Ierusalimschy -- trim_all(string) => return string with white space trimmed on both sides local trim_al...
-- The following assumes that trim module is installed or in the caller's package.path, -- which is a built-in variable that Lua uses to determine where to look for modules. local trim = require "trim" local msg = " Hello, world! " local cleaned = trim.trim_all(msg)...
Microsoft Windows applications are usually written as either a console application or a windowed application (there are other types such as services and plug-ins). The difference for the programmer is the difference in the interface for the main entry point for the application source provided by the...
You can declare properties in interfaces. Since an interface cannot have state you can only declare a property as abstract or by providing default implementation for the accessors. interface MyInterface { val property: Int // abstract val propertyWithImplementation: String g...
MSBuild 2015 On Windows there are three choices to get MSBuild: Install Visual Studio 2015 Download Microsoft Build Tools which includes VB and C# compilers. Build from Source On Linux Build from Source using this guide
Reading a file line by line public class Main { public static void main(String[] args) { try { Scanner scanner = new Scanner(new File("example.txt")); while(scanner.hasNextLine()) { String line = scanner.nextLine(); ...
One std::vector can be append to another by using the member function insert(): std::vector<int> a = {0, 1, 2, 3, 4}; std::vector<int> b = {5, 6, 7, 8, 9}; a.insert(a.end(), b.begin(), b.end()); However, this solution fails if you try to append a vector to itself, because the sta...
The data.table package provides a convenient way to group by runs in data. Consider the following example data: library(data.table) (DT <- data.table(x = c(1, 1, 2, 2, 2, 1), y = 1:6)) # x y # 1: 1 1 # 2: 1 2 # 3: 2 3 # 4: 2 4 # 5: 2 5 # 6: 1 6 The variable x has three runs: a run ...
1) scikit learn scikit-learn is a Python module for machine learning built on top of SciPy and distributed under the 3-Clause BSD license. It features various classification, regression and clustering algorithms including support vector machines, random forests, gradient boosting, k-means and DBSCA...
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 =...
<PROJECT_ROOT>\app\build.gradle is specific for app module. <PROJECT_ROOT>\build.gradle is a "Top-level build file" where you can add configuration options common to all sub-projects/modules. If you use another module in your project, as a local library you would have another...
First install the .NET Core SDK by going through the installation instructions for the platform of your choice: Windows OSX Linux Docker After the installation has completed, open a command prompt, or terminal window. Create a new directory with mkdir hello_world and change into the ne...
A list in Erlang is a sequence of zero or more Erlang terms, implemented as a singly linked list. Each element in the list can be any type of term (any data type). 1> [1,2,3]. [1,2,3] 2> [wow,1,{a,b}]. [wow,1,{a,b}] The list's head is the first element of the list. The list's tail...
The where statement may be used within a switch case match to add additional criteria required for a positive match. The following example checks not only for the range, but also if the number is odd or even: switch (temperature) { case 0...49 where temperature % 2 == 0: print(&quot...
A string representation of a Guid can be obtained by using the built in ToString method string myGuidString = myGuid.ToString(); Depending on your needs you can also format the Guid, by adding a format type argument to the ToString call. var guid = new Guid("7febf16f-651b-43b0-a5e3-0da8da4...
@interface MyObject : MySuperclass @property (copy) void (^blockProperty)(NSString *string); @end When assigning, since self retains blockProperty, block should not contain a strong reference to self. Those mutual strong references are called a "retain cycle" and will prevent the...
Key Value Coding is integrated into NSObject using NSKeyValueCoding protocol. What this means? It means that any id object is capable of calling valueForKey method and its various variants like valueForKeyPath etc. ' It also means that any id object can invoke setValue method and its various vari...

for

Syntax: for (initializer; condition; iterator) The for loop is commonly used when the number of iterations is known. The statements in the initializer section run only once, before you enter the loop. The condition section contains a boolean expression that's evaluated at the end of every loop ...
The clone() method is used to create and return a copy of an object. This method arguable should be avoided as it is problematic and a copy constructor or some other approach for copying should be used in favour of clone(). For the method to be used all classes calling the method must implement the...

Page 140 of 1336