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...
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...
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...
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...