Tutorial by Examples: c

Install vue-cli: npm install -g vue-cli start a project like: vue init <template> <project-name> where <template>: webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction. webpack-simple - A simple Webpa...
public class ConvertMapToList { public static void main(String[] args) { Map<Integer, String> map = new HashMap<>(); map.put(10, "apple"); map.put(20, "orange"); map.put(30, "banana"); map.put(40, "w...
CSS properties which add visual decorations but are not supported can be replaced with image tag. For example: border-radius is not supported in Yahoo! Mail, Outlook 2007/10/13 +, Outlook 03/Express/Mail & Android 4 (Gmail) + To work around this we can add images with border radius in them i.e...
Calling C code from Go package main /* // Everything in comments above the import "C" is C code and will be compiles with the GCC. // Make sure you have a GCC installed. int addInC(int a, int b) { return a + b; } */ import "C" import "fmt" func ma...
/** Adds user to the list of poople which are assigned the tasks. - Parameter name: The name to add - Returns: A boolean value (true/false) to tell if user is added successfully to the people list. */ func addMeToList(name: String) -> Bool { // Do something.... ...
Reference types are comprised of both a reference to a memory area, and a value stored within that area. This is analogous to pointers in C/C++. All reference types are stored on what is known as the heap. The heap is simply a managed area of memory where objects are stored. When a new object is ...
To use the example above on a blade template to hide content from the user, you would typically do something like this: @can('view-content', $content) <! -- content here --> @endcan To completely prevent navigation to the content, you can do the following in your controller: if(Gate::a...
Policies are classes that help you organise authorisation logic around a model resource. Using our previous example, we might have a ContentPolicy that manages user access to the Content model. To make ContentPolicy, laravel provides an artisan command. Simply run php artisan make:policy ContentPo...
Writing Policies follows much the same pattern as writing Gates. The content permission gate can be rewritten as a Policy like this: function view($user, $content) { return $user->isSubscribedTo($content->id); } Policies can contain more methods as needed to take care of all authori...
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...
(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...
aws ec2 describe-images --filters "Name=name,Values=${NAME_OF_AMI}"
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": { }, ...
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...
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...
In the following, weight is declared as a mutable field. type person = { name: string; mutable weight: int };; Remark: As far as design is concerned here, one would consider the fact that a person's name isn't likely to change, but their weight is.

Page 730 of 826