반응형

 

 

http://stackoverflow.com/questions/24330014/bodyparser-is-deprecated-express-4

 

express/connect top-level generic

This example demonstrates adding a generic JSON and URL-encoded parser as a top-level middleware, which will parse the bodies of all incoming requests. This is the simplest setup.

var express = require('express')
var bodyParser = require('body-parser')

var app = express()

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

app.use(function (req, res) {
  res.setHeader('Content-Type', 'text/plain')
  res.write('you posted:\n')
  res.end(JSON.stringify(req.body, null, 2))
})

express route-specific

This example demonstrates adding body parsers specifically to the routes that need them. In general, this is the most recommend way to use body-parser with express.

var express = require('express')
var bodyParser = require('body-parser')

var app = express()

// create application/json parser
var jsonParser = bodyParser.json()

// create application/x-www-form-urlencoded parser
var urlencodedParser = bodyParser.urlencoded({ extended: false })

// POST /login gets urlencoded bodies
app.post('/login', urlencodedParser, function (req, res) {
  if (!req.body) return res.sendStatus(400)
  res.send('welcome, ' + req.body.username)
})

// POST /api/users gets JSON bodies
app.post('/api/users', jsonParser, function (req, res) {
  if (!req.body) return res.sendStatus(400)
  // create user in req.body
})

change content-type for parsers

All the parsers accept a type option which allows you to change the Content-Type that the middleware will parse.

// parse various different custom JSON types as JSON
app.use(bodyParser.json({ type: 'application/*+json' }))

// parse some custom thing into a Buffer
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))

// parse an HTML body into a string
app.use(bodyParser.text({ type: 'text/html' }))
반응형
반응형

 

 

위 오류가 날때...

 

 

 

app.router 를 use 하는 라인을 지워주면 된다.

예전에는 넣어줘야되는데 최신버젼에선 없어졌다고 한다.

반응형
반응형

/var/log/error.log 를 보니 evasive:20 persimission denind 오류가 떠있었다.

그래서 a2dismod evasive 를 하니 일단 오류가 더이상 뜨진 않는다.

이건 극단적인 방법이고, mods-enabled 에서 evasive.conf 를 열어 제한 수를 조정해주는것도 한 방법이 되겠다.

반응형
반응형

- Project Explorer 뷰 - Project 선택 - Properties

- Web Project Settings - Context root 를 / 로 변경

- 메뉴 - Project - Clean

- Servers 뷰에서 tomcat 선택, + 펼침, 해당 프로젝트 선택 후 삭제

- Servers 뷰에서 tomcat 선택 - 마우스 우클릭, Clean

- Servers 뷰에서 tomcat 선택 - 마우스 우클릭, Add and Remove

- 해당 프로젝트 선택후 Add

반응형
반응형

iBook 에서 이미지를 클릭 했을때 동적으로 div를 생성하고 그 안에 background-image 스타일 지정을 해주었으나 도통 빈 칸만 뜨고 이미지가 출력되지 않았다.

 

콘솔로그를 찍어볼 수 없는 거지같은 테스트환경이어서 html 마크업으로 일일히 확인해본 결과 이미지를 불러올때 ibooksimg:// 라는 프로토콜을 사용해야 하지만 ibooks:// 로 불러오면서 이미지가 출력되지 않은 것이었다.

 

var str = $("img").get(0).src;

str = str.replace("ibooks://", "ibooksimg://");

 

로 간단히 replace 치환처리 하니 정상 출력되었다.

반응형
반응형

이미지의 원본 크기를 구하기 위해서 $("img").get(0).naturalWidth 이나 naturalHeight 를 변수에 초기화했을때, 0 값이 떨어진다. 이러한 현상을 막기 위해서

 

$("img").load(function(){

var img = {
  width:$(this).get(0).naturalWidth,

  height:$(this).get(0).naturalHeight

});

 

등으로 사용할 수 있다. 그런데 여기서 load 된 값이 캐슁처리되면서 더이상 load가 실행되지 않는다.

이때 아래와 같은 방법으로 대응가능하다.

 

$("img").one("load",function(){

var img = {
  width:$(this).get(0).naturalWidth,

  height:$(this).get(0).naturalHeight

}).each(function(){

if(this.complete){

$(this).trigger("load");

}

});

 

예를 들어 문서가 로드된 상태에서 이미지 목록이 갱신 되었을 때 해당 목록에 있는 이미지들의 원본값을 배열에 초기화하고 싶을때 사용될 수 있겠다.

반응형

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

지정된 영역만 인쇄하기  (0) 2015.06.15
Javascript iBook EPUB 3.0 Images not working  (0) 2015.05.27
jQuery Animation Rotate  (0) 2015.05.06
Javascript 모바일 체크  (0) 2015.04.23
Javascript Favicon 적용  (0) 2015.04.23
반응형

좌표 검색 페이지

http://map.yjhoon.com/naver/

 

 

 

반응형
반응형
  1. [시작]
  2. 그림 축소그림 확대
  3.  
  4. 2670598
  5. 을 클릭하고 검색 창에 regedit를 입력하세요.
  6. 그림 축소그림 확대
  7.  
  8. 2670599

    1. 프로그램 아래 [regedit]를 마우스 오른쪽 단추로 클릭한 다음 [관리자 권한으로 실행]을 클릭하세요.
    2. 그림 축소그림 확대
    3. 2670600


    4. 표 축소표 확대
    1. 그림 축소그림 확대
    주의사항
    사용자 계정 컨트롤 메시지가 나타나면 관리자 암호를 입력하거나 [예]를 클릭합니다.
    1. 레지스트리 편집기 화면에서 아래 경로로 이동하세요.
      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background

      그림 축소그림 확대
      2670602

    2. OEMBackground를 두 번 클릭하여 값을 1로 변경하세요.
      만약, OEMBackground가 없는 경우는
      [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background]를 오른쪽 마우스를 클릭하여 새로 만들기 DWORD(32비트) 값추가하면 됩니다.
      그림 축소그림 확대
      2670603

    1. 윈도우 탐색기를 실행하고 다음 위치로 이동합니다. C:\Windows\System32\oobe\info\background 폴더로 이동합니다. 만약 이 위치에 해당폴더가 없는 경우에는 폴더를 생성하고 동일한 이름으로 변경하면 됩니다.
    2. 그림 축소그림 확대
    3. 2670604


    4. 표 축소표 확대
    1. 그림 축소그림 확대
    주의사항
    폴더를 추가하거나 이름 변경시 사용자 계정 컨트롤 메시지가 나타나면 관리자 암호를 입력하거나 [예]를 클릭합니다.

    1. C:\Windows\System32\oobe\info\backgrounds 위치에 로그온 화면으로 변경하려는 이미지 파일의 이름을 backgroundDefault.jpg 로 지정하고 이동시키세요.
    2. 그림 축소그림 확대
    3. 2670606

    4. 표 축소표 확대
    1. 그림 축소그림 확대
    주의사항

    • 폴더를 추가하거나 이름 변경시 사용자 계정 컨트롤 메시지가 나타나면 관리자 암호를 입력하거나 [예]를 클릭합니다.
    • 로그온 화면으로 설정될 이미지의 파일의 크기는 256KB 미만의 이미지를 사용해야 합니다.


    1. [시작
    2. 그림 축소그림 확대
    3. 2670609
    4. ], [시스템 종료], [로그오프]를 차례대로 클릭하여 컴퓨터를 로그오프하면 설정한 이미지로 로그온 화면이 변경된 것을 확인할 수 있습니다.
    5. 그림 축소그림 확대
    6. 2670610


    7. 그림 축소그림 확대
    2670611
  • 반응형

    + Recent posts