기본 콘텐츠로 건너뛰기

5월, 2023의 게시물 표시

node install and use node ver manager in window 10

 if you want to install n under windows 32bit, it returns errors. so the common option is installing nvm. setp1. install node visit  https://nodejs.org/en download node step 2. install nvm https://github.com/coreybutler/nvm-windows/releases/download/1.1.11/nvm-setup.exe step 3. install node version nvm list nvm install 14.15.0 nvm use 14.15.0

spring rest api input validator

 spring api  https://spring.io/guides/tutorials/rest/ https://www.baeldung.com/spring-boot-bean-validation Test Code @Test public void whenPostRequestToUsersAndValidUser_thenCorrectResponse () throws Exception { MediaType textPlainUtf8 = new MediaType (MediaType.TEXT_PLAIN, Charset.forName( "UTF-8" )); String user = "{\"name\": \"bob\", \"email\" : \"bob@domain.com\"}" ; mockMvc.perform(MockMvcRequestBuilders.post( "/users" ) .content(user) .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content() .contentType(textPlainUtf8)); } @Test public void whenPostRequestToUsersAndInValidUser_thenCorrectResponse () throws Exception { String user = "{\"name\": \"\", \"email\" : \"bob@domain.com\"}" ; mockMvc.perform(MockMvcReq

split file and insert a text at the beginning of a file

 I have a text file. the first line constans of the titles. and i have an one large file which has over 70,000 lines. and some of the line, has a test cases. to test programs in a big file, it took over 10minutes. $cat file.csv "title"||"title2"||"title3" "data"||"data2"||"data3" ...... $wc -l file.csv  77488 file.csv #split it by lines $split -l 10,000 file.csv myfile $ls myfile* myfileaa myfileab myfileac myfilead myfileae myfileaf myfileag myfileah $cat myfileaa > myfile_01 $head -1 myfileaa | cat - myfileab > myfile_02 $head -1 myfileaa | cat - myfileac > myfile_03 $head -1 myfileaa | cat - myfilead > myfile_04 $head -1 myfileaa | cat - myfileae > myfile_05 $head -1 myfileaa | cat - myfileaf > myfile_06 $head -1 myfileaa | cat - myfileag > myfile_07