Tutorial by Examples: ros

A predefined macro is a macro that is already understood by the C pre processor without the program needing to define it. Examples include Mandatory Pre-Defined Macros __FILE__, which gives the file name of the current source file (a string literal), __LINE__ for the current line number (an int...
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 = $...
Flash will not load data from a domain other than the one your application is running on unless that domain has an XML crossdomain policy either in the root of the domain (e.g. http://somedomain.com/crossdomain.xml) or somewhere that you can target with Security.loadPolicyFile(). The crossdomain.xml...
Using iris dataset: import sklearn.datasets iris_dataset = sklearn.datasets.load_iris() X, y = iris_dataset['data'], iris_dataset['target'] Data is split into train and test sets. To do this we use the train_test_split utility function to split both X and y (data and target vectors) randomly w...
import pandas as pd df = pd.DataFrame({'Sex': ['M', 'M', 'F', 'M', 'F', 'F', 'M', 'M', 'F', 'F'], 'Age': [20, 19, 17, 35, 22, 22, 12, 15, 17, 22], 'Heart Disease': ['Y', 'N', 'Y', 'N', 'N', 'Y', 'N', 'Y', 'N', 'Y']}) df Age Heart Disease Sex 0 20 ...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="M 10,10 l 90,90 M 100,10 l -90,90" stroke="red" stroke-width="10" /> </svg> Result:
Given that the 8086/8088 was used in the IBM PC, and the Operating System on that was most often from Microsoft, Microsoft's assembler MASM was the de facto standard for many years. It followed Intel's syntax closely, but permitted some convenient but "loose" syntax that (in hindsight) onl...
Cross join does a Cartesian product of the two members, A Cartesian product means each row of one table is combined with each row of the second table in the join. For example, if TABLEA has 20 rows and TABLEB has 20 rows, the result would be 20*20 = 400 output rows. Using example database SELECT d...
Apply will be used when when table valued function in the right expression. create a Department table to hold information about departments. Then create an Employee table which hold information about the employees. Please note, each employee belongs to a department, hence the Employee table has ref...
Run command below to install nginx. sudo apt-get install nginx By default, Nginx automatically starts when it is installed. You can access the default Nginx landing page to confirm that the software is running properly by visiting your server's domain name or public IP address in your web browse...
The __info__/1 function takes one of the following atoms: :functions - Returns a keyword list of public functions along with their arities :macros - Returns a keyword list of public macros along with their arities To list the Kernel module’s functions: iex> Kernel.__info__ :functions [...
{!join from=personid to=id fromIndex=AddressCore}address:Address1 So if you have two cores that look like this: PersonCore - id, name AddressCore - id, address, personid This will find all PersonCore documents at a specific address
These macros merge control flow and binding. They are an improvement over anaphoric anaphoric macros because they let the developer communicate meaning through naming. As such their use is recommended over their anaphoric counterparts. (if-let (user (get-user user-id)) (show-dashboard user) (...
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...
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=&...
LISP and Scheme's greatest advantage over other mainstream programming language is their macro system. Unlike the C preprocessor and other macro languages, Scheme macros take parsed code as input and return expanded code as output. This is one of the applications of Scheme's “code is data” phrase, a...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <line x1="10" y1="10" x2="100" y2="100" stroke="red" stroke-width="10" /> <line x1="100" y1="10&...
Sometimes you will have a grid of subplots, and you want to have a single legend that describes all the lines for each of the subplots as in the following image. In order to do this, you will need to create a global legend for the figure instead of creating a legend at the axes level (which wil...
Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript is a new C# script engine. var code = "(1 + 2).ToString()"; var run = await CSharpScript.RunAsync(code, ScriptOptions.Default); var result = (string)run.ReturnValue; Console.WriteLine(result); //output 3 You can compile and run an...

Page 2 of 7