본문 바로가기

분류 전체보기155

데이터 암호화를 위한 JPA Attribute Converter User 클래스에서 juminNumber 속성 값을 테이블에 저장할 때 암호화하는 예제입니다. User Entity 생성 @Entity @Table(name = "USER") @DynamicInsert @DynamicUpdate @Getter public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "NAME", length = 50, nullable = false) private String name; @Column(name = "JUMIN_NUMBER", length = 100, nullable = false) @Convert(converter = StringCryp.. 2019. 6. 10.
Python 리스트 크기 구하기 listA = [1,2,3,4,5] listB = [6,7,8] listC = listA + listB size = len(listC) print(size) 2019. 6. 7.
Python 두 개의 리스트 합치기 listA = [1,2,3,4,5] listB = [6,7,8] listC = listA + listB print(listC) 2019. 6. 7.
Python에서는 &&, || 연산자 대신 and, or 사용 Python 논리연산자는 and, or 이다. 논리연산자의 경우에 두 개 이상의 조건식을 조합하여 표현할 때 주로 사용한다. and 논리 연산자 if i in dictA and i in dictB: print('i 값이 dictA와 dictB 딕셔너리에 키 값으로 존재합니다.'); or 논리 연산자 if i in dictA or i in dictB: print('i 값이 dictA 또는 dictB 딕셔너리에 키 값으로 존재합니다.'); 2019. 6. 7.
Python에서 printf 함수처럼 print 함수 사용하는 방법 % 스타일 포맷팅 print("%d %s" % (10000, 'lelecoder'), end='') {} 스타일 포맷팅 print("number={0}, name={1}".format(10000, 'lelecoder')) 2019. 6. 6.
리팩토링 - 객체 간의 기능 이동 메서드 이동 (Move Method) 메서드가 자신의 클래스에 있는 기능보다 다른 클래스의 기능을 더 많이 사용하는 경우에 메서드가 많이 사용하는 클래스에 비슷한 내용의 새 메서드를 작성하자. 기존 메서드는 대리 메서드로 전환 또는 삭제하자. 수정전 코드 class Account { private AccountType type; private int daysOverdrawn; double overdraftCharge() { if (type.isPremium()) { double result = 10; if (daysOverdrawn > 7) { result += (daysOverdrawn - 7) * 0.85; } return result; } else { return daysOverdrawn * 1.7.. 2019. 6. 6.