Tutorial by Examples: c

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...
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...
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...
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...
The parent axis contains only the parent of a node. The following expression selects the html element by taking a detour over the body element: /child::html/child::body/parent::html .. is a shortcut for parent::node() The ancestor and ancestor-or-self axes traverse all ancestors of a node. The ...
The following-sibling and preceding-sibling axes contain the siblings before or after the context node, and the following and preceding axes contain all nodes in the document before or after the context node, but: None of these axes contain attribute or namespace nodes. The following axis doesn'...
The attribute and namespace axes contain all attribute and namespace nodes of an element. The shortcut @ stands for attribute::, so the following are equivalent: child::div/attribute::class div/@class
Why do we need this? The current way to do unit testing in Xamarin.Forms is via a platform runner, so your test will have to run within an ios, android, windows or mac UI environment : Running Tests in the IDE Xamarin also provides awesome UI testing with the Xamarin.TestCloud offering, but when ...
To add to the first example, in order to test navigation statements that occurs within the application, we need to provide the ViewModel with a hook to the Navigation. To achieve this: Add the package SpecFlow.Xamarin.Forms.IViewModel from nuget to your PCL Xamarin.Forms project Implement the IV...

Page 526 of 826