Tutorial by Examples: er

NSDictionary can be enumerated using fast enumeration, just like other collection types: NSDictionary stockSymbolsDictionary = @{ @"AAPL": @"Apple", @"GOOGL": @"Alphabet", ...
An iterator pattern provides a simple method for selecting, sequentially, the next item in a collection. Fixed Collection class BeverageForPizza { constructor(preferenceRank) { this.beverageList = beverageList; this.pointer = 0; } next() { return this.be...
To begin, npm install the desired loaders for your project. Inside of the configuration object that is being exported in webpack.config.js, a module property will hold all of your loaders. const source = `${__dirname}/client/src/`; module.exports = { // other settings here module: { ...
You can use the TextInputLayout to display error messages according to the material design guidelines using the setError and setErrorEnabledmethods. In order to show the error below the EditText use: TextInputLayout til = (TextInputLayout) findViewById(R.id.username); til.setErrorEnabled(true); ...
The TextInputLayout has a character counter for an EditText defined within it. The counter will be rendered below the EditText. Just use the setCounterEnabled() and setCounterMaxLength methods: TextInputLayout til = (TextInputLayout) findViewById(R.id.username); til.setCounterEnabled(true); til...
Include using System.Numerics and add a reference to System.Numerics to the project. using System; using System.Numerics; namespace Euler_25 { class Program { static void Main(string[] args) { BigInteger l1 = 1; BigInteger l2 = 1; ...
RAISERROR function will generate error in the TRY CATCH block: DECLARE @msg nvarchar(50) = 'Here is a problem!' BEGIN TRY print 'First statement'; RAISERROR(@msg, 11, 1); print 'Second statement'; END TRY BEGIN CATCH print 'Error: ' + ERROR_MESSAGE(); END CATCH RAISERROR ...
You can re-throw error that you catch in CATCH block using TRHOW statement: DECLARE @msg nvarchar(50) = 'Here is a problem! Area: ''%s'' Line:''%i''' BEGIN TRY print 'First statement'; RAISERROR(@msg, 11, 1, 'TRY BLOCK', 2); print 'Second statement'; END TRY BEGIN CATCH print...
The following example code is slower than it needs to be : Map<String, String> map = new HashMap<>(); for (String key : map.keySet()) { String value = map.get(key); // Do something with key and value } That is because it requires a map lookup (the get() method) for each ...
MySQL does not support the FULL OUTER JOIN, but there are ways to emulate one. Setting up the data -- ---------------------------- -- Table structure for `owners` -- ---------------------------- DROP TABLE IF EXISTS `owners`; CREATE TABLE `owners` ( `owner_id` int(11) NOT NULL AUTO_INCREMENT,...
Let's say you have a library that returns callbacks, for example the fs module in NodeJS: const fs = require("fs"); fs.readFile("/foo.txt", (err, data) => { if(err) throw err; console.log(data); }); We want to convert it to a promise returning API, with bluebird - ...
You can convert a single function with a callback argument to a Promise-returning version with Promise.promisify, so this: const fs = require("fs"); fs.readFile("foo.txt", (err, data) => { if(err) throw err; console.log(data); }); becomes: const promisify = requ...
In order to convert any callback API to promises assuming the promisify and promisifyAll version doesn't fit - you can use the promise constructor. Creating promises generally means specifying when they settle - that means when they move to the fulfilled (completed) or rejected (errored) phase to i...
A class or struct can have member functions as well as member variables. These functions have syntax mostly similar to standalone functions, and can be defined either inside or outside the class definition; if defined outside the class definition, the function's name is prefixed with the class' nam...
Member functions can also be declared virtual. In this case, if called on a pointer or reference to an instance, they will not be accessed directly; rather, they will look up the function in the virtual function table (a list of pointers-to-member-functions for virtual functions, more commonly know...
All non-static member functions have a hidden parameter, a pointer to an instance of the class, named this; this parameter is silently inserted at the beginning of the parameter list, and handled entirely by the compiler. When a member of the class is accessed inside a member function, it is silent...
#!/usr/bin/env python """ An annotated simple socket server example in python. WARNING: This example doesn't show a very important aspect of TCP - TCP doesn't preserve message boundaries. Please refer to http://blog.stephencleary.com/2009/04/message-framing.html before adaptin...
When signing personal scripts or when testing code signing it can be useful to create a self-signed code signing certificate. 5.0 Beginning with PowerShell 5.0 you can generate a self-signed code signing certificate by using the New-SelfSignedCertificate-cmdlet: New-SelfSignedCertificate -Friendl...
Unity networking provides the High Level API (HLA) to handle network communications abstracting from low level implementations. In this example we will see how to create a Server that can communicate with one or multiple clients. The HLA allows us to easily serialize a class and send objects of ...
In features/step_definitions/documentation.rb: When /^I go to the "([^"]+)" documentation$/ do |section| path_part = case section when "Documentation" "documentation" else raise "Unknown documentation section: #{section...

Page 249 of 417