Tutorial by Examples: ai

Each domain supported in the app needs to make available its own apple-app-site-association file. If the content served by each domain is different, then the contents of the file will also change to support the respective paths. Otherwise, the same file can be used, but it needs to be accessible at ...
In MATLAB versions prior to R2014b, using the old HG1 graphics engine, it was not obvious how to create color coded 2D line plots. With the release of the new HG2 graphics engine arose a new undocumented feature introduced by Yair Altman: n = 100; x = linspace(-10,10,n); y = x.^2; p = plot(x,y,'r...
Log into a running container A user can enter a running container in a new interactive bash shell with exec command. Say a container is called jovial_morse then you can get an interactive, pseudo-TTY bash shell by running: docker exec -it jovial_morse bash Log into a running container with a s...
By convention, the functor (-)/2 is often used to denote pairs of elements in Prolog. For example, the term -(A, B) denotes the pair of elements A and B. In Prolog, (-)/2 is defined as an infix operator. Therefore, the term can be written equivalently as A-B. Many commonly available predicates also...
Although people often say Sass as the name of this CSS-preprocessor, they often mean the SCSS-syntax. Sass uses the .sass file extension, while SCSS-Sass uses the .scss extension. They are both referred to as "Sass". Speaking generally, the SCSS-syntax is more commonly used. SCSS looks li...
Recursion can be defined as: A method that calls itself until a specific condition is met. An excellent and simple example of recursion is a method that will get the factorial of a given number: public int Factorial(int number) { return number == 0 ? 1 : n * Factorial(number - 1); } ...
In the timeline of any DisplayObject that is attached as a descendant of the display tree, you can utilise the root property. This property points to the main timeline in the case of no custom document class, or the document class if you do define one. Because root is typed DisplayObject, the compi...
Output can be restricted by specifying line ranges as git blame -L <start>,<end> Where <start> and <end> can be: line number git blame -L 10,30 /regex/ git blame -L /void main/, git blame -L 46,/void foo/ +offset, -offset (only for <end>) git blame -...
It is a good idea to maintain a web-scraping session to persist the cookies and other parameters. Additionally, it can result into a performance improvement because requests.Session reuses the underlying TCP connection to a host: import requests with requests.Session() as session: # all req...
This example uses four different files: The User model The User mailer The html template for the email The plain-text template for the email In this case, the user model calls the approved method in the mailer and passes the post that has been approved (the approved method in the model may ...
public class Foo { private const int TASK_ITERATION_DELAY_MS = 1000; private CancellationTokenSource _cts; public Foo() { this._cts = new CancellationTokenSource(); } public void StartExecution() { Task.Factory.StartNew(this.OwnCodeCancelable...
Working Source - https://github.com/benhysell/V.TouchIdExample Long form description - http://benjaminhysell.com/archive/2014/11/authentication-in-xamarin-ios-with-touch-id-or-passcode/ //Simple View with a switch to enable / disable Touch ID and //a button to invoke authentication /// <s...
Template JS code Template.templateName.onCreated(function(){ this.subscribe('subsription1'); this.subscribe('subscription2'); }); Template HTML code <template name="templateName"> {{#if Template.subscriptionsReady }} //your actual view with data. it can ...
To generate an ActiveRecord model that automagically creates the correct db migrations & boilerplate test files for your model, enter this command rails generate model NAME column_name:column_type 'NAME' is the name of the model. 'field' is the name of the column in the DB table and 'type' i...
Stream is especially useful when you want to run multiple operations on a collection. This is because Stream is lazy and only does one iteration (whereas Enum would do multiple iterations, for example). numbers = 1..100 |> Stream.map(fn(x) -> x * 2 end) |> Stream.filter(fn(x) -> rem(x...
In addition to a failure/success return value, some API calls also set the last error on failure (e.g. CreateWindow). The documentation usually contains the following standard wording for this case: If the function succeeds, the return value is <API-specific success value>. If the function...
Some API calls can succeed or fail in more than one way. The APIs commonly return additional information for both successful invocations as well as errors (e.g. CreateMutex). if ( CreateMutexW( NULL, TRUE, L"Global\\MyNamedMutex" ) == NULL ) { // Failure: get additional information. ...
In order to efficiently handle cycle detection, we consider each node as part of a tree. When adding an edge, we check if its two component nodes are part of distinct trees. Initially, each node makes up a one-node tree. algorithm kruskalMST'(G: a graph) sort G's edges by their value MST ...
Creating empty deque: dl = deque() # deque([]) creating empty deque Creating deque with some elements: dl = deque([1, 2, 3, 4]) # deque([1, 2, 3, 4]) Adding element to deque: dl.append(5) # deque([1, 2, 3, 4, 5]) Adding element left side of deque: dl.appendleft(0) # deque([0, 1, 2, ...
hashlib.new requires the name of an algorithm when you call it to produce a generator. To find out what algorithms are available in the current Python interpreter, use hashlib.algorithms_available: import hashlib hashlib.algorithms_available # ==> {'sha256', 'DSA-SHA', 'SHA512', 'SHA224', 'dsa...

Page 11 of 47