Tutorial by Examples: is

Python allows you to hack list comprehensions to evaluate conditional expressions. For instance, [value_false, value_true][<conditional-test>] Example: >> n = 16 >> print [10, 20][n <= 15] 10 Here n<=15 returns False (which equates to 0 in Python). So what Python i...
Emission is when a surface (or rather a material) emits light. In the inspector panel for a material on a static object using the Standard Shader there is an emission property: If you change this property to a value higher than the default of 0, you can set the emission color, or assign an emissi...
Suppose that we have a text and a pattern. We need to determine if the pattern exists in the text or not. For example: +-------+---+---+---+---+---+---+---+---+ | Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | +-------+---+---+---+---+---+---+---+---+ | Text | a | b | c | b | c | g | l | x | +-------...
Entity falling distance is the distance the entity have fallen without reaching a block. It can be used to calculate different damage from falling, or activating an effect after a big fall. Retrieving the falling distance float distanceFell = entity.getFallingDistance(); Setting the falling ...
This helper is loaded using the following code: In Controller itself(* can repeat again and again*) $this->load->helper('captcha'); In config/autoload.php (Load only once) $autoload['helper'] = array('captcha');
Import libraries (language dependency: python 2.7) import tensorflow as tf import numpy as np from sklearn.datasets import fetch_mldata from sklearn.model_selection import train_test_split load data, prepare data mnist = fetch_mldata('MNIST original', data_home='./') print "MNIST data,...
int[string] numbers = ["a" : 10, "b" : 20]; assert("a" in numbers); assert("b" in numbers); assert("c" in numbers);
In C++, code must be declared or defined before usage. For example, the following produces a compile time error: int main() { foo(2); // error: foo is called, but has not yet been declared } void foo(int x) // this later definition is not known in main { } There are two ways to resolve...
Here a Turtle Graphics Ninja Twist: import turtle ninja = turtle.Turtle() ninja.speed(10) for i in range(180): ninja.forward(100) ninja.right(30) ninja.forward(20) ninja.left(60) ninja.forward(50) ninja.right(30) ninja.penup() ninja.setposit...
Basic reading image from java import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.imgcodecs.Imgcodecs; //Load native library System.loadLibrary(Core.NATIVE_LIBRARY_NAME); //Mat object used to host the image Mat imageArray; //Read image file from vile system ima...
In Production its good practice to secure your data and only allow operations on it to be undertaken via Stored Procedures. This means your application can't directly run CRUD operations on your data and potentially cause problems. Assigning permissions is a time-consuming, fiddly and generally oner...
Customer Table IdFirstNameLastName1OzgurOzturk2YoussefMedi3HenryTai Order Table IdCustomerIdAmount12123.502314.80 Get all customers with a least one order SELECT * FROM Customer WHERE EXISTS ( SELECT * FROM Order WHERE Order.CustomerId=Customer.Id ) Result IdFirstNameLastName2YoussefM...
Redis has a Windows port provided by 'Microsoft Open Technologies'. You can use the msi installer found on: https://github.com/MSOpenTech/redis/releases After installation completes you can see 'Redis' is a Windows service (and it's status should be "Started") To write an 'Hello world'...
set clipboard=unnamed This makes it possible to copy/paste between Vim and the system clipboard without specifying any special register. yy yanks the current line into the system clipboard p pastes the content of the system clipboard into Vim This only works if your Vim installation has cli...
import AVFoundation class QRScannerViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate { func viewDidLoad() { self.initCaptureSession() } private func initCaptureSession() { let captureDevice = AVCaptureDevice .defa...
Method Overriding and Overloading are two forms of polymorphism supported by Java. Method Overloading Method overloading (also known as static Polymorphism) is a way you can have two (or more) methods (functions) with same name in a single class. Yes its as simple as that. public class Shape{ ...
A public gist can be almost anything. A simple example of a Javascript function: function randomInt(min, max) { return Math.floor((max - min + 1) * Math.random()) + min; }
A secret gist should be used for anything that you don't want to appear publicly on GitHub. Secret gists can be used when you don't want private keys to be accessible to the public, or for and private code in general. A simple example of JSON code that would be better fit for a secret gist: { &qu...
The IE=Edge meta tag is for telling the destination rendering engine to use the latest (edge) version of IE rendering engine, which enables responsive behavior in Windows phones. <meta http-equiv="X-UA-Compatible" content="IE=edge"> Occasionally this breaks images in Li...

Page 82 of 109