Tutorial by Examples

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...
Once Pandas has been installed, you can check if it is is working properly by creating a dataset of randomly distributed values and plotting its histogram. import pandas as pd # This is always assumed but is included here as an introduction. import numpy as np import matplotlib.pyplot as plt ...
A macro can call itself, like a function recursion: macro_rules! sum { ($base:expr) => { $base }; ($a:expr, $($rest:expr),+) => { $a + sum!($($rest),+) }; } Let's go though the expansion of sum!(1, 2, 3): sum!(1, 2, 3) // ^ ^~~~ // $a $rest => 1 + sum!(2, 3)...
A macro can produce different outputs against different input patterns: /// The `sum` macro may be invoked in two ways: /// /// sum!(iterator) /// sum!(1234, iterator) /// macro_rules! sum { ($iter:expr) => { // This branch handles the `sum!(iterator)` case $iter.f...
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_...
extern crate serde; extern crate serde_json; macro_rules! enum_str { ($name:ident { $($variant:ident($str:expr), )* }) => { #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum $name { $($variant,)* } impl ::serde::Serialize for $name {...
insert overwrite table yourTargetTable select * from yourSourceTable;
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...
Say we have an enum DayOfWeek: enum DayOfWeek { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY; } An enum is compiled with a built-in static valueOf() method which can be used to lookup a constant by its name: String dayName = DayOfWeek.SUNDAY.name(); assert dayName.equal...
It's good practice to document your work for later use, especially if you are coding for a dynamic workload. Good comments should explain why the code is doing something, not what the code is doing. Function Bonus(EmployeeTitle as String) as Double If EmployeeTitle = "Sales" Then ...
The <label> element is used to reference a form action element. In the scope of User Interface it's used to ease the target / selection of elements like Type radio or checkbox. <label> as wrapper It can enclose the desired action element <label> <input type="checkb...
Given a sequence of steps we use repeatedly, it's often handy to store it in a function. Pipes allow for saving such functions in a readable format by starting a sequence with a dot as in: . %>% RHS As an example, suppose we have factor dates and want to extract the year: library(magrittr) ...
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 your application transmits text to other systems, they will also need to be informed of the character encoding. In PHP, you can use the default_charset option in php.ini, or manually issue the Content-Type MIME header yourself. This is the preferred method when targeting modern browsers. hea...
This topic specifically talks about UTF-8 and considerations for using it with a database. If you want more information about using databases in PHP then checkout this topic. Storing Data in a MySQL Database: Specify the utf8mb4 character set on all tables and text columns in your database. ...

Page 213 of 1336