2014. 11. 19. 14:56 aws

amazon web server (aws) 한글 깨짐 해결


http://youtu.be/DRElpN72k5I


posted by 욱이다
2014. 11. 18. 18:11 아이폰

ios 오토 포커스 기능 체크 하는 소스 




NSArray *devices = [AVCaptureDevice devices];

    AVCaptureDevice *frontCamera;

    AVCaptureDevice *backCamera;

    

    for (AVCaptureDevice *device in devices) {

        

        DEBUGMSG(@"Device name: %@", [device localizedName]);

     

        if ([device hasMediaType:AVMediaTypeVideo]) {

            

            if ([device position] == AVCaptureDevicePositionBack) {

                DEBUGMSG(@"Device position : back");

                backCamera = device;

            }

            else {

                DEBUGMSG(@"Device position : front");

                frontCamera = device;

            }

        }

    }

    

    if([backCamera isFocusModeSupported:AVCaptureFocusModeAutoFocus])

    {

        

    }else

    {

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil

                                                        message:@"오토 포커스 기능이 ."

                                                       delegate:nil

                                              cancelButtonTitle:@"ok"

                                            otherButtonTitles:nil];

        [alert show];


    }

    

posted by 욱이다
2014. 11. 15. 12:25 aws

awc에서 리눅스서버 아파치 설치 및 시동


아파치 설치 

sudo yum install httpd


아파치 업데이트 

sudo yum update httpd


아파치 가동 

sudo service httpd start


아파치 스톱 

sudo service httpd stop


ec2재가동시 aphache가 자동 재시작 하게 

sudo chkconfig httpd on



'aws' 카테고리의 다른 글

aws linux fpt 설정 filezilla 연동  (0) 2014.11.20
아마존 웹서버 윈도우 한글 깨짐 해결  (0) 2014.11.19
posted by 욱이다
2014. 10. 28. 15:53 html css

생활코딩 출처

http://opentutorials.org/course/1375/6666

이걸로 로그가 이쁘게 그룹으로 찍힌다 


 

<!DOCTYPE html>

<html>

<body>

<a id="anchor" href="#">opentutorials</a>

<ul>

    <li>HTML</li>

    <li>CSS</li>

    <li id="list">JavaScript</li>

</ul>

<input type="button" id="button" value="button" />

<script>

    console.group('before');

    var lis = document.getElementsByTagName('li');

    for(var i = 0; i < lis.length; i++){

        console.log(lis[i]);

    }

    console.groupEnd();

    console.group('after');

    lis[1].parentNode.removeChild(lis[1]);

    for(var i = 0; i < lis.length; i++){

        console.log(lis[i]);

    }

    console.groupEnd();

</script>

</body>

</html>

posted by 욱이다
2014. 10. 28. 11:51 카테고리 없음

function open1(){ 기본 새로운창에서 띄움

window.open('demo.html');

}

function open2(){자기 자신에게서 새창 생성

window.open('demo.html', '_self');

}

function open3(){새로운창에서

window.open('demo.html', '_blank');

}

function open4(){새로운창인데 다시 눌러도 계속 같은창

window.open('demo.html', 'noopen');

}

function open5(){팝업 같은 새로운창으로 나온다 

window.open('demo.html', '_blank', 'width=200, height=200, resizable=no');

}

posted by 욱이다
2014. 10. 27. 17:55 카테고리 없음

리스트로 만든 탭

http://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_menu


레이아웃으로 구성한 뷰

http://www.w3schools.com/html/tryit.asp?filename=tryhtml_layout_divs


심볼

http://www.w3schools.com/html/html_symbols.asp


컬러

http://www.w3schools.com/html/html_colornames.asp

http://www.w3schools.com/html/html_colorvalues.asp

http://www.w3schools.com/html/html_colors.asp

posted by 욱이다
2014. 10. 20. 17:05 JAVA

서버 죽었는지 확인하고 

죽었으면 메시지 보내기 

한시간에 한번 이상 안보내게 했다 

한번 문자 메시지 오면 내가 확인해볼꺼니깐 굳이 계속 적인 문자 메시지는 필요없다 



import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.net.HttpURLConnection;

import java.net.URL;

import java.sql.Date;

import java.text.SimpleDateFormat;

import java.util.Timer;

import java.util.TimerTask;


public class TomcatListenerS {

Long CheckSmsTime;


public static final void main(String args[]) {

System.out.println("TomcatListenerS");

TomcatListenerS lTomCat = new TomcatListenerS();

lTomCat.setTimer();


}

int delay = 60;

public TomcatListenerS()

{

CheckSmsTime = System.currentTimeMillis() + 1000 * 60 * (delay-10);

}

public void setTimer() {

Timer t = new Timer();

t.schedule(new CheckTimer(), 0, 1000 * 60 * 5);

}

public void sendSms()

{

if (CheckSmsTime + 1000 * 60 * delay < System.currentTimeMillis()) {

try {

System.out.println(getDate() + "sendSms Start - 문자 메시지 보내기");

URL obj = new URL(

"메시지 보내는 주소에 전화번호와 메시지 실어 보낸다 우린 뿌리오 쓴다");


HttpURLConnection con = (HttpURLConnection) obj

.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(

con.getInputStream()));

String inputLine;

StringBuffer response = new StringBuffer();


while ((inputLine = in.readLine()) != null) {

response.append(inputLine);

}

in.close();

System.out.println(response.toString());


CheckSmsTime = System.currentTimeMillis();

} catch (Exception e) {

System.out.println("TomcatListenerS " + e.toString());


}

System.out.println(getDate() + "sendSms End ");

}

}

public boolean checkServer() {

try {

System.out.println(getDate() + "checkServer Start - 서버 확인 ");


URL obj = new URL(

"서버 접속하고 디비 접속 가능 한지 테스트 해보는 페이지 접속 한다 /connection_check.jsp");


HttpURLConnection con = (HttpURLConnection) obj.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(

con.getInputStream()));

String inputLine;

StringBuffer response = new StringBuffer();


while ((inputLine = in.readLine()) != null) {

response.append(inputLine);

}

in.close();


System.out.println(response.toString());


if (response.toString().contains("true")) {

System.out.println(getDate() + "checkServer End True ");

return true;

}


} catch (Exception e) {

System.out.println("TomcatListenerS " + e.toString());


}

System.out.println(getDate() + "checkServer End False ");

return false;

}


public void callBat(String CallBat) {

try {


System.out.println(getDate() + "callBat Start - 톰캣 서버 작업 "+CallBat);

//톰캣  shotdown.bat과  startup.bat을 사용 한다 톰캣 설치 할때 bin폴더에 없으면 tomcat zip파일 다운받아 bin폴더를 설치한데다 덮어 써라 

Runtime.getRuntime().exec("cmd /c start "+ CallBat );

} catch (Exception e) {


}

System.out.println(getDate() + "callBat End ");

}


class CheckTimer extends TimerTask {

@Override

public void run() {

// TODO Auto-generated method stub


System.out.println(getDate() + "CheckTimer Start - 서버 살았나 죽었나 확인후 서버 껏다 키고 문자 보내는 실행 파일");

if (checkServer()) {

CheckSmsTime = 0L;

} else {

sendSms();

//일단 셧다운 호출해서 tomcat끄고 

callBat(".\\bin\\shutdown.bat");

try {

Thread.sleep(1000 * 10);

} catch (Exception e) {


}

//스타트 시킨다 

callBat(".\\bin\\startup.bat");

}

System.out.println(getDate() + "CheckTimer End ");

}


}


public String getDate() {

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

Date result = new Date(System.currentTimeMillis());

return "[" + sdf.format(result) + "]";

}

}



'JAVA' 카테고리의 다른 글

jsp  (0) 2015.04.04
이클립스 워크 스페이스 삭제후 에러 발생  (0) 2014.12.03
java 이미지 바이트 조합  (0) 2014.01.09
자바 정렬  (0) 2011.12.01
자바 한글 있나 확인하기 (java string 한글 영어 구분)  (0) 2011.12.01
posted by 욱이다
2014. 10. 8. 15:00 카테고리 없음


hillingdateLauncher-release_1.12.3.apk


posted by 욱이다
2014. 9. 25. 18:13 카테고리 없음

스트링 파싱 방법




@Override

public void getResult(String result, String strUrl) {

// TODO Auto-generated method stub


if (strUrl.contains("init")) {

for (int i = 1; i <= 9; i++) {

String temp = mHtmlParsing.getIndex_Tag("<tr", "</tr>", i, result).trim();

String link = mHtmlParsing.getIndex_Tag("<a href=\"", "\"", 1, temp).trim();

String imagelink = mHtmlParsing.getIndex_Tag("src=\"", "\"", 1, temp).trim();

String str1 = mHtmlParsing.getIndex_Tag("<h4 class=\"media-heading\">", "</h4>", 1, temp).trim();

String str2 = mHtmlParsing.getIndex_Tag("</h4>", "<p>", 1, temp).trim();

String str3 = mHtmlParsing.getIndex_Tag("<p>", "</p>", 1, temp).trim();

String Heart = mHtmlParsing.getIndex_Tag("</i>", "</h4>", 1, temp).trim();


Log.i("AA", "getResult link [http://ecomileshop.com" + link + "]");

Log.i("AA", "getResult imagelink [http://ecomileshop.com" + imagelink + "]");

Log.i("AA", "getResult str1 [" + str1 + "]");

Log.i("AA", "getResult str2 [" + str2 + "]");

Log.i("AA", "getResult str3 [" + str3 + "]");

Log.i("AA", "getResult Heart [" + Heart + "]");

}

}


}




public String getIndex_Tag(String strStartTag, String strEndTag, int index, String value) {


if (value == null)

return "";

int startindex = 0;

int endindex = value.length();

String strTemp = value;

for (int i = 0; i < index; i++) {

startindex = strTemp.indexOf(strStartTag);

strTemp = strTemp.substring(startindex+strStartTag.length(), endindex);

endindex = strTemp.length();

}

strTemp = strTemp.substring(0, endindex);

endindex = strTemp.indexOf(strEndTag);

// Log.i("AA",startindex +" "+endindex );

strTemp = strTemp.substring(0, endindex);

// Log.i("AA",strTemp);

return strTemp;

}

posted by 욱이다
2014. 9. 25. 18:10 카테고리 없음

HASH값 바꾸기 


어쩌다 보니 HASH값 바꿀 상황이 생겨서 

이미지는 바이트 하나 더 늘려서 거기다가 랜덤값 넣고

XML은 주석 추가

JAVA 소스도 주석 추가 

하는 방법으로 해시코드값 변경했다 


JAVA, XML주석 추가로 해쉬코드 변경은 컴파일 하면 의미없다 ..




다른 좋은 방법이있다면 알려주세요 ~~~~ 



import java.io.DataOutputStream;

import java.io.File;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.security.MessageDigest;

import java.util.Random;


public class HashCode {

public int byteplusvalue = 8;

public void print(File f, String type) throws Exception {

MessageDigest md = MessageDigest.getInstance(type);

// MessageDigest md = MessageDigest.getInstance("MD5");

FileInputStream fis = new FileInputStream(f);


byte[] dataBytes = new byte[1024 * 10];


int nread = 0;

while ((nread = fis.read(dataBytes)) != -1) {

md.update(dataBytes, 0, nread);

};

byte[] mdbytes = md.digest();


//convert the byte to hex format method 1

StringBuffer sb = new StringBuffer();

for (int i = 0; i < mdbytes.length; i++) {

sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16).substring(1));

}


System.out.println(f.getName() + "\t" + type + "\t" + "Digest(in hex format):: " + sb.toString());


// //convert the byte to hex format method 2

// StringBuffer hexString = new StringBuffer();

// for (int i = 0; i < mdbytes.length; i++) {

// String hex = Integer.toHexString(0xff & mdbytes[i]);

// if (hex.length() == 1)

// hexString.append('0');

// hexString.append(hex);

// }

// System.out.println(f.getName() + "Digest(in hex format):: " + hexString.toString());

}


String rootDir;


/**

* @param args

* 0 루트 경로

* 1 랜덤값

*/

public HashCode(String[] args) {

rootDir = args[0];

startSearch(new File(rootDir));

}


public void startSearch(File f) {


File[] listOfFiles = f.listFiles();

for (int i = 0; i < listOfFiles.length; i++) {

if (listOfFiles[i].isFile()) {

ChangeFile(listOfFiles[i]);

}

else if (listOfFiles[i].isDirectory()) {

startSearch(listOfFiles[i]);

}

}

}


public void ChangeFile(File f) {

String name = f.getName();

System.out.println(name);

int index = name.lastIndexOf(".");

if (index == 0 || index == -1) {

System.out.println(name + " error " + index);

return;

}

String fileType = name.substring(index + 1, name.length());


if (!(fileType.equals("xml") || fileType.equals("png") || fileType.equals("java"))) {

System.out.println(name + " " + fileType + " error");

return;

}


FileInputStream fin = null;

byte fileContent[] = null;

try {


print(f, "MD5");

print(f, "SHA-1");

fin = new FileInputStream(f);


if (fileType.equals("xml"))

fileContent = new byte[(int) f.length()];

else if (fileType.equals("png"))

fileContent = new byte[(int) f.length() + byteplusvalue];

else if (fileType.equals("java"))

fileContent = new byte[(int) f.length() ];

fin.read(fileContent);

}

catch (Exception e) {

e.printStackTrace();

}

finally {

try {

if (fin != null)

fin.close();

}

catch (Exception e) {


}

}


if (fileContent == null)

return;


DataOutputStream dos = null;

try {


dos = new DataOutputStream(new FileOutputStream(f));

if (fileType.equals("xml") ) {


Random r = new Random();

String str = new String(fileContent,"8859_1");


str += "\n <!--" + r.nextInt() + "-->";

dos.writeBytes(str);

}else if( fileType.equals("java"))

{

Random r = new Random();

String str = new String(fileContent,"8859_1");


str += "\n //<!--" + r.nextInt() + "-->";

dos.writeBytes(str);

}

else if (fileType.equals("png"))

{

Random r = new Random();

int plusvalue = r.nextInt();

fileContent[fileContent.length-1]=(byte)plusvalue;

dos.write(fileContent);

}


}

catch (Exception e) {

e.printStackTrace(System.err);

}

finally {

try {

if (dos != null)

dos.close();

}

catch (Exception e) {


}

}

try {

print(f, "MD5");

print(f, "SHA-1");

}

catch (Exception e) {


}


}


public static void main(String[] args) throws Exception {

HashCode hash = new HashCode(args);


}


}



posted by 욱이다