The Pursuit of Happyness

반응형

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.

반응형

반응형
반응형

반응형

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();

}

}


반응형

반응형
Objective-C 에서 URL Encode 를 하는 경우 아래와 같이 사용합니다.

NSString * encodedString = (NSString *) CFURLCreateStringByAddingPercentEscapes (
NULL,  
(CFStringRef)unencodedString, 
NULL, 
(CFStringRef)@"!*'();:@&=+$,/?%#[]", 
kCFStringEncodingUTF8 );

참고로 Objective-C 에서 제공하는 stringByAddingPercentEscapesUsingEncoding 의 경우 "/", "=" 등이 encode 되지 않기 때문에 위의 방법을 사용하는 것이 안전합니다.
 
관련 정보는 http://choizak.tistory.com/69 에서 퍼왔습니다.

 
반응형

반응형

Create a copy of the table 

CREATE TABLE products_bak LIKE products

Copying the data from the original table to the new table

INSERT INTO products_bak SELECT * FROM products

Copying the data back again

TRUNCATE products;
INSERT INTO products SELECT * FROM products_bak

original link http://www.electrictoolbox.com/copy-table-mysql-create-table-like/


반응형

반응형
Windows 에서 다운로드 받은 파일을 itunes 에 넣으면 한글이 종종 깨지곤 하는데,

대체로 OSX의 기본 언어 설정이 영어로 되어 있는 경우 이런 현상이 발생합니다.

따라서 itunes를 열기전에

"System Preferences" > "Language & Text" 를 열어서

"Language" 탭에 왼편에 있는 언어의 순서를 변경해 주어야 합니다.

한국어 를 끌어서 제일 위로 올려주시고,

itunes를 열고 작업을 하면 한글이 깨지지 않습니다.

작업이 완료된 후에는 언어 설정을 다시 영문으로 돌려놓으면 됩니다.

그럼..
 
반응형

반응형
vi /etc/resolv.conf

nameserver 4.2.2.1
nameserver 4.2.2.2


반응형

반응형
echo "mail content" | mail -s "mail title" tistory@email.com
 
반응형

반응형

crontab -e

m h d M y [command]

#every minute
* * * * * [command]

#every hour (0 minute)
0 * * * * [command]

#@ time (12:00)
0 12 * * * [command]


반응형

반응형
10.04 에서 테스트

ROOT password setup
sudo passwd root

IP Setup
su -
vi /etc/network/interfaces

auto eth0
iface eth- inet static
address 192.168.249.100
netmask 255.255.255.0
network 192.168.249.0
broadcast 192.168.249.255
gateway 192.168.249.2

----
14.4 업데이트
다음 파일을 생성해서 아래 nameserver를 추가한다.
vi /etc/resolvconf/resolv.conf.d/tail

nameserver 8.8.8.8
nameserver 8.8.4.4
----

/etc/init.d/networking restart

PACKAGE update
sudo apt-get update

SSH server
sudo apt-get install ssh
sudo echo "UseDNS no" >> /etc/ssh/sshd_config
----
14.4 업데이트
sudo apt-get install openssh-server
----

JAVA
sudo apt-get install openjdk-6-jdk

Apache
sudo apt-get install apache2

PHP
sudo apt-get install php5

MySQL server
sudo apt-get install mysql-server

APM setup
sudo apt-get install libapache2-mod-php5
sudo apt-get install libapache2-mod-auth-mysql

sudo apt-get install php5-mysql
sudo apt-get install phpmyadmin

TOMCAT
sudo apt-get install tomcat6
sudo apt-get install tomcat6-admin


반응형