Tutorial by Examples: ad

The following examples will use this class hierarchy: struct A { int m; }; struct B : A {}; struct C : B {}; The conversion from derived class type to base class type is preferred to user-defined conversions. This applies when passing by value or by reference, as well as when converting pointe...
Google currently has two ways to load the JS library for Google Visualization (a.k.a Google Charts), gstatic loader (https://www.gstatic.com/charts/loader.js) and jsapi (https://www.google.com/jsapi). The gstatic loader is recommended because Google is transitioning away from jsapi to the gstati...
The R-Logo is a multilayer raster file (red, green, blue) library(raster) r <- stack("C:/Program Files/R/R-3.2.3/doc/html/logo.jpg") plot(r) The individual layers of the RasterStack object can be adressed by [[. plot(r[[1]])
There is no simple way to obtain attributes from an interface, since classes does not inherit attributes from an interface. Whenever implementing an interface or overriding members in a derived class, you need to re-declare the attributes. So in the example below output would be True in all three c...
Encapsulation is a basic concept in OOP. It is about wrapping data and code as a single unit. In this case, it is a good practice to declare the variables as private and then access them through Getters and Setters to view and/or modify them. public class Sample { private String name; privat...
In order to ssh into a server your identity's public key has to be added to the list of trusted keys. Most commonly this is done per-user: ssh-copy-id -i ~/.ssh/<identity>.pub <user>@<hostname> Which can be also done manually: cat ~/.ssh/<identity>.pub | ssh <user>...
public function drawDisplayObjectUsingBounds(source:DisplayObject):BitmapData { var bitmapData:BitmapData;//declare a BitmapData var bounds:Rectangle = source.getBounds(source);//get the source object actual size //round bounds to integer pixel values (to aviod 1px str...
The first step in accessing a data source via ADO is creating an ADO Connection object. This is typically done using a connection string to specify the data source parameters, although it is also possible to open a DSN connection by passing the DSN, user ID, and password to the .Open method. Note t...
You can use the System.IO.File.ReadAllText function to read the entire contents of a file into a string. string text = System.IO.File.ReadAllText(@"C:\MyFolder\MyTextFile.txt"); You can also read a file as an array of lines using the System.IO.File.ReadAllLines function: string[] line...
There are two main approaches to creating a thread in Java. In essence, creating a thread is as easy as writing the code that will be executed in it. The two approaches differ in where you define that code. In Java, a thread is represented by an object - an instance of java.lang.Thread or its subcl...
You should remember that regex was designed for matching a date (or not). Saying that a date is valid is a much more complicated struggle, since it will require a lot of exception handling (see leap year conditions). Let's start by matching the month (1 - 12) with an optional leading 0: 0?[1-9]|1[...
Matching an email address within a string is a hard task, because the specification defining it, the RFC2822, is complex making it hard to implement as a regex. For more details why it is not a good idea to match an email with a regex, please refer to the antipattern example when not to use a ...
Read the accelerometer Sensor with precision. This example allocates memory: void Update() { //Get Precise Accelerometer values Vector3 accelValue = preciseAccelValue(); Debug.Log("PRECISE X: " + accelValue.x + " Y: " + accelValue.y + " Z: " + acc...
You can reload the current state using the $state.reload method from your controller $state.reload() This is a shorthand for (code taken from the official docs) $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: false }); Running a reload on your ...
If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen: $ git stash pop [...] Dropped refs/stash@{0} (2ca03e22256be97f9e40f08e6d6773c7d41dbfd1) (Note that git stash drop also produces the same line.) Otherwise, you...
The year, month or day components of a DATE data type can be found using the EXTRACT( [ YEAR | MONTH | DAY ] FROM datevalue ) SELECT EXTRACT (YEAR FROM DATE '2016-07-25') AS YEAR, EXTRACT (MONTH FROM DATE '2016-07-25') AS MONTH, EXTRACT (DAY FROM DATE '2016-07-25') AS DAY FROM D...
In some cases you might want to add an additional description to an enum value, for instance when the enum value itself is less readable than what you might want to display to the user. In such cases you can use the System.ComponentModel.DescriptionAttribute class. For example: public enum Possibl...
If you want to keep on-premises copy of the Gradle and let the Wrapper use it in the builds, you can set the distributionUrl pointing to your copy on the wrapper task: task wrapper(type: Wrapper) { gradleVersion = '2.0' distributionUrl = "http\://server/dadada/gradle-${gradleVersion}...
To get the IP address of a docker machine, you can do that with this command : docker-machine ip machine-name
Dim aList as New List(Of Integer) aList.Add(1) aList.Add(10) aList.Add(1001) To add more than one item at a time use AddRange. Always adds to the end of the list Dim blist as New List(of Integer) blist.AddRange(alist) Dim aList as New List(of String) alist.AddRange({"one", &...

Page 40 of 114