[안드로이드] WebView Uncaught TypeError


SDK API 26으로 올렸더니 기존에 잘 동작하던 코드가 제대로 먹히지를 않는군요~

구글이 왜그럴까요~ 점점 짜증나게 만드네요~

버전을 올리면 하위 버전도 호환되게 해야지 제거된 API 들이 은근 많아서 스트레스 받네요~

자바는 이래서 싫어요~

I/chromium(15940): [INFO:CONSOLE(15)] "Uncaught TypeError: window.WebViewCall.setMessage is not a function", source:


위와 같은 메시지가 나오면 아래 처럼 색깔이 들어간 부분을 넣어주면 됩니다.


import android.webkit.JavascriptInterface;

...

mWebView.addJavascriptInterface(new WebViewCall(), "WebViewCall");

...

public class WebViewCall {

@JavascriptInterface

public void setMessage(final String arg, final String arg2) {

...

}

별거 아닐 걸로 환장하는군요~ ㅎ


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

[안드로이드] Android Studio gradle 에러


eclipse 에서 안드로이드 스튜디오로 개발툴을 바꾸고 적응하기 힘드네요~

"Could not find com.android.tools.build:gradle:3.3.1." 에러시 File -> Project Structure -> Project 에서 아래 처럼 해주니깐 됩니다.

[안드로이드] Android Studio gradle 에러

이런 오류는 구글링도 이제 힘드네요~


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

[안드로이드] Android Studio non-ASCII 에러


기존의 eclipse 에서 개발된 앱소스를 안드로이드 스튜디오에서 import 하려고 하니 아래 처럼 에러가 나면서 불러오지를 못하네요~

"Your project file contains non-ASCII characters."

[안드로이드] Android Studio non-ASCII 에러

이클립스에서는 폴더명이 한글이 있더라도 되던게 안드로이드 스튜디오에서는 안되는가 봅니다.

Google 드라이브 폴더명을 영문으로 바꾸고 불러오니 잘 되는군요~



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

시놀로지 rsync 백업 크론탭에 등록 방법


Synology 하드디스크의 특정폴더를 USB 외장 하드에 동기화 해주는 방법입니다.

터미널로 접속해서 크론으로 rsync 스크립트가 실행되도록 해봤습니다.


sudo touch /usr/syno/bin/usb-rsync.sh

sudo chmod +x /usr/syno/bin/usb-rsync.sh

sudo vi /usr/syno/bin/usb-rsync.sh


아래 내용으로 저장

#!/bin/sh


rsync -av --delete --exclude '@eaDir' /volume1/원본폴더 /volumeUSB1/usbshare/backup

rsync -av --delete --exclude '@eaDir' /volume2/원본폴더 /volumeUSB1/usbshare/backup


sudo vi /etc/crontab

05  0   *   *   *   root    /usr/syno/bin/usb-rsync.sh

매일 0시 5분 마다 실행되도록 합니다.

시간은 알맞게 고치시면 됩니다.


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

[안드로이드] targetSDK 26 HttpClient 오류


Android SDK 23 이전에서 잘 동작하던 앱이 26으로 올리니 아래와 같은 오류가 발생합니다.

23 버전부터 제거가 되었다고 하네요~

org.apache.http.legacy.jar 파일을 다운로드 해서 libs 에 추가해 주면 됩니다.

02-22 11:34:12.168: E/AndroidRuntime(8261): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:169)

02-22 11:34:12.168: E/AndroidRuntime(8261): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:124)

02-22 11:34:12.168: E/AndroidRuntime(8261): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:366)

02-22 11:34:12.168: E/AndroidRuntime(8261): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560)

02-22 11:34:12.168: E/AndroidRuntime(8261): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:658)

02-22 11:34:12.168: E/AndroidRuntime(8261): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:632)

02-22 11:34:12.168: E/AndroidRuntime(8261): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:621)

https://android.googlesource.com/platform/prebuilts/sdk/+/android-support-test/org.apache.http.legacy

https://android.googlesource.com/platform/prebuilts/sdk/+archive/android-support-test/org.apache.http.legacy.tar.gz



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

윈도우10 제품키 종류 확인 방법


내 컴퓨터에 설치된 윈도우의 제품키 종류가 Retail, OEM, MAK 중에 무엇인지 확인하는 방법입니다.

Win + R 누르고 실행에서 cmd 를 입력하고 엔터를 치면 아래 화면 처럼 명령 프롬프트가 나옵니다.

여기에서 slmgr /dlv 입력 후 엔터를 하면 잠시 뒤에 Windows Script Host 창이 뜨면서 라이선스 정보를 알려줍니다.

윈도우10 제품키 종류 확인 방법


그리고 아래는 라이선스 제품키 관련 명령어 입니다.

slmgr /xpr         만료 날짜 확인

slmgr /upk         제품 키 제거

slmgr /cpky      레지스트리에서 제품 키 지우기

slmgr /ipk 제품키      제품키 설치

slmgr /dlv          라이선스 종류 Retail, OEM, MAK 확인



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

[CentOS] 7.x 아파치 2.4.x mod_cband 0.9.7.5 컴파일



Apache 트래픽 제어 모듈은 cband 만한게 없는 것 같네요~

CBandScoreboard 설정시 "apache2_mod_cband: cannot open scoreboard file" 같은 에러는 해당 경로의 퍼미션을 조정하면 됩니다.

CBandUser (apache 또는 root로 생성) 를 설정하고 VirtualHost (mod_ruid2 로 유저계정) 에서 사용시 파일권한이 달라서 나는 에러는 666 으로 변경하여 주세요~


# wget https://github.com/vobruba-martin/mod_cband/archive/0.9.7.5.tar.gz

# tar zxvf 0.9.7.5.tar.gz

# cd mod_cband-0.9.7.5

# ./configure  ## configure: error: apxs missing 에러가 납니다.

checking for gcc... gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking whether make sets $(MAKE)... yes

checking for apr_palloc in -laprutil... no

checking for an ANSI C-conforming const... yes

checking for apxs... no

checking for apxs2... no

configure: error: apxs missing

httpd-devel 을 설치해 줍니다.


# yum -y install httpd-devel

# ./configure

checking for gcc... gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking whether make sets $(MAKE)... yes

checking for apr_palloc in -laprutil... no

checking for an ANSI C-conforming const... yes

checking for apxs... apxs

checking how to run the C preprocessor... gcc -E

checking for egrep... grep -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking stdio.h usability... yes

checking stdio.h presence... yes

checking for stdio.h... yes

checking for string.h... (cached) yes

checking assert.h usability... yes

checking assert.h presence... yes

checking for assert.h... yes

checking ctype.h usability... yes

checking ctype.h presence... yes

checking for ctype.h... yes

checking errno.h usability... yes

checking errno.h presence... yes

checking for errno.h... yes

checking math.h usability... yes

checking math.h presence... yes

checking for math.h... yes

checking netinet/in.h usability... yes

checking netinet/in.h presence... yes

checking for netinet/in.h... yes

checking sys/socket.h usability... yes

checking sys/socket.h presence... yes

checking for sys/socket.h... yes

checking arpa/inet.h usability... yes

checking arpa/inet.h presence... yes

checking for arpa/inet.h... yes

configure: creating ./config.status

config.status: creating Makefile


# make

# make install


# find / -name mod_cband.so 명령어로 제대로 설치가 되었는지 확인하면 됩니다.


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

[리눅스] 아파치 트래픽 제어


Apache 2.2.x 속도 제어 모듈중에 mod_cband 가 있습니다.

2.4 버전에서도 사용은 가능하지만 약간의 수정이 필요합니다.

mod_qos 라는 모듈도 있는데 yum install mod_qos 로 설치가 가능합니다.

yum install epel_release 가 먼저 설치되어 있어야 합니다.


아래는 mod_qos 기본적인 설정입니다.

/etc/httpd/conf.d/qos.conf 파일을 만들어 주면 됩니다.

# allows max 50 connections from a single ip address:

QS_SrvMaxConnPerIP                        50

# limits download bandwidth to 5Mbit/sec (resp. 640kbytes/sec)

#QS_LocKBytesPerSecLimit       /           640

# 100Mbps

QS_LocKBytesPerSecLimit       /           12800

# disables connection restrictions for certain clients:

QS_SrvMaxConnExcludeIP                    127.0.0.1

QS_SrvMaxConnExcludeIP                    192.168.1.

# Brute Force

# allows a single IP addess to access the URI /wp-login.php not more

# than 10 times within an hour:

SetEnvIf                 Request_URI ^/wp-login.php LimitLogin

QS_ClientEventLimitCount 10 3600 LimitLogin


# Status Viewer

<Location /qos>

    SetHandler qos-viewer

    Order Deny,Allow

    Deny from All

    Allow from 127.0.0.1

</Location>

status 에 자신의 아이피를 넣어주면 됩니다.


최신 버전을 사용하려면 https://sourceforge.net/projects/mod-qos/files/ 여기에서 최신버전을 다운로드 받으면 됩니다.

사용방법은 http://mod-qos.sourceforge.net/ 여기를 참고하세요~



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,