Tutorial by Examples

To ensure that all possible items are documented, you can use the missing_docs link to receive warnings/errors from the compiler. To receive warnings library-wide, place this attribute in your lib.rs file: #![warn(missing_docs)] You can also receive errors for missing documentation with this lin...
Rust provides two types of documentation comments: inner documentation comments and outer documentation comments. Examples of each are provided below. Inner Documentation Comments mod foo { //! Inner documentation comments go *inside* an item (e.g. a module or a //! struct). They use th...
/// In documentation comments, you may use **Markdown**. /// This includes `backticks` for code, *italics* and **bold**. /// You can add headers in your documentation, like this: /// # Notes /// `Foo` is unsuitable for snafucating. Use `Bar` instead. struct Foo { ... } /// It is cons...
Code in documentation comments will automatically be executed by cargo test. These are known as "documentation tests", and help to ensure that your examples work and will not mislead users of your crate. You can import relative from the crate root (as if there were a hidden extern crate ...
Vaadin plug-in for eclipse provides a quick way to build vaadin project with Apache Ivy dependency manager. Vaadin's documentation explains how to create vaadin project with the help of Eclipse plugin. To install the plug-in just go to eclipse marketplace and search vaadin. Current version of the p...
To perform a query in Apex, surround the query with square brackets. The result can be assigned to a list, or to a single object. List<Account> allAccounts = [SELECT Id, Name FROM Account]; Account oldestAccount = [SELECT Id, Name FROM Account ORDER BY CreatedDate LIMIT 1];
To reference a variable in a query, add a colon (:) before the variable name. Datetime targetDate = Datetime.now().addDays(-7); List<Lead> recentLeads = [SELECT Id FROM Lead WHERE CreatedDate > :targetDate]; string targetName = 'Unknown'; List<Contact> incompleteContacts = [SELE...
When assigning to a single object, a query that returns anything other than a single row will throw a QueryException. try { Account a = [SELECT Id FROM Account WHERE Name = 'Non-existent Account']; } catch (QueryException e) { // List has no rows for assignment to SObject } try { ...
One big problem is that valuable named routes is not supported by Express out of the box. Solution is to install supported third-party package, for example express-reverse: npm install express-reverse Plug it in your project: var app = require('express')(); require('express-reverse')(app); ...
The standard (17.6.4.2.1/1) generally forbids extending the std namespace: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. The same goes for posix (17.6.4.2.2/1): The behavi...
To find if a string starts with a pattern, the start_with? method comes in handy str = "zebras are cool" str.start_with?("zebras") => true You can also check the position of the pattern with index str = "zebras are cool" str.index("zebras").zero...
To find if a string ends with a pattern, the end_with? method comes in handy str = "I like pineapples" str.end_with?("pineaaples") => false
In Ruby, strings can be left-justified, right-justified or centered To left-justify string, use the ljust method. This takes in two parameters, an integer representing the number of characters of the new string and a string, representing the pattern to be filled. If the integer is greater than th...
An array is a data structure that stores values of same data type. In Python, this is the main difference between arrays and lists. While python lists can contain values corresponding to different data types, arrays in python can only contain values corresponding to same data type. In this tutorial...
Intent: Separate the construction of a complex object from its representation so that the same construction process can create different representations Builder pattern is useful when you have few mandatory attributes and many optional attributes to construct a object. To create an object with dif...
Template method pattern is a behavioral design pattern that defines the program skeleton of an algorithm in an operation, defering some steps to subclasses. Structure: Key notes: Template method uses Inheritance The Template method implemented by the base class should not be overridden. In t...
Often you will want to perform asynchronous operations in parallel. There is direct syntax that supports this in the async/await proposal, but since await will wait for a promise, you can wrap multiple promises together in Promise.all to wait for them: // Not in parallel async function getFriend...
entry = tk.Entry(parent, width=10) entry.insert(0, "Hello, World!")
The value of an entry widget can be obtained with the get method of the widget: name_entry = tk.Entry(parent) ... name = name_entry.get() Optionally, you may associate an instance of a StringVar, and retrieve the value from the StringVar rather than from the widget: name_var = tk.StringVar() ...
// A simple class hierarchy that uses the visitor to add functionality. // class VehicleVisitor; class Vehicle { public: // To implement the visitor pattern // The class simply needs to implement the accept method // That takes a reference to a visitor object tha...

Page 665 of 1336