Tutorial by Examples: cm

5.2 Objects in lua are garbage collected. Sometimes, you need to free some resource, want to print a message or do something else when an object is destroyed (collected). For this, you can use the __gc metamethod, which gets called with the object as argument when the object is destroyed. You could...
really_neat.info name = Really Neat Module description = Provides a really neat page for your site core = 7.x really_neat.module <?php /** * @file * Hook implementation and shared functions for the Really Neat Module. */ /** * Implements hook_menu(). */ function really_nea...
This example uses four different files: The User model The User mailer The html template for the email The plain-text template for the email In this case, the user model calls the approved method in the mailer and passes the post that has been approved (the approved method in the model may ...
One of the most common things you'll need to do in the command prompt is navigate your file system. To do this, we'll utilize the cd and dir keywords. Start by opening up a command prompt using one of the methods mentioned here. You most likely see something similar to what's below, where UserNam...
If you created an empty project, or you still don't have mvc configured in your application, you can add dependency: "Microsoft.AspNetCore.Mvc": "1.0.1" To your project.json file under "dependencies". And register MVC middleware in your Startup class: public void ...
The cmath module is similar to the math module, but defines functions appropriately for the complex plane. First of all, complex numbers are a numeric type that is part of the Python language itself rather than being provided by a library class. Thus we don't need to import cmath for ordinary arith...
Type erasure is a way to hide the type of an object from code using it, even though it is not derived from a common base class. In doing so, it provides a bridge between the worlds of static polymorphism (templates; at the place of use, the exact type must be known at compile time, but it need not b...
Let's say you have class with generic methods. And you need to call its functions with reflection. public class Sample { public void GenericMethod<T>() { // ... } public static void StaticMethod<T>() { //... } } Let's say we want to...
In Java, parent and child class both can have static methods with the same name. But in such cases implementation of static method in child is hiding parent class' implementation, it's not method overriding. For example: class StaticMethodTest { // static method and inheritance public stati...
pacman is a simple package manager for R. pacman allows a user to compactly load all desired packages, installing any which are missing (and their dependencies), with a single command, p_load. pacman does not require the user to type quotation marks around a package name. Basic usage is as follows:...
C++11 It's possible to write a generic function (for example min) which accepts various numerical types and arbitrary argument count by template meta-programming. This function declares a min for two arguments and recursively for more. template <typename T1, typename T2> auto min(const T1 &...
A new pseudo-type dynamic is introduced into the C# type system. It is treated as System.Object, but in addition, any member access (method call, field, property, or indexer access, or a delegate invocation) or application of an operator on a value of such type is permitted without any type checking...
Here is an example of basic overriding in Python (for the sake of clarity and compatibility with both Python 2 and 3, using new style class and print with ()): class Parent(object): def introduce(self): print("Hello!") def print_name(self): print("Parent...
This example demonstrates creating a basic application in ExtJS using Sencha Cmd to bootstrap the process - this method will automatically generate some code and a skeleton structure for the project. Open a console window and change the working directory to an appropriate space in which to work. ...
The CMD instruction has three forms: CMD ["executable","param1","param2"] (exec form, this is the preferred form) CMD ["param1","param2"] (as default parameters to ENTRYPOINT) CMD command param1 param2 (shell form) There can only be one CMD ins...
// Include the MFC header: // (you do not need to and should not include the standard Windows headers, e.g. // Windows.h) #include <AfxWin.h> // MFC core and standard components // The following header defines resource constants, such as dialog and control IDs: #include &qu...
Python 2 includes a cmp function which allows you to determine if one object is less than, equal to, or greater than another object. This function can be used to pick a choice out of a list based on one of those three options. Suppose you need to print 'greater than' if x > y, 'less than' if x &...
apologies: since I don't know of a channel for discussing/providing feedback on requests for improvement, I'm going to put my question here. Please feel free to point out a better place for this! @DataTx states that this is "completely unclear, incomplete, or has severe formatting problems&quot...
map Overview A key sequence can be re-mapped to another key sequence using one of the map variants. As an example, the following typical map will exit Insert mode when you press jk in quick sequence: :inoremap jk <Esc> map Operator There are multiple variants of :map for different modes...
There is also the ability to evaluate expressions when naming methods similar to how you can access an objects' properties with []. This can be useful for having dynamic property names, however is often used in conjunction with Symbols. let METADATA = Symbol('metadata'); class Car { construct...

Page 3 of 8