If you don't want to use the default Toast view, you can provide your own using the setView(View) method on a Toast object.
First, create the XML layout you would like to use in your Toast.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="...
cursor: value;
Examples:
ValueDescriptionnoneNo cursor is rendered for the elementautoDefault. The browser sets a cursorhelpThe cursor indicates that help is availablewaitThe cursor indicates that the program is busymoveThe cursor indicates something is to be movedpointerThe cursor is a pointe...
The nodemon package makes it possible to automatically reload your program when you modify any file in the source code.
Installing nodemon globally
npm install -g nodemon (or npm i -g nodemon)
Installing nodemon locally
In case you don't want to install it globally
npm install --save-dev nodemo...
In $e:expr, the expr is called the fragment specifier. It tells the parser what kind of tokens the parameter $e is expecting. Rust provides a variety of fragment specifiers to, allowing the input to be very flexible.
SpecifierDescriptionExamplesidentIdentifierx, foopathQualified namestd::collection...
Exporting a macro to allow other modules to use it:
#[macro_export]
// ^~~~~~~~~~~~~~~ Think of it as `pub` for macros.
macro_rules! my_macro { (..) => {..} }
Using macros from other crates or modules:
#[macro_use] extern crate lazy_static;
// ^~~~~~~~~~~~ Must add this in ord...
(All of these are unstable, and thus can only be used from a nightly compiler.)
log_syntax!()
#![feature(log_syntax)]
macro_rules! logged_sum {
($base:expr) => {
{ log_syntax!(base = $base); $base }
};
($a:expr, $($rest:expr),+) => {
{ log_syntax!(a = $...
docker inspect supports Go Templates via the --format option. This allows for better integration in scripts, without resorting to pipes/sed/grep traditional tools.
Print a container internal IP:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' 7786807d8084
This is useful for direct ne...
Fortran 2003 introduced intrinsic modules which provide access to special named constants, derived types and module procedures. There are now five standard intrinsic modules:
ISO_C_Binding; supporting C interoperability;
ISO_Fortran_env; detailing the Fortran environment;
IEEE_Exceptions, IEEE_...
INSERT INTO will append to the table or partition, keeping the existing data intact.
INSERT INTO table yourTargetTable SELECT * FROM yourSourceTable;
If a table is partitioned then we can insert into that particular partition in static fashion as shown below.
INSERT INTO TABLE yourTarge...
You should verify every received string as being valid UTF-8 before you try to store it or use it anywhere. PHP's mb_check_encoding() does the trick, but you have to use it consistently. There's really no way around this, as malicious clients can submit data in whatever encoding they want.
$str...
If you need to match characters that are a part of the regular expression syntax you can mark all or part of the pattern as a regex literal.
\Q marks the beginning of the regex literal.
\E marks the end of the regex literal.
// the following throws a PatternSyntaxException because of the un-close...
The following code will print the arguments to the program, and
the code will attempt to convert each argument into a number (to a
long):
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <limits.h>
int main(int argc, char* argv[]) {
for (int ...
Python 2.x2.7
To import a module through a function call, use the importlib module (included in Python starting in version 2.7):
import importlib
random = importlib.import_module("random")
The importlib.import_module() function will also import the submodule of a package directly:
c...
A unique index prevents the insertion of duplicated data in a table. NULL values can be inserted in the columns that form part of the unique index (since, by definition, a NULL value is different from any other value, including another NULL value)
-- Creates a unique index for column 'name' in tabl...
To share files or to host simple websites(http and javascript) in your local network, you can use Python's builtin SimpleHTTPServer module. Python should be in your Path variable. Go to the folder where your files are and type:
For python 2:
$ python -m SimpleHTTPServer <portnumber>
For p...