Tutorial by Examples

Via The User model The Laravel User model contains two methods that help with authorisations using Policies; can and can't. These two can be used to determine if a user has authorisation or not on a model respectively. To check if a user can view a content or not, you can do the following: if($us...
These inspections are extremely useful for preventing NullPointerExceptions. By default they are disabled. You can find these inspections in Inspections preferences: Java | Probable bugs | Constant conditions & exceptions and @NotNull/@Nullable problems. There you can also configure your annotat...
tslint-microsoft-contrib tslint-eslint-rules codelyzer Yeoman genearator supports all these presets and can be extends also: generator-tslint
(From this answer) The example below adds an enumerated type to a postgres database. First, edit the migration file (created with mix ecto.gen.migration): def up do # creating the enumerated type execute("CREATE TYPE post_status AS ENUM ('published', 'editing')") # creating a...
So let's say you have an entity class like this: public class Person { public int PersonId { get; set; } public string Name { get; set; } public string ZipCode { get; set; } public string City { get; set; } public string AddressLine { get; set; } } And then let's say that...
And now let's say you want to do the opposite of entity splitting: instead of mapping one entity into two tables, you would like to map one table into two entities. This is called table splitting. Let's say you have one table with five columns: PersonId, Name, AddressLine, City, ZipCode, where Pers...
Apps written for macOS are usually written with Apple's Frameworks. The frameworks that almost every app will use are: AppKit - for creating and managing UI elements Foundation - for common non-UI objects and operations There are other common frameworks that are used in many, but not all apps...
aws ec2 describe-images --filters "Name=name,Values=${NAME_OF_AMI}"
This example uses the icarus verilog compiler. Step 1: Create a file called hello.v module myModule(); initial begin $display("Hello World!"); // This will display a message $finish ; // This causes the simulation to end. Without, it would go on..and on. end endm...
Install Xcode from the App Store. Install the Xcode developer tools > xcode-select --install This will provide basic command line tools such as gcc and make Install Mac Ports https://www.macports.org/install.php The OSX Sierra install package will provide an open-source method of ...
A library based on NETStandard 1.6 would look like this: { "version": "1.0.0", "dependencies": { "NETStandard.Library": "1.6.1", //nuget dependency }, "frameworks": { //frameworks the library is build for "netst...
Taken from microsoft's github page with official documentation { "name": String, //The name of the project, used for the assembly name as well as the name of the package. The top level folder name is used if this property is not specified. "version": String, //The Semver versi...
A simple example of project configuration for a .NetCore 1.1 Console App { "version": "1.0.0", "buildOptions": { "emitEntryPoint": true // make sure entry point is emitted. }, "dependencies": { }, "tools": { }, ...
NSE functions should be used in interactive programming. However, when developping new functions in a new package, it's better to use SE version. Load dplyr and lazyeval : library(dplyr) library(lazyeval) Filtering NSE version filter(mtcars, cyl == 8) filter(mtcars, cyl < 6) filter(mtca...
The Problem You have a set of things to do (activities). Each activity has a start time and a end time. You aren't allowed to perform more than one activity at a time. Your task is to find a way to perform the maximum number of activities. For example, suppose you have a selection of classes to ch...
Numbers have four types in Python. Int, float, complex, and long. int_num = 10 #int value float_num = 10.2 #float value complex_num = 3.14j #complex value long_num = 1234567L #long value
String are identified as a contiguous set of characters represented in the quotation marks. Python allows for either pairs of single or double quotes. Strings are immutable sequence data type, i.e each time one makes any changes to a string, completely new string object is created. a_str = 'Hello ...
A list contains items separated by commas and enclosed within square brackets [].lists are almost similar to arrays in C. One difference is that all the items belonging to a list can be of different data type. list = [123,'abcd',10.2,'d'] #can be a array of any data type or single data type. li...
Lists are enclosed in brackets [ ] and their elements and size can be changed, while tuples are enclosed in parentheses ( ) and cannot be updated. Tuples are immutable. tuple = (123,'hello') tuple1 = ('world') print(tuple) #will output whole tuple. (123,'hello') print(tuple[0]) #will outp...
Dictionary consists of key-value pairs.It is enclosed by curly braces {} and values can be assigned and accessed using square brackets[]. dic={'name':'red','age':10} print(dic) #will output all the key-value pairs. {'name':'red','age':10} print(dic['name']) #will output only value with 'nam...

Page 1177 of 1336