11 2020 档案
摘要:pom.xml: <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependenc
阅读全文
摘要:Define an action to update the record: import { createAction, props } from "@ngrx/store"; import { Update } from "@ngrx/entity"; import { Course } fro
阅读全文
摘要:Reducer: import { Course, compareCourses } from "../model/course"; import { EntityState, createEntityAdapter } from "@ngrx/entity"; import { createRed
阅读全文
摘要:Run bash to generate keystore.jks in src/mian/resources folder: keytool -genKey -keyalg RSA -alias linkedin -keystore keystore.jks -storepass password
阅读全文
摘要:Profiles allow us to do different configurations based on different env. application.yml: spring: profiles: dev server: port: 8000 spring: profiles: t
阅读全文
摘要:We can use @Controller to return a view with data: package com.frankmoley.lil.learningspring.web; import com.frankmoley.lil.learningspring.busniess.do
阅读全文
摘要:Controller: @Controller @RequestMapping("/reservations") public class RoomReservationWebController { @Autowired private ReservationService reservation
阅读全文
摘要:first(predFn, defVal) first can do the work for both "filter" + "take(1)" which filtering the data and end observable. // RxJS v6+ import { from } fro
阅读全文
摘要:Opening large JSON files inside of your IDE or text editor can be a pain at times, with this command line tool you can drill down into large JSON file
阅读全文
摘要:export let mapError = transform => broadcaster => listener => { return broadcaster((value) => { if (value instanceof Error) { listener(transform(value
阅读全文
摘要:let getUrl = url => listener => { let controller = new AbortController() let signal = controller.signal fetch(url, {signal}) .then((response) => { ret
阅读全文
摘要:While using async/await, seeing such error: Uncaught ReferenceError: regeneratorRuntime is not defined Solution: in package.json, add: "browserslist":
阅读全文
摘要:You often want to ignore values until the user performs a certain action. This lesson walks through setting up an allowWhen broadcaster that will only
阅读全文
摘要:https://github.com/mike-north/professional-ts/blob/master/notes/04-mikes-ts-setup.md#api-surface-report--docs Install: yarn add -D @microsoft/api-extr
阅读全文
摘要:Using Volta: volta pin node yarn In add into package.json: "volta": { "node": "14.15.1", "yarn": "1.22.10" }
阅读全文
摘要:As simple as: npx gitignore node
阅读全文
摘要:To display a sequence of values in React, we can use our mapSequence operator, wrap it around a broadcaster, then pass that new broadcaster into our u
阅读全文
摘要:Instead of always combining useState and useEffect, when can create a utility useBroadcaster hook which allows us to pass in a broadcaster. export let
阅读全文
摘要:Many streams of events end when a certain condition is met. When we run into that condition, we'll want to pass down our own custom values. This lesso
阅读全文
摘要:function somethingRisky() {} try { somethingRisky() } catch(err: unknown) { if (err instanceof Error) { console.log(err.stack) } else { console.log(er
阅读全文
摘要:Typescript v3.9 introduces the @ts-expect-error assertion added to TypeScript 3.9. This assertion is more descriptive than @ts-ignore because, rather
阅读全文
摘要:type Corner = `${'top' | 'bottom'}-${ 'left' | 'right'}` type VerticalAlignment = "top" | "middle" | "bottom"; type HorizontalAlignment = "left" | "ce
阅读全文
摘要:...T: type Foo<T extends any[]> = [boolean, ...T, boolean] In previous typescript version, you can only put '...T' to the last element of array. Put n
阅读全文
摘要:class Foo { #name; constructor(rawName?: string) { this.#name = rawName ?? (no name) } log() { console.log(this.#name) } } Checking 'rawName' is nulli
阅读全文
摘要:Volta’s job is to manage your JavaScript command-line tools, such as node, npm, yarn, or executables shipped as part of JavaScript packages. Similar t
阅读全文
摘要:First, let's see the code: // builder/Contact.java public class Contact { private String firstName; private String lastName; private String emailAddre
阅读全文
摘要:It's common for a user to enter values that you want to check against your pre-defined values. Let's make a demo of a word game to demonstrate one app
阅读全文
摘要:Coding again the interface. interface: package com.frankmoley.lil.designpatternsapp.factory; public interface Pet { void setName(String name); String
阅读全文
摘要:In previous post, we have follow code: const delayMessage = (message) => hardCode(message)(createTimeout(1000)); const sequence = (...broadcasters) =>
阅读全文
摘要:For example we have tow Entities: package com.virtualpairprogrammers.theater.domain import javax.persistence.* @Entity data class Performance( @Id @Ge
阅读全文
摘要:pom.xml: add compile plugin <build> <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory> <testSourceDirectory>${project.basedir}/src/
阅读全文
摘要:pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <gr
阅读全文
摘要:We want to only freeze the private variable when we get it and set it: class Cart { #items; constructor(items = []) { this.value = items; } set value(
阅读全文
摘要:Morden Javascript allows us to write private and static class memebers. To do this, we need to install babel plugins: First, let see "static member":
阅读全文
摘要:Let's see two code snippets which has same functionalities: No1: function Cart(items = []) { this.items = Object.freeze(items); this.add = item => { c
阅读全文
摘要:https://epicreact.dev/css-variables/ Code body[data-theme='light'] { --colors-primary: deeppink; --colors-background: white; } body[data-theme='dark']
阅读全文
摘要:Structure: tempalates/seatBooking.html: <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>com.
阅读全文
摘要:In Java, you can use Autowired to init the service: @Autowired TheaterService theaterService In kotlin, it is different, you need to use 'lateinit var
阅读全文
摘要:Many scenarios involve one task happening after another has completed. This lesson walks you through setting up "steps" which trigger one after anothe
阅读全文
摘要:Backing bean: A typical JavaServer Faces application includes one or more backing beans, each of which is a type of JavaServer Faces managed bean that
阅读全文
摘要:Install devtool: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <option
阅读全文
摘要:ou can create diffs in markdown to show what has changed in a code snippet. I use this in blog posts to highlight changed lines for readers. This work
阅读全文
摘要:Asynchronous code often uses conditions to determine when a block of code should finish running. This lesson walks through writing a doneIf operator w
阅读全文
摘要:Apps often have scenarios where one event controls another. In operators, this requires passing one broadcaster in and using it to control another bro
阅读全文
摘要:After a broadcaster is "done", starting it up again requires calling the broadcaster with the same listener. This creates a kind of "async recursion"
阅读全文
摘要:Controlling when a broadcaster starts and stops gives you complete control over your broadcasters. This let's you hook multiple pieces of UI together
阅读全文
摘要:Chrome DevTools provide many handy utility functions that we can use to make debugging faster and easier so we can fix the bug and move on. In this le
阅读全文
摘要:Sometimes you encounter a backend issue which seems to occur only on your computer, with a very specific sets of headers, cookies etc. Because of that
阅读全文
摘要:In this lesson, we use CSS variables with calc and hsl to implement a rudimentary dark mode. We can do this by adjusting the lightness of our colors b
阅读全文
摘要:In Kotlin, you are able to extend a class. Just like add prototype in Javascript. fun toSentenceCase(a: String): String { return a[0].toUpperCase() +
阅读全文
摘要:import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import java.util.* class AgeCalculation() { fun getAge(dob: Calendar): Int {
阅读全文