2017년 10월 29일 일요일

libgdx 최초 실행시 다음 과 같은 에러 발생시



libgdx  최초 실행시 다음 과 같은 에러 발생시

Exception in thread "LWJGL Application"
com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: badlogic.jpg


Run -> Edit Configurations
On the left hand side choose: Application -> DesktopLauncher

In the "Configuration"-Tab, undert "Working directory" choose your android/assets path

working directory 의 경로를 asset 폴더로 지정


자바 코틀린 변환

IntelliJ + Android studio

 일단 kotlin 을 사용할 수 있는 project 가 필요하다.(쿠...sal: [컴][자바][안드로이드] 안드로이드에서 코틀린 사용하기)

그 다음 여기에서 .java file 을 하나 열어놓자. 그리고 java code 를 .java 로 먼저 붙여넣기 하고 난 후 다시 이 녀석을 copy 해서 kotlin file(.kt ) 로 붙여넣기를 하자.
그러면 IDE 에서 이 code 를 kotlin 으로 변환할 것인가를 물어본다.

참고로 이야기 하자면 외부에서 단순히 복사한 java code 는 java 로 인식하지 못하는 듯 하다. 그래서 kotlin 으로 변환할까요? 등의 질문을 하지 않는다.

2017년 10월 28일 토요일

우분투 16.04 자바 버젼 변경 9 --> 8로 변경


설치된 자바 확인
update-java-alternatives --list

:/usr/lib/jvm$ update-java-alternatives --list
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64
java-1.9.0-openjdk-amd64       1091       /usr/lib/jvm/java-1.9.0-openjdk-amd64


자바 8로 선택
java-1.8.0-openjdk-amd64



아래 명령 실행 하지만 에러 그러면 그다음 아래 명령 실행
뭔가 버그에 의한 에러 같다.
sudo update-java-alternatives -s java-1.8.0-openjdk-amd64


update-alternatives: 오류: no alternatives for mozilla-javaplugin.so



위와 같은 에러 발생시 아래 멸령 실행
sudo update-java-alternatives --jre-headless --jre --set java-1.8.0-openjdk-amd64

2017년 10월 25일 수요일

부동산 계산기 앱소개




부동산 계산기 앱소개

https://play.google.com/store/apps/details?id=buster.com.landprice

평 <--> ㎡

- 임대 공인중개사 수수료 계산
- 매매 공인중개사 수수료 계산 

- 눈에 잘들어 오는 디자인 
- 쉬운 인터페이스

- 계산된 수수료에 대해 문자메세지 , kakao talk 메세지 공유 기능 
이용해 주셔서 감사합니다.




정말 편리 합니다.
광고도 없어 쾌적 하고요
감사합니다.

다시 아래 링크
https://play.google.com/store/apps/details?id=buster.com.landprice

2017년 10월 24일 화요일

인크 스케이프 익스퍼트 명령

인크 스케이프 익스퍼트 명령

터미널 창에서 명령줄로  현재 편집중인 파일 익스퍼트 하기


inkscape 512x512_file_name.svg --export-png=test.png -w512 -h512

inkscape 512x512_file_name2.svg --export-png=test.png -w512 -h512


현재 디렉토리에 파일이 떨어지므로
바로 확인 가능하다.

자가 확인용


AVD 에뮬레이터에 구글 플레이 설치 하기





지니모션(genymotion) 구글 플레이 설치 및 다운로드하여 실행하기

AVD 에뮬레이터에 구글 플레이 설치 하기

Download this files

아래 파일은 인터넷 검색해서 받으세요
Genymotion_ARM_Translation_v1.1.zip



http://opengapps.org/

pico 다운로드

open_gapps-x86-4.4-pico-20171024.zip




받은 파일 두개 를 

2017년 10월 14일 토요일

java 숫자를 한글로 변환 해주는 메소드


java 숫자를 한글로 변환 해주는 메소드

그런데 이것은 약간 문제가 있네요

몇백억 넘어가면 억만 으로 표시하는데 이것을 수정해야 할듯 합니다.


public String convertHangul(String money){
String[] han1 = {"","일","이","삼","사","오","육","칠","팔","구"};
String[] han2 = {"","십","백","천"};
String[] han3 = {"","만","억","조","경"};

StringBuffer result = new StringBuffer();
int len = money.length();
for(int i=len-1; i>=0; i--){
result.append(han1[Integer.parseInt(money.substring(len-i-1, len-i))]);
if(Integer.parseInt(money.substring(len-i-1, len-i)) > 0)
result.append(han2[i%4]);
if(i%4 == 0)
result.append(han3[i/4]);
}

return result.toString();
}

===========================================================

숫자를 한글로 변환


       public static long hangulToNum(String input){
             long result = 0;
             long tmpResult =0;
             long num = 0;
           
             final StringNUMBER="영일이삼사오육칠팔구";
             final String UNIT= "십백천만억조";
             final long[] UNIT_NUM = {
                           10,100,1000,10000,(long)Math.pow(10, 8),(long)Math.pow(10,12)
             };
           
             StringTokenizer st = new StringTokenizer(input,UNIT,true);//단위
             while(st.hasMoreTokens()){//삼,*,*,삼,*,*
                    String token =st.nextToken();
                    //숫자인지 단위(UNIT)인지 확인한다.
                    int check =NUMBER.indexOf(token);//1)삼 ->3 2)십 ->-1
                    System.out.println("CHECK:"+check);
                 
                    if(check==-1){//단위인경우
                           if("만억조".indexOf(token)==-1){//만억조가 아니면 3)만
                                 tmpResult+=(num!=0?num:1)*UNIT_NUM[UNIT.indexOf(token)];//num=30 * 10000
                           }else{
                                 //만,억,조 경우 ->result
                                 tmpResult +=num;
                                 result +=(tmpResult!=0?tmpResult:1)*UNIT_NUM[UNIT.indexOf(token)];
                                 tmpResult = 0;
                           }
                           num = 0;
                    }else{//숫자
                           num = check;
                    }
             }
             System.out.println("result:"+result);
             System.out.println("tmpResult:"+tmpResult);
             System.out.println("num:"+num);
           
             return result +tmpResult + num;     
       }
 

안드로이드 화면 회전 및 로딩 흰색 화면 방지

로딩시 화면 흰색 제거
와 화면 회전시 센서에의한 회전 과 내용 refresh 방지



AndroidManifest.xml
android:configChanges="orientation|screenSize"
android:screenOrientation="sensor">

styles.xml
 //로딩시 화면 흰색 제거
@null
true

2017년 10월 13일 금요일

what the fuck steam

what the fuck steam


Running Steam on ubuntu 16.04 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
[2017-10-14 04:21:50] Startup - updater built Oct 11 2017 10:57:45
SteamUpdateUI: An X Error occurred
X Error of failed request:  BadWindow (invalid Window parameter)
Major opcode of failed request:  155 (NV-GLX)
Minor opcode of failed request:  4
Resource id in failed request:  0x1400002
Serial number of failed request:  45
xerror_handler: X failed, continuing
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[2017-10-14 04:21:50] Checking for update on startup
[2017-10-14 04:21:50] Checking for available updates...
[2017-10-14 04:21:50] Download skipped: /client/steam_client_ubuntu12 version 1507769972, installed version 1507769972
[2017-10-14 04:21:50] Nothing to do
[2017-10-14 04:21:50] Verifying installation...
[2017-10-14 04:21:50] Performing checksum verification of executable files
[2017-10-14 04:21:50] Verification complete


==============================================================



mv $HOME/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6{.bak,}

mv $HOME/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6{.bak,}

LD_PRELOAD='/usr/$LIB/libstdc++.so.6' DIAPLAY=:0 steam

안드로이드 공유 기능




안드로이드 공유(sms, sns) 기능





Intent msg = new Intent(Intent.ACTION_SEND);
msg.addCategory(Intent.CATEGORY_DEFAULT);
msg.putExtra(Intent.EXTRA_SUBJECT, "주제");
msg.putExtra(Intent.EXTRA_TEXT, "내용");
msg.putExtra(Intent.EXTRA_TITLE, "제목");
msg.setType("text/plain");   
startActivity(Intent.createChooser(msg, "공유"));

2017년 10월 12일 목요일

천단위 컴마 붙이기








edt1 = (EditText) findViewById(R.id.editText);
edt1.addTextChangedListener(new CustomTextWatcher(edt1));





클래스 생성
=======================================================



import android.text.Editable;
import android.text.Selection;
import android.text.TextWatcher;
import android.widget.EditText;

import java.text.DecimalFormat;

/**
 * Created by buster on 17. 10. 13.
 * 천단위 컴마 붙이기
 *
 */
public class CustomTextWatcher implements TextWatcher {
    @SuppressWarnings("unused")
    private EditText mEditText;
    String strAmount = ""; // 임시 저장값 (콤마)

    public CustomTextWatcher(EditText e) {
        mEditText = e;
    }

    @Override
    public void afterTextChanged(Editable s) {
        // TODO Auto-generated method stub

    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count,
                                  int after) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {    //텍스트가 변경될때마다 실행
        if (!s.toString().equals(strAmount)) { // StackOverflow 방지
            strAmount = makeStringComma(s.toString().replace(",", ""));
            mEditText.setText(strAmount);
            Editable e = mEditText.getText();
            Selection.setSelection(e, strAmount.length());
        }
    }

    protected String makeStringComma(String str) {    // 천단위 콤마 처리
        if (str.length() == 0)
            return "";
        long value = Long.parseLong(str);
        DecimalFormat format = new DecimalFormat("###,###");
        return format.format(value);
    }

}
======================================================
계산식에 , 마 제거 해야 정상적인 계산이 이루어 진다.

double input1 = Double.valueOf(edt1.getText().toString().replace(",",""));

자바 데이터형

종류       설명              저장 공간    값의 범위 (최소값~최대값)
======================================================================================
boolean    논리값            1 bit        true / false
--------------------------------------------------------------------------------------
byte       부호 있는 정수    8 bits       -128 ~ 127
--------------------------------------------------------------------------------------
char       유니코드 문자     16 bits      \u0000 ~ \uFFFF
--------------------------------------------------------------------------------------
short      부호 있는 정수    16 bits      -32768 ~ 32767
--------------------------------------------------------------------------------------
int        부호 있는 정수    32 bits      -2147483648 ~ 2147483647
--------------------------------------------------------------------------------------
long       부호 있는 정수    64 bits      -9223372036854775808 ~ 9223372036854775807
--------------------------------------------------------------------------------------
float      IEEE 754 실수     32 bits      1.40239846E-45f
                                          ~ (표현 가능 양수 범위)
                                          3.40282347E+38f
--------------------------------------------------------------------------------------
double     IEEE 754 실수     64 bits      4.94065645841246544E-324
                                          ~ (표현 가능 양수 범위)
                                          1.79769313486231570E+308
--------------------------------------------------------------------------------------

2017년 10월 9일 월요일

자바 메쏘드 분리 및 인수 전달

 
 
android:background="#333333" 
android:textColor="#99ff00"
android:gravity="center_vertical"
 
 
 double input1 = Double.valueOf(edt1.getText().toString());


 m2result= calc.M2Result(input1);
 


 
 public static double M2Result(double input1) {
 
 
return input1;
 
 
} 

2017년 10월 8일 일요일

안드로이드 스튜디오 화면 고정


첫번째 방법 엑티비티 소스에 골라서 추가

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);  //강제 가로
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);  //강제 세로
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); //센서대로


두번째 방법
androidmanifest.xml 수정 방법

android:screenOrientation="portrait"

android:screenOrientation="landscape"