Tutorial by Examples: st

One of the more useful things about const correctness is that it serves as a way of documenting code, providing certain guarantees to the programmer and other users. These guarantees are enforced by the compiler due to constness, with a lack of constness in turn indicating that code doesn't provide...
Castle enables to register components also via XML Registration. //To install from the app/web.config container.Install(Configuration.FromAppConfig()); //To install from an xml file Configuration.FromXmlFile("relative_path_to_file.xml"); Read Castle's documentation for "What ...
->add('housing', EntityType::class, array( 'class' => 'AppBundle:Housing', 'choice_label' => 'housing', 'placeholder' => '', 'attr' => (in_array('Housing', $options['disabledOptions']) ? ['disabled' => 'disabl...
In a simple case statement, one value or variable is checked against multiple possible answers. The code below is an example of a simple case statement: SELECT CASE DATEPART(WEEKDAY, GETDATE()) WHEN 1 THEN 'Sunday' WHEN 2 THEN 'Monday' WHEN 3 THEN 'Tuesday' WHEN 4 THEN 'Wednes...
It's possible to make a simple lazily-evaluated list using mutable types and closures. A lazily-evaluated list is a list whose elements are not evaluated when it's constructed, but rather when it is accessed. Benefits of lazily evaluated lists include the possibility of being infinite. import Base:...
#include <iostream> #include <vector> #include <string> #include <boost/algorithm/string.hpp> using namespace std; int main() { // String to split string str = "You're supposed to see this!|NOT THIS!!!!!!"; // Line container vec...
Detailed instructions on getting networking set up or installed.
Objective-C NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Hello. That is a test attributed string."]; [str addAttribute:NSBackgroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(3,5)]; [str addAttribute:NSForegroundColorAttrib...
// Create the request. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]; // Specify that it will be a POST request request.HTTPMethod = @"POST"; // This is how we set header fields [request setValue:@&...
// Create the request. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]; // Specify that it will be a POST request request.HTTPMethod = @"POST"; // Setting a timeout request.timeoutInterval = 20.0; //...
<link rel="import" href="../bower_components/iron-icon/iron-icon.html"> <link rel="import" href="../bower_components/iron-icons/iron-icons.html"> <link rel="import" href="../bower_components/iron-icons/social-icons.html"&gt...
On whichever page you want to display your product / project portfolio, invoke the custom element like so: <article id="project-neighbourhood"> <div class="row"> <div class="col-12 hero"> <img src="path-to-hero-image...
The command \sout of the package ulem strikes through a text: \sout{This text is striked through} The package ulem redefines the command \emph. When you do not want to have this behavior you can use the package ulem with the option normalem: \usepackage[normalem]{ulem}
Empty string Empty string is not null but has zero length: string emptyString = ""; // an empty string is not null... assert(emptyString !is null); // ... but it has zero lenght assert(emptyString.length == 0); Null string string nullString = null; a null string is null (De ...
Depth-first search is an algorithm for traversing or searching tree or graph data structures. One starts at the root and explores as far as possible along each branch before backtracking. A version of depth-first search was investigated in the 19th century French mathematician Charles Pierre Trémaux...
;;Recursively print the elements of a list (defun print-list (elements) (cond ((null elements) '()) ;; Base case: There are no elements that have yet to be printed. Don't do anything and return a null list. (t ;; Recursive case ;; Print the next elem...
Let us assume the following stock market data stored in HDFS. It is a CSV file with fields: Symbol, Date, Open, High, Close & Volume. ABT,20160106,42.310001,42.98,42.209999,42.560001,5906000 BAC,20160201,14.05,14.09,13.8,13.96,105739400 CAS,20160129,1.9,1.97,1.83,1.84,34500 DCA,20160129,3.46...
Here is an example of an Azure Powershell automation runbook that deletes any blobs in an Azure storage container that are older than a number of days. This may be useful for removing old SQL backups to save cost and space. It takes a number of parameters which are self explanatory. Note: I have ...
Most examples of a function returning a value involve providing a pointer as one of the arguments to allow the function to modify the value pointed to, similar to the following. The actual return value of the function is usually some type such as an int to indicate the status of the result, whether ...
//Get permission for Battery Monitoring [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; UIDevice *myDevice = [UIDevice currentDevice]; [myDevice setBatteryMonitoringEnabled:YES]; double batLeft = (float)[myDevice batteryLevel] * 100; NSLog(@"%.f",batLeft); int d = myD...

Page 264 of 369