Syncope.T-*
[SWT] Display Async Method.
BackEnd/Java 2016. 12. 7. 03:40

123456789101112 private static void doUpdate(final Display display, final Label target, final String value) { display.asyncExec(new Runnable() { @Override public void run() { if (!target.isDisposed()) { target.setText(value); target.getParent().layout(); } } }); }Colored by Color Scriptercs

Java로 바로가기(lnk파일) 만들기.
BackEnd/Java 2016. 5. 30. 19:15

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253private void makelnk(String targetPath, String name) throws IOException, NoSuchMethodException, ScriptException { File lnkFolder = new File(System.getProperty("user.dir") + "\\lnk"); if(!(lnkFolder.exists())) lnkFolder.mkdirs(); File scriptFile = new File("whatever.js"); scriptFile.createNewFile(); t..

Subset Problem 2
BackEnd/Java 2016. 5. 11. 09:33

Subset sum Problem이란, A라는 배열내의 원소들의 합이 K에 가까운 수를 나열하는 것인데. 가령 예를 들자면A = { 1, 2, 3, 4, 5, 6, 7, 8 } 이 있고 K가 9 일때[1,8] , [2, 7], [3, 6], [4, 5] 로 나열되는게 가장 이상적이다.그렇다고해서 가장 큰수를 가지고 노는것도 이상하다.자료를 찾아봤는데 위키디피아에는 이렇게 정의되어 있다.출처 https://en.wikipedia.org/wiki/Subset_sum_problem에 의하면.An approximate version of the subset sum would be: 변수는 N x1, x2, ..., xN 그리고 합 s, 결과 output이 주어져야 한다.yes, 부분 집합들의 합들이 s에 가까워..

Socket 통신에서 쓰이는 바이트 쪼개기
BackEnd/Java 2016. 5. 11. 09:30

Byte를 1024단위로 보내주는게 어느 하나의 규약이라고들 하시길래.. 한 번 만들어 봤습니다.(사실 규약이겠어요?... 이게 안전하니까!) 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061import java.io.*; public class server { final static int maxBufferSize = 1024; public static void main(String[] args) { try { File file = new File("C:\\sendData\\netty-all-4.1.0.CR3.jar"); DataInputStream ..

큰 수 계산 (BigNumber)
BackEnd/Java 2016. 5. 11. 09:27

큰 수 계산경우 특히, 계산기 소스나 RSA암호화 모듈러 연산같은 경우 큰수가 필요한 때가 있는데잠깐 값만 얻을 경우라면 아래와 같이 계산하는 편이 좋다. 123456789101112131415161718import java.math.BigInteger; public class BigInt { public static void main(String[] args) { BigInteger a = new BigInteger("1"); BigInteger b = new BigInteger("1"); int i = 0; for (i = 0; i

get Jar file's path
BackEnd/Java 2016. 5. 11. 09:25

123CodeSource codeSource = YourMainClass.class.getProtectionDomain().getCodeSource();File jarFile = new File(codeSource.getLocation().toURI().getPath());String jarDir = jarFile.getParentFile().getPath();Colored by Color Scriptercs

profile on loading

Loading...