Tutorial by Examples: code

Ember has a static global method called runInDebug which can run a function meant for debugging. Ember.runInDebug(() => { // this code only runs in dev mode }); In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from ...
Supported by IE11+ View Result Use these 3 lines to vertical align practically everything. Just make sure the div/image you apply the code to has a parent with a height. CSS div.vertical { position: relative; top: 50%; transform: translateY(-50%); } HTML <div class="vertica...
In MATLAB versions prior to R2014b, using the old HG1 graphics engine, it was not obvious how to create color coded 2D line plots. With the release of the new HG2 graphics engine arose a new undocumented feature introduced by Yair Altman: n = 100; x = linspace(-10,10,n); y = x.^2; p = plot(x,y,'r...
During development, when certain code paths must be prevented from the reach of control flow, you may use assert(0) to indicate that such a condition is erroneous: switch (color) { case COLOR_RED: case COLOR_GREEN: case COLOR_BLUE: break; default: assert(0); ...
Code lens is a simple way to know what happens with the code. Here you could find an image with the number of references of a method or class. If you can't see the code lens please see this question: Missing CodeLens references count in VS 2015 Community edition
First need to create a final static logger object: final static Logger logger = Logger.getLogger(classname.class); Then, call logging methods: //logs an error message logger.info("Information about some param: " + parameter); // Note that this line could throw a NullPointerException!...
Sometimes you need to keep a linear (non-branching) history of your code commits. If you are working on a branch for a while, this can be tricky if you have to do a regular git pull since that will record a merge with upstream. [alias] up = pull --rebase This will update with your upstream so...
String hubUrl = "http://localhost:4444/wd/hub" DesiredCapabilities capability = DesiredCapabilities.firefox(); //or which browser you want RemoteWebDriver driver = new RemoteWebDriver(hubUrl, capability);
After you've created and registered your platform-specific classes you can start hooking them up to your shared code. The following page contains a button that triggers the text-to-speech functionality using a pre-defined sentence. It uses DependencyService to retrieve a platform-specific implementa...
All you need is a variable of type IHostingEnvironment: get environment name: env.EnvironmentName for predefined Development, Staging, Production environments the best way is to use extension methods from HostingEnvironmentExtensions class env.IsDevelopment() env.IsStaging() ...
Codename One is a set of tools for mobile application development that derive a great deal of its architecture from Java. Codename One's mission statement is: Unify the complex and fragmented task of mobile device programming into a single set of tools, APIs & services. As a result create a...
Machine code is term for the data in particular native machine format, which are directly processed by the machine - usually by the processor called CPU (Central Processing Unit). Common computer architecture (von Neumann architecture) consist of general purpose processor (CPU), general purpose mem...
Extension methods enable you to simplify your interface definitions by only including core required functionality in the interface itself and allowing you to define convenience methods and overloads as extension methods. Interfaces with fewer methods are easier to implement in new classes. Keeping o...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; public class ReadingUTF8TextFile { public static void main(String[] args) throws IOException { ...
The double-colon syntax of names in the use statement looks similar to names used elsewhere in the code, but meaning of these paths is different. Names in the use statement by default are interpreted as absolute, starting at the crate root. Names elsewhere in the code are relative to the current mo...
GetLastError returns a numerical error code. To obtain a descriptive error message (e.g., to display to a user), you can call FormatMessage: // This functions fills a caller-defined character buffer (pBuffer) // of max length (cchBufferLength) with the human-readable error message // for a Win32 ...
Suppose, your users and/or groups have profiles and you want to display address profile fields on a google map. # app/models/profile_fields/address.rb class ProfileFields::Address < ProfileFields::Base # Attributes: # label, e.g. "Work address" # value, e.g. "Willy-Bran...
The following examples can be tested on https://ellie-app.com/m9vmQ8NcMc/0. import Html exposing (..) import Json.Decode payload = """ [ { "bark": true, "tag": "dog", "name": "Zap", "playful": true } , { "w...
By default, one should subscribe to event using inspector, but sometimes it's better to do it in code. In this example we subscribe to click event of a button in order to handle it. using UnityEngine; using UnityEngine.UI; [RequireComponent(typeof(Button))] public class AutomaticClickHandler :...
Basic code completion (the name of any class, method or variable) Windows: Ctrl + Space OS X / macOS: Cmd + Space Smart code completion (filters the list of methods and variables by expected type) Windows: Ctrl + Shift + Space OS X / macOS: Cmd + Shift + Space Overwriting code with a suggestio...

Page 4 of 21