主页面

显示当前发表博客的完整内容,以及历史博客列表

Bootstrap Job

一个play job任务就是一个在没有任何http请求的情况下执行一些特定的方法

应用程序在启动时间隔一定时间后自动执行某个方法

应用程序启动便执行基础数据的初始化操作:

  1. import models.User;
  2. import play.jobs.Job;
  3. import play.jobs.OnApplicationStart;
  4. import play.test.Fixtures;
  5. /**
  6. * 使用@OnApplicationStart注释Job,告诉Play在应用程序启动时便执行这个任务
  7. * DEV模式和PROD模式下,任务执行情况不同
  8. *      DEV模式:等到第一个客户端请求才会执行
  9. *      PROD模式:应用程序启动时就执行
  10. * @author lenovo
  11. *
  12. */
  13. @OnApplicationStart
  14. public class Bootstrap extends Job {
  15. public void doJob() {
  16. //检查用户是否为空
  17. if(User.count()==0) {
  18. Fixtures.loadModels("initial-data.yml");
  19. }
  20. }
  21. }

其中,在yabe\conf目录下新建initial-data.yml文件,用来初始化Blog系统的基础数据!

  1. # Test data
  2. User(bob):
  3. email:          bob@gmail.com
  4. password:       secret
  5. fullname:       Bob
  6. isAdmin:        true
  7. User(jeff):
  8. email:          jeff@gmail.com
  9. password:       secret
  10. fullname:       Jeff
  11. User(paul):
  12. email:          paul@gmail.com
  13. password:       secret
  14. fullname:       Paul
  15. Post(firstBobPost):
  16. title:          About the model layer
  17. postedAt:       2009-06-14
  18. author:         bob
  19. content:        >
  20. The model has a central position in a Play! application. It is the domain-specific
  21. representation of the information on which the application operates.
  22. Martin fowler defines it as :
  23. Responsible for representing concepts of the business, information about the
  24. business situation, and business rules. State that reflects the business situation
  25. is controlled and used here, even though the technical details of storing it are
  26. delegated to the infrastructure. This layer is the heart of business software.
  27. Post(secondBobPost):
  28. title:          Just a test of YABE
  29. postedAt:       2009-03-25
  30. author:         bob
  31. content:        >
  32. Well, it's just a test.
  33. Post(jeffPost):
  34. title:          The MVC application
  35. postedAt:       2009-06-06
  36. author:         jeff
  37. content:        >
  38. A Play! application follows the MVC architectural pattern as applied to the
  39. architecture of the Web.
  40. This pattern splits the application into separate layers: the Presentation
  41. layer and the Model layer. The Presentation layer is further split into a
  42. View and a Controller layer.
  43. Comment(c1):
  44. author:         Guest
  45. content:        >
  46. You are right !
  47. postedAt:       2009-06-14
  48. post:           firstBobPost
  49. Comment(c2):
  50. author:         Mike
  51. content:        >
  52. I knew that ...
  53. postedAt:       2009-06-15
  54. post:           firstBobPost
  55. Comment(c3):
  56. author:         Tom
  57. content:        >
  58. This post is useless ?
  59. postedAt:       2009-04-05
  60. post:           secondBobPost

打开yabe\app\controllers\Application.java,修改index()

  1. package controllers;
  2. import play.*;
  3. import play.mvc.*;
  4. import java.util.*;
  5. import models.*;
  6. public class Application extends Controller {
  7. public static void index() {
  8. //最新的博客
  9. Post frontPost = Post.find("order by postedAt desc").first();
  10. //过去的博客
  11. List<Post> olderPosts = Post.find("order by postedAt desc").from(1).fetch(10);
  12. render(frontPost,olderPosts);
  13. }
  14. }

修改yabe\app\views\Application\index.html

action通过render()传递对象,在模块中只需要使用${xxx}就能获取到相应的对象,进而展现数据。

  1. #{extends 'main.html' /}
  2. #{set title:'Home' /}
  3. #{if frontPost}
  4. <div class="post">
  5. <h2 class="post-title">
  6. <a href="#">${frontPost.title}</a>
  7. </h2>
  8. <div class="post-metadata">
  9. <span class="post-author">by ${frontPost.author.fullname}</span>
  10. <span class="post-date">${frontPost.postedAt.format('MMMdd')}</span>
  11. <span class="post-comments">
  12. &nbsp;|&nbsp;
  13. ${frontPost.comments.size() ?: 'no'}
  14. comment${frontPost.comments.size().pluralize()}
  15. #{if frontPost.comments}
  16. , latest by ${frontPost.comments[-1].author}
  17. #{/if}
  18. </span>
  19. </div>
  20. <div class="post-content">
  21. ${frontPost.content.nl2br()}
  22. </div>
  23. </div>
  24. #{if olderPosts}
  25. <div class="older-posts">
  26. <h3>
  27. Older posts <span class="from">from this blog</span>
  28. </h3>
  29. #{list items:olderPosts, as:'oldPost'}
  30. <div class="post">
  31. <h2 class="post-title">
  32. <a href="#">${oldPost.title}</a>
  33. </h2>
  34. <div class="post-metadata">
  35. <span class="post-author">by ${oldPost.author.fullname}</span>
  36. <span class="post-date">${oldPost.postedAt.format('dd MMM yy')}</span>
  37. <div class="post-comments">
  38. ${oldPost.comments.size() ?: 'no'}
  39. comment${oldPost.comments.size().pluralize()}
  40. #{if oldPost.comments}
  41. - latest by ${oldPost.comments[-1].author}
  42. #{/if}
  43. </div>
  44. </div>
  45. </div>
  46. #{/list}
  47. </div>
  48. #{/if}
  49. #{/if}
  50. #{else}
  51. <div class="empty">
  52. There is currently nothing to read here!
  53. </div>
  54. #{/else}

刷新页面http://localhost:9000/

抽取相同部分出来,提高代码复用性

新增yabe\app\views\tags\display.html

display.html被index.html使用标签(另一个模板)方式进行操作

由于index.html中通过#{display post:frontPost, as:'home' /}来调用display.html模板

则display.html中就可以通过_post 和 _as 来获取对应的参数值

  1. #{extends 'main.html' /}
  2. #{set title:'Home' /}
  3. <div class="post ${_as == 'teaser' ? 'teaser' : ''}">
  4. <h2>
  5. <a href="#">${_post.title}</a>
  6. </h2>
  7. <div class="post-metadata">
  8. <span class="post-author">by ${_post.author.fullname}</span>
  9. <span class="post-date">${_post.postedAt.format('dd MMM yy')}</span>
  10. #{if _as!='full'}
  11. <span class="post-comments">
  12. &nbsp;|&nbsp;
  13. ${_post.comments.size() ?: 'no'}
  14. comment${_post.comments.size().pluralize()}
  15. #{if _post.comments}
  16. , latest by ${_post.comments[-1].author}
  17. #{/if}
  18. </span>
  19. #{/if}
  20. </div>
  21. #{if _as!='teaser'}
  22. <div class="post-content">
  23. <div class="about">Detail:</div>
  24. ${_post.content.nl2br()}
  25. </div>
  26. #{/if}
  27. </div>
  28. #{if _as=='full'}
  29. <div class="comments">
  30. <h3>
  31. ${_post.comments.size() ?: 'no'}
  32. comment${_post.comments.size().pluralize()}
  33. </h3>
  34. #{list items:_post.comments, as:'comment'}
  35. <div class="comment">
  36. <div class="comment-metadata">
  37. <span class="comment-author">by ${comment.author},</span>
  38. <span class="comment-data">${comment.postedAt.format('dd MMM yy')}</span>
  39. </div>
  40. <div class="comment-content">
  41. <div class="about">Detail: </div>
  42. ${comment.content.escape().nl2br()}
  43. </div>
  44. </div>
  45. #{/list}
  46. </div>
  47. #{/if}

修改index.html,直接通过display模板完成页面的显示

  1. #{extends 'main.html' /}
  2. #{set title:'Home' /}
  3. #{if frontPost}
  4. <!--调用display模板-->
  5. #{display post:frontPost, as:'home' /}
  6. #{if olderPosts.size()}
  7. <div class="older-posts">
  8. <h3>
  9. Older posts <span class="form">from this blog</span>
  10. </h3>
  11. #{list items:olderPosts ,as:'oldPost'}
  12. <!--调用display模板-->
  13. #{display post:oldPost, as:'teaser' /}
  14. #{/list}
  15. </div>
  16. #{/if}
  17. #{/if}
  18. #{else}
  19. <div class="empty">
  20. There is currently nothing to read here!
  21. </div>
  22. #{/else}

刷新页面

修改yabe\public\stylesheets\main.css,对页面进行美观修饰

附:main.css

  1. /** Main layout **/
  2. html, body {
  3. background: #364B66 !important;
  4. font-family: Helvetica, Arial, Sans !important;
  5. }
  6. body {
  7. width: 900px;
  8. padding: 0 30px;
  9. margin: auto;
  10. }
  11. /** Blog header **/
  12. #header {
  13. padding: 10px 0;
  14. position: relative;
  15. }
  16. #logo {
  17. display: block;
  18. height: 49px;
  19. margin-left: 20px;
  20. color: #fff;
  21. font-size: 48px;
  22. font-weight: bold;
  23. letter-spacing: -4px;
  24. text-shadow: 1px 2px 2px #000;
  25. }
  26. #logo span {
  27. color: #f00;
  28. font-size: 70%;
  29. }
  30. #tools {
  31. list-style: none;
  32. margin: 0;
  33. padding: 0;
  34. position: absolute;
  35. right: 0;
  36. top: 30px;
  37. right: 20px;
  38. }
  39. #tools a {
  40. color: #fff;
  41. text-decoration: none;
  42. }
  43. #title {
  44. background: #B8C569;
  45. padding: 20px 30px 30px 20px;
  46. margin: 20px 0;
  47. color: #3C4313;
  48. position: relative;
  49. -webkit-border-radius: 16px;
  50. -webkit-box-shadow: 0 2px 0 #93A045;
  51. -moz-border-radius: 16px;
  52. }
  53. /** A little hacky to create arrows without images **/
  54. .about {
  55. text-indent: -999em;
  56. display: block;
  57. width: 0;
  58. height: 0;
  59. border-left: 10px solid transparent;
  60. border-right: 10px solid transparent;
  61. border-bottom: 10px solid #BAC36E;
  62. border-top: 0;
  63. position: absolute;
  64. top: -10px;
  65. left: 60px;
  66. }
  67. #title h1 {
  68. font-size: 64px;
  69. margin: 0;
  70. }
  71. #title h1 a {
  72. text-decoration: none;
  73. color: inherit;
  74. }
  75. #title h2 {
  76. font-size: 26px;
  77. margin: 0;
  78. font-weight: normal;
  79. }
  80. /** Main content **/
  81. #main {
  82. background: #314660;
  83. background: -webkit-gradient(linear, left top, left 30%, from(#314660), to(#364B66));
  84. -webkit-border-radius: 16px;
  85. -moz-border-radius: 16px;
  86. padding: 20px;
  87. }
  88. /** Post **/
  89. .post .post-title {
  90. margin: 0;
  91. }
  92. .post .post-title a {
  93. font-size: 36px;
  94. color: #F5C2CC;
  95. text-decoration: none;
  96. }
  97. .post .post-metadata {
  98. color: #BAC36E;
  99. display: block;
  100. font-size: 70%;
  101. display: inline-block;
  102. }
  103. .post .post-author {
  104. font-size: 130%;
  105. font-weight: bold;
  106. }
  107. .post .post-metadata a {
  108. color: #9FA85D;
  109. }
  110. .post .post-content {
  111. position: relative;
  112. background: #fff;
  113. padding: 10px;
  114. margin: 10px 0 50px 0;
  115. -webkit-border-radius: 10px;
  116. -moz-border-radius: 10px;
  117. -webkit-box-shadow: 0 2px 0 #BBBBBB;
  118. }
  119. .post .about {
  120. text-indent: -999em;
  121. display: block;
  122. width: 0;
  123. height: 0;
  124. border-left: 10px solid transparent;
  125. border-right: 10px solid transparent;
  126. border-bottom: 10px solid #fff;
  127. border-top: 0;
  128. position: absolute;
  129. top: -6px;
  130. left: 24px;
  131. }
  132. /** Older posts **/
  133. .older-posts h3 {
  134. color: #869AB1;
  135. font-size: 28px;
  136. margin-bottom: 15px;
  137. }
  138. .older-posts h3 .from {
  139. font-weight: normal;
  140. font-size: 70%;
  141. }
  142. .older-posts .post {
  143. margin-bottom: 15px;
  144. border-left: 3px solid #869AB1;
  145. padding-left: 10px;
  146. }
  147. .older-posts .post-title a {
  148. padding: 0;
  149. color: #131921;
  150. font-size: 20px;
  151. }
  152. .older-posts .post-metadata {
  153. color: #869AB1;
  154. padding: 0;
  155. font-size: 12px;
  156. }
  157. .older-posts .post-metadata a {
  158. color: #869AB1;
  159. }
  160. /** Comments **/
  161. .comments {
  162. margin-bottom: 30px;
  163. }
  164. h3 {
  165. color: #869AB1;
  166. font-size: 18px;
  167. margin-bottom: 15px;
  168. }
  169. h3 span {
  170. font-size: 80%;
  171. font-weight: normal;
  172. }
  173. .comment {
  174. width: 70%;
  175. clear: both;
  176. }
  177. .comment .comment-metadata {
  178. color: #869AB1;
  179. display: block;
  180. font-size: 50%;
  181. display: block;
  182. float: left;
  183. width: 80px;
  184. text-align: right;
  185. }
  186. .comment .comment-author {
  187. font-size: 150%;
  188. font-weight: bold;
  189. display: block;
  190. }
  191. .comment .comment-content {
  192. position: relative;
  193. background: #E4EAFF;
  194. color: #242C58;
  195. font-size: 80%;
  196. margin-top: 10px;
  197. margin-bottom: 10px;
  198. margin-left: 100px;
  199. padding: 10px;
  200. -webkit-border-radius: 10px;
  201. -moz-border-radius: 10px;
  202. }
  203. .comment .about {
  204. text-indent: -999em;
  205. display: block;
  206. width: 0;
  207. height: 0;
  208. border-top: 10px solid transparent;
  209. border-bottom: 10px solid transparent;
  210. border-right: 10px solid #E4EAFF;
  211. border-left: 0;
  212. position: absolute;
  213. top: 4px;
  214. left: -4px;
  215. }
  216. /** Form **/
  217. form {
  218. padding: 10px;
  219. background: #253142;
  220. background: -webkit-gradient(linear, left top, left 60%, from(#253142), to(#364B66));
  221. -webkit-border-radius: 10px;
  222. -moz-border-radius: 10px;
  223. }
  224. form .error {
  225. background: #c00;
  226. color: #fff;
  227. font-size: 90%;
  228. padding: 3px 5px;
  229. -webkit-border-radius: 6px;
  230. -moz-border-radius: 6px;
  231. -webkit-box-shadow: 0 2px 0 #800;
  232. }
  233. form .error:empty {
  234. display: none;
  235. }
  236. form p {
  237. margin: 5px 0 0 0;
  238. }
  239. form textarea {
  240. width: 70%;
  241. height: 150px;
  242. }
  243. form input, form textarea {
  244. font-size: 14px;
  245. }
  246. form label {
  247. display: block;
  248. font-weight: bold;
  249. font-size: 90%;
  250. color: #aaa;
  251. margin-bottom: 3px;
  252. }
  253. #captcha{
  254. display: block;
  255. height: 50px;
  256. }
  257. .success {
  258. background: #67AD10;
  259. color: #fff;
  260. padding: 10px;
  261. -webkit-border-radius: 6px;
  262. -moz-border-radius: 6px;
  263. -webkit-box-shadow: 0 2px 0 #4E840B;
  264. }
  265. /** Pagination **/
  266. #pagination {
  267. list-style: none;
  268. padding: 0;
  269. position: relative;
  270. color: #869AB1;
  271. font-size: 90%;
  272. top: -20px;
  273. margin-bottom: 30px;
  274. }
  275. #pagination a {
  276. color: #869AB1;
  277. font-size: 90%;
  278. }
  279. #pagination #previous {
  280. position: absolute;
  281. top: 0;
  282. left: 0;
  283. }
  284. #pagination #previous:before {
  285. content: '<< ';
  286. }
  287. #pagination #next {
  288. position: absolute;
  289. top: 0;
  290. right: 0;
  291. }
  292. #pagination #next:after {
  293. content: ' >>';
  294. }
  295. /** Footer **/
  296. #footer {
  297. border-top: 1px solid #45597A;
  298. font-size: 70%;
  299. padding: 10px 30px;
  300. text-align: center;
  301. color: #869AB1;
  302. margin-top: 30px;
  303. }
  304. #footer a {
  305. color: #869AB1;
  306. font-weight: bold;
  307. }
  308. /** Admin **/
  309. .tags-list .tag {
  310. cursor: pointer;
  311. color: red;
  312. }
  313. #adminMenu {
  314. list-style: none;
  315. padding: 0;
  316. margin: 0 0 20px 0;
  317. }
  318. #adminMenu li {
  319. display: inline;
  320. }
  321. #adminMenu li a {
  322. color: #fff;
  323. text-decoration: none;
  324. font-size: 80%;
  325. background: #591C64;
  326. padding: 2px 10px;
  327. -webkit-border-radius: 9px;
  328. -moz-border-radius: 9px;
  329. }
  330. #adminMenu li.selected a {
  331. background: #82A346;
  332. }
  333. #crudContent {
  334. color: #8B98AD;
  335. }
  336. #crudContent h2 {
  337. color: #EDC3CD !important;
  338. }
  339. #crudContent thead tr {
  340. background: #512162 !important;
  341. }
  342. #crudContent table {
  343. border: none !important;
  344. }
  345. #crudContent table td {
  346. color: #444;
  347. }
  348. tr.odd {
  349. background: #BECCE7 !important;
  350. }
  351. #crud #crudContent, #crudContent form, #crudListSearch, #crudListPagination, .crudButtons {
  352. background: transparent;
  353. border: none;
  354. padding: 0;
  355. }
  356. #crudListTable {
  357. margin: 10px 0;
  358. }
  359. .crudField, .objectForm {
  360. border: none;
  361. padding-left: 0;
  362. }
  363. .crudField label {
  364. color: #B8FA5C;
  365. }
  366. .crudHelp {
  367. color: #fff !important;
  368. }
  369. .crudField .tag {
  370. color: #111;
  371. font-size: 80%;
  372. }
  373. .crudButtons input {
  374. font-size: 110%;
  375. }
  376. .crudButtons {
  377. margin-top: 20px;
  378. border-top: 1px dotted #8B98AD;
  379. padding-top: 10px;
  380. }
  381. .crudFlash {
  382. border: 0;
  383. -webkit-border-radius: 8px;
  384. font-size: 80%;
  385. padding: 2px 10px;
  386. }
  387. .crudField .tag.selected {
  388. -webkit-border-radius: 8px;
  389. -moz-border-radius: 8px;
  390. }
  391. .crudField .error {
  392. background: transparent;
  393. border: none;
  394. padding: 0;
  395. color: pink;
  396. -webkit-box-shadow: none;
  397. }
  398. /** Login **/
  399. #login form {
  400. background: #8B98AD !important;
  401. border: 0 !important;
  402. -webkit-border-radius: 16px;
  403. -moz-border-radius: 16px;
  404. }
  405. #login label, #password-field label, #username-field label {
  406. color: #161D28 !important;
  407. font-size: 110% !important;
  408. }
  409. #remember-field {
  410. display: none;
  411. }
  412. /** My posts **/
  413. #admin .post {
  414. background: #fff;
  415. padding: 4px;
  416. margin: 0;
  417. font-size: 90%;
  418. }
  419. #admin .post.odd {
  420. background: #C0CBE5;
  421. }
  422. #admin .post a {
  423. color: #444;
  424. }
  425. #newPost {
  426. border-top: 1px dotted #C0CBE5;
  427. padding-top: 15px;
  428. }
  429. #newPost a {
  430. background: #C88116;
  431. -webkit-border-radius: 12px;
  432. -moz-border-radius: 12px;
  433. padding: 5px 10px;
  434. font-size: 80%;
  435. text-decoration: none;
  436. color: #fff;
  437. font-weight: bold;
  438. -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.3);
  439. }
  440. #newPost a span {
  441. background: #7D510E;
  442. -webkit-border-radius: 8px;
  443. -moz-border-radius: 8px;
  444. padding: 0 5px 2px 5px;
  445. position: relative;
  446. top: -1px;
  447. }
  448. #postContent {
  449. width: 100%;
  450. height: 300px;
  451. }
  452. .hasError {
  453. background: pink;
  454. }

(四)play之yabe项目【页面】的更多相关文章

  1. (六)play之yabe项目【验证码】

    (六)play之yabe项目[验证码] 博客分类: 框架@play framework   添加验证码功能 在Application.java中添加一个action:captcha() /** * 添 ...

  2. (八)play之yabe项目【身份验证】

    (八)play之yabe项目[身份验证] 博客分类: 框架@play framework   添加身份验证 play提供了一个模块-Secure(安全模块),用来做身份验证 允许Secure模块 修改 ...

  3. (九)play之yabe项目【发表博文】

    (九)play之yabe项目[发表博文] 博客分类: 框架@play framework   发表一篇博文 填充管理页面 从主页链接到管理页面时,只简单显示了登陆用户的名称 现在对显示的内容加以丰富 ...

  4. (七)play之yabe项目【CRUD】

    (七)play之yabe项目[CRUD] 博客分类: 框架@play framework    增加CRUD功能 使用CRUD能干嘛?----> 在页面对模型进行增删改查操作,这样有什么实际意义 ...

  5. 单点登录CAS使用记(四):为登录页面加上验证码

    CAS默认的登录页面样式如下,只有用户名与密码两项验证项目. 现在需要为首页登录加上验证码功能. 第一步:首页对默认登录页面的样式进行了调整,使其看上去还算美观. 在页面上加上了验证码项目. 第二步: ...

  6. (三)play之yabe项目【数据模型】

    (三)play之yabe项目[数据模型] 博客分类: 框架@play framework   创建项目 play new yabe What is the application name? [yab ...

  7. 我是怎么发现并解决项目页面渲染效率问题的(IE调试工具探查器的使用)

    #我是怎么发现并解决项目页面渲染效率问题的(IE调试工具探查器的使用) ##背景 之前的项目中,有很多的登记页面,一般都有100-200甚至更加多的字段,而且还涉及到字典.日期及其他效果的显示,载入时 ...

  8. .NET Core Community 第四个千星项目诞生:微服务框架 Surging

    本文所有打赏将全数捐赠于 NCC(NCC 的资金目前由 倾竹大人 负责管理),请注明捐赠于 NCC.捐赠情况将由倾竹大人在此处公示. 提及 .NET 微服务,我们脑海中浮现的一系列印象中,总有 Sur ...

  9. django之创建第11个项目-页面整合

    目的:将如下众多html页面整合到一个index.html页面中. 百度云盘:django之创建第11个项目-页面整合 用下面的方式实现: <!DOCTYPE html> <head ...

随机推荐

  1. java中的==和equals

    1,==用于比较基本数据类型,和引用类型.而equals是Object上的方法,可以被子类重写,用于判断内容一致. 比较奇葩的是,java基本数据类型(byte,short,int,long,floa ...

  2. android dalvik heap 浅析

    android 系统中可以在/system/build.prop中配置dalvik堆的有关设定.具体设定由如下三个属性来控制 -dalvik.vm.heapstartsize  堆分配的初始大小,调整 ...

  3. POJ 3320 Jessica's Reading Problem

    Jessica's Reading Problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6001   Accept ...

  4. php网页切图/js切图

    PhantomJS抓取网站页面信息以及网站截图 http://phantomjs.org/download.html PHP imagegrabscreen和imagegrabwindow(截取网站缩 ...

  5. Ruby on Rails 和 J2EE:两者能否共存?

    http://www.ibm.com/developerworks/cn/java/wa-rubyonrails/

  6. 【cs229-Lecture16】马尔可夫决策过程

    之前讲了监督学习和无监督学习,今天主要讲“强化学习”. 马尔科夫决策过程:Markov Decision Process(MDP) 价值函数:value function 值迭代:value iter ...

  7. 爬虫技术 -- 基础学习(一)HTML规范化(附特殊字符编码表)

    最近在做网页信息提取这方面的,由于没接触过这系列的知识点,所以逛博客,看文档~~看着finallyly大神的博文和文档,边看边学习边总结~~ 对网站页面进行信息提取,需要进行页面解析,解析的方法有以下 ...

  8. ruby -- 进阶学习(十四)设置background-image(解决无法获取图片路径问题)

    基于rails4.0环境 为了美化界面,添加背景图片,于是又傻逼了一回~~ 一开始在xxx.html.erb中添加:(注:图片的路径为:app/asssets/images/background.jp ...

  9. DDD:如何更好的使用值对象

    背景 大师们让我们多使用“值语义”的对象(并非一定是是值对象),我们工作中也没有少使用(int.bool.date等等),只是大多数人都没有多的自定义“值语义”的类型(我也其中之一),本文不说其它的, ...

  10. 【转载】shell中 dd 命令

    转载自:http://blog.chinaunix.net/uid-24958038-id-3416169.html dd if=/dev/zero of=的含义是什么? 一.dd命令的解释 dd:用 ...