Create a .gitattributes file in the project root containing:
* text=auto
This will result in all text files (as identified by Git) being committed with LF, but checked out according to the host operating system default.
This is equivalent to the recommended core.autocrlf defaults of:
input o...
__construct() is the most common magic method in PHP, because it is used to set up a class when it is initialized. The opposite of the __construct() method is the __destruct() method. This method is called when there are no more references to an object that you created or when you force its deletion...
In this example, documentation for the local function baz (defined in foo.m) can be accessed either by the resulting link in help foo, or directly through help foo>baz.
function bar = foo
%This is documentation for FOO.
% See also foo>baz
% This wont be printed, because there is a line w...
If a function contains just one expression, we can omit the brace brackets and use an equals instead, like a variable assignment. The result of the expression is returned automatically.
fun sayMyName(name: String): String = "Your name is $name"
Django's default authentication works on username and password fields. Email authentication backend will authenticate users based on email and password.
from django.contrib.auth import get_user_model
class EmailBackend(object):
"""
Custom Email Backend to perform authent...
You can also combine several operators together to create more complex WHERE conditions. The following examples use the Employees table:
Id FName LName PhoneNumber ManagerId DepartmentId Salary Hire_date CreatedDate ModifiedDate
1 James Smith 1234567890 NULL ...
ViewData is the mechanism for a controller to provide data to the view it presents, without using a ViewModel. Specifically, ViewData is a dictionary which is available both in MVC action methods and views. You may use ViewData to transfer some data from your action method to the view returned by th...
For instance, a computation involving commands to read and write from the prompt:
First we describe the "commands" of our computation as a Functor data type
{-# LANGUAGE DeriveFunctor #-}
data TeletypeF next
= PrintLine String next
| ReadLine (String -> next)
derivin...
The basics
After making changes to your source code, you should stage those changes with Git before you can commit them.
For example, if you change README.md and program.py:
git add README.md program.py
This tells git that you want to add the files to the next commit you do.
Then, commit your...
First download anaconda from the Continuum site. Either via the graphical installer (Windows/OSX) or running a shell script (OSX/Linux). This includes pandas!
If you don't want the 150 packages conveniently bundled in anaconda, you can install miniconda. Either via the graphical installer (Window...
A query engine is required in order to execute SPARQL queries over a dataset. Query engines may be embedded in applications, or accessed remotely. Remote access may be through a vendor-specific API, or through the SPARQL protocol if an implementation supports it. This documentation will not cover ho...
/**
* LoginController constructor.
* @param Socialite $socialite
*/
public function __construct(Socialite $socialite) {
$this->socialite = $socialite;
}
Within the constructor of your Controller, you're now able to inject the Socialite class that will help you handle login with so...
Usually we want to separate the creation of the dialog from its appearance. Then three steps are needed.
Create base element
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can...
Avoid destructive operations on quoted objects. Quoted objects are literal objects. They are possibly embedded in the code in some way. How this works and the effects of modifications are unspecified in the Common Lisp standard, but it can have unwanted consequences like modifying shared data, tryin...
docker exec -it <container id> /bin/bash
It is common to log in an already running container to make some quick tests or see what the application is doing. Often it denotes bad container use practices due to logs and changed files should be placed in volumes. This example allows us log in the...
Before Python 3.5+ was released, the asyncio module used generators to mimic asynchronous calls and thus had a different syntax than the current Python 3.5 release.
Python 3.x3.5
Python 3.5 introduced the async and await keywords. Note the lack of parentheses around the await func() call.
import ...
First, remove autopublish. autopublish automatically publishes the entire database to the client-side, and so the effects of publications and subscriptions cannot be seen.
To remove autopublish:
$ meteor remove autopublish
Then you can create publications. Below is a full example.
import { Mon...