Tutorial by Examples: ti

npm install --global yarn If you didn't have npm installed before, check there website documentation for more details. https://yarnpkg.com/en/docs/install
Almost any controller needs some external dependencies to work. Here is a way to configure a dependency object (or its factory) and pass it to a controller. Doing so will help to sustain a separation of concerns, keep code clear and testable. Say, we have an interface and its implementation that...
BeautifulSoup allows you to filter results by providing a function to find_all and similar functions. This can be useful for complex filters as well as a tool for code reuse. Basic usage Define a function that takes an element as its only argument. The function should return True if the argument m...
To illustrate how to use regr_slope(Y,X), I applied it to a real world problem. In Java, if you don't clean up memory properly, the garbage can get stuck and fill up the memory. You dump statistics every hour about memory utilization of different classes and load it into a postgres database for anal...
Content Negotiation can be defined as the process of selecting best representation for a given resource. So Content negotiation means the client and server can negotiate between them so that client can get data according to their required format. There are three points on which internet depends, ...
/** * Runs user-specified code when the given javascript object is garbage collected */ template<class CALLBACK_FUNCTION> void global_set_weak(v8::Isolate * isolate, const v8::Local<v8::Object> & javascript_object, CALLBACK_FUNCTION function) { struct SetWeakCallbackData{...
Define a new basic command A macro can be defined using \newcommand. For example: \newcommand{\foo}{Just foo, you see?} defines a macro \foo that expands to Just foo, you see?. It can then be used like any built-in command, for example after that definition: He said: ``\foo'' expands to He...
# create a window with a button that closes the window when clicked window = cmds.window(title='example window') # create the window layout = cmds.columnLayout(adjustableColumn=True) # add a vertical layout def close_window(*_): cmds.deleteUI(window) # delet...
Reading a text file line-by-line A proper way to read a text file line-by-line till the end is usually not clear from ifstream documentation. Let's consider some common mistakes done by beginner C++ programmers, and a proper way to read the file. Lines without whitespace characters For the sake o...
Basic printing std::ostream_iterator allows to print contents of an STL container to any output stream without explicit loops. The second argument of std::ostream_iterator constructor sets the delimiter. For example, the following code: std::vector<int> v = {1,2,3,4}; std::copy(v.begin(), v...
First we must edit the SSH daemon config file. Though under different Linux distributions this may be located in different directories, usually it is stored under /etc/ssh/sshd_config Use your text editor to change the values set in this file, all lines starting with # are commented out and must ha...
Passport must be initialized using passport.initialize() middleware. To use login sessions, passport.session() middleware is required. Note that passport.serialize() and passport.deserializeUser() methods must be defined. Passport will serialize and deserialize user instances to and from the sessi...
The passport-local module is used to implement a local authentication. This module lets you authenticate using a username and password in your Node.js applications. Registering the user : const passport = require('passport'); const LocalStrategy = require('passport-local').Strategy; // A ...
The passport-facebook module is used to implement a Facebook authentication. In this example, if the user does not exist on sign-in, he is created. Implementing strategy : const passport = require('passport'); const FacebookStrategy = require('passport-facebook').Strategy; // Strategy is name...
GDAL is available in the default repositories of most popular Linux distributions and can be installed in the same way that packages in a Linux distribution are usually installed. apt-get install libgdal-dev CPLUS_INCLUDE_PATH and C_INCLUDE_PATH are necessary in order to include these correspondin...
Entity entity; //The entity you want to teleport Entity teleportTo; //The entity where you want <entity> to be teleported to boolean success = entity.teleport(teleportTo); //Attempting to teleport. if(success) { //Teleport was successful }else { //Teleport wasn't successful } ...
Entity toBeTeleported; //The entity you want to teleport Location teleportTo = new Location(world,x,y,z,yaw,pitch); //The location to teleport to boolean success = toBeTeleported.teleport(teleportTo); if(success) { //Teleport was successful }else { //Teleport wasn't success...
Java's checked exception mechanism requires the programmer to declare that certain methods could throw specifed checked exceptions. This is done using the throws clause. For example: public class OddNumberException extends Exception { // a checked exception } public void checkEven(int number) ...
MediaTypeFormatter is an abstract class from which JsonMediaTypeFormatter and XmlMediaTypeFormatter classes inherit from. Here, JsonMediaTypeFormatter class handles JSON objects and XmlMediaTypeFormatter class handles XML objects. Return only JSON irrespective of the Accept Header value: To return...
ReactiveCocoa supports macOS 10.9+, iOS 8.0+, watchOS 2.0+, and tvOS 9.0+. Carthage If you use Carthage to manage your dependencies, simply add ReactiveCocoa to your Cartfile: github "ReactiveCocoa/ReactiveCocoa" ~> 5.0 If you use Carthage to build your dependencies, make sure you...

Page 380 of 505