- login 정보가 없으면, planning관련 메뉴 숨김
2. syn.php 개선
- syn 노드이면, syn 노드 끼리 동기화
- syn 노드의 내용은 visibility를 hidden으로 설정
- syn 노드 user의 내용은 visibility를 사용자(syn user)로 표시
- extmul을 이용한 확장
벡터선언 및 plotting
xml데이터 파싱을 이용한 chart
[GIT] github의 기본적인 명령어
매트랩 구현 사전 학습
[GS] ArrayFormula 함수 활용하기
ArrayFormula 는 영역의 내용을 그대로 참조할 수 있다.
importrange 함수는 다른 파일(스프레드시트)의 영역을 참조하는데, limit 가 걸려있고, 느리므로 별로 안 좋아한다.
ArrayFormula 를 이용해 다른 view 를 구성하는 것이 필요한 경우 사용 가능하다.
A, B, C 컬럼 중 A, C 만 연속해서 활용해야할 때 좋다.
더더욱 좋은 것은 문자열의 가공이 가능하다는 것이다.
=ArrayFormula(if('sheet'!V3:X="",,left('sheet'!V3:X,19)))
V3 행부터 X 행 전체 내용을 가져오는데, 비어있지 않다면(내용이 있다면) LEFT 함수를 거쳐 출력하는 것이다.
원래 내용은 20자인데, 별로 안 예쁘게 출력될 때, 새로운 view를 구성하면서 문자열을 자르고 출력시킬 수 있다.
또다른 활용으로는 index 와 row 를 이용한 순서 바꾸기(reverse) 이다.
=INDEX(ArrayFormula('sheet'!B$2:B),COUNTA(ArrayFormula('sheet'!$B$2:$B))-ROW()+2,1)
해당 예제는 2행 부터 시작되는 경우이고, arrayformula를 사용하는 시트도 2행부터 시작하여 내용을 맞췄다.
C 컬럼의 경우 그대로 복사하면, 옆의 행을 참조하도록 상대 주소가 반영된다.
3행의 경우도 전체 참조내용에서 row 함수에 의해 index 가 반전되므로 역정렬된 데이터를 볼 수 있다.
구글 form의 고질적인 문제(아래로 쌓이면 내용 확인을 위해 스크롤)가 있어 찾아봤다.
창업일지 - 사업자등록 및 통신판매업신고
zbxe 작업일지(13일차)
퓨리에 변환을 통한 주파수영역으로 전환
[GS] apps script 를 이용한 구글 드라이브로 파일 업로드
PHP 를 이용한 파일 업로드는 서버에 저장된 파일을 스크립트를 이용해 리스트와 파일로 저장하는 방식이었다.
이제는 apps script를 이용해 직접 구글 드라이브로 업로드하여 중간 절차와 서버 사용 부담을 줄였다.
[원본글]
https://ctrlq.org/code/19747-google-forms-upload-files
[file.gs]
/* The script is deployed as a web app and renders the form */
function doGet(e) {
return HtmlService
.createHtmlOutputFromFile('form.html')
.setTitle("파일 업로드");
}
function uploadFileToGoogleDrive(data, file, name, kind, row) {
try {
var tD = Utilities.formatDate(new Date(), "GMT+9", "yyyyMMdd");
var folder, folders = DriveApp.getFoldersByName(tD);
var imageFolder = DriveApp.getFolderById("폴더");
/* Find the folder, create if the folder does not exist */
if (folders.hasNext()) {
folder = folders.next();
} else {
folder = imageFolder.createFolder(tD);
}
var contentType = data.substring(5,data.indexOf(';')),
bytes = Utilities.base64Decode(data.substr(data.indexOf('base64,')+7)),
blob = Utilities.newBlob(bytes, contentType, file);
var file = folder.createFolder(tD).createFile(blob);
return "OK";
} catch (f) {
return f.toString();
}
}
[form.html]
<!-- File upload button -->
<input id="file" type="file">
<!-- Form submit button -->
<button id="sb" onclick="submitForm();return false;">전송</button>
<!-- Show Progress -->
<div id="progress"></div>
<!-- Add the jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
var file,
reader = new FileReader();
// Upload the file to Google Drive
reader.onloadend = function(e) {
google.script.run
.withSuccessHandler(showMessage)
.uploadFileToGoogleDrive(
e.target.result, file.name,
$('select#company option:selected').text(),
$('select#kind').val(),
$('select#company').val()
);
};
// Read the file on form submit
function submitForm() {
file = $('#file')[0].files[0];
if(!file){
alert('파일선택');
}else{
file = $('#file')[0].files[0];
showMessage("Uploading file..");
reader.readAsDataURL(file);
}
}
function showMessage(e) {
$('#progress').html(e);
$('#sb').prop("disabled",true);
}
</script>
cos함수의 주파수영역에서 보기
[R] 구글 플레이스토어 리뷰 수집
json 등으로 제공되지 않기 때문에, html 을 직접 크롤링해야 하는데, 더보기 버튼 등이 있고, 유용성 순서로 정렬이 기본이므로 제약이 많다.
https://blog.naver.com/PostView.nhn?blogId=nife0719&logNo=221329685115&parentCategoryNo=&categoryNo=30&viewDate=&isShowPopularPosts=false&from=postView
에서 제공되는 소스를 조금 고쳐서 전체를 다 수집하지 않고, 최근 것 일부만 수집하도록 한다.
리뷰가 너무 많을 경우 30분이 넘어가는 일이 발생하므로 다음과 같이 수정하였다.
다음을 실행하기 위해서는, r을 다운로드하여 설치하고 https://cran.r-project.org/bin/windows/base/
콘솔에서 관련 라이브러리를 설치한다. 아래 코드는 적당한 이름으로 저장하여 불러오기 후 전체 실행하면 된다.
(예제 앱은 스마트 헌혈 임)
install.packages("rvest")
install.packages("httr")
install.packages("stringr")
install.packages("RSelenium")
[다음]
library(rvest)
library(RSelenium)
library(httr)
library(stringr)
ch=wdman::chrome(port=4444L) #크롬드라이버를 포트
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4444L, browserName = "chrome")
remDr$open() #크롬 Open
remDr$navigate("https://play.google.com/store/apps/details?id=net.bloodinfo.smartapp&showAllReviews=true") #설정 URL로 이동
webElem <- remDr$findElement("css", "body")
webElem$sendKeysToElement(list(key = "end"))
# webElemButton <- remDr$findElements(using = 'css selector',value = '.ZFr60d.CeoRYc') #버튼 element 찾기
# remDr$mouseMoveToLocation(webElement = webElemButton) #해당 버튼으로 포인터 이동
flag <- TRUE
endCnt <- 0
while (flag) {
Sys.sleep(10)
webElemButton <- remDr$findElements(using = 'css selector',value = '.ZFr60d.CeoRYc')
if(length(webElemButton)==1){
endCnt <- 0
webElem$sendKeysToElement(list(key = "home"))
webElemButton <- remDr$findElements(using = 'css selector',value = '.ZFr60d.CeoRYc')
remDr$mouseMoveToLocation(webElement = webElemButton[[1]]) #해당 버튼으로 포인터 이동
remDr$click()
webElem$sendKeysToElement(list(key = "end"))
flag <- FALSE #추가한 부분
}else{
if(endCnt>3){
flag <- FALSE
}else{
endCnt <- endCnt + 1
}
}
}
frontPage <- remDr$getPageSource() #페이지 전체 소스 가져오기
reviewNames <- read_html(frontPage[[1]]) %>% html_nodes('.bAhLNe.kx8XBd') %>% html_nodes('.X43Kjb') %>% html_text() #페이지 전체 소스에서 리뷰 정보(이름, 날짜) 부분 추출하기
reviewDates <- read_html(frontPage[[1]]) %>% html_nodes('.bAhLNe.kx8XBd') %>% html_nodes('.p2TkOb') %>% html_text() #페이지 전체 소스에서 리뷰 정보(이름, 날짜) 부분 추출하기
reviewComments <- read_html(frontPage[[1]]) %>% html_nodes('.UD7Dzf') %>% html_text() #페이지 전체 소스에서 리뷰 정보(이름, 날짜) 부분 추출하기
reviewData <- data.frame(name=reviewNames, date=reviewDates, comment=reviewComments)
write.csv(reviewData, paste0("net.bloodinfo.smartapp(",nrow(reviewData),").csv"))
remDr$close()
[slack] bot 을 이용한 메시지 보내기
browse Apps -> Custom Integrations -> Bots 에서
bot을 추가하여 이름 정도만 설정하면 access-token을 받을 수 있다.
xoxb 로 시작하는 token을 넣은 뒤 아래와 같은 php 소스로 메시지 전송이 가능하다.
<?php
$cont="#".$_GET["channel"];
echo slack($_GET["cont"],$cont);
function slack($message, $channel)
{
$ch = curl_init("https://slack.com/api/chat.postMessage");
$data = http_build_query([
"token" => "xoxb-~~~",
"channel" => $channel, //"#general",
"text" => $message, //"Hello, Foo-Bar channel message.",
"username" => "MySlackBot",
]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
?>
[OSX] VMWARE 에 WINDOWS 설치 후, 키보드 매핑
http://docs.cena.co.kr/?mid=textyle&category=13620&document_srl=17478
위 사이트를 참고하였다.
Left Option(0038) -> Left Windows(E05B)
Left Command(E05B) -> Left Alt(0038)
Right Control(E01D) -> Context Menu(E05D)
Right Option(E038) -> 한자(E071)
Right Command(E05C) -> 한글(E072)
위와 같이 변경해 보았으나, 기본적으로 Left Command + Tab이 OSX의 창 전환 기능이기 때문에, WINDOWS에서 사용할 수 없다. 그래서 HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout
에서 Scancode Map의 데이터를 다음과 같이 입력했다.
00 00 00 00 // Map Header
00 00 00 00 // Map Version
06 00 00 00 // Count (DWORD)
5B E0 5B E0 // Left Command(E05B) -> Left Windows(E05B)
38 00 38 00 // Left Option(0038) -> Left Alt(0038)
5D E0 1D E0 // Right Control(E01D) -> Context Menu(E05D)-> 내 맥북 AIR에는 없다
71 E0 38 E0 // Right Option(E038) -> 한자(E071)
72 E0 5C E0 // Right Command(E05C) -> 한글(E072)
00 00 00 00
이렇게 하여, 한자, 한글만 적용했다.
함수 - 데이터 생성 함수 magic
magic(k)는 1에서 k^2까지의 정수를 사용하여 열, 행 그리고 대각선의 합이 똑같은 정방행렬을 만들어주는 Matlab의 데이터 생성함수이다.
To get started, select MATLAB Help or Demos from the Help menu.
>> B = magic(4)
B =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
>>
[bWAPP] XML External Entity Attacks (XXE)
페르미 패러독스
댓글 달기