01 2021 档案

摘要:Docker containers that are running on your local machine can't communicate with each other. In this mini post explains why and shows a demonstration o 阅读全文
posted @ 2021-01-31 18:05 Zhentiw 阅读(94) 评论(0) 推荐(0) 编辑
摘要:Starting up our server and running the curl command curl localhost:3000/health, we find that we get an error. Our server is complaining about us not h 阅读全文
posted @ 2021-01-30 21:46 Zhentiw 阅读(88) 评论(0) 推荐(0) 编辑
摘要:Running MySQL in a Docker Container is great for being able to emulate various environments. The more advanced containers will include a bunch of exec 阅读全文
posted @ 2021-01-30 21:22 Zhentiw 阅读(62) 评论(0) 推荐(0) 编辑
摘要:Containers can be very useful to emulate various environments. You can also use much more complex containers. In this case, we had a container with a 阅读全文
posted @ 2021-01-30 21:12 Zhentiw 阅读(84) 评论(0) 推荐(0) 编辑
摘要:Netlify serverless Set up a Local Development Environment for Serverless Functions Using Netlify Netlify makes developing serverless functions easy wi 阅读全文
posted @ 2021-01-26 15:36 Zhentiw 阅读(146) 评论(0) 推荐(0) 编辑
摘要:function useState<S>( initialState: S | (() => S), ): [S, Dispatch<SetStateAction<S>>] Example: function useDarkMode() { // ... const returnValue: [st 阅读全文
posted @ 2021-01-26 03:58 Zhentiw 阅读(134) 评论(0) 推荐(0) 编辑
摘要:Stream<Employee> emps = ... TreeSet<Employee> tree = emps.collect( Collectors.toCollection( () -> new TreeSet<Employee>( Comparator.comparingInt(Emplo 阅读全文
posted @ 2021-01-22 20:17 Zhentiw 阅读(137) 评论(0) 推荐(0) 编辑
摘要:Nx Create a new empty Nx workspace npx create-nx-workspace <workspace name> Choose Empty workspace Nx Cloud Nx CLI Useful Commands yarn nx list Shows 阅读全文
posted @ 2021-01-21 23:17 Zhentiw 阅读(304) 评论(0) 推荐(0) 编辑
摘要:To void: forEach, forEachOrdered, peek stream.peek(System.out::println) // print without termination .filter(n -> n > 0) .distinct() .limit(10) .forEa 阅读全文
posted @ 2021-01-21 03:19 Zhentiw 阅读(78) 评论(0) 推荐(0) 编辑
摘要:Saying that we have some icons and a target sum, for example 16. How to choose which and how many icons to include to reach the target but minize the 阅读全文
posted @ 2021-01-19 03:00 Zhentiw 阅读(48) 评论(0) 推荐(0) 编辑
摘要:Sream<Employee> emps = ...; emps.sorted( Comparator.comparingInt(Employee::getSalary) .reversed() ).limit(10) .map(Employee::getName) .forEachOrdered( 阅读全文
posted @ 2021-01-18 22:43 Zhentiw 阅读(416) 评论(0) 推荐(0) 编辑
摘要:A serial of number, you cannot add siblings number together. To calcaulate what is the max sum value. Thinking: 1. Weather I should add current number 阅读全文
posted @ 2021-01-18 18:21 Zhentiw 阅读(122) 评论(0) 推荐(0) 编辑
摘要:<!-- HTML --> <div class="wrap"> <div class="headers"> <div class="scroller"> <div class="track"> <div class="heading">Heading 1</div> </div> ... </di 阅读全文
posted @ 2021-01-18 16:17 Zhentiw 阅读(151) 评论(0) 推荐(0) 编辑
摘要:Fibonacci sequence: The most well-known approach is memoization. Advantage is fast, but space complexity is big. O(N). Bottom-up: 1 : Bottom-up dynami 阅读全文
posted @ 2021-01-18 03:35 Zhentiw 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Why need to use @ResponseEntity, first let's see what problem we might have when we don't use it. @RestController public class ProductsRestController 阅读全文
posted @ 2021-01-15 21:38 Zhentiw 阅读(86) 评论(0) 推荐(0) 编辑
摘要:Interceptor jump in before controller. So request may not reach controller if Pre-process is not ok. Demo: package com.test.hplus.interceptors; import 阅读全文
posted @ 2021-01-15 19:56 Zhentiw 阅读(94) 评论(0) 推荐(0) 编辑
摘要:In this lesson, you will learn how to extend a class's functionality through typescript decorators. Decorators provide a way to add both annotations a 阅读全文
posted @ 2021-01-14 04:21 Zhentiw 阅读(49) 评论(0) 推荐(0) 编辑
摘要:@ControllerAdvice public class DefaultAttributeController { // apply default value @ModelAttribute("newuser") public User getDefaultUser() { return ne 阅读全文
posted @ 2021-01-13 19:40 Zhentiw 阅读(116) 评论(0) 推荐(0) 编辑
摘要:Create file: // this apply to all the controllers @ControllerAdvice public class ApplicationExceptionHandler { @ExceptionHandler(ApplicationException. 阅读全文
posted @ 2021-01-13 19:36 Zhentiw 阅读(74) 评论(0) 推荐(0) 编辑
摘要:Controller: @Controller public class LoginController { private UserRepository userRepository; @PostMapping("/login") public String login(@ModelAttribu 阅读全文
posted @ 2021-01-13 01:18 Zhentiw 阅读(56) 评论(0) 推荐(0) 编辑
摘要:If you need to convert a deep nested object struture, you cannot just use @InitBinder, you need to build a custom convertor: Exp: conver city prop in 阅读全文
posted @ 2021-01-13 00:54 Zhentiw 阅读(110) 评论(0) 推荐(0) 编辑
摘要:For example, from the client, it send date as string to BE. But BE requires date to be a Date instead of String. Controller: .. @Autowired private Use 阅读全文
posted @ 2021-01-13 00:39 Zhentiw 阅读(86) 评论(0) 推荐(0) 编辑
摘要:User entity: import javax.validation.constraints.*; @Entity public class User { @Id private int id; @Size(min = 6, message = "Username cannot be less 阅读全文
posted @ 2021-01-12 20:54 Zhentiw 阅读(76) 评论(0) 推荐(0) 编辑
摘要:@Repository public interface ProductRepository extends CrudRepository<Product, Integer> { @Query("select p from Product p where p.name like %:name%") 阅读全文
posted @ 2021-01-12 15:49 Zhentiw 阅读(147) 评论(0) 推荐(0) 编辑
摘要:Set<Book> lib = ... lib.stream() .flatMap(book -> book.getWords().stream()) .distinct() .forEach(System.out::println); 阅读全文
posted @ 2021-01-07 03:22 Zhentiw 阅读(105) 评论(0) 推荐(0) 编辑
摘要:Entity: package com.frankmoley.security.app.auth; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Generated 阅读全文
posted @ 2021-01-06 02:42 Zhentiw 阅读(113) 评论(0) 推荐(0) 编辑
摘要:Code to improve: final Collection<DiscussionTopics> topics = s.getTopics(); final boolean anyTopics = topics != null && !topics.isEmpty(); Change to: 阅读全文
posted @ 2021-01-05 17:05 Zhentiw 阅读(55) 评论(0) 推荐(0) 编辑
摘要:Module defined what can be used inside the module package and what outside world can use inside our module. module-info.java /* * To change this licen 阅读全文
posted @ 2021-01-04 02:44 Zhentiw 阅读(92) 评论(0) 推荐(0) 编辑
摘要:Highlights: Solve the complexities of write Redux (actions, reducers, selector...middleware...) Solve the immutable pattern with nested spread operato 阅读全文
posted @ 2021-01-02 21:06 Zhentiw 阅读(351) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示