Tutorial by Examples: c

In order to read a cookie use the following code: $value = \Yii::$app->getRequest()->getCookies()->getValue('my_cookie'); Note: this code allows read cookies that has been set using cookie component (because it signs all cookies by default). Therefore if you add/update cookie using JS c...
Because of security reasons, by default cookies are accessible only on the same domain from which they were set. For example, if you have set a cookie on domain example.com, you cannot get it on domain www.example.com. So if you're planning to use subdomains (i.e. admin.example.com, profile.exampl...
In case of autologin or "remember me" cookie, the same quirks as in case of subdomain cookies are applying. But this time you need to configure user component, setting identityCookie array to desired cookie config. Open you application config file and add identityCookie parameters to use...
Session cookies parameters are important both if you have a need to maintain session while getting from one subdomain to another or when, in contrary, you host backend app under /admin URL and want handle session separately. $config = [ // ... 'components' => [ // ... ...
Pure JavaScript It's possible to add, remove or change CSS property values with JavaScript through an element's style property. var el = document.getElementById("element"); el.style.opacity = 0.5; el.style.fontFamily = 'sans-serif'; Note that style properties are named in lower came...
import { Component } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/of'; @Component({ selector: 'async-stuff', template: ` <h1>Hello, {{ name | async }}</h1> Your Friends are: <ul> <li *ngFor=&quot...
A less known builtin feature is Controller Action injection using the FromServicesAttribute. [HttpGet] public async Task<IActionResult> GetAllAsync([FromServices]IProductService products) { return Ok(await products.GetAllAsync()); } An important note is that the [FromServices] c...
Element and attribute names live in namespaces that are URIs. Namespaces are bound to prefixes that are used in the actual element and attribute names, which are called QNames. This document binds a namespace to the prefix prefix and defines a default namespace, bound with the absence of prefix. &...
Comments in XML look like so: <!-- This is a comment --> They can appear in element content or top-level: <?xml version="1.0"?> <!-- a comment at the top-level --> <document> <!-- a comment inside the document --> </document> Comments canno...
Given a Person struct struct Person { let name: String let birthYear: Int? } and an Array of Person(s) let persons = [ Person(name: "Walter White", birthYear: 1959), Person(name: "Jesse Pinkman", birthYear: 1984), Person(name: "Skyler White&quo...
This is a normal function call: console.log("Hello World!"); When you call a normal function, it does its job and then returns control back to the caller. However, sometimes a function needs to return control back to the caller in order to do its job: [1,2,3].map(function double(x) {...
The ng-dblclick directive is useful when you want to bind a double-click event into your DOM elements. This directive accepts an expression HTML <input type="number" ng-model="num = num + 1" ng-init="num=0"> <button ng-dblclick="num++">Double...
A deadlock occurs when every member of some group of two or more threads must wait for one of the other members to do something (e.g., to release a lock) before it can proceed. Without intervention, the threads will wait forever. A pseudocode example of a deadlock-prone design is: thread_1 { ...
Custom Renderers let developers customize the appearance and behavior of Xamarin.Forms controls on each platform. Developers could use features of native controls. For example, we need to disable scroll in ListView. On iOS ListView is scrollable even if all items are placed on the screen and user s...
Cheatsheet DODON'TControl flow with control statementsControl flow with exceptionsKeep track of ignored (absorbed) exception by loggingIgnore exceptionRepeat exception by using throwRe-throw exception - throw new ArgumentNullException() or throw exThrow predefined system exceptionsThrow custom exce...
ng-app Sets the AngularJS section. ng-init Sets a default variable value. ng-bind Alternative to {{ }} template. ng-bind-template Binds multiple expressions to the view. ng-non-bindable States that the data isn't bindable. ng-bind-html Binds inner HTML property of an HTML element....
C++11 introduced core language and standard library support for moving an object. The idea is that when an object o is a temporary and one wants a logical copy, then its safe to just pilfer o's resources, such as a dynamically allocated buffer, leaving o logically empty but still destructible and co...
Placeholders allow you to feed values into a tensorflow graph. Aditionally They allow you to specify constraints regarding the dimensions and data type of the values being fed in. As such they are useful when creating a neural network to feed new training examples. The following example declares a ...
To perform elementwise multiplication on tensors, you can use either of the following: a*b tf.multiply(a, b) Here is a full example of elementwise multiplication using both methods. import tensorflow as tf import numpy as np # Build a graph graph = tf.Graph() with graph.as_default(): ...
In the following example a 2 by 3 tensor is multiplied by a scalar value (2). # Build a graph graph = tf.Graph() with graph.as_default(): # A 2x3 matrix a = tf.constant(np.array([[ 1, 2, 3], [10,20,30]]), dtype=tf.float32) ...

Page 233 of 826