Tutorial by Examples: di

An interface is declared like a class, but without access modifiers (public, private, ...). Also, no definitions are allowed, so variables and constants can't be used. Interfaces should always have an Unique Identifier, which can be generated by pressing Ctrl + Shift + G. IRepository = interface ...
When using the DllImport attribute you have to know the correct dll and method name at compile time. If you want to be more flexible and decide at runtime which dll and methods to load, you can use the Windows API methods LoadLibrary(), GetProcAddress() and FreeLibrary(). This can be helpful if the ...
:autocmd BufWritePost * if &diff | diffupdate | endif
After the subscription was created, it is important to manage its correct deallocation. The docs told us that If a sequence terminates in finite time, not calling dispose or not using addDisposableTo(disposeBag) won't cause any permanent resource leaks. However, those resources will be used unti...
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...
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...
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...
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...
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 relatively common mistake: You created an rect element, in a bar chart for instance, and you want to add a text label (let's say, the value of that bar). So, using the same variable that you used to append the rect and define its x and y position, you append your text element. Very logic, ...
$ pwd /home/bob/somedir1/somedir2/somedir3 $ pushd /home/bob/otherdir1/otherdir2 /home/bob/otherdir1/otherdir2 /home/bob/somedir1/somedir2/somedir3 $ popd /home/bob/somedir1/somedir2/somedir3 $ pushd /usr /usr /home/bob/somedir1/somedir2/somedir3 $ pushd /var /var /usr /home/bob/som...
The div is a block-level element, i.e it occupies the whole of the page width and the siblings are place one below the other irrespective of their width. <div> <p>This is DIV 1</p> </div> <div> <p>This is DIV 2</p> </div> The output of...
Here are some example on how to add new filters/functions to twig,the synax for adding Twig_Functions are the same as the Twig_Filter ones, just change the keywords accordingly <?php $twig = new Twig_Environment($loader); /* You can chain a global function */ $twig->addFilter(ne...
Custom Setting Custom Setting Field Custom Setting Field Value When the field is checked the validation rule will be disabled, for the running user or in this example, their profile - The rule can also be disabled for a whole Salesforce org - Validation Rule AND( /* the below is the...
Explanation In this example a simple Trigger has been created to change the Close Date of an Opportunity, that's about to be inserted or updated, to a date 10 days in the future. The Apex Controller custom setting's checkbox field enables the code to be disabled at the user / profile / org level. ...
Each signed integer type may be represented in any one of three formats; it is implementation-defined which one is used. The implementation in use for any given signed integer type at least as wide as int can be determined at runtime from the two lowest-order bits of the representation of value -1 ...
Resolving scoped services during application startup can be difficult, because there is no request and hence no scoped service. Resolving a scoped service during application startup via app.ApplicationServices.GetService<AppDbContext>() can cause issues, because it will be created in the sc...
Editor templates are a good way to reuse Razor code. You can define editor templates as Razor partial views and then use them in other views. Editor templates usually exist in the Views/Shared/EditorTemplates/ folder, although they can also be saved to the Views/ControllerName/EditorTemplates/ fold...
Multidimensional Arrays As the name indicates, multi dimensional arrays are arrays that contain more than one dimension, usually two or three but it can have up to 32 dimensions. A multi array works like a matrix with various levels, take in example a comparison between one, two, and three Dimensi...

Page 85 of 164