묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결자바(Java) 알고리즘 문제풀이 입문: 코딩테스트 대비
채점 오류
package main;import java.util.Scanner; class Main{ public String solution(String str) { String answer=""; char [] charArray = str.toCharArray(); for( int i=0 ; i<charArray.length; i ++) { if(Character.isUpperCase(charArray[i])) { answer+=Character.toLowerCase(charArray[i]); }else { answer +=Character.toUpperCase(charArray[i]); } } return answer; } public static void main(String[] args) { Main T = new Main(); Scanner sc = new Scanner(System.in); String str = sc.nextLine(); System.out.print(T.solution(str)); } } 대소문자 바꾸기 부분에서 , 이클립스에서는 잘 돌아가는데 자꾸 런타임 에러가 뜹니다
-
해결됨20년 경력자의 알기쉬운 컴퓨터네트워크
이미 구성된 토폴로지 그려보기
토폴로지 구성을 파악하려면 방법이 있을까요?정말 유익한 강의 감사드립니다.다름이 아니라 처음부터 토폴로지를 구성하는 것이 아닌,이미 구성되어 있는(회사같은) End-Point 단말에서 ping 이나 tracert 같은 혹은 더 유용한 툴을 통해서 어떻게 토폴로지가 구성되어 있는지 파악하는건 가능할까요?강의를 보고 ping 이나 tracert 를 해봐도 대부분 제대로 된 응답을 안주는 경우가 많아서 어떻게 구성되어 있는지 보이지가 않습니다.도움말씀 부탁드립니다.
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
안녕하세요! 재귀함수에 관해서 질문드립니다
교안 p.118에 있는 재귀함수 예제문제에서 for(int i = depth; i < n; i++){ swap(v[i], v[depth]); //첫번째 swap(v[i], v[depth]); makePermutation(n, r, depth + 1); swap(v[i], v[depth]); //두번째 swap(v[i], v[depth]); } return;이렇게 예제가 나와있습니다.제가 이해한 바로는,함수 makePermutation에 (3, 3, 0)을 대입하면 i와 depth는 0으로 첫번째 swap(v[i], v[depth]); 은 swap(0,0)이 되고for문 안에 있는 makePermutation에 의해 매개변수 (3, 3, 0)이 (3, 3, 1)로 변하게되어 (3, 3, 1)에 해당하는 함수 makePermutation을 실행하게 되어 다시 첫번째 swap(v[i], v[depth]);이 실행되는 방식인 것으로 이해를 하였습니다.여기서 첫번째 swap(v[i], v[depth]); 의 역할은 이해가 가지만 두번째 swap(v[i], v[depth]); 의 역할은 이해가 가지 않아서 질문 드렸습니다. 감사합니다!
-
미해결설계독학맛비's 실전 FPGA를 이용한 HW 가속기 설계 (LED 제어부터 Fully Connected Layer 가속기 설계까지)
8장 vitis에 대하여
맛비님 안녕하세요, vitis 관련 궁금사항이 생겨 글 남깁니다. 헤더파일을 확인해 보던 중 sleep함수의 헤더파일이 zynq_fsbl_bsp 안에 include 되어있는것을 확인했습니다.저희가 ip를 만들고 HW export를 진행한 것을 vitis에 올리는 것으로 알고있는데, 그러면 zynq 내부에 sleep 함수에 관한 내용을 포함하고 있다 라고 생각하면 되는지 궁금합니다.
-
미해결AWS Certified Solutions Architect - Associate 자격증 준비하기
실전 문제 풀이 해설 파일 문의
안녕하세요.덕분에 강의 잘 듣고 있습니다. 다름이 아니라 실전문제 pdf외로 각 보기 별 해설이 작성된 파일도 내려받을 수 있을까요?실전문제풀이 강의를 보면 각 보기 별로 틀린 이유에 대해서 작성해 주시는데요. 이 부분도 반영된 파일을 받을 수 있는 지 문의 드립니다. 감사합니다.
-
미해결스프링 부트 - 핵심 원리와 활용
강의 PPT 자료 관련 문의
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]안녕하세요! 강의 잘 듣고 있습니다.다름이 아니라 올려주신 수업 자료에는 '스프링 부트 소개' 파트에서 사용하신 PPT 자료가 업로드 되어 있지 않습니다.복습을 위해 해당 자료가 있으면 좋을듯 한데, 추후 따로 업로드 해주실 수 있는지 궁금합니다.감사합니다!
-
미해결
아나콘다 커널연결시 에러
pip로 ipykernel 설치했고,커널 연결하려고 하니까 이런 에러가 뜨고 있습니다 커널 list 에도 "yuseong" 이 아예 뜨지 않는데뭐가 문제일까요?
-
해결됨스프링 시큐리티 OAuth2
Ajax 인증시 인가코드가 발급 되지 않는 원인 문의
Spring Authorization 1.0,1 기반으로 개발을 하고 있습니다. 인가코드를 발급 할떄 FormLogin 기본 설정을 사용하면 인가코드가 발급이 되는데 Ajax 로 로그인을 하면 인가코드가 발급되지 않고 있습니다. 디버깅을 해보면 로그인인 후 OAuth2AuthorizationEndpointFilter 는 실행되는데 @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { if (!this.authorizationEndpointMatcher.matches(request)) { filterChain.doFilter(request, response); return; } try { Authentication authentication = this.authenticationConverter.convert(request); if (authentication instanceof AbstractAuthenticationToken) { ((AbstractAuthenticationToken) authentication) .setDetails(this.authenticationDetailsSource.buildDetails(request)); } Authentication authenticationResult = this.authenticationManager.authenticate(authentication); if (!authenticationResult.isAuthenticated()) { // If the Principal (Resource Owner) is not authenticated then // pass through the chain with the expectation that the authentication process // will commence via AuthenticationEntryPoint filterChain.doFilter(request, response); return; } if (authenticationResult instanceof OAuth2AuthorizationConsentAuthenticationToken) { if (this.logger.isTraceEnabled()) { this.logger.trace("Authorization consent is required"); } sendAuthorizationConsent(request, response, (OAuth2AuthorizationCodeRequestAuthenticationToken) authentication, (OAuth2AuthorizationConsentAuthenticationToken) authenticationResult); return; } this.authenticationSuccessHandler.onAuthenticationSuccess( request, response, authenticationResult); } catch (OAuth2AuthenticationException ex) { if (this.logger.isTraceEnabled()) { this.logger.trace(LogMessage.format("Authorization request failed: %s", ex.getError()), ex); } this.authenticationFailureHandler.onAuthenticationFailure(request, response, ex); } } FormLogin 적용시에는 authenticationResult의 principal 에 UsernamePasswordAuthenticationToken이 설정되어 인가 코드가 정상적으로 발급되는데 AjaxLogin 적용시에는 authenticationResult의 principal 에 AnonymousAuthenticationToken이 설정되어 인가 코드가 정상적으로 발급되지 않고 403 예외가 발생합니다.AuthenticationProvider 구현체에서는 정상적으로 토큰을 저장하고 있습니다. AuthenticationProvider 구현체 소스@Component @RequiredArgsConstructor public class CustomAuthenticationProvider implements AuthenticationProvider { private final CustomUserDetailsService customUserDetailsService; private final PasswordEncoder passwordEncoder; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if(authentication == null){ throw new InternalAuthenticationServiceException("Authentication is null"); } LoginRequestDto loginRequestDto = (LoginRequestDto)authentication.getPrincipal(); String password = loginRequestDto.getLoginPassword(); UserAdapter userAdapter = (UserAdapter) customUserDetailsService.loadUserByLoinRequestDto(loginRequestDto); if (!passwordEncoder.matches(password, userAdapter.getCurrentUser().getLoginPwd())) { throw new BadCredentialsException("BadCredentialsException"); } CustomAuthenticationToken result = CustomAuthenticationToken.authenticated(userAdapter.getCurrentUser(), authentication.getCredentials(), userAdapter.getAuthorities()); result.setDetails(authentication.getDetails()); return result; } @Override public boolean supports(Class<?> authentication) { return CustomAuthenticationToken.class.isAssignableFrom(authentication); } } 이외 Custom 소스Spring Security 설정@EnableWebSecurity @RequiredArgsConstructor @Configuration public class DefaultSecurityConfig { private final CustomAuthenticationProvider customAuthenticationProvider; // private final CustomUserDetailsService customUserDetailsService; @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); } @Bean public CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter() throws Exception { CustomAuthenticationProcessingFilter filter = new CustomAuthenticationProcessingFilter(); // filter.setAuthenticationManager(authenticationManager(null)); filter.setAuthenticationManager(new ProviderManager(customAuthenticationProvider)); // filter.setAuthenticationSuccessHandler(customAuthenticationSuccessHandler()); // filter.setAuthenticationFailureHandler(customAuthenticationFailureHandler()); return filter; } // @formatter:off @Bean SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception { http .authorizeHttpRequests(authorizeRequests ->authorizeRequests .requestMatchers(CorsUtils::isPreFlightRequest).permitAll() .requestMatchers(new AntPathRequestMatcher("/")).permitAll() .requestMatchers(new AntPathRequestMatcher("/login/**")).permitAll() .requestMatchers("/api/login/**").permitAll() .requestMatchers("/api/registered-client/**").permitAll() .anyRequest().authenticated() ); http.addFilterBefore(customAuthenticationProcessingFilter(), UsernamePasswordAuthenticationFilter.class); http.exceptionHandling(httpSecurityExceptionHandlingConfigurer -> httpSecurityExceptionHandlingConfigurer .authenticationEntryPoint(new CustomLoginAuthenticationEntryPoint()) .accessDeniedHandler(customAccessDeniedHandler()) ); // http.userDetailsService(customUserDetailsService); // http.formLogin(); http.csrf().disable(); return http.build(); } // @formatter:on @Bean public AccessDeniedHandler customAccessDeniedHandler() { return new CustomAccessDeniedHandler(); } @Bean public AuthenticationSuccessHandler customAuthenticationSuccessHandler() { return new CustomAuthenticationSuccessHandler(); } @Bean public AuthenticationFailureHandler customAuthenticationFailureHandler() { return new CustomAuthenticationFailureHandler(); } } Ajax 로그인 처리 필터 소스public class CustomAuthenticationProcessingFilter extends AbstractAuthenticationProcessingFilter { private final ObjectMapper objectMapper = new ObjectMapper(); private static final AntPathRequestMatcher DEFAULT_ANT_PATH_REQUEST_MATCHER = new AntPathRequestMatcher("/api/login", HttpMethod.POST.name()); public CustomAuthenticationProcessingFilter() { super(DEFAULT_ANT_PATH_REQUEST_MATCHER); } public CustomAuthenticationProcessingFilter(AuthenticationManager authenticationManager) { super(DEFAULT_ANT_PATH_REQUEST_MATCHER, authenticationManager); } @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { if (!request.getMethod().equals("POST")) { throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); } LoginRequestDto loginRequestDto = objectMapper.readValue(request.getReader(), LoginRequestDto.class); if(StringUtils.isEmpty(loginRequestDto.getLoginId())||StringUtils.isEmpty(loginRequestDto.getLoginPassword())) { throw new IllegalStateException("Username or Password is empty"); } CustomAuthenticationToken authRequest = CustomAuthenticationToken.unauthenticated(loginRequestDto, loginRequestDto.getLoginPassword()); authRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); return getAuthenticationManager().authenticate(authRequest); } } CustomAuthenticationToken 소스public class CustomAuthenticationToken extends AbstractAuthenticationToken { private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; private final Object principal; private Object credentials; public CustomAuthenticationToken(Object principal, Object credentials) { super(null); this.principal = principal; this.credentials = credentials; setAuthenticated(false); } public CustomAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) { super(authorities); this.principal = principal; this.credentials = credentials; super.setAuthenticated(true); // must use super, as we override } public static CustomAuthenticationToken unauthenticated(Object principal, Object credentials) { return new CustomAuthenticationToken(principal, credentials); } public static CustomAuthenticationToken authenticated(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) { return new CustomAuthenticationToken(principal, credentials, authorities); } @Override public Object getCredentials() { return this.credentials; } @Override public Object getPrincipal() { return this.principal; } }
-
해결됨it 취업을 위한 알고리즘 문제풀이 입문 (with C/C++) : 코딩테스트 대비
테스트 케이스 질문
#include <iostream> #include <vector> using namespace std; int main() { freopen("input.txt", "rt", stdin); int s, n, i, j, tmp, idx; scanf("%d%d", &s, &n); vector<int> a(n); for (i = 0; i < n; i++) { scanf("%d", &tmp); if(i < s) a[s-1-i] = tmp; else { idx = s; for (j = 0; j < s; j++) { if(a[j] == tmp) { idx = j; break; } } for (j = idx - 1; j >= 0; j--) a[j+1] = a[j]; a[j+1] = tmp; } } for (i = 0; i < s; i++) printf("%d ", a[i]); return 0; }이렇게 작성했는데 채점 폴더 전부 통과하는데 만약 입력이 5 51 2 2 3 4 이 들어왔다면 출력이4 3 2 2 1로 출력 되니까 위의 코드는 틀린 코드 같은데 맞나요???
-
미해결[개정판] 파이썬 머신러닝 완벽 가이드
numpy.random.default_rng/hyperopt버젼
안녕하세요, 권철민 강사님!강의 잘 듣고있습니다~1.4.9_ 분류실습_산탄데르_고객만족예측 실습 중에numpy.random.default_rng()를 사용하셨는데 default_rng() 를 사용하신 이유가 있으실까요? 이건 어떤때 쓰는게 좋은건가요? 2.저는 코랩을 쓰고 있는데, hyperopt는 실행이 안됩니다. 이전에 답변을 보니 넘파이와 hyperopt의 버젼 문제일거라고 하셨는데, 코랩에서 버젼을 바꾸어야 할까요? 현재 버젼은 다음과 같습니다.hyperopt(0.2), np(1.22.4)감사합니다!
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
한줄 if 쓸 때 return의 필요성
한줄로 if문을 쓰실 때 return을 붙이시는 이유가 있나요??제가 감히 생각해보면 return을 붙일 필요가 없는 것 같은데코드를 좀 더 명확하게 하시려고 붙이시는 건가요??
-
해결됨스프링 프레임워크는 내 손에 [스프1탄]
23.Spring MVC02 버전 만들기(Ajax, jQuery)
SPringMVC01 폴더를 복사 후, SpringMVC02 폴더로 변경해서 강의 순서대로 실행을 했는데, Mapping 경로를 찾지 못하는 오류가 발생했습니다. 그래서 해결 방법으로 [appServlet] - [servlet-context.xml] 파일 안에 19번째 줄 기존의 파일 내용 일부분을 수정했습니다. 이렇게 해도 괜찮을까요 ? 다른 방법이 있으면 알고 싶어요 ㅠ[servlet-context.xml] - 수정 전 <resources mapping="/resources/**" location="/resources/" /> [servlet-context.xml] - 수정 <resources mapping="/assets/**" location="/resources/assets/" /> <resources mapping="/ad_assets/**" location="/resources/ad_assets/" /> a
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
시간 오류 - getTime()
안녕하세요. 한국에선 문제 없던 앱이. 미국에서 동작할경우 등록한 날짜보다 하루 전의 날짜로 저장되는문제를 겪었습니다.찾아보니 getTime()도 toISOString 와 마찬가지로 UTC 0+ 시간으로 작동되는 부분이 문제였습니다. 스토리지에 저장되는 타임스탬프가 UTC 기반이였던거죠. 달력에서 날짜를 설정할때 시간은 반영되지않고 12am 즉 00시로 설정되는데, 한국은 UTC +9 이라 날짜에 영향을 주지 않았지만, 제가 있는 지역의 타임존은 UTC -5이기에 하루전날의 타임스탬프가 저장되고 다시 그 타임스탬을 이용해 new Date(date)을 해줄때 전날의 날짜가 불러진다고 결론내렸습니다.이문제를 해결하기위해, 스트로지에 타임스탬프가아닌 getStringDate 으로 뽑아낸 스트링 날짜를 넣어주었고. 다이어리 리스트에서 sort 를 위한 비교를할때만 getTime()을 써주었습니다. 전문가의 의견을 듣고싶습니다.
-
미해결Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex
github 권한 요청 드립니다
인프런 아이디 : devdh.cho@samsung.com인프런 이메일 : devdh.cho@samsung.com깃헙 아이디 : rhsnfl1122깃헙 Username : JoDongHyuen
-
해결됨외워서 끝내는 네트워크 핵심이론 - 기초
TCP 연결 종료 과정 중 Time wait관련
서버로부터 FIN + ACK을 수신 후, 최종 ACK를 서버로 다시 전달한 다음, TIME_WAIT 상태로 넘어가고, 일정 시간이 지난 다음 Close 처리가 된다는 설명에서,TIME_WAIT 시간은 정해진 값이 있는 것인지? 아니면 소켓 프로그래밍 시 따로 정해주는 것인지?바로 CLOSED하지 않고, TIME_WAIT을 하는 이유(목적)는 무엇인지?질문의 드립니다. :) 널널한개발자님 답변 부탁 드립니다!!
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
atom으로 강의를 하는데...
vscode 로 셋팅을 다 하도록 영상이 나왔는데 print문 강의는 아톰으로 시작하네요? vscode로 해도 괜찮나요?
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
강사님의 강의노트
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.강사님의 강의노트를 사이트에서 계속 찾아봤는데 찾을수가 없네요. 강의노트(소스와 개념설명)를 다운받을 수 있는 방법을 부탁드립니다.
-
해결됨GraphQL 완전정복 (키오스크를 만들며 배우는 풀스택 과정) - [2024 부분 리뉴얼]
apollo-upload-client 패키지 설치에러 문구
해당 부분 진행중에위와 같은 에러 코드를 보게 되었습니다.설치는 잘 된 것 같은데, 문제가 없을까 염려됩니다.
-
해결됨GraphQL 완전정복 (키오스크를 만들며 배우는 풀스택 과정) - [2024 부분 리뉴얼]
meteor npm i short 설치 에러문구
이 부분을 진행하고 있었습니다.라고 에러가 나오는데, 문제가 없을까요?혹시 몰라서, 지우고, 이 방법으로 설치해봤습니다. 이렇게 하니까, 에러문구는 많이 안보이네요
-
해결됨탄탄한 백엔드 NestJS, 기초부터 심화까지
이 강의를 들을 때 필요한 언어공부가 있을까요? 추천 부탁드립니다,
제가 백엔드 공부도 처음이고 언어 공부에서도 c 이후로 는 거의 하지 않았습니다. 프로젝트 단계로 넘어가기 전 언어 공부를 해야 더 도움이 될거같은데 typescript 나 자바스크립트를 선행 언어 공부를 한 후에 들어야 도움이 더 잘 될까요? 아니면 공부 없이도 듣기 괜찮을 까요?