Tutorial by Examples: c

SELECT * FROM customers WHERE id IN ( SELECT DISTINCT customer_id FROM orders ); The above will give you all the customers that have orders in the system.
Classes provide a way of creating your own types within the .NET framework. Within a class definition you may include the following: Fields Properties Methods Constructors Events To declare a class you use the following syntax: Public Class Vehicle End Class Other .NET types can...
If classes share common functionality you can group this in a base or abstract class. Abstract classes can contain partial or no implementation at all and allow the derived type to override the base implementation. Abstract classes within VisualBasic.NET must be declared as MustInherit and cannot ...
Converting between encodings is easy with C++11 and most compilers are able to deal with it in a cross-platform manner through <codecvt> and <locale> headers. #include <iostream> #include <codecvt> #include <locale> #include <string> using namespace std; i...
C++14 In C++14, this is easily done by std::mismatch which returns the first mismatching pair from two ranges: std::string prefix = "foo"; std::string string = "foobar"; bool isPrefix = std::mismatch(prefix.begin(), prefix.end(), string.begin(), string.end()).first == ...
You can provide help for OpenFileDialog, SaveFileDialog and ColorDialog. To do so set ShowHelp property of dialog to true and handle HelpRequest event for dialog: void openFileDialog1_HelpRequest(object sender, EventArgs e) { //Perform custom action Help.ShowHelp(this, "Http://examp...
When a user press F1 on a control or click on Help button of form (?) and then clicks on a control the HelpRequested event will be raised. You can handle this event to provide custom action when user requests help for controls or form. The HelpRequested supports bubble up mechanism. It fires for y...
You can use Help class in code, to provide these kinds of help: Show a help pop-up for a control Open a CHM file based on context (Show table of content, Show a keyword or index, show a topic) Navigate to a URL using default browser Show Help pop-up window You can use Help.ShowPopup to disp...
If you have a Form with MinimizeBox and MaximizeBox set to true, then you can not show Help button on title-bar of Form and will lose the feature of click on help button to convert it to help cursor to be able to click on controls to show help. You can make a menu item on MenuStrip act like standar...
You can detect when a user Clicked on a HelpButton on title-bar of form by handling HelpButtonClicked. You can let the event continue or cancel it by setting Cancel property of its event args to true. private void Form1_HelpButtonClicked(object sender, CancelEventArgs e) { e.Cancel = true; ...
SELECT product, SUM(quantity) AS "Total quantity" FROM order_details GROUP BY product;
Assume a table of employees in which each row is an employee who has a name, a department, and a salary. SELECT department, MIN(salary) AS "Lowest salary" FROM employees GROUP BY department; This would tell you which department contains the employee with the lowest salary, and what t...
The protected internal keyword marks field, methods, properties and nested classes for use inside the same assembly or derived classes in another assembly: Assembly 1 public class Foo { public string MyPublicProperty { get; set; } protected internal string MyProtectedInternalPropert...
std::ostringstream can be used to convert any streamable type to a string representation, by inserting the object into a std::ostringstream object (with the stream insertion operator <<) and then converting the whole std::ostringstream to a std::string. For int for instance: #include <sst...
Below is a recursive code to reverse a string /** * Just a snippet to explain the idea of recursion * **/ public class Reverse { public static void main (String args[]) { String string = "hello world"; System.out.println(reverse(string)); //prints dlrow oll...
SELECT * FROM Cars WHERE status IN ( 'Waiting', 'Working' ) This is semantically equivalent to SELECT * FROM Cars WHERE ( status = 'Waiting' OR status = 'Working' ) i.e. value IN ( <value list> ) is a shorthand for disjunction (logical OR).
A pointer (resp. reference) to an object type can be converted to a pointer (resp. reference) to any other object type using reinterpret_cast. This does not call any constructors or conversion functions. int x = 42; char* p = static_cast<char*>(&x); // error: static_cast cannot perf...
Default behavior when cloning an object is to perform a shallow copy of the object's fields. In that case, both the original object and the cloned object, hold references to the same objects. This example shows that behavior. import java.util.List; public class Sheep implements Cloneable { ...
To copy nested objects, a deep copy must be performed, as shown in this example. import java.util.ArrayList; import java.util.List; public class Sheep implements Cloneable { private String name; private int weight; private List<Sheep> children; public Sheep(Str...
Custom Fonts for UI components from storyboard can be easily achieved with User Defined Runtime Attributes in storyboard and Categories. The advantages are like, No need to define outlets for the ui element No need to set font for elements programatically. Steps to follow Font File: A...

Page 289 of 826