Static .Net library methods can be called from PowerShell by encapsulating the full class name in third bracket and then calling the method using ::
#calling Path.GetFileName()
C:\> [System.IO.Path]::GetFileName('C:\Windows\explorer.exe')
explorer.exe
Static methods can be called from the c...
trigger ContactTrigger on Contact (before insert, after insert,
before update, after update,
before delete, after delete,
after undelete) {
/** Before or After trigger execution**/
/...
trigger MyTrigger on SomeObject__c (after insert, after update) {
if (Trigger.isAfter && Trigger.isInsert) {
System.debug('The following records were inserted: ');
for (SomeObject__c o : Trigger.new) {
System.debug(o.Name);
}
} else if (Trigg...
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 ends with a pattern, the end_with? method comes in handy
str = "I like pineapples"
str.end_with?("pineaaples") => false
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...
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()
...