본문 바로가기

전체 글

(81)
string date 계산 String now = "20190823 10:20:10"; String min = "15"; String sec = "55"; System.out.println(getDate(now, min, sec)); public static String getDate(String now, String min, String sec) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss"); try { Date nowDate = sdf.parse(now); long nowMilliSeconds = nowDate.getTime(); nowMilliSeconds += Integer.parseInt(min) * 60 * 1000; nowMilliSeconds ..
chat server & client SERVER public class Server { private static final int PORT = 9001; private static HashSet names = new HashSet(); private static HashSet writers = new HashSet(); public static void main(String[] args) throws Exception { System.out.println("The chat server is running."); ServerSocket listener = new ServerSocket(PORT); try { while (true) { new Handler(listener.accept()).start(); } } finally { liste..
line copy public static void lineCopy() { String rootPath = "."; String outFolder = "/output"; String fileName = "Client.java"; File oFolder = new File(rootPath+outFolder); if (!oFolder.exists()) oFolder.mkdirs(); File inFile = new File(rootPath, fileName); File outFile = new File(rootPath+outFolder, fileName); BufferedReader in = null; BufferedWriter out = null; try { in = new BufferedReader(new FileRead..
byte stream copy public static void byteStreamCopy() { String rootPath = "."; String outFolder = "/output"; String fileName = "o.png"; File oFolder = new File(rootPath+outFolder); if (!oFolder.exists()) oFolder.mkdirs(); File inFile = new File(rootPath, fileName); File outFile = new File(rootPath+outFolder, fileName); FileInputStream in = null; FileOutputStream out = null; try { byte[] buffer = new byte[1024]; i..
정규식 (regular expression) 정규식 표현시 고려사항 1. [ ] 으로 감싸줘야 하는것 * -> [*] + -> [+] $ -> [$] | -> [|] 2. \\ 추가해줘야 되는것 ( -> \\( ) -> \\) { -> \\{ } -> \\} ^ -> \\^ [ -> \\[ ] -> \\] \ -> \\\\ 3. 무관한 특수문자 ! # % & @ ` : ; - . , ~ ‘ “
file copy (java 7 이상) public static void fileCopy() throws IOException { File destDir = new File("./BACKUP"); destDir.mkdirs(); File dirFile = new File("./SERVER"); File[] fileList = dirFile.listFiles(); for (File file : fileList) { if (file.isFile()) { File dest = new File("./BACKUP/"+file.getName()); Files.move(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); } } }
CHERRY MX BOARD 2.0 - 2017.11 기계식 키보드 IT관련 일을 하고는 있으나 멋도 모르는 상태에서 회사에 입사하여 여기저기 프로젝트만 다녔다. 지방으로 해외로... 짐들은 거추장스러운 것이었고 [노트북, 마우스, 탁상달력] 딱 3가지만 책상위에 두고 언제든지 떠날 수 있는 모드를 유지하였다 ㅎㅎ 유랑도 지쳐갈 무렵 솔루션 개발하는 파트로 이동했고, 본사에 책상에 앉아 꼼짝도 하지 않는 일을 하게 되었다 주변 동료들이 개발할려면 [모니터 / 모니터받침 / 노트북 받침 / 기계식 기보드 / 키보드 손목 받침대] 는 기본이라고 했다. 와우~ 대충은 알고 있었지만 기계식 키보드를 한번 사용해보자는 마음으로 회사에서 소모품 구매목록에서 하나 고르게 되었다. 사실 당시에는 구매 목록에 기계식 키보드가 하나뿐이어서 고를 것도 없었다. MX BOARD..
fitbit charge 3 (핏빗 차지 3) - 2018.10 스마트밴드 with 수영트래커 moov now를 계속 써야 하나 고민하던중에 평소에 좋은 감정을 가지고 있던 Fitbit에서 메일이 날아왔다 와우 내가 사려고 했던 기준들이 모두 포함되어있었다. 물론 Fitbit Pay는 한국에서 지원하지 않기에 안될꺼라고 생각은 했다. 이제 드디어 방황을 마치고 정착할 수 있겠다는 생각으로 바로 구매했다. 예전에는 밴드 사이즈가 Small / Large 중 선택이었는데 이번에는 두 가지를 한번에 제공한다고 했다. 역시 핏빗!! 여전히 좋은 인터페이스와 사용성 2년 만에 사용하여 어색하지 않을까 걱정했으나, 앱의 UI와 사용성은 기존과 거의 동일하여 금방 익숙해졌다. (단점인건가...) 밴드 모양이 그렇게 캐주얼 하지 않아 걱정했으나 실제로 착용하니 청바지와도 잘 어울렸..