Tutorial by Examples: al

A palindrome is a word that can be read both ways, like 'kayak'. This example will show how to find if a given word is a palindrome using Python3. First, we need to turn a string into a stack (we will use arrays as stacks). str = "string" stk = [c for c in str] #this makes an array: [&...
If you want to create a custom validation rule, you can do so for instance in the boot method of a service provider, via the Validator facade. <?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Validator; class AppServiceProvider extends ServiceProvider { ...
var x = 5; var str = "if (x == 5) {console.log('z is 42'); z = 42;} else z = 0; "; console.log("z is ", eval(str)); The use of eval is strongly discouraged. See the Remarks section for details.
Objective-C First go the Target->Capabilities and enable HealthKit. This would setup the info.plist entry. Make a new CocoaClass of type NSObject The filename I gave is GSHealthKitManager and the header file is as shown below GSHealthKitManager.h #import <Foundation/Foundation.h> #imp...
Installation $ npm install gulp-jslint --save-dev Usage In gulpfile.js add: var gulp = require('gulp'); var jslint = require('gulp-jslint'); gulp.task('lint', function(){ return gulp.src(['source.js']) .pipe(jslint({ /* this object represents the JSLint directives being passe...
To install PHP on Ubuntu, first install the Redis server: sudo apt install redis-server then install the PHP module: sudo apt install php-redis And restart the Apache server: sudo service apache2 restart
Maya supports 3 main programming environments. Each has different setup requirements. MEL MEL scripting language is included with the Maya application. Enabled by default, users can test MEL in the script listener window in a running copy of Maya. MEL files are text files with the extension .mel...
The partition of an integer is a way of writing it as a sum of positive integers. For example, the partitions of the number 5 are: 5 4 + 1 3 + 2 2 + 2 + 1 2 + 1 + 1 + 1 1 + 1 + 1 + 1 + 1 Notice that changing the order of the summands will not create a different partition. The partition f...
public class IntegerPartition { public static int[,] Result = new int[100,100]; private static int Partition(int targetNumber, int largestNumber) { for (int i = 1; i <= targetNumber; i++) { for (int j = 1; j <= largestNumber; j++) ...
This is an example of using until/retries/delay to implement an alive check for a webapp that is starting up. It assumes that there will be some period of time (up to 3 minutes) where the webapp is refusing socket connections. After that, it checks the /alive page for the word "OK". It als...
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...
Add button Login as facebook account to your login view: Edit site/login.php in views folder, add theses line to content of page login: <?= yii\authclient\widgets\AuthChoice::widget([ 'baseAuthUrl' => ['site/auth'], 'popupMode' => false, ]) ?> Above, we set that aut...
This document explains how to get Google Access tokens and use them to get Google Analytics data to be displayed in our websites. Example: A live example is available in https://newtonjoshua.com note: Use the same gmail account for all the below steps. STEP 1: Set Up Google Analytics Foll...
XML <Animal> <legs>4</legs> <eyes>2</eyes> <horns>2</horns> <tail>1</tail> </Animal> XPATH boolean(/Animal/tusks) OUTPUT false
XPATH <Animal> <legs>4</legs> <eyes>2</eyes> <horns>2</horns> <tail>1</tail> </Animal> XPATH boolean(/Animal/horns) OUTPUT true
SELECT CURRENT_DATE + '1 day'::INTERVAL SELECT '1999-12-11'::TIMESTAMP + '19 days'::INTERVAL SELECT '1 month'::INTERVAL + '1 month 3 days'::INTERVAL
SELECT string_agg(<TABLE_NAME>.<COLUMN_NAME>, ',') FROM <SCHEMA_NAME>.<TABLE_NAME> T
Detailed instructions on getting architecture set up or installed.
Detailed instructions on getting directx-11 set up or installed.

Page 193 of 269