id="elephant"src="about:blank"alt="A close up of an elephant">src="elephant.png"alt="A close up of an elephant">A mighty big elephant, and mighty close too!
BlobBuilder(提供接口来构建Blob对象,Blob对象是BLOB (binary large object),二进制大对象,是一个可以存储二进制文件的容器。在计算机中,BLOB常常是数据库中用来存储二进制文件的字段类型。BLOB是一个大文件,典型的BLOB是一张图片或一个声音文件,由于它们的尺寸,必须使用特殊的方式来处理(例如:上传、下载或者存放到一个数据库)。)
// Getting a file through XMLHttpRequest as an arraybuffer and creating a Blobvar rhinoStorage = localStorage.getItem("rhino"),
rhino = document.getElementById("rhino");if(rhinoStorage){// Reuse existing Data URL from localStorage
rhino.setAttribute("src", rhinoStorage);}else{// Create XHR, BlobBuilder and FileReader objectsvar xhr =newXMLHttpRequest(),
fileReader =newFileReader();
xhr.open("GET","rhino.png",true);// Set the responseType to arraybuffer. "blob" is an option too, rendering BlobBuilder unnecessary, but the support for "blob" is not widespread enough yet
xhr.responseType ="blob";
xhr.addEventListener("load",function(){if(xhr.status ===200){// onload needed since Google Chrome doesn't support addEventListener for FileReader
fileReader.onload =function(evt){// Read out file contents as a Data URLvar result = evt.target.result;// Set image src to Data URL
rhino.setAttribute("src", result);// Store Data URL in localStoragetry{
localStorage.setItem("rhino", result);}catch(e){
console.log("Storage failed: "+ e);}};// Load blob as Data URL
fileReader.readAsDataURL(xhr.response);}},false);// Send XHR
xhr.send();}
/*
*处理例外
*/
--例外简介
--处理例外-传递例外
declare
v_ename emp.ename%TYPE;
begin
SELECT ename INTO v_ename FROM emp
where empno=&no;
dbms_output.put_line('雇员名:'||v_ename);
exceptio
import java.util.ArrayList;
import java.util.List;
public class KickOutBadGuys {
/**
* 题目:13个坏人和13个好人站成一圈,数到7就从圈里面踢出一个来,要求把所有坏人都给踢出来,所有好人都留在圈里。请找出初始时坏人站的位置。
* Maybe you can find out
Redis.conf配置文件及相关项说明
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
public static String convertInputStreamToString(InputStream is) {
StringBuilder result = new StringBuilder();
if (is != null)
try {
InputStreamReader inputReader = new InputStreamRead
原文:
http://www.sitepoint.com/3-new-javascript-apis-may-want-follow/?utm_source=html5weekly&utm_medium=email
本文中,介绍3个仍然处于草稿阶段,但应该值得关注的Javascript API.
1) Web Alarm API
&