Mustache学习
Mustache是基于JavaScript的一款模版Web引擎,Web 模板引擎是为了使用户界面与业务数据(内容)分离而产生的,它可以生成特定格式的文档,通常是标准的 HTML 文档。
一、Mustache简介
Mustache 是一个 logic-less (轻逻辑)模板解析引擎,它的优势在于可以应用在 Javascript、PHP、Python、Perl 等多种编程语言中。
二、Mustache语法
1、{{keyName}}
2、{{#keyName}} {{/keyName}}
3、{{^keyName}} {{/keyName}}
4、{{.}}
5、{{<partials}}
6、{{{keyName}}}
7、{{!comments}}
三、demo介绍
1、{{keyName}}
var data={
name:"张三",
age:,
sex:"girl"
}
var template="My name is {{name}},I'm {{age}} years old,I'm a {{sex}} !";
var view=Mustache.render(template,data);
document.getElementsByTagName("body")[].innerHTML=view;
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAAAyCAIAAACrhDX5AAAEzklEQVR4nO2b3bGkOAyFiYuAiIc4JgCeNocNgAw2g3liH2iwJEtCTZsCVOcrV03TgLGPdPxD3+nm//6ioKAkKN3tLUBBQWlSYGYUlCSl+/PPvygoKAlKtwAAUgAzA5AEmBmAJMDMACQBZgYgCTAzAEmAmQFIAswMQBJgZgCSADMDkASYGYAkwMwAJAFmDjGPfTdM8ivxDQC34ph5Hvuu67p+nOWZaTBOPJNp6KQTHT7d3hmmpTbzNHRdN4zzrN5iYCjZjzP5cBLWBF6Rc+r52LFTFWum5484KRfMxnnsv8naZVkiZtYVe2FenGD3MDXzqkubWblN8q0t+tz+Cdunfc6pV/BSMzvcaOZhGKQo09ANw2O1akpl5nUca+eGPeeUdfxXrWQ3ly+cU+/grJl/0fNa7jTzNAk3T0PXjyMdAckjNQ3XSz7TubBC+ZZ+X55MFodktVhlp7+G5G3ka2JFLrFoJmaex77xEFYychrWf7/pe6Da0CkniI68euxKflDtXMGr6siDWNNITSQF9d79qqfRO7fVI3l6uUsIEt30fbc5XJYlYuaFu3k9mtRm6+Mh22HPY79/prfS78VufVOeLhzpZ3aXlsLkOWK8W7e+6uBTa3HFQF9bK9z3g1qd+UwPkRJER14zdusT9qOI4PJ7elCeU1/imnnjlJ527w5abZiZVnCvmVkif5xNRBNWqbvNBS768UHC9Kh+uNVQrRoUAci3EYWUdpn8Ok8byRfou1+nl32B8a5kpCGvHTtxVyglq7yp54qq43pX2ujp9E7WbDRJmtlaazhcY2bq5q2btIH7U41VqGiV1shtsaIPmNahETl33jne9KqTMN0zazcH3mer9jrsgn+oV2hc4XZdCWJQXhE7LdwHWVlXy8drXXh/z2xVfk7Pw+lbPl2m3EH+W0++wMwlv/chi4lGBD8Y9fkh27lUM3PMzAr+IlIYr5ZL+LLsvLgUbWibfGfmZHoBD6Irrxk7JQkPBNc6tVfy+WBccpWZ7d4dtvrxZt5SeB57Emi2llr30ebso3TGkfX0zKxjynKU4Xz3WD61ewnWzsxr/qktc07xpvAgOvJ6rfKSUBf8aTNzUPOLZ+YTxMy8JvPIltti59H3VpIbndGWY9+ZOaqLc5lfg2bmtnZuOpM4Jg+oVAfRFseJ3YGk6tkze2b9vVQTPb3e2TWzJj3azNuaix5Wb4lCvwzp4ZnY28lwAEREjZlWvAATLyMcX5Zpimw0+nGOvIaK0W4m0bvhnNKvZReb8jqxE+EOCl4NBzRgSqzFM1k9bWdm60l6q9uZ+ZvIbUTNLMYnKZo3W0X2zNsbciVXDg75FtdcTfP0EjtiRwBqZvqXMtZwHYF0oEXyGS/fev57qjzl99eoXDREi12drEHByWXWu1/20PKjbmM93d45rV5/zC7teJSZv6Hspt+PllWT8k72kziGYXTK2HDRSusX3hvEh+h54Qo6RBszvzcNYrTu3/bnSY/ixUG8RU85q0ffx17Hz2aOvSoFlMd5+eVBvE1P/uvd7YsD/H9mAJIAMwOQBJgZgCTAzAAkAWYGIAkwMwBJgJkBSALMDEASYGYAkgAzA5AEmBmAJMDMACQBZgYgCTAzAEmAmQFIAswMQBJgZgCSADMDkIT/AaqtvCEJWgl+AAAAAElFTkSuQmCC" alt="" />
分析:{{keyName}}中的{{}}就是Mustache的标识符,keyName就是data对象中的键名,这句的作用是直接输出与键名匹配的键值!
2、{{#keyName}} {{/keyName}} 有两种用法:
第一种:
以"#"开始,"/"结束,被它们所包围的标签为进行循环多次渲染,keyName为需要循环渲染的数组名,代码如下:
注意:这里的keyName表示需要表示需要循环渲染到html模版中的数组的数组名,
var obj={
result:[
{name:null,age:22,sex:"女"},
{name:"李四",age:22,sex:"男"},
{name:"王五",age:22,sex:"男"}]
};
var template="<table>"
+"<thead><tr><td>姓名</td><td>年龄</td><td>性别</td></tr></thead>"
+"<tbody>" +
"{{#result}}" +
"<tr>" +
"<td>{{name}}</td>" +
"<td>{{age}}</td>" +
"<td>{{sex}}</td>" +
"{{/name}}</tr>" +
"{{/result}}" +
"</tbody>"
+"</table>";
var view=Mustache.render(template,obj);
document.getElementsByTagName("body")[0].innerHTML=view;
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABzCAIAAADfWp0rAAAFPklEQVR4nO2d0aGkIAxFqcuCqMdqaMZiZj9UBElCcIQw++792n2OAjkEGLk67gOZyllX4K8LAIwFAMYCAGMBgLEAwFgAYCwAMBYAGAsAjAUAxlIC2NbFLetGH/BBOjV4R58qKnhXuW55wr2Uet3YzxBXU4qNFCM9gPyqZ4AqjdzW5Un4G1pxhooIWfCuSjGvfyyXBhC8K3X7XCcAwectifWWAGzrQlSYq7n+xOz0BMCpoz7BO7/WkuAoar/Y1RgWQP7XK9rx0OsACurLuvERyjsT0/9qaXGnLY4IXAacOVvkblaNxfvF+bDns8CdwTICwFlOWoWk25MZsLdkWbcylgKXQ1Sw2wEkBXNJGryLKbKta0iv0DwE9QUQW7O3JZ0gidYlh7ctJL19r391ytbkflIUFZLV7x36OIkMyl7zbCy9PjPREJSVG/zeuiuKipXGldn1igUvjnBFx+PKK4aMop5HoM6/345LqyDyWE8AV096sNQ7+2jTkrK4KBuP+MmdnDQSKYuqFMgd6wog+H0YiYXQmZ/FWdGJ+ci0A4idpHUBfxUl1TgOUuzBvnNALL28ctmDdjr5VC20W3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BrAMCYJUsJgH8GQDoZxqy6dACYBonthDFLJR0Awfwm/PoejFkKqQBwdefbBGMWoUZvKPVTsjbJrdVPGbP+J8GYBX0AwFwAYCwAMBYAGAsAjAUAxgIAYwGAsQDAWABgLAAwFgAY6x8AEBpERNwPdgAAAABJRU5ErkJggg==" alt="" />
上面的代码对result数组进行了循环渲染,以{{#result}}开始,以{{/result}}结束,中间包裹着需要循环绑定数据的标签!
第二种:
{{#keyName}} {{/keyName}}还有第二种用法,当keyName表示键名的时候,代码如下:
注意:这里的keyName表示键名,并不表示需要循环的数组名
var obj={
result:[
{name:null,age:22,sex:"女"},
{name:"李四",age:22,sex:"男"},
{name:"王五",age:22,sex:"男"}]
};
var template="<table>"
+"<thead><tr><td>姓名</td><td>年龄</td><td>性别</td></tr></thead>"
+"<tbody>" +
"{{#result}}" +
"<tr>" +
"<td>{{#name}}{{name}}</td>" +
"<td>{{age}}</td>" +
"<td>{{sex}}{{/name}}</td>" +
"</tr>" +
"{{/result}}" +
"</tbody>"
+"</table>";
var view=Mustache.render(template,obj);
document.getElementsByTagName("body")[0].innerHTML=view;
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJoAAABnCAIAAAB3kcyHAAAEwElEQVR4nO2dUYKrIAxFXRcLYj2uhs24GOeDiiBJCKhTTe/5eq9WxRyItIbOtAJDTN9uALgS6DQFdJoCOk0BnaaATlNApymg0xTQaQroNIVS5zK7yc0LvcEHadfgJ3pXkeCnxnHrHY5nabeNfQ9xNCVspP4Fvc6yjVu4GyFbZjcisyMmW+AJAcFPzT5Rtj+dl9YZ/FRzeN8rdAZfxiVFQdK5zI64fC4O+h2L3TOdG5/2BD/5uTVAP6eKB9svhtVZvrq7S5serrPqkW5e+HiXHZ0ZG60he+w7Yu7jRueWT6q8UjTDee8mH2KuEXoRI/l9Ote17rXZkCRHZ4yLm5fajGD5A6WuX2d2Yi6BBD+l4bvMc8iP0J1s36QzxSZGJp+mELHKNi9LyEZijEZz4qTJctmpqADPPg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1cpHgI4Sy6ZNcvkaF+gtDz05jP1w2bQmUTYOHA52mgE5TQKcpoNMU0GkK6DQFdJoCOk0BnaaATlNApymg0xTQaQroNAV0mgI6TQGdpoBOU0CnKaDTFNBpCug0xR9zXdBVsxpnpgAAAABJRU5ErkJggg==" alt="" />
分析代码和提供的obj数据发现,result数组中的第一个对象的name属性值为空,当我们使用{{#name}}{{/name}}将<tr></tr>包围的时候,发现这个时候name为空的那一整行数据就被排除掉了,这了注意:根据{{#name}}{{/name}}放的位置的不同,会产生不同的效果!
3、{{^keyName}}{{/keyName}} 与{{#keyName}}{{/keyName}}第二种用法的作用相反,代码如下:
var obj={
result:[
{name:null,age:22,sex:"女"},
{name:"李四",age:22,sex:"男"},
{name:"王五",age:22,sex:"男"}]
};
var template="<table>"
+"<thead><tr><td>姓名</td><td>年龄</td><td>性别</td></tr></thead>"
+"<tbody>" +
"{{#result}}" +
"<tr>" +
"<td>{{^name}}</td>" +
"<td>{{age}}</td>" +
"<td>{{sex}}</td>" +
"</tr>{{/name}}" +
"{{/result}}" +
"</tbody>"
+"</table>";
var view=Mustache.render(template,obj);
document.getElementsByTagName("body")[0].innerHTML=view;
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAA6CAIAAADz+BayAAADSElEQVR4nO2by7HDIAxFqcsFUQ/V0AzF5C3AGIwkPs8mdya6uwTz00GCGMV8VAAy3x6A6vNRDCBSDBBSDBBSDBBSDBBSDBAaxBDcYQ4X6ALrpareGrqqKG9Np922wr2X/tjYZ4jWBsVaStQ4hrrt00ydqQZ3rECYmMtpMMJw3pouy3r8uV8ag7em1e25VzF4W88nj17CENxBDJsb/3jFqnqB4VQaj7fGup5DpK5iY9dkWAz1t5fNc9FLGJoVcLjA26leWMxa7LnInbkYIzhvOP238eNqGIe1h7E++rZAn4GzD8PZWzmQwgVIb4jzOVxoLSrQSaJMPo+h6JhzWG9NdpfgnC9bmA5KOzDkOcUZldsnMceiOARfrPw4i+6GPhINiq4owzgbF3eqRJomjryKrtczcEGp6t3bOMfLlgOnkcvX+8PzVox5zSLk+muCSDPOZK7z+1u5dFIiy97HcK2qhUPhuV6nDp9No6xV8pORnxSbBrvqdMiVbcDgbQwsuSs6FlTWHljQvH3mMeSlMnvgv7qSRpzDFlu4Y2/IY2jbb1dTZFRv5GRzT2Lw1uQzQQybg0Fs3huqGnkf3IqhnY5gzwUMvJtRyqiLk4Olz1kLA+kdzeoPWzDktoM76ik9i4GT6A33qJGcoviu8zN/BkONlLD5m1v09GrqFD2KgQ5f2X0f3KKbtyOEn03OLKmLgQv+0mZ21ZT0pDfQuwC3oRHT64XDuOHcCBeNl/XnKbz5onuHN/Sf7ASJtcX7uPS+AUKKAUKKAUKKAUKKAUKKAUKKAUKKAUKKAUKKAUKKIWs6Q+1BAWKoXte1L4iYon/rmxTgMFQvRZPVi1wcpugBfZUCGgbyWom5wOnd6EzpuxTQMLQSMpHXkpSThhI0125HFoSOQUgHHskUHhN9J7Ge1T0vbAw54WKqaKWX71JAxiDkWo6kYY6K2WL2bhaoGPb4wYcLSGv5FetCxCDc5A9c8q/0dV/4289NcBh6/4t4yTwps+LMKt59eAXDIPwDpffnlEeUMz9f7aUVFgbmMC8k2z+6R9Rd/fresFVccu5ez/hZDKf5e2b+10/1Yf0sBiwpBggpBggpBggpBggpBggpBggpBggpBggpBgj9AedCrSJ1dcJlAAAAAElFTkSuQmCC" alt="" />
根据输出和分析上面的代码,发现{{^name}}{{/name}}再循环玩result对象数组后,只输出了name值为null的那一行值!
4、{{.}} 表示枚举,可以循环输出整个数组,例如:
var obj={
result:["Macbook ","iPhone ","iPod ","iPad "]
};
var template="<div>{{#result}}<span>{{.}}</span>{{/result}}</div>";
var view=Mustache.render(template,obj);
document.getElementsByTagName("body")[0].innerHTML=view;
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPgAAAAhCAIAAAB7gvG7AAAC/klEQVR4nO2Y0WHEIAiGncuBnMdpXCbDXB9SL6CgaNKzrf/3dDlDQPijRPcCYAPc6gAA+AQQOtgCCB1sAYQOtgBCB1sAoYMtgNDBFkDoYAsgdLAFEDrYgobQj+idc87HoxxJQRmwcUTvXEhzxiIp9MNJgTg9Z1ByxcRu/ghD4Y0+uM7Nh92tpy/0OuzvvPwxoXcNUrgm9XmhV6G0wrv7rLXultATegihjDsFF8Kd6fxSodN/f6HQZzU0KfQfdLeErtBTKpSegvMx8unQva/QR94XyNj54HgNiKvJyBDL7ulR3IfYZl2X43oDU+ARsknpMYR0jVETmgRFBUPhdbJ00NRGVcVD7mwl1tytpy/0F1f6eUVTQ3N2RE/nyS+zUdH8FzYpkFSyC33oCud8trQYG0rLV/T3HSzAZgyiCTMvJjsZXitL9cWk0Mm/jRLb3K3HIPQjepYTH48iCWRibBlQtrGq2MToiL7aQIiGlaH8i78XnG5p5TeHx2eIoTSpXMlt0VB4ehhVW6j02qPZUEpsdbceg9Cp0vOU9TXAOT0L5YOZoVwnHoUydNp7sWNhPtrnDFUfUtn2YhBM6kzJaRkJrxFG/RbNnrrImSxKbHW3HovQL6W/X206HdKihVS+7tKc6//f/wgi0EV2pTm3DUnxyG7OF61ymIXOY1CELtAXeiM8PQxlZKp1KR0KJTa7W49J6FnpR/SkaSNN8TXX5r4m3HPyyIouNBCUnxH6xIpu8Dgs9Psrut0dvfxnK/q30iNrYeSDuOrbxNqjky+3+R79pb9djwi9F4NkIrfk98Ib6NGVr98Rd40SW92txyj0vAPXEpbu4id9/Crvr8oBQusIQR9ilVK+SB8ReicG0UQ6prjbSzSyVJ8RPbqiN0usuluPVeiC5IQe/X3yUXw48c60OkcvVUn62olzdEXqDwm9GYNmwpIgr++DQlfDKNzdOEfXHtgq8Z88Rwfg/wChgy2A0MEWQOhgCyB0sAUQOtgCCB1sAYQOtgBCB1sAoYMt+AIUw0ItDwE98AAAAABJRU5ErkJggg==" alt="" />
分析如上代码和输出发现:{{#result}}{{/result}}表示循环的目标是result数组,{{.}}则表示循环输出result中的每一项
5、{{keyName.keyName}}
var data={
company:["Microsoft"],
adress:{
province:"浙江",
city:"湖州",
county:"安吉",
town:"报福",
village:"统里"
}
}
var template="<h1>{{company}}</h1><ul>" +
"<li>{{adress.province}}</li>" +
"<li>{{adress.city}}</li>" +
"<li>{{adress.county}}</li>" +
"<li>{{adress.town}}</li>" +
"<li>{{adress.village}}</li>" +
"</ul>";
var view=Mustache.render(template,data);
document.getElementsByTagName("body")[0].innerHTML=view;
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ0AAACxCAIAAABRKijMAAAIJ0lEQVR4nO2dW26rMBCGu4lIp1Kr7oMF8d6qldJdsBo24320Ul58HgL4NrbHTtJMhv97aokBx198wQzmyQKNPN07A+AmwKtO4FUn8KoTeNUJvOoEXnUCrzqBV53Aq07gVScVr/P4lDJMhkxspoFIPc6FRNGHwIMqzqS8zDSQZdjjNWeDlRheOdBFGRXXkuh6XulD8dLCax264fMbSj/FFb1SLXEuM1DXTFjqaQEy6kaT12FYj5eKdedyqeC1i6q2q3udpjF3sC3lMI7wehF38DpvR8x1m36aYsKKdNZoMM3kOCe5pnoN4ui5UX4xR8zfLfN0mV7P7ZHr69JDNno1rloG+TKeb3Op1+rXK6Qf53Tv4CTloslYKueIzFTP6e7o1dAV1td9mddqET4lpcj/HVRKmTw6K0fkV2k+3R29WlKsSzbOleFc0WuU7/xXpn9UucPS6byjx+Xl7V/Kb1o6F5+uWkSsBI1ew86LupoiureGTAc7xsUU7uh/Wu9OOYWROXnSedMHTU7aeTrOrrfx6l3QLLmJt/R6LWrd9iz3r1mtlYNnc8b70VztdOVPuAl6vEaNLrGh02vwCbf8quej0jTV6HynVxgJ95+u9AE7QZfX2GPS43Z65ZRFPZOc6poTQieqj34qTUjb6e7nNWx303ZZoFfeVXP2QJyBbT596+nu5dXb6l/Rbh83DHkfob7mSiPF7fKQ9dU/7jj6jhmnvWC4wMpk97CprYOv3Gu+6HR/7ZW+TVT79Grj4eyAmFXRLxmgLh+P1btYmQorfDxcnhlxh+/1WhnYZi9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eUE1rMD2CF6Nmf0pRAbwKtBr/WlH7057eeG8mP3IFuq1PuFUTIX6+gBeyelfeC0jLm4tpmtmF15lxq05WI0yr0fe1VIT4uLW+KOm3blqQXLcWvb+OmxWkRm3Zl2MU7qV6jmrtXxv3a3IuDVrrZnnaYyN0CPj5ZPyUuLwKo1g4iHXAsNrhHyvYRub8QOvEZK9bkK9Wrpso+La0L96CPRK6YxIBlWorxECvYIrAK86gVedwKtO4FUn8KoToV7bHtKh55J3jXyv+QAm8rkqvCjUWvsoXlMflefTd484r8kaEjPptXAbNldj91NZrUCvZ+j6St0BSNcSoe7R7u6VK0Lj1qrtcGafdSku1Ne/OU1r3JqZhnUxrTk/EPJN7e6J9DLi4tasa1r999LFtTbUeF4qZlgTcn4HyhEXt+bWq4za4ey7y9Zed5jmaRjG0X3ip9pZDys0bo3qX9OlLq21dh7ThRPhVWrcGj1ucm1sbCj0inb4sa5zsmEwqK8xj+P1XBHdhUww+IXXCHle12FQIGRMIofPcukF4tEOC/TaBV1f6RS7QIlXEAGvOoFXncCrTuBVJ/CqE6leidtuO7tSuQyhXukwl2iN/w3W2lz7ujkr0quzWnn+MXxDXXCA4ssm9SPQK9neFkOE4TVBnFfnyLW6odTUO9rhBGlxa4GiYTLZEVTDy66oDdqRGbcWvC0yS74Gw6vQuLVYQvQS0GAT2mECcXFrREtsSa/RLqivAeLi1sL75d5GN5hiLU68L40JQuPWrI3Hw96jHGSADIM9qRZ3neM8+TEuQbCwU5wzhfoqzSvxOu3kQVd4rSPNqw85Hey3ustjAA3sxrZkr6AfeNUJvOoEXnUCrzqBV53Aq07gVSfwqhN41Qm86uQ/etgfJjRgMjgAAAAASUVORK5CYII=" alt="" />
Mustache学习的更多相关文章
- 微信小程序入门——Mustache语法学习
微信小程序中用到了大量Mustache语法,特发此文学习一下 1.简单的变量调换:{{name}} 1 var data = { "name": "Willy" ...
- 学习笔记《Mustache》模板
Mustache 是一款经典的前端模板引擎,在前后端分离的技术架构下面,前端模板引擎是一种可以被考虑的技术选型,随着重型框架(AngularJS.ReactJS.Vue)的流行,前端的模板技术已经成为 ...
- 5月学习总结(Ant-Design,mustache,require.js,grunt)
一.Ant-Design学习 因为Ant-Design是基于React实现的,之前自己也学过一段时间的React,对React还是相对比较熟悉的,在学习Ant-Design也还不算吃力. 最开始是从源 ...
- Mustache.js语法学习笔记
原文地址:http://www.cnblogs.com/flypig88/archive/2012/05/14/2497780.html 看了Mustache的github,学学其中的语法,做个笔记 ...
- Javascript模板引擎mustache.js详解
mustache.js是一个简单强大的Javascript模板引擎,使用它可以简化在js代码中的html编写,压缩后只有9KB,非常值得在项目中使用.本文总结它的使用方法和一些使用心得,内容不算很高深 ...
- 微信小程序学习
官方网站 https://mp.weixin.qq.com/debug/wxadoc/dev/index.html 项目结构介绍 -- MINA框架 https://mp.weixin.qq.com/ ...
- Spring 4 官方文档学习(十二)View技术
关键词:view technology.template.template engine.markup.内容较多,按需查用即可. 介绍 Thymeleaf Groovy Markup Template ...
- Github上PHP资源汇总大全,php学习的好资料
Github上PHP资源汇总大全,php学习的好资料 国外程序员ziadoz 在Github上收集整理了PHP的各种资源,内容包括模板.框架.数据库.安全等方面的库和工具.汇总了各种PHP资源,供各位 ...
- Vue.js学习 Item4 -- 数据双向绑定
Vue.js 的模板是基于 DOM 实现的.这意味着所有的 Vue.js 模板都是可解析的有效的 HTML,且通过一些特殊的特性做了增强.Vue 模板因而从根本上不同于基于字符串的模板,请记住这点. ...
随机推荐
- diff函数(matlab)
diff函数式用于求导数和差分的.无论是求导数还是差分,其原理是一样的. 这里简单介绍下其用法: 前后相邻元素之差 上下相邻行之差. 与diff(A,1,1)类似. 第三个参数为2时,则变为列差分运算 ...
- 充分利用CPU高速缓存,提高程序效率(原理篇)
提高程序效率应该充分利用CPU的高速缓存.要想编写出对CPU缓存友好的程序就得先明白CPU高速缓存的运行机制. i5-2400S: 1.有三级缓存分别为 32k(数据.指令缓存分开,分为32k),25 ...
- word2vec 入门(二)使用教程篇
word2vec 要解决问题: 在神经网络中学习将word映射成连续(高维)向量,这样通过训练,就可以把对文本内容的处理简化为K维向量空间中向量运算,而向量空间上的相似度可以用来表示文本语义上的相似度 ...
- php float 转int
round(x,prec) 参数 描述 x 可选.规定要舍入的数字. prec 可选.规定小数点后的位数. <?php echo(round(0.60)); echo(round(0.50)); ...
- 商人过河问题(二)java实现
本文实现的java版商人过河是参考http://wenku.baidu.com/link?url=dpe2AC8mCjpGnclFv6iZy88_vqYm3bED4QDpSkAI4ssgs7Bhntu ...
- 浅谈JNDI的使用
原文:http://www.weicoop.com/web/article/52.html 关于什么是JNDI的概念这里不做解释,本文作为初学者根据所了解到内容做些总结,主要内容如下: 1.JNDI使 ...
- STM32F407VG (三)ADC
12位ADC是一种逐次逼近型模拟数字转换器. 它有多达19个通道,可測量16个外部和2个内部信号源和VBAT通道.各通道的A/D转换能够单次.连续.扫描或间断模式运行. ADC的结果能够左对齐或右对齐 ...
- odbc连接数据库
using System; using System.Collections.Generic; using System.Text; using Console = System.Console; u ...
- DevExpress GridControl一些属性使用方法总结
一.如何解决单击记录整行选中的问题 View->OptionsBehavior->EditorShowMode 设置为:Click 二.如何新增一条记录 (1).gridView.AddN ...
- HTML5 canvas 绘制精美的图形
HTML5 是一个新兴标准,它正在以越来越快的速度替代久经考验的 HTML4.HTML5 是一个 W3C “工作草案” — 意味着它仍然处于开发阶段 — 它包含丰富的元素和属性,它们都支持现行的 HT ...