본문 바로가기

Programming30

Stopping thread in Java 졸작을 하다가 네트워크 프로그래밍에서 쓰레드를 닫으려고 쓰레드의 stop()을 호출했는데, 이클립스에서 deprecated라는 경고가 떴다. 왜그런가 해서 뒤져봤더니 흠냐 -_- Java Thread Primitive Deprecation Why is Thread.stop deprecated? Because it is inherently unsafe. Stopping a thread causes it to unlock all the monitors that it has locked. (The monitors are unlocked as the ThreadDeath exception propagates up the stack.) If any of the objects previously protected .. 2008. 2. 4.
Android에서의 TCP/IP 통신 안드로이드 에뮬레이터와 데스크탑 서버간 TCP/IP통신을 하는 간단한 코드이다. 보통 이런 테스트는 loopback을 이용하면 되지 않을까? 라고 착각하는 사람들이 굉장히 많을 것이다. 그래서 서버의 주소를 getLocalHost()를 통해 가져오게 되면 완전 삽질이다. 왜냐? 안드로이드 에뮬레이터의 localhost는 안드로이드 에뮬레이터의 네트웍이지 데스크탑의 네트웍이 아니기 때문이다. 따라서 아래의 소스코드는 일단 네트웍이 돌아가는 컴퓨터에서만 작동이 가능하다. - Android Client의 메인부분 package android.SocketTest; import android.app.Activity; import android.os.Bundle; public class SocketTest exte.. 2008. 1. 20.
[펌]C에서 쓰이는 문자열 관련 함수 Written by LHC ( s1662543@kiscos.sarang.net) - 스트링 관련 함수 v1.2- 1. 종류 int strcasecmp(const char *s1, const char *s2); char *strcat(char *dest, const char *src); char *strchr(const char *s, int c); int strcmp(const char *s1, const char *s2); int strcoll(const char *s1, const char *s2); char *strcpy(char *dest, const char *src); size_t strcspn(const char *s, const char *reject); char *strdup(const .. 2008. 1. 14.
Bubble Sort(거품 정렬) #include using namespace std; template void BubbleSort(T arr[], int n); int main() { int arr[] = {5, 4, -1, 0, 2, 11, 1}; BubbleSort(arr, 7); for (int i = 0; i < 7; i++) cout 2007. 11. 9.