A metatable defines a set of operations which alter the behaviour of a lua object. A metatable is just an ordinary table, which is used in a special way.
local meta = { } -- create a table for use as metatable
-- a metatable can change the behaviour of many things
-- here we modify the 'tostrin...
Some metamethods don't have to be functions. To most important example for this is the __index metamethod. It can also be a table, which is then used as lookup. This is quite commonly used in the creation of classes in lua. Here, a table (often the metatable itself) is used to hold all the operation...
Perhaps the most important use of metatables is the possibility to change the indexing of tables. For this, there are two actions to consider: reading the content and writing the content of the table. Note that both actions are only triggered if the corresponding key is not present in the table.
Re...
To create a background session
// Swift:
let mySessionID = "com.example.bgSession"
let bgSessionConfig = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(mySessionID)
let session = NSURLSession(configuration: bgSessionConfig)
// add tasks here
//...
In C# 5.0 and earlier the developer could only suppress warnings by number. With the introduction of Roslyn Analyzers, C# needs a way to disable warnings issued from specific libraries. With C# 6.0 the pragma directive can suppress warnings by name.
Before:
#pragma warning disable 0501
C# 6.0:
...
Ionic Framework
A Cross-platform mobile application development framework using Angular JS and Front End web technologies.
Official website: http://ionicframework.com/
Documentation: http://ionicframework.com/docs/
Installation and Setup
Installation
Ionic required NPM(Node Package Manager) an...
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
/**
* A very simple Swing example.
*/
public class SwingExample {
/**
* The number of times the ...
You can create a new branch and switch to it using
git checkout -b AP-57
After you use git checkout to create a new branch, you will need to set that upstream origin to push to using
git push --set-upstream origin AP-57
After that, you can use git push while you are on that branch.
import std.format;
void main() {
string s = "Name Surname 18";
string name, surname;
int age;
formattedRead(s, "%s %s %s", &name, &surname, &age);
// %s selects a format based on the corresponding argument's type
}
Official documentatio...
By default a property is a primary key if a property on a class is named “ID” (not case sensitive), or the class name followed by "ID". If the type of the primary key property is numeric or GUID it will be configured as an identity column. Simple Example:
public class Room
{
// Pri...
Input the name of the template to get the template by using GetTemplate Method.
TemplateItem templateItem = Sitecore.Context.Database.GetTemplate("NameOfTheTemplate");
Sent to a window procedure when:
the user selects an item from a menu
a control sends a notification to its parent window
an accelerator keystroke is translated
Message SourceHIWORD(wp)LOWORD(wp)lpMenu0Menu ID (IDM_*)0Accelerator1Accel ID (IDM_*)0Controlnotification codeControl idHWND of con...
SQL Server 2012
You can utilize the new function: FORMAT().
Using this you can transform your DATETIME fields to your own custom VARCHAR format.
Example
DECLARE @Date DATETIME = '2016-09-05 00:01:02.333'
SELECT FORMAT(@Date, N'dddd, MMMM dd, yyyy hh:mm:ss tt')
Monday, September 05, 2016 ...
The Windows API documentation for functions taking one or more string as argument will usually look like this:
BOOL WINAPI CopyFile(
_In_ LPCTSTR lpExistingFileName,
_In_ LPCTSTR lpNewFileName,
_In_ BOOL bFailIfExists
);
The datatype for the two string parameters is made of several ...
When you have an input with well defined boundaries and are expecting more than one match in your string, you have two options:
Using lazy quantifiers;
Using a negated character class.
Consider the following:
You have a simple templating engine, you want to replace substrings like $[foo] whe...
[^0-9a-zA-Z]
This will match all characters that are neither numbers nor letters (alphanumerical characters). If the underscore character _ is also to be negated, the expression can be shortened to:
[^\w]
Or:
\W
In the following sentences:
Hi, what's up?
I can't wait for 2017!...
[^0-9]
This will match all characters that are not ASCII digits.
If Unicode digits are also to be negated, the following expression can be used, depending on your flavor/language settings:
[^\d]
This can be shortened to:
\D
You may need to enable Unicode character properties support expl...
To get version 5394 use:
svn co --revision r5394 https://svn.example.com/svn/MyRepo/MyProject/trunk
Or the shorter version:
svn co -r 5394 https://svn.example.com/svn/MyRepo/MyProject/trunk
Or by using pegged revisions:
svn co https://svn.example.com/svn/MyRepo/MyProject/trunk@5394
If al...