Skip to content

Instantly share code, notes, and snippets.

View dodangquan's full-sized avatar

Đỗ Đăng Quân dodangquan

View GitHub Profile
@dodangquan
dodangquan / GitHub-Project-Guidelines.md
Created July 22, 2019 06:40 — forked from rsp/GitHub-Project-Guidelines.md
Git Strict Flow and GitHub Project Guidelines - setup rules and git flow for commercial and open-source projects by @rsp

Git Strict Flow and GitHub Project Guidelines

Or how to turn this:

into this:

@dodangquan
dodangquan / build.sh
Created February 27, 2019 01:53 — forked from bobbytables/build.sh
Protocol Buffer build script for multiple folders
#!/usr/bin/env bash
# This script is meant to build and compile every protocolbuffer for each
# service declared in this repository (as defined by sub-directories).
# It compiles using docker containers based on Namely's protoc image
# seen here: https://github.com/namely/docker-protoc
set -e
REPOPATH=${REPOPATH-/opt/protolangs}
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"}
@dodangquan
dodangquan / Tạo column kiểu số có giá trị tự động tăng trong Oracle Database.md
Created October 8, 2017 07:26
Tạo column kiểu số có giá trị tự động tăng trong Oracle Database

Để tạo được một column có kiểu là NUMBER mà giá trị của column đó có thể tự động tăng khi thực hiện câu lệnh INSERT trong hệ quản trị cơ sở dữ liệu Oracle ta sẽ phải sử dụng đến SEQUENCE kết hợp với TRIGGER.

Muốn thực hiện được điều này, đầu tiên phải tạo một SEQUENCE:

CREATE SEQUENCE name_of_sequence
  START WITH 1
  INCREMENT BY 1
  MAX VALUE 999999
  CACHE 100;
@dodangquan
dodangquan / PrimeNumber.java
Last active October 27, 2016 17:45
Phân tích số nguyên tố dùng đệ qui
private static void dequi(int n, int i, int count) {
if (n == 1) {
return;
} else if (isPrime(i)) {
if (n % i == 0) {
count++;
n = n / i;
}
if (count == 0) {
++i;
// @org.springframework.security.access.prepost.PreAuthorize
@Transactional
@PreAuthorize("hasRole('ROLE_ADMIN')")
public void removeContact(int id) {
contactDao.removeContact(id);
}
// @org.springframework.web.bind.annotation.RequestParam
@Controller
@RequestMapping("/user")
public class LoginController {
@RequestMapping("/login")
public String listCompanies(@RequestParam String username, @RequestParam String password) {
if(username.equals("admin") && password.equals("mypass")){
return "welcome";
} else {
// @org.springframework.web.bind.annotation.RequestMapping
@Controller
@RequestMapping("/login")
public class LoginController {
@Autowired
private UserService userService;
...
}
// @org.springframework.stereotype.Controller
@Controller
public class LoginController {
...
}
// @org.springframework.transaction.annotation.Transactional
@Service
@Transactional(readOnly = true)
public class BookServiceImpl implements BookService {
@Autowired
private BookDao bookDao;
@Transactional
public Book findByName(String name) {
// @org.springframework.stereotype.Service
@Service
public class BookServiceImpl implements BookService {
...
}