All posts by bluebee

144월/20

JCenter(Bintray) 배포 방법

Android Module을 개발 완료하였다면 배포방안이 필요하다. Bintray에 업로드를 하고 JCenter를 연결하여 해결할 수 있다. 그렇게 되면 아래와같이 dependencies 항목에 추가할 수 있게 된다. dependencies { implementation ‘kr.co.paep:paep-sdk:1.0.1’ } https://bintray.com/ 에 회원가입을 한다. open source로 가입하도록 한다. repository를 하나 생성해준다. 이름을 명시해주고, Type을 Maven 으로 선택하였다. 우측상단의 프로필을 선택하여 Edit Profile에 접속하면 API Key를 얻을 수 있다. 기록해두자. 안드로이드 스튜디오에서 gradle 작업을 진행한다. project build.gradle buildscript { repositories { jcenter() } dependencies { classpath ‘com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+’ classpath ‘com.github.dcendents:android-maven-gradle-plugin:2.1’ } } module build.gradle ext { bintrayRepo = ‘paep’ bintrayName = ‘paep-sdk’ publishedGroupId = ‘kr.co.paep’ libraryName = ‘paep-sdk’ artifact = ‘paep-sdk’ libraryDescription = ‘PAEP adx library’ siteUrl = ‘https://github.com/phaserep/paep-android-sdk’ gitUrl = ‘https://github.com/phaserep/paep-android-sdk.git’ libraryVersion = ‘1.0.1’ developerId = ‘jakeyu’ // Maven plugin uses this. I don’t know if it needs to be anything special. developerName = ‘Jake Yu’ developerEmail = ‘jake@phaserep.com’ licenseName = ‘The MIT License (MIT)’ licenseUrl = ‘https://opensource.org/licenses/MIT’ allLicenses = [“MIT”] } android { } dependencies { } apply plugin: ‘com.github.dcendents.android-maven’ group = publishedGroupId // Maven Group ID for the artifact install { repositories.mavenInstaller { // This generates POM.xml with proper parameters pom { project { packaging ‘aar’ groupId publishedGroupId artifactId artifact // Add your description here name libraryName description libraryDescription url siteUrl더보기…

024월/20

httpd 프로세스 누적 처리

httpd 프로세스가 누적되는 경우가 종종 있다. 특히 워드프레스.. 음 안쓰기도 뭐하고.. 무거운 워드프레스를 다 해집기 보다는.. 그냥 재시작 처리를 해두는게 나을지도 #!/bin/sh while ( true ) ; do if [ “`ps aux | grep httpd | wc -l`” -ge “50” ] ; then systemctl restart httpd date >> /home/engineer/shell/apache_auto_restart.log fi sleep 10 done 프로세스 수량 50은.. 봐가면서 변경

1012월/19

bootstrap datepicker language, format 설정

언어 설정 가이드 : https://bootstrap-datepicker.readthedocs.io/en/stable/i18n.html 한국어js : https://github.com/uxsolutions/bootstrap-datepicker/blob/master/dist/locales/bootstrap-datepicker.ko.min.js <script src=”/assets/js/bootstrap-datepicker.ko.min.js” charset=”UTF-8″></script> <script src=”/assets/js/bootstrap-datepicker.js” type=”text/javascript”></script> $(‘#date1’).datepicker({ format: ‘yyyy-mm-dd’, language: “ko” }

1311월/19

php 로그인, 크롤링 by Snoopy

간혹 업체의 report api가 구비되지 않아서 크롤링을 한다거나, 주기적인 업데이트를 위해 크롤링이 필요한 경우가 있다. 그와중에 로그인 후 크롤링을 할 경우까지 종종 등장한다. 이때 오래되었으나 snoopy 라이브러리를 이용하면 좋다. Snoopy download https://sourceforge.net/projects/snoopy/ 바로 import하여 사용한다. <?php require_once(‘lib/Snoopy.class.php’); $snoopy = new Snoopy; $snoopy->agent = “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)”; //login $loginUri = ‘http://www.bluebee.co.kr/loginTest.php’; $snoopy->httpmethod = “POST”; $auth[‘id’] = ‘bluebee’; $auth[‘password’] = ‘1234’; $snoopy->submit($loginUri, $auth); $snoopy->setcookies(); //로그인에 쿠키를 사용하는 경우가 있으니 쿠키정보를 저장 $loginResult = json_decode($snoopy->results); $report_data = array(); if($loginResult->{‘ret’} != “ok”) { echo ‘Login 실패!’; exit; } else { //리포트 데이터 크롤링 $reportUri = ‘http://www.bluebee.co.kr/reportTest.php’; $snoopy->httpmethod = “POST”; $report[‘sdate’] = ‘2019-11-01’; $report[‘edate’] = ‘2019-11-13’; $snoopy->submit($reportUri, $report); preg_match(‘/<tr class=”reportR”>(.*?)<\/tr>/is’, $snoopy->results, $result_report_tr); if(sizeof($result_report_tr) > 1) { preg_match_all(‘/<td[^>]*>(.*?)<\/td>/is’, $result_report_tr[1], $result_report_td); /*데이터 정리*/ } } ?> 로그인이 필요한 경우 간편하게~ 대충 이런 형태로 간단하게 뽑아낼 수 있겠다.   오류 발생 대처 방법 PHP Deprecated: The each() function is deprecated. php버전에 따라 오류발생 가능 Snoopy.class.php 의 each 관련 사항을 모두 foreach로 수정 예) while (list($key, $val) = each($links[2])) { => foreach($links[2] as $key => $val) { 그외 딱히 이슈될건 없다.

189월/19

ubuntu, nginx, php 빈번한 셋팅 오류

서버 셋팅시 빈번히 발생하는 오류와 해결내용을 메모해두자. nginx 502 Bad Gateway upstream: “fastcgi://127.0.0.1:9000” sudo vi /etc/php/7.0/fpm/pool.d/www.conf ;listen = /run/php/php7.0-fpm.sock listen = 127.0.0.1:9000   access denied sudo vi /etc/php/7.0/fpm/pool.d/www.conf security.limit_extensions = .php .php3 .php4 .php5 .php7 .html sudo service php7.0-fpm restart nginx ssl_certificate_key pass 오류 원본 백업 cp domain.key domain.key.org 키의 password 입력 처리 openssl rsa -in domain.key.org -out domain.key sudo service nginx restart 스마트에디터 The uploaded file exceeds the post_max_size The uploaded file exceeds the post_max_size 오류 발생 php.ini 용량 설정이나 그누보드 어드민의 용량설정을 해봤자 스마트에디터 자체에 용량제한이 또 걸려있다. (어떤놈이 대체 이렇게..) /extend/smarteditor_upload_extend.php 를 열어서 수정하자. define(‘SMARTEDITOR_UPLOAD_SIZE_LIMIT’, 20); // 스마트에디터 업로드 사이즈 제한 ( 기본 20MB ) client intended to send too large body nginx 설정에서 적용해주자. server { client_max_body_size 0; }

037월/19

TensorFlow on Anaconda3 5.2.0

아나콘다 설치 : https://repo.continuum.io/archive/index.html Anaconda3-5.2.0-Windows-x86_64.exe (python 3.6.5) 관리자 권한으로 설치 후 확인 > conda –version conda 4.5.4 > python –version Python 3.6.5 :: Anaconda ,Inc.  Anaconda Prompt 관리자 실행 후 업데이트 > conda update -n base conda > conda update –all > python -m pip install –upgrade pip 아나콘다 가상환경 구성 > conda create -n bluebee1 python=3.6 > conda activate bluebee1 base로 돌아오려면.. > conda deactivate 가상환경에 TensorFlow 설치 > conda install tensorflow 설치확인 > python >>> import tensorflow as tf >>> tf.__version__ ‘1.13.1’ jupyter notebook ide설치 > conda install jupyter notebook 실행 > jupyter notebook 기본 브라주에서 실행되는것을 확인. 준비끝 jupyter notebook 기본 디렉터리 변경 설정파일 path 알아보기 > jupyter notebook –generate-config Writing default config to : 경로 해당 경로의 jupyter_notebook_config.py 열어서 수정 c.NotebookApp.notebook_dir = ” 항목에 디렉터리 지정 예) c.NotebookApp.notebook_dir = ‘D:/project/jupyter’

112월/19

android adb를 이용한 shell 접근

adb를 이용하여 기기에서의 shell 명령이 가능하다. 우선 디바이스 리스트를 가져오자. C:\Users\bluebee\AppData\Local\Android\Sdk\platform-tools>adb devices 그다음 기기에 shell을 아래와 같이 날린다. 예제는 기기의 알람 상황 살펴보기. adb -s devicename shell dumpsys alarm | find “bluebee” 이렇게 진행해도 되겠다. adb -s devicename shell run-as packagename