profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <malloc/_malloc.h> | |
typedef struct NODE { | |
char szData[64]; | |
int index; | |
struct NODE *prev; | |
struct NODE *next; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
public class StreamController { | |
@GetMapping("/stream") | |
public ResponseEntity<StreamingResponseBody> streamData() { | |
StreamingResponseBody responseBody = out -> { | |
for (int i = 0; i < 1000; i++) { | |
out.write(("Data " + i + "\n").getBytes()); | |
out.flush(); | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableAsync | |
public class AsyncConfig extends AsyncConfigurerSupport { | |
public Executor getAsyncExecutor() { | |
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | |
executor.setCorePoolSize(2); // 실행 대기 중인 Thread 개수 | |
executor.setMaxPoolSize(10); // 동시에 동작하는 최대 Thread 개수 | |
executor.setQueueCapacity(500);// CorePool이 초과될때 Queue에 저장했다가 꺼내서 실행된다. (500개까지 저장함) | |
// 단, MaxPoolSize가 초과되면 Thread 생성에 실패할 수 있음. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// history.back()을 통해 이 페이지가 호출되었을때 테스트!!! 를 확인가능 | |
window.onpageshow = function (event) { | |
if (event.persisted || (window.performance && window.performance.navigation.type == 2)) { | |
alert("테스트!!!"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function QueryStringToJSON(qs) { | |
//파라메터별 분리 | |
var pairs = qs.split('&'); | |
var result = {};//json 빈 객체 | |
//각 파라메터별 key/val 처리 | |
pairs.forEach(function(pair) { | |
pair = pair.split('=');//key=val 분리 | |
result[pair[0]] = decodeURIComponent(pair[1] || ""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | |
List<Role> roles = new ArrayList<>(); | |
roles.add(Role.USER); | |
List<GrantedAuthority> actualAuthorities = roles.stream().map(role -> new | |
SimpleGrantedAuthority(role.getKey())).collect(Collectors.toList()); | |
Authentication newAuth = new | |
UsernamePasswordAuthenticationToken(auth.getPrincipal(), auth.getCredentials(), actualAuthorities); | |
SecurityContext context = SecurityContextHolder.getContext(); | |
context.setAuthentication(newAuth); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RoleConverter implements AttributeConverter<Role, String> { | |
@Override | |
public String convertToDatabaseColumn(Role attribute) { | |
return attribute.getKey(); | |
} | |
@Override | |
public Role convertToEntityAttribute(String dbData) { | |
return EnumSet.allOf(Role.class).stream() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AttrWrapper<T extends Serializable> { | |
public final T value; | |
public final long timeoutMs; | |
private long lastAccess = System.currentTimeMillis(); | |
public AttrWrapper(T value, long timeoutMs) { | |
this.value = value; | |
this.timeoutMs = timeoutMs; | |
} | |
public boolean isValid() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<div id="demo"></div> | |
</body> |
NewerOlder