Tutorial by Examples

2005 The following iterates over the characters of the string s. It works similarly for looping over the elements of an array or a set, so long as the type of the loop-control variable (c, in this example) matches the element type of the value being iterated. program ForLoopOnString; {$APPTYPE ...
OpenCL is short for Open Computing Language. OpenCL is a Framework for parallel programming across heterogeneous platforms, called compute devices, ranging from CPUs over GPUs to more special platforms like FPGAs. OpenCL provides a standard interface for parallel computing on these compute devices b...
If you have a modern CPU or graphics card (GPU) inside your machine, chances are you have everything ready for first steps in OpenCL. Finding out if your processor is OpenCL capable can be usually done via the manufacturer's homepage, a good first start is the official documentation at https://www...
Every Windows Phone project contains App.cs class: public sealed partial class App : Application This class is your global application context. General Application class usage: App entry point, particularly for various activation contracts. Application lifecycle management. Application g...
Perl supports many kinds of conditional statements (statements that are based on boolean results). The most common conditional statements are if-else, unless, and ternary statements. given statements are introduced as a switch-like construct from C-derived languages and are available in versions Per...
Perl supports many kinds of loop constructs: for/foreach, while/do-while, and until. @numbers = 1..42; for (my $i=0; $i <= $#numbers; $i++) { print "$numbers[$i]\n"; } #Can also be written as foreach my $num (@numbers) { print "$num\n"; } The while loop ev...
When I first started managing the keyboard I would use separate Notifications in each ViewController. Notification Method (Using NSNotification): class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() NSNotificationCenter.defaultCenter().a...
// Get the reference to your ListView ListView listResults = (ListView) findViewById(R.id.listResults); // Set its adapter listResults.setAdapter(adapter); // Enable filtering in ListView listResults.setTextFilterEnabled(true); // Prepare your adapter for filtering adapter.setFilter...
Objects can be centered by using margin: 0 auto; if they are block elements and have a defined width. HTML <div class="containerDiv"> <div id="centeredDiv"></div> </div> <div class="containerDiv"> <p id="centeredPara...
Many tasks require elevated privileges. You can elevate user privileges to Administrator level for your batch runtime using a shortcut: Press alt+ and the batch file to a selected folder to create a shortcut. Right click and select "Properties". Select the "Shortcut&quo...
The following batch file will popup a UAC Prompt allowing you to accept elevated Administrator privileges for the batch session. Add your tasks code to :usercode section of the batch, so they run with elevated privileges. @echo off setlocal EnableDelayedExpansion :: test and acquire admin rights ...
In most scripting languages, if a function call fails, it may throw an exception and stop execution of the program. Bash commands do not have exceptions, but they do have exit codes. A non-zero exit code signals failure, however, a non-zero exit code will not stop execution of the program. This can...
The behaviour of virtual functions in constructors and destructors is often confusing when first encountered. #include <iostream> using namespace std; class base { public: base() { f("base constructor"); } ~base() { f("base destructor"); } virtual co...
Detailed instructions on getting database-design set up or installed.
Principal Component Analysis finds sequences of linear combinations of the features. The first linear combination maximizes the variance of the features (subject to a unit constraint). Each of the following linear combinations maximizes the variance of the features in the subspace orthogonal to that...
Security is a very general, broad field, and touches every aspect of development, deployment, support, among other areas. Per the (ISC)2, there are 10 domains, and include Physical security, in addition to the "Software" aspects. The intent of information security is to protect the confid...
We can use the class DateInterval to add or subtract some interval in a DateTime object. See the example below, where we are adding an interval of 7 days and printing a message on the screen: $now = new DateTime();// empty argument returns the current date $interval = new DateInterval('P7D');//th...
Learning the parameters of a prediction function and testing it on the same data is a methodological mistake: a model that would just repeat the labels of the samples that it has just seen would have a perfect score but would fail to predict anything useful on yet-unseen data. This situation is call...
Standard DateTime Formatting DateTimeForma­tInfo specifies a set of specifiers for simple date and time formating. Every specifier correspond to a particular DateTimeFormatInfo format pattern. //Create datetime DateTime dt = new DateTime(2016,08,01,18,50,23,230); var t = String.Format("{0...
Any nullable type is a generic type. And any nullable type is a value type. There are some tricks which allow to effectively use the result of the Nullable.GetUnderlyingType method when creating code related to reflection/code-generation purposes: public static class TypesHelper { public stat...

Page 670 of 1336