Some formats can take additional parameters, such as the width of the formatted string, or the alignment:
>>> '{:.>10}'.format('foo')
'.......foo'
Those can also be provided as parameters to format by nesting more {} inside the {}:
>>> '{:.>{}}'.format('foo', 10)
'.......
By default, one should subscribe to event using inspector, but sometimes it's better to do it in code. In this example we subscribe to click event of a button in order to handle it.
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Button))]
public class AutomaticClickHandler :...
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....
<svg xmlns="http://www.w3.org/2000/svg">
<text x="40" y="60" font-size="28">Hello World!</text>
</svg>
The x and y coordinate specifies the position of the bottom-left corner of the text (unless text-anchor has been modified).
...
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...
Parameters
AttributeRequiredTypeDefaultDescriptionindextruestringVariable name for the loop's index. Defaults to the variables scope.fromtruenumericStarting value for the index.totruenumericEnding value for the index.stepfalsenumeric1Value by which to increase or decrease the index per iteration.Ba...
Tag syntax
Parameters
AttributeRequiredTypeDefaultDescriptionconditiontruestringCondition that manages the loop. Cannot contain math symbols like <, > or =. Must use ColdFusion text implementations like less than, lt, greater than, gt, equals or eq.
Final value of x is 5.
<cfset x = 0 /...
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...
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...
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...
JsonReader reads a JSON encoded value as a stream of tokens.
public List<Message> readJsonStream(InputStream in) throws IOException {
JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
try {
return readMessagesArray(reader);
} finall...
The column-width property sets the minimum column width. If column-count is not defined the browser will make as many columns as fit in the available width.
Code:
<div id="multi-columns">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididun...