[Linux][CentOS] 유용한 커맨드들..
@ 부팅할때 생기는 로그 확인하기
> dmesg
@ 시스템 종료하기
> init 0
> shutdown -h -time 0
> shutdown -r -time 0 (reboot)
@ 환경설정하기
> setup
@ 네트워크 관리
> ifdown eth0
> service network restart
@ DNS 세팅
> vi /etc/resolv.conf
nameserver 4.2.2.1
nameserver 4.2.2.2
@ 부팅할때 실행할 서비스 관리
> ntsysv
[XCode] Cocos2D 를 사용하자!
먼저 아래 URL 에서 다운로드가 가능한데, 현재 1.0.1 버전이 다운로드 가능하며,
Cocos3D까지 배포가 되고 있습니다.
http://www.cocos2d-iphone.org/download
Document 탭에 들어가보면 설치 방법이 나와 있습니다.
http://www.cocos2d-iphone.org/wiki/doku.php/
> Programming Guide > Lesson 1: Install + Start empty project
콘솔에서 설치 스크립트를 실행하면 설치가 되며, XCode 에 template 으로 추가되어 개발에 이용이 가능합니다.
참고로 iPhone 과 android 를 동시해 지원하는 cocos2d-x 버전도 있습니다.
http://www.cocos2d-x.org/
[ECLIPSE] eclipse 개발 환경 설정 (ant, jsch 포함)
@ 준비물
아래 링크에서 적당한 버전의 Java SDK 를 다운로드 합니다.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
아래 링크에서 적당한 버전의 eclipse 를 다운로드 합니다.
http://www.eclipse.org/downloads/
아래 링크에서ant 를 다운로드 합니다.
http://ant.apache.org/bindownload.cgi
아래 링크에서 jsch를 다운로드 합니다.
@ 설치
Java는 default 폴더에 설치하는 것을 권장합니다.
eclipse 는 My Document 에 압축을 풀면 됩니다.
ant 는 eclipse 설치 경로 아래 있는 plugins 폴더에 압축을 풀어줍니다.
jsch 는 ant 폴더 아래 있는 lib 폴더에 jar 파일만 추가합니다.
eclipse 를 실행합니다.
Window > Preferences > Ant > Runtime
Classpath 탭에 있는 Ant Home 버튼을 눌러서 압축을 푼 ant 경로를 지정합니다.
[XCode] Unistall Xcode on OS X (XCode 제거하기)
If you ever need to completely remove Xcode due to application issues or future upgrades, you can run a single command from Terminal to remove it.
sudo /Developer/Library/uninstall-devtools --mode=all
Of course, /Developer
is dependant on where you installed Xcode to.
[XCode] 단축키 PDF 버전
[JAVA][CLASS] ZipUtil.java - Compress Data and Decompress Data
import java.io.ByteArrayOutputStream;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
public class ZipUtil {
public static final int BUF_SIZE = 1024;
public static ZipUtil instance = null;
private ZipUtil() {
}
public static ZipUtil getInstance() {
if (instance == null)
instance = new ZipUtil();
return instance;
}
public byte[] compress(byte[] input) {
if (input == null)
return null;
byte[] buf = new byte[BUF_SIZE];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Deflater def = new Deflater();
def.setInput(input);
def.finish();
try {
while (!def.finished()) {
int count = def.deflate(buf);
baos.write(buf, 0, count);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
def.end();
}
return baos.toByteArray();
}
public byte[] decompress(byte[] input) {
if (input == null)
return null;
byte[] buf = new byte[BUF_SIZE];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Inflater inf = new Inflater();
inf.setInput(input);
try {
while (true) {
int count = inf.inflate(buf);
if (count > 0) {
baos.write(buf, 0, count);
} else if (count == 0 && inf.finished()) {
break;
} else {
throw new RuntimeException();
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
inf.end();
}
return baos.toByteArray();
}
}
[OBJC] URL Encode
NSString * encodedString = (NSString *) CFURLCreateStringByAddingPercentEscapes (
NULL,
(CFStringRef)unencodedString,
NULL,
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
kCFStringEncodingUTF8 );
참고로 Objective-C 에서 제공하는 stringByAddingPercentEscapesUsingEncoding 의 경우 "/", "=" 등이 encode 되지 않기 때문에 위의 방법을 사용하는 것이 안전합니다.
관련 정보는 http://choizak.tistory.com/69 에서 퍼왔습니다.
[MySQL] Copy a table with CREATE TABLE LIKE
Create a copy of the table
Copying the data from the original table to the new table
Copying the data back again
original link http://www.electrictoolbox.com/copy-table-mysql-create-table-like/
[Linux][CentOS] DNS setup
nameserver 4.2.2.1
nameserver 4.2.2.2