Tutorial by Examples: ti

A pointer to a const object can be converted to a pointer to non-const object using the const_cast keyword. Here we use const_cast to call a function that is not const-correct. It only accepts a non-const char* argument even though it never writes through the pointer: void bad_strlen(char*); const...
A lexer action is a block of arbitrary code in the target language surrounded by {...}, which is executed during matching: IDENTIFIER: [A-Z]+ { log("matched rule"); }; A semantic predicate is a block of arbitrary code in the target language surrounded by {...}?, which evaluates to a bo...
There are several ways to insert data: Using the DB Facade public function run() { DB::table('users') ->insert([ 'name' => 'Taylor', 'age' => 21 ]); } Via Instantiating a Model public function run() { $user = new User; $us...
Functions within a class can be overloaded for when they are accessed through a cv-qualified reference to that class; this is most commonly used to overload for const, but can be used to overload for volatile and const volatile, too. This is because all non-static member functions take this as a hi...
# make this routine available outside this translation unit .globl string_to_integer string_to_integer: # function prologue push %ebp mov %esp, %ebp push %esi # initialize result (%eax) to zero xor %eax, %eax # fetch pointer to the string mov 8(%ebp), %e...
Disclaimer: the examples presented here are only for the purpose of showing the use of abstract classes and inheritance and may not necessarily be of a practical use. Also, there is no sich thing as polymorphic in MATLAB and therefore the use of abstract classes is limited. This example is to show w...
A class or a structure may declare any function it's friend. If a function is a friend of a class, it may access all it's protected and private members: // Forward declaration of functions. void friend_function(); void non_friend_function(); class PrivateHolder { public: PrivateHolder(in...
In every applications life-cycle comes a day where it's components needs to be updated. Everyone knows the pain of updating every single dependency one-by-one. Well here you just need to issue the command: npm update (-g) If the "-g" is there then npm will update the global packages. ...
Here is an example of how to import a function that is defined in an unmanaged C++ DLL. In the C++ source code for "myDLL.dll", the function add is defined: extern "C" __declspec(dllexport) int __stdcall add(int a, int b) { return a + b; } Then it can be included into ...
""" ================================================================================ DRAW MULTIPLE LINES IN THE SAME PLOT ================================================================================ """ import matplotlib.pyplot as plt ...
JavaFX 8 The following example demonstrates how to add custom properties that can be styled from css to a custom Node. Here 2 DoublePropertys are added to the Rectangle class to allow setting the width and height from CSS. The following CSS could be used for styling the custom node: StyleableRe...
UCanAccess is a pure Java JDBC driver that allows us to read from and write to Access databases without using ODBC. It uses two other packages, Jackcess and HSQLDB, to perform these tasks. Once it has been set up*, we can work with data in .accdb and .mdb files using code like this: import java.sq...
Use this binding to build options for a select item <select data-bind="options: gasGiants"></select> <script type="text/javascript"> var viewModel = { gasGiants: ko.observableArray(['Jupiter', 'Saturn', 'Neptune', 'Uranus']) }; </scri...
Gnuplot is a portable command-line driven graphing utility. This example will show how to setup gnuplot in the various platforms. Windows Download the latest version of the installer from gnuplot site. Run the downloaded file and allow it to run as administrator if requested On the ...
HTTP Basic Authentication provides a straightforward mechanism for authentication. Credentials are sent in plain text, and so is insecure by default. Successful authentication proceeds as follows. The client requests a page for which access is restricted: GET /secret The server responds with st...
Download your preferred version from Lightbend with curl: curl -O http://downloads.lightbend.com/scala/2.xx.x/scala-2.xx.x.tgz Unzip the tar file to /usr/local/share or /opt/bin: unzip scala-2.xx.x.tgz mv scala-2.xx.x /usr/local/share/scala Add the PATH to ~/.profile or ~/.bash_profile or ...
This example connects to a Wi-Fi access point with WEP encryption, given an SSID and the password. public boolean ConnectToNetworkWEP(String networkSSID, String password) { try { WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID ...
This example connects to a Wi-Fi access point with WPA2 encryption. public boolean ConnectToNetworkWPA(String networkSSID, String password) { try { WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID + "\""; // Please note th...
{ "description": "My awesome library", "dependencies": { "NETStandard.Library": "1.6.0" }, "frameworks": { "netstandard1.3": { } } } A library that targets netstandard1.3 can be used on any fr...
{ "description": "My awesome library", "dependencies": { }, "frameworks": { "net40": { }, "netstandard1.3": { "dependencies": { "NETStandard.Library": "1.6.0" ...

Page 165 of 505