요즘은 정말 스택오버플로우의 코드조각을 많이 참고합니다.

2000년에 만들어진 cos.jar를 보내드리고, 아파치 커먼스의 업로드 컴포넌트를 사용해 봤습니다.


https://github.com/kenu/oksample/tree/master/commons-fileup


/**
* code from: http://stackoverflow.com/questions/15432024/how-to-upload-a-file-using-commons-file-upload-streaming-api
*/
@WebServlet("/upload4")
public class UploadServlet4 extends HttpServlet {
        private static final long serialVersionUID = 1L;

        protected void doPost(HttpServletRequest request,
                        HttpServletResponse response) throws ServletException, IOException {
                PrintWriter out = response.getWriter();
                response.setHeader("Content-Type", "text/html");
                out.print("Request content length is " + request.getContentLength()
                                + "<br/>");
                out.print("Request content type is "
                                + request.getHeader("Content-Type") + "<br/>");
                boolean isMultipart = ServletFileUpload.isMultipartContent(request);
                if (isMultipart) {
                        ServletFileUpload upload = new ServletFileUpload();
                        try {
                                FileItemIterator iter = upload.getItemIterator(request);
                                FileItemStream item = null;
                                String name = "";
                                InputStream stream = null;
                                while (iter.hasNext()) {
                                        item = iter.next();
                                        name = item.getFieldName();
                                        stream = item.openStream();
                                        if (item.isFormField()) {
                                                out.write("Form field " + name + ": "
                                                                + Streams.asString(stream) + "<br/>");
                                        } else {
                                                name = item.getName();
                                                System.out.println("name==" + name);
                                                if (name != null && !"".equals(name)) {
                                                        String fileName = new File(item.getName())
                                                                        .getName();
                                                        out.write("Client file: " + item.getName()
                                                                        + " <br/>with file name " + fileName
                                                                        + " was uploaded.<br/>");
                                                        File file = new File(getServletContext()
                                                                        .getRealPath("/" + fileName));
                                                        FileOutputStream fos = new FileOutputStream(file);
                                                        long fileSize = Streams.copy(stream, fos, true);
                                                        out.write("Size was " + fileSize + " bytes <br/>");
                                                        out.write("File Path is " + file.getPath()
                                                                        + "<br/>");
                                                }
                                        }
                                }
                        } catch (FileUploadException fue) {
                                out.write("fue!!!!!!!!!");
                        }
                }
        }
}


프로그래밍 교육 처음에 가장 넘기 힘든 것이 개발환경을 구축하는 것입니다. 자바의 경우 JDK 설치하고, CLASSPATH 설정하고, 등등등

그래서 저는 자바스크립트가 브라우저로 쉽게 시작할 수 있는 것이라 생각하고 있었습니다.


그런데 진짜가 나타났습니다.


http://www.processing.org


개발환경을 자동 지원해줍니다. 자바스크립트의 경우, 크롬브라우저가 바로 실행되고, 자바는 애플릿으로 바로 뜹니다. 안드로이드는 이클립스가 없이도 SDK만 설치해서 연결하면 됩니다. 현재는 3가지 언어를 지원합니다. 

자체적으로 Processing.js 라는 언어를 사용하고 있는데, 몇 권의 서적도 나와있습니다.


"Processing is a programming language, development environment, and online community. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. Initially created to serve as a software sketchbook and to teach computer programming fundamentals within a visual context, Processing evolved into a development tool for professionals. Today, there are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning, prototyping, and production."

프로세싱은 프로그래밍 언어, 개발 환경, 온라인 커뮤니티입니다. 2001년부터, 프로세싱은 기술을 이용한 시각 예술과 시각화 분야에서 소프트웨어 역량을 진흥시켜 왔습니다. 초기에 소프트웨어 스케치북으로 사용되거나, 시각화 영역에서 컴퓨터 프로그래밍 기초를 가르치기 위해 만들어졌지만, 프로세싱은 전문가들을 위한 개발 도구로 진화했습니다. 오늘날에는, 프로세싱을 사용해서 배우고, 프로토타이핑하고, 제품을 만드는 수많은 학생, 예술가, 디자이너, 연구원, 동호회원이 있습니다.




다음과 같은 특징이 있습니다.

  • » Free to download and open source
  • » Interactive programs with 2D, 3D or PDF output
  • » OpenGL integration for accelerated 3D
  • » For GNU/Linux, Mac OS X, and Windows
  • » Over 100 libraries extend the core software
  • » Well documented, with many books available


윈도우, 맥, 리눅스 OS를 지원합니다.


jdk가 설치되어 있지 않아도, java applet이 실행됩니다. 배포 패키지에 java가 들어가 있기 때문이죠.

processing.exe를 실행하면 다음과 같은 스플래시 화면이 뜹니다. 만든 분 이름이 보이네요. Ben Fry, Casey Reas. 오픈 프로젝트이고요.


이클립스보다 메뉴가 아주 단순합니다. 툴바의 아이콘이 실행, 정지, 새파일, Open, Save, Export Application 입니다. 우측에 작업중인 언어가 Java로 표시되어 있습니다.  


하지만 줘도 못먹는 화면입니다. 실행 버튼 클릭하고 아래 콘솔을 보면 null (멍~~~)해집니다. 당.황.하셨어요~~ 모드죠.

그리고, 어디서 많이 봤다 싶었는데, 아두이노의 개발환경과 똑같습니다.


팁을 하나 알려드리자면, 메뉴에서 File > Examples... 가 있습니다.


여기에 있는 코드를 보고 학습을 하면 될 것입니다.



개발 도구의 우측에 Java 라고 쓰여진 버튼을 확장 시켜서 다른 언어 모드를 추가할 수 있습니다.


안드로이드, 커피스크립트, 자바스크립트, PDE X, Tweak Mode 를 추가할 수 있습니다.



새로운 개발 플랫폼, 흥미롭습니다.



하나 더,

프로세싱을 통해서 만들어진 것들의 전람회입니다.

http://www.processing.org/exhibition/


2000년까지 만들어지고, 현재도 쓰이고 있는 언어들입니다. 연도는 위키피디어에 기록된 것입니다.




프로그래밍 언어의 역사

  • 기계식 컴퓨터
    • Piano Player
    • 차분 기관
  • 기계어
    • Machine Language
    • Machine Code
  • 어셈블리어
    • 1950s
    • Assembly Language
  • Fortran
    • 1957
    • The IBM Mathematical Formula Translating System
  • Lisp
    • 1958
    • LISt Processing
  • COBOL
    • 1959
    • COmmon Business Oriented Language
  • BASIC
    • 1964
    • Beginner's All-purpose Symbolic Instruction Code
  • Pascal
    • 1970
  • C
    • 1972
  • C++
    • 1983
  • Python
    • 1991
  • Java
    • 1995
  • JavaScript
    • 1995
  • C#
    • 2000  


+ Recent posts