Tutorial by Examples

In this example, we rewrite url's of the form http://example.com/topic/id-seoname to a php script that takes an id as input. This example expects the rule to be in "per-directory" context. RewriteEngine on RewriteRule ^topic/([0-9]+)-[^/]*/?$ /topics.php?id=$1 [L] In this example, t...
To match a query string, a condition must be added to the RewriteRule. This is done by putting RewriteCond directives before the corresponding rule. In the following example we dynamically internally rewrite an old url to a new url. RewriteCond %{QUERY_STRING} ^name=([^&]*)$ RewriteRule ^oldsc...
The Cholesky decomposition is a method to decompose an hermitean, positiv definite matrix into an upper triangular matrix and its transpose. It can be used to solve linear equations systems and and is around twice as fast as LU-decomposition. A = [4 12 -16 12 37 -43 -16 -43 98]; R = chol...
This method will decompose a matrix into an upper triangular and an orthogonal matrix. A = [4 12 -16 12 37 -43 -16 -43 98]; R = qr(A); This will return the upper triangular matrix while the following will return both matrices. [Q,R] = qr(A); The following plot will display the run...
Hereby a matrix will be decomposed into an upper trangular and an lower triangular matrix. Often it will be used to increase the performance and stability (if it's done with permutation) of Gauß elimination. However, quite often does this method not or badly work as it is not stable. For example A...
You can use extensions for reference View, no more boilerplate after you created the views. Original Idea is by Anko Library Extensions inline fun <reified T : View> View.find(id: Int): T = findViewById(id) as T inline fun <reified T : View> Activity.find(id: Int): T = findViewById(i...
OpenCv image read from file system in Java import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.imgcodecs.Imgcodecs; public class Giris { public static void main(String[] args) { //Load native library System.loadLibrary(Core.NATIVE_LIBRARY_NAME...
Display a live video feed taken from a webcam using OpenCV's VideoCapture class with Java, C/C++ and Python. Java import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.videoio.VideoCapture; public class Camera { public static void main(String[] args) { // L...
Getters and setters are methods that are behaved like properties. it means they have function structure but when used, they are used same as properties: Structure of getter functions: they should have get keyword after function keyword and before function name, with no argument, a return type spec...
This is an example how to get the play an audio file which you already have on your pc/laptop .First create a new directory under res and name it as raw like this copy the audio which you want to play into this folder .It may be a .mp3 or .wav file. Now for example on button click you want to pl...
To illustrate relation OneToMany we need 2 Entities e.g. Country and City. One Country has multiple Cities. In the CountryEntity beloww we define set of cities for Country. @Entity @Table(name = "Country") public class CountryEntity implements Serializable { private static final l...
Numpy provides a cross function for computing vector cross products. The cross product of vectors [1, 0, 0] and [0, 1, 0] is [0, 0, 1]. Numpy tells us: >>> a = np.array([1, 0, 0]) >>> b = np.array([0, 1, 0]) >>> np.cross(a, b) array([0, 0, 1]) as expected. While cr...
Either input can be an array of 3- (or 2-) element vectors. >>> a=np.array([[1,0,0],[0,1,0],[0,0,1]]) >>> b=np.array([1,0,0]) >>> np.cross(a,b) array([[ 0, 0, 0], [ 0, 0, -1], [ 0, 1, 0]]) The result in this case is array([np.cross(a[0],b), np.c...
The default requests integrated in volley don't allow to pass a JSONArray as request body in a POST request. Instead, you can only pass a JSON object as a parameter. However, instead of passing a JSON object as a parameter to the request constructor, you need to override the getBody() method of the...
Float data type The float data type is a single-precision 32-bit IEEE 754 floating point. Float overflow Maximum possible value is 3.4028235e+38 , When it exceeds this value it produces Infinity float f = 3.4e38f; float result = f*2; System.out.println(result); //Infinity Float Und...
Step 1: Add the dependency of latest ACRA AAR to your application gradle(build.gradle). Step 2: In your application class(the class which extends Application; if not create it) Add a @ReportsCrashes annotation and override the attachBaseContext() method. Step 3: Initialize the ACRA class in your...
Animation to show how selection sort works The below example shows selection sort in Python def sort_selection(my_list): for pos_upper in xrange( len(my_list)-1, 0, -1): max_pos = 0 for i in xrange(1, pos_upper + 1): if(my_list[i] > my_list[max_pos]): max_po...
We may forget to apply the Antiforgery attribute for each POST request so we should make it by default. This sample will make sure Antiforgery filter will always be applied to every POST request. Firstly create new AntiForgeryTokenFilter filter: //This will add ValidateAntiForgeryToken Attribute t...
Traversing from the root node to a descendant element using the child axis: /child::html/child::body/child::div/child::span Since the child axis is the default axis, this can be abbreviated to: /html/body/div/span
The descendant and descendant-or-self axes can be used to find all descendant elements of a node at any depth. In contrast, the child axis only traverses immediate children. /child::html/descendant::span /child::html/descendant-or-self::* The double slash // is a shortcut for /descendant-or-sel...

Page 849 of 1336