Tutorial by Examples: 2

This example will create an EC2 instance of t2.micro type in N.Virginia region running Amazon Linux. During the execution, it will ask to select the KeyPair to use and an I.P. CIDR from where you can SSH to the instance, use default to make SSH open to the internet { "AWSTemplateFormatVersion"...
We initialize the data: [X,Y] = meshgrid(1:2:10); Z = X.*cos(Y) - Y.*sin(X); The surface looks like the following. Now we set the points where we want to interpolate: [Vx,Vy] = meshgrid(1:0.25:10); We now can perform nearest interpolation, Vz = interp2(X,Y,Z,Vx,Vy,'nearest'); line...
Jersey (2) uses HK2 as its dependency injection (DI) system. We can use other injection systems, but its infrastructure is built with HK2, and allows us to also use it within our applications. Setting up simple dependency injection with Jersey takes just a few lines of code. Let say for example we ...
1 dimensional To integrate a one dimensional function f = @(x) sin(x).^3 + 1; within the range xmin = 2; xmax = 8; one can call the function q = integral(f,xmin,xmax); it's also possible to set boundarys for relative and absolute errors q = integral(f,xmin,xmax, 'RelTol',10e-6, 'AbsTo...
This example uses Angular 2.0.0 Final Release registration-form.component.ts import { FormGroup, FormControl, FormBuilder, Validators } from '@angular/forms'; @Component({ templateUrl: "./registration-form.html" }) export class ExampleComponent { ...
The iv is prefixed to the encrypted data aesCBC128Encrypt will create a random IV and prefixed to the encrypted code. aesCBC128Decrypt will use the prefixed IV during decryption. Inputs are the data and key are Data objects. If an encoded form such as Base64 if required convert to and/or from in ...
Password Based Key Derivation can be used both for deriving an encryption key from password text and saving a password for authentication purposes. There are several hash algorithms that can be used including SHA1, SHA256, SHA512 which are provided by this example code. The rounds parameter is use...
See Swift 3 example for usage information and notes func pbkdf2SHA1(password: String, salt: [UInt8], keyCount: Int, rounds: Int) -> [UInt8]? { return pbkdf2(CCPBKDFAlgorithm(kCCPRFHmacAlgSHA1), password:password, salt:salt, keyCount:keyCount, rounds:UInt32(rounds)) } func pbkdf2SHA256(p...
See Swift 3 example for usage information and notes func pbkdf2SHA1Calibrate(password:String, salt:[UInt8], msec:Int) -> UInt32 { let actualRoundCount: UInt32 = CCCalibratePBKDF( CCPBKDFAlgorithm(kCCPBKDF2), password.utf8.count, salt.count, CCPseudoRandom...
Here i am going to explain the ajax custom pagination in cakephp 3.2. This one is easier to use and understandable. Do this code inside any function and any controller you need. Make an ajax call for the pagination <script type="text/javascript"> $(document).ready(function ()...
Will talk about directory structure of CakePHP, what each folder means. CakePHP has some main folders app - It Contains our application source code, all our code lies under this directory. lib - This is the cakephp core liberary, it contains all the base cakephp library code. Editing code insid...
Most of the time, we'll need to find out the shortest path from single source to all other nodes or a specific node in a 2D graph. Say for example: we want to find out how many moves are required for a knight to reach a certain square in a chessboard, or we have an array where some cells are blocked...
Often the easiest solution is simply to pass 2D and higher arrays around as flat memory. /* create 2D array with dimensions determined at runtime */ double *matrix = malloc(width * height * sizeof(double)); /* initialise it (for the sake of illustration we want 1.0 on the diagonal) */ int x, y...
This example uses the official Google .net Client library. PM> Install-Package Google.Apis.AnalyticsReporting.v4 Authorization Requires one of the following OAuth scopes: https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/analytics Oauth2 // The...
Example uses the Google APIs Dotnet client library. PM> Install-Package Google.Apis.AnalyticsReporting.v4 /// <summary> /// This method requests Authentcation from a user using Oauth2. /// Credentials are stored in System.Environment.SpecialFolder.Personal /// Do...
Sometimes we want to use a where query on a a collection of records returned which is not ActiveRecord::Relation.Hence we get the above error as Where clause is know to ActiveRecord and not to Array. There is a precise solution for this by using Joins. EXAMPLE:- Suppose i need to find all user ...
To separate API logic from the component, we are creating the API client as a separate class. This example class makes a request to Wikipedia API to get random wiki articles. import { Http, Response } from '@angular/http'; import { Injectable } from '@angular/core'; import { Observabl...
With the 2.x versions of typescript, typings are now available from the npm @types repository. These are automatically resolved by the typescript compiler and are much simpler to use. To install a type definition you simply install it as a dev dependency in your projects package.json e.g. npm i -...
In this Example we are going to take a sqaure shaped line plotted using line and perform transformations on it. Then we are going to use the same tranformations but in different order and see how it influences the results. First we open a figure and set some initial parameters (square point coordin...
Before install this extension, you must install yii2-app. In this example, I use yii2-basic template. Guide for installation in here. Run composer require --prefer-dist yiisoft/yii2-authclient or add "yiisoft/yii2-authclient": "~2.1.0" to the require section of your comp...

Page 12 of 21