Tutorial by Examples

package com.mcf7.spring.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.io.Serializable;...
package com.mcf7.spring.domain; import org.springframework.data.repository.PagingAndSortingRepository; public interface BookRepository extends PagingAndSortingRepository<Book, Long> { } Basic Spring Repository pattern, except we enabled a Paging and Sorting Repository for extra featu...
package com.mcf7.spring.domain; import org.springframework.validation.Errors; import org.springframework.validation.Validator; public class BeforeCreateBookValidator implements Validator{ public boolean supports(Class<?> clazz) { return Book.class.equals(clazz); } ...
package com.mcf7.spring.domain; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component public class DatabaseLoader implements CommandLineRunner { private final BookRep...
package com.mcf7.spring.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.rest.core.event.ValidatingRepositoryEventListener; import org...
buildscript { repositories { jcenter() } dependencies { classpath 'io.spring.gradle:dependency-management-plugin:0.5.4.RELEASE' } } apply plugin: 'io.spring.dependency-management' apply plugin: 'idea' apply plugin: 'java' dependencyManagement { imp...
int get_l2cap_connection () { First off, all the variables we need, explanation for will follow at the appropriate spot. int ssock = 0; int csock = 0; int reuse_addr = 1; struct sockaddr_l2 src_addr; struct bt_security bt_sec; int result = 0; First, we need to cre...
Usually, J and K move up and down file lines. But when you have wrapping on, you may want them to move up and down the displayed lines instead. set wrap " if you haven't already set it nmap j gj nmap k gk
set mouse=a This will enable mouse interaction in the vim editor. The mouse can change the current cursor's position select text
The most basic application of add_action() is to add custom code to be executed at a certain location in a WordPress installation's source-code - either using actions supplied by the Core of WordPress, or ones created by third-party code such as plugins and themes. To add content to the <head&g...
Any number of functions may be "hooked" to any given action. In some instances it is important for a hooked function to execute before or after others, which is where the third parameter to add_action(), $priority comes into play. If the $priority argument is omitted, the function will be...
PHP Classes are powerful tool for improving code organization and minimizing naming collisions. At some point or another, the question of how to create an action hook for a class method inevitably arises. The $function_to_add argument is often shown as a string containing the function's name, howev...
Python Code import numpy as np import cv2 #loading haarcascade classifiers for face and eye #You can find these cascade classifiers here #https://github.com/opencv/opencv/tree/master/data/haarcascades #or where you download opencv inside data/haarcascades face_cascade = cv2.CascadeClassi...
With Ruby you can modify the structure of the program in execution time. One way to do it, is by defining methods dynamically using the method method_missing. Let's say that we want to be able to test if a number is greater than other number with the syntax 777.is_greater_than_123?. # open Numeric...
Monkey patching's main issue is that it pollutes the global scope. Your code working is at the mercy of all the modules you use not stepping on each others toes. The Ruby solution to this is refinements, which are basically monkey patches in a limited scope. module Patches refine Fixnum do ...
Image img = new Image(); BitmapImage bitmap = new BitmapImage(new Uri("ms-appx:///Path-to-image-in-solution-directory", UriKind.Absolute)); img.Source = bitmap;
public override async void ViewDidLoad(){ base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. Title = "Pull to Refresh Sample"; table = new UITableView(new CGRect(0, 20, View.Bounds.Width, View.Bounds.Height - 20)); //table.Aut...
drop table table01; drop table table02; create table table01 ( code int, name varchar(50), old int ); create table table02 ( code int, name varchar(50), old int ); truncate table table01; insert into table01 values (1, 'A', 10); insert in...
The simplest approach to parallel reduction in CUDA is to assign a single block to perform the task: static const int arraySize = 10000; static const int blockSize = 1024; __global__ void sumCommSingleBlock(const int *a, int *out) { int idx = threadIdx.x; int sum = 0; for (int i ...
Doing parallel reduction for a non-commutative operator is a bit more involved, compared to commutative version. In the example we still use a addition over integers for the simplicity sake. It could be replaced, for example, with matrix multiplication which really is non-commutative. Note, when ...

Page 897 of 1336