Tutorial by Examples

Here counter is a child component accessed by demo which is a parent component using v-model. // child component Vue.component('counter', { template: `<div><button @click='add'>+1</button> <button @click='sub'>-1</button> <div>this is inside the child c...
RubyInline is a framework that lets you embed other languages inside your Ruby code. It defines the Module# inline method, which returns a builder object. You pass the builder a string containing code written in a language other than Ruby, and the builder transforms it into something that you can ca...
After spending more than 5 hours, i found this easy solution: -To verify that the system has a CUDA-capable GPU, run the following command: lspci | grep -i NVIDIA You will see output similar to the following example (showing an NVIDIA Tesla K80/M60 card): -Disabling the nouveau driver: sudo...
The most basic way to structure your code using spring boot for good automatic package scanning is using @SpringBootApplication annotation. This annotation provide in itself 3 other annotations that helps with automatic scanning: @SpringBootConfiguration, @EnableAutoConfiguration, @ComponentScan (mo...
You can use @ComponentScan in order to configure more complex package scanning. There is also @ComponentScans that act as a container annotation that aggregates several @ComponentScan annotations. Basic code examples @ComponentScan public class DemoAutoConfiguration { } @ComponentScans({@Co...
Spring boot is based on a lot of pre-made auto-configuration parent projects. You should already be familiar with spring boot starter projects. You can easily create your own starter project by doing the following easy steps: Create some @Configuration classes to define default beans. You should...
You might need a v-model on a computed property. Normally, the v-model won't update the computed property value. The template: <div id="demo"> <div class='inline-block card'> <div :class='{onlineMarker: true, online: status, offline: !status}'></div> ...
@interface NSString : NSObject (NSObject is a base class of NSString class). You can use below methods for allocation of string class: - (instancetype)init + (instancetype)new + (instancetype)alloc For Copy any object : - (id)copy; - (id)mutableCopy; For compare objects : - (BOOL...
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.... ...
Value types simply contain a value. All value types are derived from the System.ValueType class, and this includes most of the built in types. When creating a new value type, the an area of memory called the stack is used. The stack will grow accordingly, by the size the declared type. So for exa...
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 ...
In order to publish to a repository in Maven format ,“maven-publish” plugin for gradle can be used. The plugin should be added to build.gradle file in library module. apply plugin: 'maven-publish' You should define the publication and its identity attributes in build.gradle file too. This iden...
Gates are closures that determine if a user is allowed to perform a certain action on a resource. Gates are typically defined in the boot method of AuthServiceProvider and succinctly named to reflect what it's doing. An example of a gate that allows only premium users to view some content will look ...
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...

Page 1176 of 1336