Tutorial by Examples: pre

It is a good practice to provide expression string arguments as braced strings. The heading "Double Substitution" outlines important reasons behind the same. The expr command evaluates an operator-based expression string to calculate a value. This string is constructed from the arguments ...
JavaScript has native conversion from Number to it's String representation for any base from 2 to 36. The most common representation after decimal (base 10) is hexadecimal (base 16), but the contents of this section work for all bases in the range. In order to convert a Number from decimal (base...
If you are optimizing all images manually, disable APT Cruncher for a smaller APK file size. android { aaptOptions { cruncherEnabled = false } }
Introduction and motivation Expression templates (denoted as ETs in the following) are a powerful template meta-programming technique, used to speed-up calculations of sometimes quite expensive expressions. It is widely used in different domains, for example in implementation of linear algebra ...
Lets suppose you have 2 Lists A and B, and you want to remove from B all the elements that you have in A the method in this case is List.removeAll(Collection c); #Example: public static void main(String[] args) { List<Integer> numbersA = new ArrayList<>(); List<Intege...
Input must must read from the Update function. Reference for all the available Keycode enum. 1. Reading key press with Input.GetKey: Input.GetKey will repeatedly return true while the user holds down the specified key. This can be used to repeatedly fire a weapon while holding the specified key ...
A basic CORS request is allowed to use one of only two methods: GET POST and only a few select headers. POST CORS requests can additionally choose from only three content types. To avoid this issue, requests that wish to use other methods, headers, or content types must first issue a preflig...
When a server receives a preflight request, it must check if it supports the requested method and headers, and send back a response that indicates its ability to support the request, as well as any other permitted data (such as credentials). These are indicated in access-control Allow headers. The ...
When we want to count the number of items in an iterable, that meet some condition, we can use comprehension to produce an idiomatic syntax: # Count the numbers in `range(1000)` that are even and contain the digit `9`: print (sum( 1 for x in range(1000) if x % 2 == 0 and '9' in str...
preg_match can be used to parse string using regular expression. The parts of expression enclosed in parenthesis are called subpatterns and with them you can pick individual parts of the string. $str = "<a href=\"http://example.org\">My Link</a>"; $pattern = "/...
Please read Preventing SQL injection with Parametrized Queries for a complete discussion of why prepared statements help you secure your SQL statements from SQL Injection attacks The $conn variable here is a MySQLi object. See MySQLi connect example for more details. For both examples, we assume t...
CSRF is an attack which forces end user to execute unwanted actions on a web application in which he/she is currently authenticated. It can happen because cookies are sent with every request to a website - even when those requests come from a different site. We can use csurf module for creating cs...
In the build.gradle file of your Android app module add next dependencies: dependencies { // Android JUnit Runner androidTestCompile 'com.android.support.test:runner:0.5' // JUnit4 Rules androidTestCompile 'com.android.support.test:rules:0.5' // Espresso core a...
Place next java class in src/androidTest/java and run it. public class UITest { @Test public void Simple_Test() { onView(withId(R.id.my_view)) // withId(R.id.my_view) is a ViewMatcher .perform(click()) // click() is a ViewAction .check(matches(isDi...
Setup First, install the necessary packages with: npm install express cors mongoose Code Then, add dependencies to your server.js file, create the database schema and the name of the collection, create an Express.js server, and connect to MongoDB: var express = require('express'); var cors =...
Setup First, install the necessary packages with: npm install express cors mongoose Code Then, add dependencies to server.js, create the database schema and the name of the collection, create an Express.js server, and connect to MongoDB: var express = require('express'); var cors = require('...
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload HSTS is activated only after a successful HTTPS request to the server with a valid certificate. There is still a risk of a first-time user accessing the site, at which point a Man-in-the-Middle attack is possible. To make th...
C++14 In C++14, this is easily done by std::mismatch which returns the first mismatching pair from two ranges: std::string prefix = "foo"; std::string string = "foobar"; bool isPrefix = std::mismatch(prefix.begin(), prefix.end(), string.begin(), string.end()).first == ...
When a user press F1 on a control or click on Help button of form (?) and then clicks on a control the HelpRequested event will be raised. You can handle this event to provide custom action when user requests help for controls or form. The HelpRequested supports bubble up mechanism. It fires for y...
UI testing tools Two main tools that are nowadays mostly used for UI testing are Appium and Espresso. AppiumEspressoblackbox testwhite/gray box testingwhat you see is what you can testcan change inner workings of the app and prepare it for testing, e.g. save some data to database or sharedpreferen...

Page 12 of 34