SMALL

프로그램 추가/제거에서 삭제후에 재설치후에도 plugin에러나 동일한 문제들이 발생할경우

완전삭제하고 설치해줘야할 경우가 발생한다.


방법은 비교적 간단하다


C:\User\사용자계정\ 경로에있는 .AndroidStuido해당버젼 파일을 지워주면된다.



나같은경우는 .AndroidStuio3.1 인데 이걸 지우고 재설치하면 문제없이 완전설치가 이뤄진다.



출처: http://831218.com/74 [호구인생]

LIST
블로그 이미지

SeoHW

,
SMALL
Linux에서 NTP(Network Time Protocol) 서비스가 실행 되면서 시스템 시간을 주기적으로 동기화 합니다.
NTP(ntpd 데몬)가 실행중이더라도 외부의 TimeServer에 접속이 되질 않는다면, 어느정도 시기가 지나면 서버의 시간이 느려지는 증상이 있습니다.

HDFS 컨테이너에서 요청 허용 시간의 범위를 체크하는데, 시간이 지나면서 각 서버의 시간차가 커지다 보면 작업을 실패합니다.


관련 오류
2016-07-22 17:04:44,437 ERROR [Thread-712]: SessionState (SessionState.java:printError(833)) - Status: Failed
2016-07-22 17:04:44,438 ERROR [Thread-712]: SessionState (SessionState.java:printError(833)) - Vertex failed, vertexName=Map 6, vertexId=vertex_1468916542684_0021_1_00, diagnostics=[Task failed, taskId=task_1468916542684_0021_1_00_000007, diagnostics=[TaskAttempt 0 failed, info=[Container launch failed for container_e54_1468916542684_0021_02_000002 : org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.
This token is expired. current time is 1469175137466 found 1469175128093
Note: System times on machines may be out of sync. Check system time and time zones.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.instantiateException(SerializedExceptionPBImpl.java:168)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.deSerialize(SerializedExceptionPBImpl.java:106)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$Container.launch(ContainerLauncherImpl.java:168)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$EventProcessor.run(ContainerLauncherImpl.java:380)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
], TaskAttempt 1 failed, info=[Container launch failed for container_e54_1468916542684_0021_02_000015 : org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.
This token is expired. current time is 1469175138445 found 1469175128918
Note: System times on machines may be out of sync. Check system time and time zones.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.instantiateException(SerializedExceptionPBImpl.java:168)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.deSerialize(SerializedExceptionPBImpl.java:106)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$Container.launch(ContainerLauncherImpl.java:168)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$EventProcessor.run(ContainerLauncherImpl.java:380)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
], TaskAttempt 2 failed, info=[Container launch failed for container_e54_1468916542684_0021_02_000017 : org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.
This token is expired. current time is 1469175139258 found 1469175129970
Note: System times on machines may be out of sync. Check system time and time zones.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.instantiateException(SerializedExceptionPBImpl.java:168)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.deSerialize(SerializedExceptionPBImpl.java:106)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$Container.launch(ContainerLauncherImpl.java:168)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$EventProcessor.run(ContainerLauncherImpl.java:380)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
], TaskAttempt 3 failed, info=[Container launch failed for container_e54_1468916542684_0021_02_000020 : org.apache.hadoop.yarn.exceptions.YarnException: Unauthorized request to start container.
This token is expired. current time is 1469175140315 found 1469175131018
Note: System times on machines may be out of sync. Check system time and time zones.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.instantiateException(SerializedExceptionPBImpl.java:168)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.deSerialize(SerializedExceptionPBImpl.java:106)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$Container.launch(ContainerLauncherImpl.java:168)
at org.apache.tez.dag.app.launcher.ContainerLauncherImpl$EventProcessor.run(ContainerLauncherImpl.java:380)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
]], Vertex failed as one or more tasks failed. failedTasks:1, Vertex vertex_1468916542684_0021_1_00 [Map 6] killed/failed due to:null]
2016-07-22 17:04:44,438 ERROR [Thread-712]: SessionState (SessionState.java:printError(833)) - Vertex killed, vertexName=Reducer 3, vertexId=vertex_1468916542684_0021_1_04, diagnostics=[Vertex received Kill while in RUNNING state., Vertex killed as other vertex failed. failedTasks:0, Vertex vertex_1468916542684_0021_1_04 [Reducer 3] killed/failed due to:null]
2016-07-22 17:04:44,439 ERROR [Thread-712]: SessionState (SessionState.java:printError(833)) - DAG failed due to vertex failure. failedVertices:1 killedVertices:5


각 서버의 시간 정보를 확인후에 맞지 않을 경우 변경
 

# 시스템 현재 시간으로 수동 설정

> System Time 확인
[root@hdfs ~]# date
2016. 07. 25. (월) 21:57:52 KST
 
> 시분초 설정 (24시간제로 입력)
[root@hdfs ~]# date -s 23:43:21
 
> 연월일 시분초 바꾸기
[root@hdfs ~]# date -s '2016-7-26 11:21:21'


네트워크 내부에 NTP Server가 셋팅 되어 있다면, 그리고 HDFS 클러스터의 각 서버가 접근 가능하다면,
아래의 TimeServer(time.bora.net) 설정과 같이 내부 NTP 서버로 등록 가능.

# NTP 정보 확인

> ntpd 서비스 구동 여부 확인
[root@hdfs ~]# service ntpd status
ntpd가 정지되었습니다.
 
> ntpstat 명령을 사용하여 NTP 서비스의 상태를 확인
[root@hdfs ~]# ntpstat
synchronised to NTP server (211.233.40.78) at stratum 3
   time correct to within 163 ms
   polling server every 1024 s
 
> 작동 되지 않는 상태
[root@www ~]# ntpstat
Unable to talk to NTP daemon. Is it running?
 
> Time Server의 시간 조회
[root@hdfs ~]# rdate -p time.bora.net
rdate: [time.bora.net]  Mon Jul 25 21:10:57 2016
 

# 시스템 시간 동기화

> Time Server의 시간 동기화 설정(일시적)
[root@hdfs ~]# rdate -s time.bora.net
[root@hdfs ~]# date
2016. 07. 25. (월) 21:44:19 KST
 
> Time Server 시간 주기적 동기화 ( 매일 24시에 동기화 )
[root@hdfs ~]# crontab -e
0 0 * * * rdate -s time.bora.net


LIST

'빅데이터(bigData)' 카테고리의 다른 글

HDFS - Python Encoding 오류 처리  (0) 2018.09.20
블로그 이미지

SeoHW

,
SMALL

> 에러 내용


  File "/usr/lib/python2.6/site-packages/resource_management/core/logger.py", line 101, in filter_text

    text = text.replace(unprotected_string, protected_string)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xea in position 117: ordinal not in range(128)


> Python Default Encoding 수정

[root@peaceful ~]# vi /usr/lib/python2.6/site-packages/site.py
def __boot():
    import sys, imp, os, os.path
    sys.setdefaultencoding("utf-8")
    PYTHONPATH = os.environ.get('PYTHONPATH')
    if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
        PYTHONPATH = []
    else:
        PYTHONPATH = PYTHONPATH.split(os.pathsep)


LIST

'빅데이터(bigData)' 카테고리의 다른 글

HDFS - Hive 실행시 System Time 오류  (0) 2018.09.20
블로그 이미지

SeoHW

,
SMALL

String형 배열 seoul의 element중 Kim의 위치 x를 찾아, 김서방은 x에 있다는 String을 반환하는 함수, solution을 완성하세요. seoul에 Kim은 오직 한 번만 나타나며 잘못된 값이 입력되는 경우는 없습니다.

제한 사항
  • seoul은 길이 1 이상, 1000 이하인 배열입니다.
  • seoul의 원소는 길이 1 이상, 20 이하인 문자열입니다.
  • Kim은 반드시 seoul 안에 포함되어 있습니다.
입출력 예
seoulreturn
[JaneKim]김서방은 1에 있다



풀이다


import java.util.*;

class Solution {

  public String solution(String[] seoul) {

      String answer = "";

        int a = Arrays.asList(seoul).indexOf("Kim");


   

    return "김서방은 "+ a + "에 있다";

  }

}

배열에서 "Kim" 을 찾아서 인덱스 값을 가져오는것이다 


https://programmers.co.kr/ 에서 문제를 풀었다



LIST
블로그 이미지

SeoHW

,
SMALL

※ JAVA 배열 내에 중복값 제거하기/출력하기


import java.util.TreeSet;

import java.util.Iterator;


TreeSet 중복값을 제거해주고 정렬해줍니다

int [] arr = {1,1,1,2,3,4,5,6};

TreeSet t = new TreeSet();

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

            {

                t.add(arr[i]);

            }

            Iterator it = t.iterator();

            int x = 0;

            while(it.hasNext())

            {

                System.out.println(it.next());


            }

결과값은 1,2,3,4,5,6 으로 나오게 됩니다


LIST
블로그 이미지

SeoHW

,
SMALL
String[] test = {"1","2","3","1","2"};
System.out.println("before length=" + test.length);
 
test = new HashSet<String>
(Arrays.asList(test)).toArray(new String[0]);
System.out.println("after length=" + test.length);
 
for(String s:test){
    System.out.println(s);            
}
 
/* result 
before length=5
after length=3
1
2
3

*/


LIST
블로그 이미지

SeoHW

,
SMALL

Oracle Replace 함수 생성(결과값 변환 출력)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
CREATE OR REPLACE FUNCTION FN_REPLACE_CUST(
    IN_VALUES     IN      VARCHAR2,
    IN_TYPE         IN INT,
    IN_DELIMETER IN    VARCHAR2
)
RETURN VARCHAR2
    
/**************************************************************************
  # FN : FN_REPLACE_CUST
  # 옵션
  IN_VALUES     : 분리할 문자열 입력
  IN_TYPE        : 출력값 구분자(코드, 코드명)
  IN_DELIMITER : 분리할 구분자
**************************************************************************/
IS
    RETURN_VAL    VARCHAR2(2000); -- 결과 리턴 변수
    TMP_RET_VALUE VARCHAR2(2000);  -- 결과 임시 저장 변수
    
    SET_CODE  VARCHAR2(2000);        -- SELECT 결과 코드 저장 
    SET_CODE_NAME VARCHAR2(2000); -- SELECT 결과 코드명 저장
     
BEGIN
    
   -- IN_VALUES의 값이 없으면 빈 값을 리턴하고 종료
    IF LENGTH(LTRIM(RTRIM(IN_VALUES))) = 0 THEN
        RETURN '';
    END IF;
    
   FOR ForResult IN
    (
     WITH T AS
      (
        SELECT IN_VALUES AS SET_VALUES FROM DUAL -- 입력받은 문자열 임시 테이블 처리
       )
       /* 문자열을 분리하여 세로로 추출 */
       SELECT TRIM(REGEXP_SUBSTR(SET_VALUES, '[^'||IN_DELIMETER||']+', 1, LEVEL)) AS SET_VALUES
         FROM T
         CONNECT BY INSTR(SET_VALUES, ''||IN_DELIMETER||'', 1, LEVEL - 1) > 0
    )
    LOOP
            /* COMMON_CODE 의 코드 값과 비교후 결과값 대입 */
            SELECT CODE_M, CODE_M_NAME
                INTO SET_CODE, SET_CODE_NAME
                FROM COMMON_CODE
                WHERE CODE_L = '005'
                AND CODE_M = ForResult.SET_VALUES;
                  
            /* # IN_TYPE 구분값에 따라 코드번호, 코드명 추출 */
            IF IN_TYPE = 1 THEN
                TMP_RET_VALUE := SET_CODE;
            ELSIF IN_TYPE = 2 THEN
                TMP_RET_VALUE := SET_CODE_NAME;
            END IF;
                  
            /* # 결과값 저장 : 결과값 가로 배치 */
            IF RETURN_VAL IS NULL THEN
                    RETURN_VAL := TMP_RET_VALUE;
               ELSE
                    RETURN_VAL := RETURN_VAL||','||TMP_RET_VALUE;
            END IF;
    END LOOP;
    
    RETURN RETURN_VAL; -- 결과 리턴
    
    EXCEPTION
         WHEN OTHERS THEN
--              RETURN SQLERRM;
            RETURN IN_VALUES; -- 에러 또는 조인 결과값 없을시 기본 입력받은 값 리턴
    
END FN_REPLACE_CUST;
/



> 생성후 조회

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- # IN_TYPE : 1
SELECT ORG_TYPE, FN_REPLACE_CUST(ORG_TYPE, 1, '|') AS REPLACE_VALUES
    FROM USER_INFO
;       
 
ORG_TYPE         REPLACE_VALUES
--------------------------------------------
101|102|103|104    101,102,103,104
 
 
-- # IN_TYPE : 2
SELECT ORG_TYPE, FN_REPLACE_CUST(ORG_TYPE, 2, '|') AS REPLACE_VALUES
    FROM USER_INFO
;    
 
ORG_TYPE         REPLACE_VALUES
--------------------------------------------
101|102|103|104    가수,작곡가,작사가,기타


LIST
블로그 이미지

SeoHW

,
SMALL

얼랏창 알림에 줄바꿈이 필요할 때가 있습니다

그럴땐 아래와 같이 사용하시면 됩니다

exam) alert("안녕하세요 \n 블로그입니다");

결과 : 


안녕하세요

블로그입니다 


이런식으로 나옵니다

문자열\n문자열\n

"\n" 을 여러 개 넣으면 여러줄로 줄바꿈이 됩니다.

LIST
블로그 이미지

SeoHW

,
SMALL

안드로이드 프로그램을 작성한 후 테스트를 위해서는 

실제 장비에 프로그램을 포팅하여 테스트하는 것이 가장 좋지만,

수많은 사이즈와 성능의 장비들을 모두 준비하여 테스트 하는 것은 

현실적으로도 힘들고, 번거롭기도 하다.

그래서, 안드로이드 스튜디오에서는 AVD(Android Virtual Device)라는 가상의 애뮬레이터를 제공하고,

우리는 이 애뮬레이터를 통해서 다양한 디바이스에서의 테스트를 해볼 수 있다.

(물론, 당연히 실제 디바이스와 100% 동일하지는 않지만..)


여기서는 AVD 설정과 실행방법을 소개한다.

(참고로, 나는 여기서 AVD 설정 실패...내 PC에서는 돌지 않는다. ㅠㅠㅠㅠㅠㅠㅠ

하지만, 이건 나의 PC사양의 문제이므로 이 글을 보는 다른 이들은 모두 성공하실 것임..ㅠㅠ)



AVD를 설정하고, 실행시키기 위해


1. Tools > Android > AVD Manager를 선택한다.


2. 'Create Virtual Device' 버튼을 클릭한다.


3. 여러가지 Device 중 원하는 하드웨어 스펙을 선택한다.

Category를 선택하고 나면 해당 카테고리에서 기본으로 제공하는 Device 정보중 하나를 선택해도 되고, 하단의 'New Hardware Profile'을 선택하여 상세한 하드웨어 정보를 설정할 수도 있다.

여기서는 Phone category를 선택하고, 그중 해상도 480*800의 Nexus S를 선택하였다.


4. 하드웨어에 들어갈 System Image를 선택한다.

Recommended 탭에서 추천한 Marshmallow x86이미지를 선택하려고 하니, 오른쪽에 뜨는 빨간 메세지 ㅠㅠ

(아마 나 빼고 다른 분들은 안날거에요...ㅠㅠ)

일단 진행이 되니 패스하고, 이 빨간 메세지에 대해서는 다음 포스팅에서 ...


5. Virtual Device의 상세 스펙을 설정한다.

AVD Name은 여러개의 Virtual Device를 구분하기 위한 이름이므로 자유롭게 기술한다.

'Show Advanced Settings'를 클릭하여 기타 상세사항들을 자유롭게 조정한다.

여기서는 일단 변경없이 그대로 생성한다.

이 설정들은 나중에도 변경할 수 있다.

Finish 버튼을 클릭한다.


6. Android Virtual Device Manager에 새로운 Device가 생성된 것을 볼 수 있다.


7. AVD Manager의 화살표 버튼을 클릭하거나, 

화면 상단의 화살표 버튼을 클릭하면 생성된 Virtual Device가 실행된다.


요렇게 실행되면 되는데,

사실 아래 캡쳐는 제대로 실행이 안된 상태이다.

원인은 아까 중간에 스킵했던 빨간 오류 메세지..

이 내용에 대해서는 다음 포스팅에...하휴...


여기 까지 하면 애뮬레이터 설치 및 실행 완료!



출처: http://hianna.tistory.com/144 [어제 오늘 내일]

LIST
블로그 이미지

SeoHW

,
SMALL

SimpleMagic  example 입니다

SimpleMagic - Simple Magic Content and Mime Type Detection Java Package

Here's a quick "magic" number package that I whipped up which allows content-type (mime-type) determination from files and byte arrays. It makes use of the magic(5) Unix content-type files to implement the same functionality as the Unix file(1) command in Java which detects the contents of a file. It uses either internal config files or can read /etc/magic/usr/share/file/magic, or other magic(5) files and determine file content from FileInputStream, or byte[].

Simple Code Sample

The following is a quick code sample to help you get started using the library for mime-type detection.

// create a magic utility using the internal magic file
ContentInfoUtil util = new ContentInfoUtil();
// if you want to use a different config file(s), you can load them by hand:
// ContentInfoUtil util = new ContentInfoUtil("/etc/magic");
...
ContentInfo info = util.findMatch("/tmp/upload.tmp");
// or
ContentInfo info = util.findMatch(inputStream);
// or
ContentInfo info = util.findMatch(contentByteArray);
// display content type information
if (info == null) {
   System.out.println("Unknown content-type");
} else {
   // other information in ContentInfo type
   System.out.println("Content-type is: " + info.getName());
}

Free Spam Protection   Eggnog Recipe   Android ORM   Simple Java Magic   JMX using HTTP   OAuth 2.0 Simple Example   Great Eggnog Recipe   Christopher Randolph  


다운

링크 : https://github.com/j256/simplemagic

LIST
블로그 이미지

SeoHW

,