Tutorial by Examples: c

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...
const CACHE_TAG_NAMESPACE_MODULE = "YOUR_MODULES_CACHE_TAGS"; $cacheGroup = 'namespace_module'; $useCache = Mage::app()->useCache($cacheGroup); if (true === $useCache) { $cacheId = 'unique_name'; if ($cacheContent = Mage::app()->loadCache($cacheId)) { $html ...
Mage::app()->removeCache($cacheId); Flush all Magento cache entries Mage::app()->cleanCache() or: Mage::app()->getCacheInstance()->flush();
Redis configuration: Install redis (2.4+ required) Install phpredis Install the Magento extension Cm_Cache_Backend_Redis (only for Magento 1.7 and below) Edit your app/etc/local.xml: <global> ... <cache> <backend>Cm_Cache_Backend_Redis</backend> <b...
NSArray *a = @[@1]; a = [a arrayByAddingObject:@2]; a = [a arrayByAddingObjectsFromArray:@[@3, @4, @5]]; These methods are optimized to recreate the new array very efficiently, usually without having to destroy the original array or even allocate more memory.
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}...
The addition and multiplication have equivalents in this type algebra. They correspond to the tagged unions and product types. data Sum a b = A a | B b data Prod a b = Prod a b We can see how the number of inhabitants of every type corresponds to the operations of the algebra. Equivalently, we...
Lists Lists can be defined as: data List a = Nil | Cons a (List a) If we translate this into our type algebra, we get List(a) = 1 + a * List(a) But we can now substitute List(a) again in this expression multiple times, in order to get: List(a) = 1 + a + a*a + a*a*a + a*a*a*a + ... ...
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) -...
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...
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...
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...
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...
A simple EntitySystem that processes a Family of entities not once per frame, but after a given interval. Entity processing logic should be placed in processEntity(Entity). For more info, please see IntervalIteratingSystem In the below code example, the best usage for this is the physics world ...
As far as client-side JavaScript engines are concerned (those running inside a browser), there is no straightforward solution available for requesting content from sources other than the current domain. (By the way, this limitation does not exist in JavaScript-server tools such as Node JS.) However...

Page 416 of 826