Tutorial by Examples: c

Code in documentation comments will automatically be executed by cargo test. These are known as "documentation tests", and help to ensure that your examples work and will not mislead users of your crate. You can import relative from the crate root (as if there were a hidden extern crate ...
Vaadin plug-in for eclipse provides a quick way to build vaadin project with Apache Ivy dependency manager. Vaadin's documentation explains how to create vaadin project with the help of Eclipse plugin. To install the plug-in just go to eclipse marketplace and search vaadin. Current version of the p...
To reference a variable in a query, add a colon (:) before the variable name. Datetime targetDate = Datetime.now().addDays(-7); List<Lead> recentLeads = [SELECT Id FROM Lead WHERE CreatedDate > :targetDate]; string targetName = 'Unknown'; List<Contact> incompleteContacts = [SELE...
When assigning to a single object, a query that returns anything other than a single row will throw a QueryException. try { Account a = [SELECT Id FROM Account WHERE Name = 'Non-existent Account']; } catch (QueryException e) { // List has no rows for assignment to SObject } try { ...
The standard (17.6.4.2.1/1) generally forbids extending the std namespace: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. The same goes for posix (17.6.4.2.2/1): The behavi...
An array is a data structure that stores values of same data type. In Python, this is the main difference between arrays and lists. While python lists can contain values corresponding to different data types, arrays in python can only contain values corresponding to same data type. In this tutorial...
Intent: Separate the construction of a complex object from its representation so that the same construction process can create different representations Builder pattern is useful when you have few mandatory attributes and many optional attributes to construct a object. To create an object with dif...
Often you will want to perform asynchronous operations in parallel. There is direct syntax that supports this in the async/await proposal, but since await will wait for a promise, you can wrap multiple promises together in Promise.all to wait for them: // Not in parallel async function getFriend...
entry = tk.Entry(parent, width=10) entry.insert(0, "Hello, World!")
// A simple class hierarchy that uses the visitor to add functionality. // class VehicleVisitor; class Vehicle { public: // To implement the visitor pattern // The class simply needs to implement the accept method // That takes a reference to a visitor object tha...
The visitor Pattern can be used to traverse structures. class GraphVisitor; class Graph { public: class Node { using Link = std::set<Node>::iterator; std::set<Link> linkTo; public: void accept(GraphVisito...
<?php use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; class TestController extends Controller { //Inject Request HTTP Component in your function then able to exploit it public function myFunctionAction(Request $request) {...
Objective-C UILabel *label = [[UILabel alloc] init]; label.highlighted = YES; label.highlightedTextColor = [UIColor redColor]; Swift let label = UILabel() label.highlighted = true label.highlightedTextColor = UIColor.redColor() Swift 3 let label = UILabel() label.isHighlighted = true ...
If you like to show the dialog without the close button (i.e. the x button in the upper-right corner of the dialog), perhaps because you want to force the user to select one of options or buttons in the dialog itself: 1- Give your dialog a CSS class: $("#selector").dialog({ closeOnE...
Nesting is great for keeping related selectors together to make it easier for future developers to understand your code. The parent selector, represented by an ampersand ("&") can help do that in more complex situations. There are several ways its can be used. Create a new selector th...
Clone the SFML Repository from Github. Enter following comands in a cmd window: git clone https://github.com/SFML/SFML.git SFML If you already downloaded SFML before you can just use the existing one. Create some folders for the build-files cd SFML mkdir build && cd build mkdir ar...
Swift 2 import UIKit extension UIDevice { var modelName: String { var systemInfo = utsname() uname(&systemInfo) let machineMirror = Mirror(reflecting: systemInfo.machine) let identifier = machineMirror.children.reduce("") { identifier, ele...
You can disable compiler warnings using #pragma warning disable and restore them using #pragma warning restore: #pragma warning disable CS0168 // Will not generate the "unused variable" compiler warning since it was disabled var x = 5; #pragma warning restore CS0168 // Will gene...
Individual elements can be accessed through indexes. Python arrays are zero-indexed. Here is an example : my_array = array('i', [1,2,3,4,5]) print(my_array[1]) # 2 print(my_array[2]) # 3 print(my_array[0]) # 1
index() returns first index of the matching value. Remember that arrays are zero-indexed. my_array = array('i', [1,2,3,4,5]) print(my_array.index(5)) # 5 my_array = array('i', [1,2,3,3,5]) print(my_array.index(3)) # 3 Note in that second example that only one index was returned, even though...

Page 413 of 826