반응형
반응형
기한 없는 목표는 탁상공론이다.
기한이 없으면
일을 진행시켜주는 에너지도 발생하지 않는다.
당신의 삶을 불발탄으로 만들지 않으려면
분명한 기한을 정하라.
기한을 정하지 않는 목표는 총알 없는 총이다.
-브라이언 트레이시

목표라는 단어 자체에 기한이 포함되어 있는 것입니다.
다시 말해 기한이 있어야만 목표라 할 수 있습니다.
기한이 있어야 목표가 뚜렷해져,
에너지가 생기고 몰입하게 되며,
그 결과로 성과가 나오는 것입니다.
기한 없는 목표는
아무런 쓸모가 없는 펑크 난 타이어와 같습니다.

반응형
반응형

http://html5-demos.appspot.com/



반응형
반응형

Drag and drop a folder onto Chrome now available

As web apps evolve, you might have found it handy to let users drag and drop files from the desktop onto the browser to edit, upload, share, etc. But unfortunately, we’ve been unable to drag and drop folders onto web pages. Luckily, beginning with Chrome 21, this issue will be addressed (already available in the Chrome dev channel).

Passing multiple files with drag and drop

Let’s look at a code sample of existing drag and drop.

<div id=”dropzone”></div>

var dropzone = document.getElementById('dropzone');
dropzone.ondrop = function(e) {
  var length = e.dataTransfer.files.length;
  for (var i = 0; i < length; i++) {
    var file = e.dataTransfer.files[i];
    ... // do whatever you want
  }
};

In this example, you can actually drag and drop a file or files from the desktop to your browser, but when you try to pass a folder, notice that it will be either rejected or treated as a File object resulting in a failure.

How to handle dropped folders

Chrome 21 allows you to drop a folder or multiple folders into the browser window. To handle these, you need to change the way you handle dropped objects.

<div id=”dropzone”></div>

var dropzone = document.getElementById('dropzone');
dropzone.ondrop = function(e) {
  var length = e.dataTransfer.items.length;
  for (var i = 0; i < length; i++) {
    var entry = e.dataTransfer.items[i].webkitGetAsEntry();
    if (entry.isFile) {
      ... // do whatever you want
    } else if (entry.isDirectory) {
      ... // do whatever you want
    }
  }
};

Notice that a big difference here is that you can treat a dropped object as Entry (FileEntry or DirectoryEntry) by using new function called getAsEntry (webkitGetAsEntry).
After obtaining access to the Entry object, you can use standard file handling methods that were introduced in the FileSystem API specification. For example, this example shows how you can detect if a dropped object is a file or a directory by examining the .isFile (or the .isDirectory) field.

For further information regarding the FileSystem API, read Exploring the FileSystem APIs, regarding new drag and drop capability, read this document. Of course, these features are open standards or are waiting to become one soon.

반응형
반응형

 Integrating input[type="file"] with the Filesystem API

 - http://updates.html5rocks.com/tag/file-access


: http://html5-demos.appspot.com/static/dnd/all_types_of_import.html

Launch Demo

In a recent post, Eiji Kitamura highlighted a subtle, yet powerful new feature in the drag and drop APIs; the ability to drag in folders and retrieve them as HTML5 Filesystem API FileEntry and DirectoryEntry objects (done by accessing a new method on the DataTransferItem, .webkitGetAsEntry()).

What's remarkably cool about the .webkitGetAsEntry() extension is how elegant it makes importing files and entire folders. Once you have a FileEntry or DirectoryEntry from a drop event, it's a matter of using the Filesystem API's copyTo() to get it imported into your app.

An example of copying multiple dropped folders over to the filesystem:

var fs = null; // Cache filesystem for later.

// Not shown: setup drag and drop event listeners.
function onDrop(e) {
  e.preventDefault();
  e.stopPropagation();

  var items = e.dataTransfer.items;

  for (var i = 0, item; item = items[i]; ++i) { 
    var entry = item.webkitGetAsEntry();

    // Folder? Copy the DirectoryEntry over to our local filesystem.
    if (entry.isDirectory) {
      entry.copyTo(fs.root, null, function(copiedEntry) {
        // ...
      }, onError);
    }
  }
}

window.webkitRequestFileSystem(TEMPORARY, 1024 * 1204, function(fileSystem) {
  fs = fileSystem;
}, function(e) {
  console.log('Error', e);
});

Very nice! Again, the simplicity comes from integrating DnD with the Filesystem API calls.

Taking this one step further, we also have the ability to drag and drop a folder and/or files onto a normal <input type="file">, then access the entries as Filesystem directory or file entries. That is done through .webkitEntries:

<input type="file" multiple>

function onChange(e) {
  e.stopPropagation();
  e.preventDefault();

  var entries = e.target.webkitEntries; // Get all dropped items as FS API entries.

  [].forEach.call(entries, function(entry) {

    // Copy the entry into our local filesystem.
    entry.copyTo(fs.root, null, function(copiedEntry) {
      ...
    }, onError);

  });
}

document.querySelector('input[type="file"]').addEventListener('change', onChange);

I've put together a photo gallery demo to demonstrate these different techniques for importing files/folders.

Launch Demo

To learn more about the HTML5 Filesystem API, see Exploring the Filesystem APIs.

반응형
반응형

어떤 일을 달성하기로 결심했으면 그 어떤 지겨움과 혐오감도 불사하고 완수하라.

고단한 일을 해낸 데서 오는 자신감은 실로 엄청나다.


- 아놀드 베넷

반응형
반응형
성공한 상인과 그렇지 못한 상인의 차이점이 있다.
성공한 상인은 어제보다 지혜롭고, 어제보다 너그러우며,
어제보다 삶을 잘 알고, 어제보다 잘 베풀며,
어제보다 여유롭다는 것이다.
-리카싱 청쿵그룹 회장

상인에 국한되지 않고 성공한 모든 사람의 공통점일 것입니다.
남과의 경쟁이 아닌,
어제의 나 보다 조금이라도 더 좋아지려는 지난한 노력,
나 혼자만이 아닌 세상과 더불어 잘 살아가려는 노력이
우리에게 행복한 성공을 가져다주는 토대가 된다는 말씀, 잘 새겨봅니다.

반응형

+ Recent posts