Background
============
WebStorm is lightweight yet powerful Integrated Development Environment (IDE) perfectly equipped for complex client-side development and server-side development, it is cross-platform and works on Windows, Mac OS X, and Linux.
WebStorm features advanced support for JavaScri...
1. Character Class
Character class is denoted by []. Content inside a character class is treated as single character separately. e.g. suppose we use
[12345]
In the example above, it means match 1 or 2 or 3 or 4 or 5 . In simple words, it can be understood as or condition for single characters (...
Observe the notifications UIKeyboardWillShowNotification and UIKeyboardWillHideNotification, update the scrollView content insets according to keyboard height, then scroll to the focused control.
- (void)viewDidLoad
{
[super viewDidLoad];
// register for keyboard notifications
[[...
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' => [
// ...
...
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...
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...
HTTP describes how an HTTP client, such as a web browser, sends an HTTP request via a network to an HTTP server, which then sends an HTTP response back to the client.
The HTTP request is typically either a request for an online resource, such as a web page or image, but may also include additiona...
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():
...
Type synonym families are just type-level functions: they associate parameter types with result types. These come in three different varieties.
Closed type-synonym families
These work much like ordinary value-level Haskell functions: you specify some clauses, mapping certain types to others:
{-# ...
Set MONGO_URL to any arbitrary value except for a database URL and ensure no collections are defined in your Meteor project (including collections defined by Meteor packages) to run Meteor without MongoDB.
Note that without MongoDB, server/client methods alongside any packages related to Meteor's u...
XSS attacks consist in injecting HTML (or JS) code in a page. See What is cross site scripting for more information.
To prevent from this attack, by default, Django escapes strings passed through a template variable.
Given the following context:
context = {
'class_name': 'large" style=&...
It is possible to create custom routing constraint which can be used inside routes to constraint a parameter to specific values or pattern.
This constrain will match a typical culture/locale pattern, like en-US, de-DE, zh-CHT, zh-Hant.
public class LocaleConstraint : IRouteConstraint
{
pri...
This multimap allows duplicate key-value pairs. JDK analogs are HashMap<K, List>, HashMap<K, Set> and so on.
Key's orderValue's orderDuplicateAnalog keyAnalog valueGuavaApacheEclipse (GS) CollectionsJDKnot definedInsertion-orderyesHashMapArrayListArrayListMultimapMultiValueMapFastListMu...
Compare operation with collections - Create collections
1. Create List
DescriptionJDKguavags-collectionsCreate empty listnew ArrayList<>()Lists.newArrayList()FastList.newList()Create list from valuesArrays.asList("1", "2", "3")Lists.newArrayList("1", &...
select_dtypes method can be used to select columns based on dtype.
In [1]: df = pd.DataFrame({'A': [1, 2, 3], 'B': [1.0, 2.0, 3.0], 'C': ['a', 'b', 'c'],
'D': [True, False, True]})
In [2]: df
Out[2]:
A B C D
0 1 1.0 a True
1 2 2.0 b False
2...
In PaaS sites such as Heroku, it is usual to receive the database information as a single URL environment variable, instead of several parameters (host, port, user, password...).
There is a module, dj_database_url which automatically extracts the DATABASE_URL environment variable to a Python dictio...
To connect to MySQL you need to use the MySQL Connector/J driver. You can download it from http://dev.mysql.com/downloads/connector/j/ or you can use Maven:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version...
When you create a function in TypeScript you can specify the data type of the function's arguments and the data type for the return value
Example:
function sum(x: number, y: number): number {
return x + y;
}
Here the syntax x: number, y: number means that the function can accept two argum...