Tutorial by Examples: f

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...
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...
You can set a ColdFusion variable using the <cfset> tag. To output the variable, you need to surround the variable name with hash # symbols and enclose it within <cfoutput> tags. <cfset variablename="World!"> <cfoutput> Hello #variablename# </cfoutput>...
The <cfparam> tag creates a variable if it does not already exist. You can assign a default value using the default attribute. This can be used if you want to create a variable, but don't want to overwrite it if it has been previously created elsewhere. Here the variable hasn't been set previ...
You can check if a variable has been defined in a scope by using ColdFusion's built in StructKeyExists() function. This can be used inside a <cfif> tag to prevent error messages in the event you attempt to refer to a variable that does not exist. You can also use this function to determine whe...
public class Producer { private static Random random = new Random((int)DateTime.UtcNow.Ticks); //produce the value that will be posted to buffer block public double Produce ( ) { var value = random.NextDouble(); Console.WriteLine($"Producing value: {value}...
Functions can be seen as exponentials in our algebra. As we can see, if we take a type a with n instances and a type b with m instances, the type a -> b will have m to the power of n instances. As an example, Bool -> Bool is isomorphic to (Bool,Bool), as 2*2 = 2². iso1 :: (Bool -> Bool) -...
You can, of course, return lists from subs: sub foo { my @list1 = ( 1, 2, 3 ); my @list2 = ( 4, 5 ); return ( @list1, @list2 ); } my @list = foo(); print @list; # 12345 But it is not the recommended way to do that unless you know what you are doing. While th...
The auto keyword by itself represents a value type, similar to int or char. It can be modified with the const keyword and the & symbol to represent a const type or a reference type, respectively. These modifiers can be combined. In this example, s is a value type (its type will be inferred as s...
The most important consequence of the One Definition Rule is that non-inline functions with external linkage should only be defined once in a program, although they can be declared multiple times. Therefore, such functions should not be defined in headers, since a header can be included multiple tim...
Lets use the same code as above for this example. #include <iostream> void fail() { int *p1; int *p2(NULL); int *p3 = p1; if (p3) { std::cout << *p2 << std::endl; } } int main() { fail(); } First lets compile it g++ -g -o main m...
A function template can be overloaded under the rules for non-template function overloading (same name, but different parameter types) and in addition to that, the overloading is valid if The return type is different, or The template parameter list is different, except for the naming of paramete...
This attaches the results of the query SELECT * FROM Users and sends it to [email protected] EXEC msdb.dbo.sp_send_dbmail @profile_name = 'The Profile Name', @recipients = '[email protected]', @query = 'SELECT * FROM Users', @subject = 'List of users', ...
Returns an integer (int) value that indicates the difference between the soundex values of two character expressions. Parameters: character expression 1. character expression 2. Both parameters are alphanumeric expressions of character data. The integer returned is the number of chars in th...
SQL Server 2012 Returns a NVARCHAR value formatted with the specified format and culture (if specified). This is primarily used for converting date-time types to strings. Parameters: value. An expression of a supported data type to format. valid types are listed below. format. An NVARCHAR form...
This is a very basic feature selection technique. Its underlying idea is that if a feature is constant (i.e. it has 0 variance), then it cannot be used for finding any interesting patterns and can be removed from the dataset. Consequently, a heuristic approach to feature elimination is to first re...
Whereas inside a Translation Unit, order of initialization of global variables is specified, order of initialization across Translation Units is unspecified. So program with following files foo.cpp #include <iostream> int dummyFoo = ((std::cout << "foo"), 0); b...
Create Dynamic Web project, provide following information's as stated below Project name : DemoSpringMVCProject Target runtime : set as Apache Tomcat v7.0 server Click on finish, successfully we have created dynamic web project. Now we have to setup Spring-MVC framework : Create web.xml...
SoundEffect.Play() plays the sound effect in a "fire-and-forget" fashion. The sound plays once and its lifetime is managed by the framework. You are not able to change the properties (volume, pan, pitch) of the sound during playback, loop it, position it in 3D or pause it. You can hold a ...

Page 224 of 457