- 博客(34)
- 收藏
- 关注
原创 2020-11-2 grid cell下拉框不自动加载, Jacoco, Excel, Spring MVC vs Boot, if as && in JS, IDEA ECMA 6, linux
https://github.com/afitiskin/redux-saga-routineshttps://github.com/ag-grid/ag-grid/issues/2450onFirstDataRendered -> onRowDataChanged就可以了因为custom cellRender改变了一个cell的值,也就是改变了row data,进而re-render,导致之前setSelected(true)的row又被deselect了...
2020-11-23 08:32:22
395
原创 0809-1004 setTimeout, cellRenderer, onClick called on render, read list RestTemplate, fetchMock 500
1. List - Using the spread operator in React以前笔记好像写过…但是是关于map-{}的,这次是关于list-[]的。var colors = ['red', 'green', 'blue'];var refColors = [...colors, 'yellow'];//colors => ['red', 'green', 'blue']//refColors => ['red', 'green', 'blue', 'yellow']2.
2020-10-05 13:11:10
179
原创 0809-1004 validator, access-control-allow, SCSS loader, any/() after function, reduce, debug webpack
1. javax validatorValidatorFactory factory = Validation.buildDefaultValidatorFactory();Validator validator = factory.getValidator();https://stackoverflow.com/questions/37972859/java-util-objects-isnull-vs-object-nullhttps://github.com/corydolphin/flas
2020-10-05 09:42:31
253
原创 0727 0802 - redux action 500, xml to POJO, ZonedDateTime&UTC, ag-grid overlay/copy, jest synchronize
1. redux async action handle non-200It seems though the call backend get 500, the redux async will not goes into catch block automatically. For example, It can go into catch because it cannot parse Json of the error message, but not because of the backend
2020-07-27 13:02:47
246
原创 Jackson Annotations - @JsonProperty,etc; Other - @ApiModelProperty
我理解的serialize deserialize是,比如把POJO class <-> JSON相互转换1. Jackson AnnotationsJackson Serialization Annotations: @JsonAnyGetter, @JsonGetter, @JsonPropertyOrder, @JsonRawValue, @JsonValue, @JsonRootName, @JsonSerialize,Jackson Deserialization Annota
2020-07-20 09:25:29
477
原创 0720 - useEffect infinite loop, redux post, ag-grid checkbox, java8 stream example
1. run-p: command not found应该是我忘了npm install…2. How to Fix the Infinite Loop Inside “useEffect” (React Hooks)By providing [userId] as a second argument, we are just telling “useEffect()” to run only if the certain value (userId) has changed between the
2020-07-19 15:43:34
193
原创 Spring: Connect 2 Backends, Jersey, Jackson, @ResponseBody, @Produces, Json (de)serialize
1. @ResponseBody, @Produces不太清楚Spring中,两个backend互相call,返回的值会被如何打包并通过何种协议(应该是http)进行传输。先总结一下: 1. @Produces, @Consumes可以和@ResponseBody一起使用,我的理解是在打包成http的response和request的时候,还能指定media type。2. @Produces和@Consumes并不负责serialize或者deserialize POJO -> JSON /
2020-07-19 15:01:44
235
原创 0713 - application-test.yml, ===, join json, @Qualifier, Serializable, @Responsebody, @JsonInclude..
https://stackoverflow.com/questions/21450060/how-to-join-two-javascript-objects-without-using-jquery可以整理到以前相关笔记,并且整理一下那个笔记的标题https://www.ag-grid.com/javascript-grid-resizing/https://stackoverflow.com/questions/42501291/ag-grid-sizecolumnstofit-for-colum
2020-07-13 08:58:00
146
原创 0706 - ReflectionTestUtils, JUnit test Kafka, EqualsVerifier, Eqauls and Hashcode, Gradle run JUnit
https://stackoverflow.com/questions/2457239/injecting-mockito-mocks-into-a-spring-beanThis solved my problem, I can’t inject MyDAO alone then mock it, will have some NullPointerException because it actually goes into its method e.g. myDao.method1(anty(),
2020-07-12 15:51:06
385
原创 ThreadPool -逐渐更新
1. How to stop a Callable submitted to ExecutorService?Using the shutdown will bring down the entire executorService… This executor service might also be processing few more threads…You can cancel a future using Future.cancel() method. It attempts to can
2020-07-04 12:15:20
206
原创 0629-@Resource, JUnit-Response, objectMapper, Jest fetch/tooltip undefined, mimic ConsumerRecords...
1. How to stop a Callable submitted to ExecutorService?using the shutdown will bring down the entire executorService… This executor service might also be processing few more threads…https://stackoverflow.com/questions/36375204/how-to-terminate-callable-p
2020-07-04 11:18:00
244
原创 0622 - Kafka assign all partitions, dateTime, forEach, !==, [variable], onChange w/o event, ag-grid
1. 一个Kafka message会不会被分成几部分存在不同的partitions上?大概问的是,一个kafka message会不会被分成几部分存在不同的partitions上,不会。consumer获得的最小粒度应该就是以一个kafka message为单位,也就是每个offset上存的都是个完整的kafka message。2. a single consumer in a group with no other consumers will be assigned all partitions
2020-06-22 13:33:35
226
原创 0615零散问题整理
1. test root reducers借鉴了标题超链接的方法:(就不放自己的代码了,与这个例子类似)Original:let rootReducer = combineReducers({ counter, todo })Test:let store = createStore(rootReducer)// check that initial state of the root reducer matches// what child reducers return given a
2020-06-15 11:42:58
285
原创 各种情境下获得Spring Application Context
1. How to get Spring application context最开始我想写一个public static void main, 去直接run一个bean的方法,所以我需要给它提供一个spring application context。总结有以下几种方法:1. 1 ClassPathXmlApplicationContext但其实我没有config.xml文件,所以不行@Componentpublic class Main { public static void main(S
2020-06-15 10:47:18
265
原创 Solved - In jest test, how to update react state?
1. 遇到两个问题:state not update after simulate(‘change’, event).state updated, but component that use state not updated2. 有几点注意:一些例子:如何用spy.on,有时候可能需要wrapper.update(),具体会在“3. 我的实现”里说道it('should call handleUserIdChange', () => { const value = '0
2020-06-10 13:48:39
382
原创 0608零散问题整理
1. redux storecreateStoreCreates a Redux store that holds the complete state tree of your app. There should only be a single store in your app.The only way to change its state is by dispatching actions.You may also subscribe to the changes to its state
2020-06-10 12:51:43
139
原创 Solved - jest/ enzyme如何测试conditional render/ useSelector/ redux dispatch actions?
1. Test component have useSelector / conditional renderI got information from stackOverflow, and I combine the first and third stackOverflow answers.I also use example from github1.1 Test conditional renderStackOverflow 1st answer: Use mockStore to tes
2020-06-09 13:34:51
727
1
原创 Solved - How to abort fetch in redux async actions? 如何取消正在进行的fetch / redux前端如何cancel request?
1. 一些参考链接dispatch一个abort的action:这个方法我没有采用,总觉得这个dispatch会在上一个dispatch的action结束后再执行,不一定会中断当前正在fetch的这个action… 但是这个例子又用了action id,感觉是会中断指定的action的用AbortController这个我感觉更方便,也是我后来采用的AbortController的其它参考2. 我的理解尝试了promise.abort,promise,reject,都不可
2020-06-09 13:24:36
244
原创 0525 0601 - React Component父子组件间传值, Redux Reducer, react/redux state, Kendo, ReactJson, Router, Jest
https://medium.com/@ruthmpardee/passing-data-between-react-components-103ad82ebd17return {…state, …newState}https://redux.js.org/recipes/structuring-reducers/immutable-update-patternsfunction updateNestedState(state, action) { let nestedState = state.
2020-06-01 12:29:31
341
原创 Solved - Test Redux Actions Error: fetch-mock: No fallback response defined for GET to https://..
即使是官方代码,都仍然会报这个错:fetch-mock: No fallback response defined for GET to https://…然后这个https://…网址,指的是你原本action.tsx里fetch的那个url。1. 先上官方代码:function fetchTodosRequest() { return { type: FETCH_TODOS_REQUEST }}function fetchTodosSuccess(body) { ret
2020-05-30 07:24:57
737
原创 Solved - Enzyme test Child Component pass props to Parent Component /Enzyme test callback function
1. Child Component pass props to Parent Component / 子组件通过props给父组件传参1.1 Component:parent and child componentexport const parentComponent = (props) => { const val = props.val; const onChange = (e) => { props.sendToParent(e.target.value); //
2020-05-30 04:01:30
106
原创 Solved - react-json-view, react-json-pretty不能import,misnamed import
1. 按官方文档,react-json-pretty 和 react-json-view 都有不能import不能使用的问题1.1 Error 11. mismatched import name: should be reactJsonPretty, but found JSONPretty.2. mismatched import name: should be reactJsonView, but found ReactJson.1.2 Error 2改成reactJsonPretty或者r
2020-05-20 03:12:58
491
原创 0517零散问题整理
1. Long vs longLong可以是null,long不可以。Long是个Object,long是个primitivelong is a primitive, which must have a value. Simple.Long is an object, so:it can be null (meaning whatever you like, but “unknown” is a common interpretation)it can be passed to a meth
2020-05-18 11:30:31
562
原创 如何在test中模拟Kafka broker? EmbeddedKafka如何使用?
EmbeddedKafkaBroker1. EmbeddedKafkaRule vs. EmbeddedKafkaBrokerEmbeddedKafkaRule: A TestRule wrapper around an EmbeddedKafkaBroker.查看源码,发现他俩都是创建一些虚拟的broker给test使用的。然后看到这样一段话,不过对我没有什么用:TopicAlreadyExists exceptions:Some suggestions:Since you are usi
2020-05-18 07:47:53
2415
1
原创 0511零散问题整理
1. consumer.assign() vs. consumer.subscribe()2. Warning equals/hashCode on @Data annotation lombok with inheritanceAdd:@EqualsAndHashCode(callSuper=false) // or trueBy setting callSuper to true, you can include the equals and hashCode methods of your
2020-05-11 13:29:48
216
原创 Solved - Kafka consumer的一些方法(Method): offsetsForTimes/endOffsets
1. 并不是所有的offset或timestamp都有消息,如何找到合适的offset或time?consumer.offsetsForTimes: the offsetsForTimes API can return the earliest offset in a topic-partition with a timestamp greater than or equal to the input timestamp.当时还是这篇博客给了我启发。2. 如何找到kafka队列中最开始和最后的offs
2020-05-09 11:59:39
3352
原创 Solved - JUnit Mockito: 比较 @Inject @InjectMocks @MockBean @Mock
ref: https://howtodoinjava.com/mockito/mockito-mock-injectmocks/1. initMocks vs. @SpringBootTest1.1 在@Before中用initMocks源码注释:Initializes object annotated with Mockito annotations for given testClass1.1.1 先看看init mocks的多种方法:https://examples.javacodegeek
2020-05-09 08:26:30
4825
3
原创 Solved - Spring Kafka consumer.poll()如何一次只获取一条消息?consumer.poll()后会移除Kafka队列中的消息吗?
1. Spring Kafka consumer.poll()如何一次只获取一条消息?step 1. DefaultKafkaConsumerFactory首先,如果你在config Kafka的时候,用的是DefaultKafkaConsumerFactory, 那么max-poll-records是被强制设置为1的。Spring官方原文:By default, max.poll.rec...
2020-05-05 13:47:34
4554
1
原创 Solved - Kafka Consumer.poll() returned ConsumerRecords is empty? kafka消费者收不到消息,记录为空;如何收到kafka历史消息
尝试以下解决方案:1. ConsumerFactory<xxx, xxx>确定在自己的kafkaConfig.java(不一定要叫这个名字,但是是有@Configuration和@EnableKafka的一个config kafka配置的文件)定义的consumerFactory里,有没有配置ConsumerFactory<String, String> consume...
2020-05-05 00:31:50
1407
原创 学习笔记 - 5步理解Gradle. How build execution is controlled by gradle tasks?
https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:projects_and_taskshttps://docs.gradle.org/current/userguide/build_lifecycle.html这是来自官网的学习笔记,含有很多复制粘贴,链接也都贴在上面和文章超链接里了1. Five ...
2020-05-03 16:45:10
1165
原创 学习笔记 - webpack. How loaders are used in webpack?
https://webpack.js.org/concepts/#entryref: https://webpack.js.org/concepts/loaders/其实就是整理了一下官方文档,加深理解和印象…1. Webpack:1.1 Conceptwebpack就是个打包机:Webpack is a static module bundler for modern JavaSc...
2020-05-03 07:45:31
217
原创 学习笔记 - npm依赖管理 npm dependency
ref: https://nodejs.dev/an-introduction-to-the-npm-package-manager1. Node.js1.1 Difference between Node.js and BrowserCan use JS to write backend…In the browser, most of the time what you ar...
2020-05-02 11:33:45
2974
原创 学习笔记 - Gradle依赖管理 Gradle Dependencies
TODO: 待补充官方文档:https://docs.gradle.org/current/userguide/core_dependency_management.html1. Overview of Gradle.buildaccess artifactsaccess artifactsstore artifactsGradle Buildlocal file repositoryNet...
2020-05-02 04:08:42
3911
原创 Solved - 如何在react jsx中显示复杂的JSON字符串? How to display complex/nested json string in React jsx?
如何在react jsx中显示复杂的JSON字符串? How to display complex/nested json string in React jsx?1. Handle the String to JSON in Backend? Frontend?2. How to handle raw JSON string with \r\n in frontend in JSX?1. Ha...
2020-05-02 00:02:58
234
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人