[영단어] directory entry 

           디스크에 있는 각 파일의 이름·크기·특징 등을 기재한 것

Reference url : http://dic.daum.net/search.do?q=entry



(PHP 4, PHP 5, PHP 7)

readdir — Read entry from directory handle


Description

string readdir ([ resource $dir_handle ] )

Returns the name of the next entry in the directory. The entries are returned in the order in which they are stored by the filesystem.


reference url : http://php.net/manual/en/function.readdir.php



<?php
/**
* Description.
*
* @author: JinMyung <dcan@doitforyou.co.kr>
* @category Filesystem
* @version 1.0
*/

/* files이 있는 directory의 모든 파일을 읽어 리스트업 */
echo "<pre>";
echo "<b>files이 있는 directory의 모든 파일을 읽어 리스트업</b>";
echo "<br>";

$dir = $_SERVER['DOCUMENT_ROOT']."/admin1/test/img/";

// 핸들 획득
$handle = opendir($dir);
$files = array();
// 디렉터리에 포함된 파일을 저장한다.
while (false !== ($filename = readdir($handle))) {
if ($filename =="." || $filename =="..") {
continue;
}

// 파일인 경우만 목록에 추가한다.
if (is_file($dir . "/" . $filename)) {
$files[] = $filename;
}
}
// 핸들 해제
closedir($handle);

sort($files);

// 파일명을 출력한다.
foreach ($files as $f) {
echo $f . "(" . round(filesize($dir . "/" . $f)/1024, 2) . " KB)" ;
echo "<br />";
}

echo "</pre>";
echo "reference url : http://blog.devez.net/292 | http://php.net/manual/en/function.readdir.php";

?>




'프로그래밍 > PHP' 카테고리의 다른 글

php 패스워드 암호화 bcript  (0) 2018.05.02
unlink(=delete) 메소드 이용하기  (0) 2018.04.22
파일 업로드(move_uploaded_file)  (3) 2018.04.14
fileupload 에러메시지 설명  (0) 2018.04.14
angularJS 사용하기  (0) 2018.04.01

Oracle DB를 사용하다보면 항상 찾아보게되는 에러코드


Exception name Oracle Database
error number
SQLCODE Description
ACCESS_INTO_NULL ORA-06530 -6530 Program attempted to assign values to the attributes of an uninitialized object.
CASE_NOT_FOUND ORA-06592 -6592 None of the choices in the WHEN clauses of a CASE statement were selected and there is no ELSE clause.
COLLECTION_IS_NULL ORA-06531 -6531 Program attempted to apply collection methods other than EXISTS to an uninitialized nested table or varray, or program attempted to assign values to the elements of an uninitialized nested table or varray.
CURSOR_ALREADY_OPENED ORA-06511 -6511 Program attempted to open an already opened cursor.
DUP_VAL_ON_INDEX ORA-00001 -1 Program attempted to insert duplicate values in a column that is constrained by a unique index.
INVALID_CURSOR ORA-01001 -1001 There is an illegal cursor operation.
INVALID_NUMBER ORA-01722 -1722 Conversion of character string to number failed.
NO_DATA_FOUND ORA-01403 100 Single row SELECT returned no rows or your program referenced a deleted element in a nested table or an uninitialized element in an associative array (index-by table).
PROGRAM_ERROR ORA-06501 -6501 PL/SQL has an internal problem.
ROWTYPE_MISMATCH ORA-06504 -6504 Host cursor variable and PL/SQL cursor variable involved in an assignment statement have incompatible return types.
STORAGE_ERROR ORA-06500 -6500 PL/SQL ran out of memory or memory was corrupted.
SUBSCRIPT_BEYOND_COUNT ORA-06533 -6533 A program referenced a nested table or varray using an index number larger than the number of elements in the collection.
SUBSCRIPT_OUTSIDE_LIMIT ORA-06532 -6532 A program referenced a nested table or varray element using an index number that is outside the legal range (for example, -1).
SYS_INVALID_ROWID ORA-01410 -1410 The conversion of a character string into a universal rowid failed because the character string does not represent a ROWID value.
TOO_MANY_ROWS ORA-01422 -1422 Single row SELECT returned multiple rows.
VALUE_ERROR ORA-06502 -6502 An arithmetic, conversion, truncation, or size constraint error occurred.
ZERO_DIVIDE ORA-01476 -1476 A program attempted to divide a number by zero.

reference url : https://docs.oracle.com/cd/E11882_01/timesten.112/e21639/exceptions.htm#TTPLS192


'DataBase > Oracle' 카테고리의 다른 글

ORA-01403 no data found, ORA-01422 TOO_MANY_ROWS  (0) 2018.12.16
select for update wait/nowait  (0) 2018.07.22

Simon & Garfunkel – The Sound Of Silence


Hello, darkness, my old friend

I've come to talk with you again

Because a vision softly creeping

Left it's seeds while I was sleeping

And the vision that was planted in my brain

Still remains

Within the sound of silence

In restless dreams I walked alone

Narrow streets of cobblestone

'Neath the halo of a street lamp

I turned my collar to the cold and damp

When my eyes were stabbed by the flash of a neon light

That split the night

And touched the sound of silence

And in the naked light I saw

Ten thousand people, maybe more

People talking without speaking

People hearing without listening

People writing songs that voices never share

And no-one dared

Disturb the sound of silence

'Fools, ' said I, 'you do not know

Silence like a cancer grows

Hear my words that I might teach you

Take my arms that I might reach you, '

But my words like silent raindrops fell

And echoed

In the wells of silence

And the people bowed and prayed

To the neon god they made

And the sign flashed out it's warning

In the words that it was forming

And the sign said 'The words of the prophets are written on the subway walls

And tenement halls'

And whisper'd

In the sound of silence

Songwriters: PAUL SIMON


reference url : http://www.lyricsfreak.com/a/art+garfunkel/the+sound+of+silence_20271694.html

           https://www.youtube.com/watch?v=HZVkk_aQ0BI

피노 누아 : 프랑스어로 소나무를 뜻하는 피노(Pino)와 검정색을 뜻하는 누아(Noir)가 합쳐진 말.

 

와인~닷컴에서 추천했던 피노누아

조금 알고 먹으면 더 맛나지 않을까 해서 

와인설명 동영상을 보고 구입해봤다.


느낌은 :

맑~고 약간 떫은 맛. 입안에 풍기는 포도향 달콤함, 상큼함도 있었다.

여기서 끝........  알콜 15%.(^_^)



아래 url을 참고하면 이런 내용이 있던데  

와인의 라벨에 쓰여 있는 알코올 함유량을 보아라: 만약 피노 누아 와인의 알코올 함유량이 14.5% 이상이라면 포도가 너무 많이 익었을 때 수확해서 만들었을 가능성이 높다. 이것은 와인이 가지고 있는 맛을 손상시킬 수 있다. 또한 좋은 피노 누아 와인은 균형이 굉장히 중요한데 높은 알코올은 균형을 손상시킬 수도 있다. 따라서 알코올 함유량이 14.5% 이하인 피노 누아 와인을 고르는 것이 좋다.

http://news.chosun.com/site/data/html_dir/2015/07/28/2015072802332.html







'Food > Wine' 카테고리의 다른 글

1865 Single Vineyard Cabernet Sauvignon  (0) 2018.04.28

Composer :  PHP 환경에서 사용하는 의존성 관리 도구

설치 => https://getcomposer.org/download/



C:\Users\Administrator>composer


Composer version 1.6.4 2018-04-13 12:04:24

Usage: command [options] [arguments]

Options:

  -h, --help                     Display this help message

  -q, --quiet                    Do not output any message

  -V, --version                  Display this application version

      --ansi                     Force ANSI output

      --no-ansi                  Disable ANSI output

  -n, --no-interaction           Do not ask any interactive question

      --profile                  Display timing and memory usage information

      --no-plugins               Whether to disable plugins.


c:\APMorg\Apache24\htdocs>composer global require squizlabs/php_codesniffer

Changed current directory to C:/Users/Administrator/AppData/Roaming/Composer

Using version ^3.2 for squizlabs/php_codesniffer

./composer.json has been created

Loading composer repositories with package information

Updating dependencies (including require-dev)

Package operations: 1 install, 0 updates, 0 removals

  - Installing squizlabs/php_codesniffer (3.2.3): Downloading (100%)

Writing lock file

Generating autoload files


c:\APMorg\Apache24\htdocs>



C:\APMorg\Apache24\htdocs>composer require --dev squizlabs/php_codesniffer

Using version ^3.2 for squizlabs/php_codesniffer

./composer.json has been created

Loading composer repositories with package information

Updating dependencies (including require-dev)

Package operations: 1 install, 0 updates, 0 removals

  - Installing squizlabs/php_codesniffer (3.2.3): Loading from cache

Writing lock file

Generating autoload files





vscode-phpcs(composer based)를 적용했더니 
내 코드가 마음에 안드나 보다
30개가 문제있다 나오네...
There must be...
invalid...

phpcs(composer based) 상세 내용은 사용해 보면서 이 글에 업데이트 하는걸로 하겠습니다.




phpcs에서 invalid라 warning하는 건

주석 / 문법오류 / 함수사용시 패턴 / 들여쓰기등을 가이드 해주면서 일괄적인 코딩패턴을 유지할 수 있게 해준다. warning없애려고 하다보니 코드가 깔끔해졌다. => 가독성 좋아짐

참고 ) 주석관련 : https://github.com/squizlabs/PHP_CodeSniffer/issues/258







[fileupload0.php]

html tag enctype="multipart/form-data" 

파일을 업로드 할때 파일속 데이타 모두 encode해서 넘겨야 원본파일을 넘길수 있다. 

그래서 enctype="multipart/form-data" 로 지정해서 넘김.

<form enctype="multipart/form-data" action="fileupload1.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="4000000" />
Send File: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>



[fileupload1.php]

php에서 file upload 시키는 함수는 move_uploaded_file


아래는 업로드시 에러발생했을 경우 에러 메시지를 case별로 적어봤다.

bool move_uploaded_file ( string $Filename , string $Destination )


실제 fileupload0에서 submit되면서 fileupload1으로 넘어올때.

$_FILES 에는 업로드 성공여부(temp폴더에 임시 업로드됨)가 모두 담겨 넘어온다.

그 후 temp폴더에서 "move_uploaded_file" 메소드를 이용 개발자가 정의한 폴더로 move시키는 것이다.


$_FILES info : Array

(

    [userfile] => Array

        (

            [name] => uploaded1.jpg

            [type] => image/jpeg

            [tmp_name] => C:\Windows\Temp\phpFD71.tmp

            [error] => 0

            [size] => 68985

        )

)


<?php

$uploaddir = $_SERVER['DOCUMENT_ROOT']."/admin1/test/img/";

print_r($uploadfile = $uploaddir.basename($_FILES['userfile']['name']));

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File was successfully uploaded.\n";
} else {
echo "FileUpload was failed.\n";
}

echo 'info:';
print_r($_FILES);
echo "<br />";

if(UPLOAD_ERR_OK !=$_FILES['userfile']['error'])
{

switch ($_FILES['userfile']['error']) {
case UPLOAD_ERR_INI_SIZE:
$message = "The uploaded file exceeds the upload_max_filesize directive in php.ini";
break;
case UPLOAD_ERR_FORM_SIZE:
$message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form";
break;
case UPLOAD_ERR_PARTIAL:
$message = "The uploaded file was only partially uploaded";
break;
case UPLOAD_ERR_NO_FILE:
$message = "No file was uploaded";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = "Missing a temporary folder";
break;
case UPLOAD_ERR_CANT_WRITE:
$message = "Failed to write file to disk";
break;
case UPLOAD_ERR_EXTENSION:
$message = "File upload stopped by extension";
break;
default:
$message = "Unknown upload error";
break;
}

echo $message;

}
print "</pre>";
?>


자 이렇게 해서 fileupload0.php => fileupload1.php 순서로 실행되면 

아래의 로그를 받아볼 수 있다.

화일은 temp로 임시 저장된 후 다시 최초 지정한 경로로 옮겨간다. 

'프로그래밍 > PHP' 카테고리의 다른 글

unlink(=delete) 메소드 이용하기  (0) 2018.04.22
directory entry 읽어 파일리스트업  (0) 2018.04.20
fileupload 에러메시지 설명  (0) 2018.04.14
angularJS 사용하기  (0) 2018.04.01
json 데이타 사용하기  (0) 2018.03.28

화일 업로드 수행시 에러건에 대한 코드 설명


에러 코드는 PHP로 파일을 업로드 했을때 만들어지는 파일 배열의 error 세그먼트에서 확인할 수 있음.

예) $_FILES['userfile']['error']에서 확인할 수 있음.



UPLOAD_ERR_OK

값: 0; 오류 없이 파일 업로드가 성공했습니다.


UPLOAD_ERR_INI_SIZE

값: 1; 업로드한 파일이 php.ini upload_max_filesize 지시어보다 큽니다.



이 에러의 경우 php.ini의 아래 2곳 수정한다.


; Maximum allowed size for uploaded files.

; http://php.net/upload-max-filesize

upload_max_filesize = 40M


; Maximum size of POST data that PHP will accept.

; Its value may be 0 to disable the limit. It is ignored if POST data reading

; is disabled through enable_post_data_reading.

post_max_size = 40M



UPLOAD_ERR_FORM_SIZE

값: 2; 업로드한 파일이 HTML 폼에서 지정한 MAX_FILE_SIZE 지시어보다 큽니다.


html tag에서 max_file_size를 변경한다. 

Validation순서

first) html의 MAX_FILE_SIZE

second) php.ini 의 upload_max_filesize 

<form enctype="multipart/form-data" action="fileupload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="200000" />
Send File: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>



UPLOAD_ERR_PARTIAL

값: 3; 파일이 일부분만 전송되었습니다.


UPLOAD_ERR_NO_FILE

값: 4; 파일이 전송되지 않았습니다.


UPLOAD_ERR_NO_TMP_DIR

값: 6; 임시 폴더가 없습니다. PHP 4.3.10과 PHP 5.0.3에서 추가.


UPLOAD_ERR_CANT_WRITE

값: 7; 디스크에 파일 쓰기를 실패했습니다. PHP 5.1.0에서 추가.


UPLOAD_ERR_EXTENSION

값: 8; 확장에 의해 파일 업로드가 중지되었습니다. PHP 5.2.0에서 추가.


※출처 : http://php.net/manual/kr/features.file-upload.errors.php

'프로그래밍 > PHP' 카테고리의 다른 글

directory entry 읽어 파일리스트업  (0) 2018.04.20
파일 업로드(move_uploaded_file)  (3) 2018.04.14
angularJS 사용하기  (0) 2018.04.01
json 데이타 사용하기  (0) 2018.03.28
Cookie 사용하기  (0) 2018.03.18

DB를 핸들링하는 server-side 언어, php

반응형웹페이지디자인 : bootstrap

자바스크립트기반 웹어플리케이션 프레임웍 : angularjs

이것 3개 조합해서 웹페이지 만들기.


xmlhttp, ajax, jquery등 다양한 스크립트 형식의 모듈들이 많이 있었지만.

angularjs는 MVC패턴의 자바스크립트 프로그램방식으로 진행된다.

자바스크립트로 진행되지만 스크립트 같지 않은 아주 다양한 기능과 표준화, 개인생각임.. ㅋㅋ

모바일 웹앱만들때 가장 좋은것 같다.


angularjs를 적용한 html 페이지소스.




<html lang="en" ng-app="myApp">
<head>
...
 

        
Full Name: {{firstName + " " + lastName}}

Calc using AngularJs, expression: {{ 5 + 5 }}

{{ y.help_topic_id }} : {{ y.name }}
… /*angularjs 스크립트 적용부분은 웹페이지 맨 하단에 적용*/




angularjs 문법이 궁금하면, https://www.w3schools.com/angular/default.asp

'프로그래밍 > PHP' 카테고리의 다른 글

파일 업로드(move_uploaded_file)  (3) 2018.04.14
fileupload 에러메시지 설명  (0) 2018.04.14
json 데이타 사용하기  (0) 2018.03.28
Cookie 사용하기  (0) 2018.03.18
Session 사용하기  (0) 2018.03.17

"H.I." : a Japanese friend who lives in Osaka. 



In this morning, I talked with "H.I." about daily lives using Facebook video messenger.

It’s the first time to use this video messenger.

We talked about these days events like ‘Cherry blossoms festivals’ and ‘Learning other languages’.

"H.I." loves to study Korean and talks with Korean people using Korean but there are not enough chances.

I suggest ‘Phone Speaking’ to him. We will talk via the internet protocol video once a week.

We can share languages such as English, Korean, Japanese.

OK, let’s try. How about Japanese? 

Do not be greedy!

'other Language > english essay' 카테고리의 다른 글

english dialogue scripts  (0) 2018.03.28

인체감지센서,LED로 센서등 만들기

 

LED를 멀티로 5개까지 on/off처리함

불 밝기를 위해서. 현관문 앞에 달고 싶은데 선이 지저분하다. 사진처럼

선 처리를 좀 깔끔하게 할 방법은 없을까?

 

 

아두이노 인체감지센서와 LED제어 프로그램 소스

소스보다 LED를 멀티로 on 시켜보자 하여 아래 led09~led12까지 추가함.

 

HsensorLed.ino

	
int led09 = 9;       // ledPin 출력을 09번
int led10 = 10;      // ledPin 출력을 10번
int led11 = 11;      // ledPin 출력을 11번
int led12 = 12;      // ledPin 출력을 12번
int led13 = 13;      // ledPin 출력을 13번
int sensorInput = 2;     // PIR센서 입력을 inputPin 2번에 연결
int pirState = LOW;   // 초기값은 PIR 센서값이 없다고 가정
int val = 0;          // 핀의 상태를 판독하기 위한 변수를 선언
int itime = 0;

void setup() {

  pinMode(led09, OUTPUT);     //led 포트를 출력모드로
  pinMode(led10, OUTPUT);     //led 포트를 출력모드로
  pinMode(led11, OUTPUT);     //led 포트를 출력모드로
  pinMode(led12, OUTPUT);     //led 포트를 출력모드로
  pinMode(led13, OUTPUT);     //led 포트를 출력모드로
  pinMode(sensorInput, INPUT);    //센서입력 포트를 입력모드로
  Serial.begin(9600);         // 9600속도로 시리얼 통신 시작 
}


void loop(){
  val = digitalRead(sensorInput);   

  if (val == HIGH)
  {            
      digitalWrite(led09, HIGH);   
      digitalWrite(led10, HIGH);   
      digitalWrite(led11, HIGH);   
      digitalWrite(led12, HIGH);   
      digitalWrite(led13, HIGH);   
      
      if(pirState == LOW){
         pirState = HIGH;
         itime ++;
         
      Serial.println("Somebody detected~! : ");
      delay(10000);           // 10초 지연
      } 
  }
  else {
      if(pirState == HIGH){
        digitalWrite(led09, LOW);        
        digitalWrite(led10, LOW);        
        digitalWrite(led11, LOW);                        
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);

        pirState = LOW;      
        Serial.println("Nobody detected~!");
        }
    }
}


회도로는 검색엔진에서 “아두이노 인체감지센서 led” 이렇게 검색하면 여러blog내용이 나옴.

회로도 작성툴, “fritzing”가 있는데 다음엔 이걸로 작성해보는걸로..




고장난 센서등의 안쪽 부속품들을 모두 들어내고 그 안에 회로판LED를 넣어 아래처럼 만듦




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

선정리로 고민하다. 기존 무선센서의 led와 센서를 이용하고 건전지 전력을 집전기로 바꾸기만 해서 간단해 해봤음

전력을 use용 얇은 선으로 대체함

use는 [ 5V(+) | Data(+) | Data(-) | GND ] 4개의 선으로 되어있어 여기서 5V(+)/GND를 사용해서 연결 납땜하면 된다.



 






'IOT > 아듀이노' 카테고리의 다른 글

아듀이노 dc모터제어 4 wheel  (0) 2019.09.07
back light  (0) 2019.03.02
크리스마스 트리 만들기(led strip (네오픽셀))  (0) 2018.12.23
미세먼지 센서(GP2Y1010AU0F) 로 측정하기  (3) 2018.06.11
DIY-공기청정기  (0) 2018.06.01

+ Recent posts