import processing.serial.*;
// serial
Serial myPort; // The serial port
String i;
void setup()
{
size(1000, 1000);
smooth();
noStroke();
// serial setting
String portName = Serial.list()[1]; // 자기에게 맞는 포트 찾기
myPort = new Serial(this, portName, 9600);
myPort.bufferUntil(10); // newline ('\n') 나올 때 가지 읽기
}
void keyPressed() {
print(i);
}
void draw(){
}
void serialEvent(Serial p) {
String inBuffer = p.readString();
// 프로토콜에 맞게 왔는지 검사하기
if (inBuffer != null){
String [] nums = split(inBuffer, ',');
if (nums.length == 9){
for (int j = 0; j < 8; j++){
if (split(nums[j],(':')).length != 7){
return;
}
}
i = inBuffer;
}
}
}
// serial
Serial myPort; // The serial port
String i;
void setup()
{
size(1000, 1000);
smooth();
noStroke();
// serial setting
String portName = Serial.list()[1]; // 자기에게 맞는 포트 찾기
myPort = new Serial(this, portName, 9600);
myPort.bufferUntil(10); // newline ('\n') 나올 때 가지 읽기
}
void keyPressed() {
print(i);
}
void draw(){
}
void serialEvent(Serial p) {
String inBuffer = p.readString();
// 프로토콜에 맞게 왔는지 검사하기
if (inBuffer != null){
String [] nums = split(inBuffer, ',');
if (nums.length == 9){
for (int j = 0; j < 8; j++){
if (split(nums[j],(':')).length != 7){
return;
}
}
i = inBuffer;
}
}
}
MySQL 날짜 연산 예제 입니다.
>> select a from b where to_days(date) = to_days(now()) -1
뜻은 b table 의 a 필드 요소를 출력하는데 그 조건은 date 필드의 날짜값 오늘의 날짜값 보다 1 작은 (어제) 것으로 해석해볼 수 있겠습니다.
그리고 우분투 서버버전에서 crontab 사용해보려고 했는데 /var/log 에 crontab 로그파일이 남겨져 있지 않아서 왜 그런지 찾아보니 기본설정이 로그가 남겨지지 않도록 되어있었습니다. 다음과 같이 로그 관련 데몬 설정 파일을 수정하고 데몬을 재시작 시켜 주면 됩니다.
>> sudo vi /etc/syslog.conf
파일 열어서 crontab 찾아서 코멘트 되어 있는 부분 풀어줍니다.
>> sudo /etc/init.d/sysklogd restart
데몬을 재시작 시켜 줍니다. /var/log 에 가면 이제 crontab 로그가 생겨있습니다. 아래는 참고한 웹 페이지 입니다:






