Autocommand groups are good for organization but they can be useful for debugging too. Think of them as small namespaces that you can enable/disable at will.
Example
augroup MyGroup
" Clear the autocmds of the current group to prevent them from piling
" up each time you rel...
By default the built-in Request Localization middleware only supports setting culture via query, cookie or Accept-Language header. This example shows how create a middleware which allows to set the culture as part of the path like in /api/en-US/products.
This example middleware assumes the locale t...
Types & Protocols
Type and protocol names should start with an uppercase letter.
Example:
protocol Collection {}
struct String {}
class UIView {}
struct Int {}
enum Color {}
Everything else...
Variables, constants, functions and enumeration cases should start with a lowercase letter.
Exa...
In case we want to use enum with more information and not just as constant values, and we want to be able to compare two enums.
Consider the following example:
public enum Coin {
PENNY(1), NICKEL(5), DIME(10), QUARTER(25);
private final int value;
Coin(int value){
this....
Using the baseline-shift parameter, you can specify super- or subscript. But this is not supported by all major browsers.
<svg xmlns="http://www.w3.org/2000/svg">
<text x="10" y="20">x<tspan baseline-shift="super">2</tspan></te...
In cases such as restoring a database dump, or otherwise wishing to push some information through a pipe from the host, you can use the -i flag as an argument to docker run or docker exec.
E.g., assuming you want to put to a containerized mariadb client a database dump that you have on the host, in...
docker inspect <image>
The output is in JSON format. You can use jq command line utility to parse and print only the desired keys.
docker inspect <image> | jq -r '.[0].Author'
The above command will shows author name of the images.
To split a JID into its component parts (the localpart, domainpart, and resourcepart), the following algorithm should be used (where the localpart is represented by lp, the resourcepart by rp, and the domainpart by dp and ∈ is used to check if the given character is included in the string):
Note ...
In a module (library or application) where you need the aar file you have to add in your build.gradle the repository:
repositories {
flatDir {
dirs 'libs'
}
}
and add the dependency:
dependencies {
compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar')
}
Pay a...
The aar file doesn't contain the transitive dependencies and doesn't have a pom file which describes the dependencies used by the library.
It means that, if you are importing a aar file using a flatDir repo you have to specify the dependencies also in your project.
You should use a maven repositor...
The XMPP network can be thought of as a bidirected graph with servers (S) operating in a mesh, clients (C) clustered about their local server, and streams represented by extraverted edges:
When a client wants to send data (eg. a message or presence information) across the network to another clien...
In some cases, you want to show your users a UIPickerView with predefined contents for a UITextField instead of a keyboard.
Create a custom UIPickerView
At first, you need a custom wrapper-class for UIPickerView conforming to the protocols UIPickerViewDataSource and UIPickerViewDelegate.
class My...
Similar to SQL for doing your first steps in MDX you need to start by installing a Server.
There are several servers available that are compatible with MDX (check wikipedia page) with a couple of them free or with a community edition.
Once you've your server you'll have to create your schema, you ...
NSString *someString = @" Objective-C Language \n";
NSString *trimmedString = [someString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
//Output will be - "Objective-C Language"
Method stringByTrimmingCharactersInSet returns a new str...
A JID consists of three parts: localpart@domainpart/resourcepart.
Full JIDs (always have a resource part)
[email protected]/orchard
example.org/da863ab
Bare JIDs (always without resource part)
[email protected]
example.org
Data attributes were introduced in HTML5 which is supported by all modern browsers, but older browsers before HTML5 don't recognize the data attributes.
However, in HTML specifications, attributes that are not recognized by the browser must be left alone and the browser will simply ignore them when...
Object obj = new Object(); // Note the 'new' keyword
Where:
Object is a reference type.
obj is the variable in which to store the new reference.
Object() is the call to a constructor of Object.
What happens:
Space in memory is allocated for the object.
The constructor Object() is call...
The CSS multi-column layout makes it easy to create multiple columns of text.
Code
<div id="multi-columns">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation...
@input is useful to bind data between components
First, import it in your component
import { Input } from '@angular/core';
Then, add the input as a property of your component class
@Input() car: any;
Let's say that the selector of your component is 'car-component', when you call the compone...