一、关于Velocity的基本配置

在Solr中,可以以多种方式返回搜索结果,如单纯的文本回复(XML、JSON、CSV等),也可以返回velocity,js等格式。而VelocityResponseWriter就是用于将返回velocity类型文本,以便直接用于结果呈现。

在Solr提供的example,其中的一个RequestHandler--/browse,使用了VelocityResponseWriter。其配置如下:

  1. <requestHandler name="/browse" class="solr.SearchHandler">
  2. <lst name="defaults">
  3. <str name="echoParams">explicit</str>
  4.  
  5. <!-- VelocityResponseWriter settings -->
  6. <str name="wt">velocity</str>
  7. <str name="v.template">browse</str>
  8. <str name="v.layout">layout</str>
  9. <str name="title">Solritas_test</str>
  10.  
  11. <!-- Query settings -->
  12. <str name="defType">edismax</str>
  13. <str name="qf">
  14. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  15. title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0
  16. </str>
  17. <str name="df">text</str>
  18. <str name="mm">100%</str>
  19. <str name="q.alt">*:*</str>
  20. <str name="rows">10</str>
  21. <str name="fl">*,score</str>
  22.  
  23. <str name="mlt.qf">
  24. text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
  25. title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0
  26. </str>
  27. <str name="mlt.fl">text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename</str>
  28. <int name="mlt.count">3</int>
  29.  
  30. <!-- Faceting defaults -->
  31. <str name="facet">on</str>
  32. <str name="facet.field">cat</str>
  33. <str name="facet.field">manu_exact</str>
  34. <str name="facet.field">content_type</str>
  35. <str name="facet.field">author_s</str>
  36. <str name="facet.query">ipod</str>
  37. <str name="facet.query">GB</str>
  38. <str name="facet.mincount">1</str>
  39. <str name="facet.pivot">cat,inStock</str>
  40. <str name="facet.range.other">after</str>
  41. <str name="facet.range">price</str>
  42. <int name="f.price.facet.range.start">0</int>
  43. <int name="f.price.facet.range.end">600</int>
  44. <int name="f.price.facet.range.gap">50</int>
  45. <str name="facet.range">popularity</str>
  46. <int name="f.popularity.facet.range.start">0</int>
  47. <int name="f.popularity.facet.range.end">10</int>
  48. <int name="f.popularity.facet.range.gap">3</int>
  49. <str name="facet.range">manufacturedate_dt</str>
  50. <str name="f.manufacturedate_dt.facet.range.start">NOW/YEAR-10YEARS</str>
  51. <str name="f.manufacturedate_dt.facet.range.end">NOW</str>
  52. <str name="f.manufacturedate_dt.facet.range.gap">+1YEAR</str>
  53. <str name="f.manufacturedate_dt.facet.range.other">before</str>
  54. <str name="f.manufacturedate_dt.facet.range.other">after</str>
  55.  
  56. <!-- Highlighting defaults -->
  57. <str name="hl">on</str>
  58. <str name="hl.fl">content features title name</str>
  59. <str name="hl.encoder">html</str>
  60. <str name="hl.simple.pre"><b></str>
  61. <str name="hl.simple.post"></b></str>
  62. <str name="f.title.hl.fragsize">0</str>
  63. <str name="f.title.hl.alternateField">title</str>
  64. <str name="f.name.hl.fragsize">0</str>
  65. <str name="f.name.hl.alternateField">name</str>
  66. <str name="f.content.hl.snippets">3</str>
  67. <str name="f.content.hl.fragsize">200</str>
  68. <str name="f.content.hl.alternateField">content</str>
  69. <str name="f.content.hl.maxAlternateFieldLength">750</str>
  70.  
  71. <!-- Spell checking defaults -->
  72. <str name="spellcheck">on</str>
  73. <str name="spellcheck.extendedResults">false</str>
  74. <str name="spellcheck.count">5</str>
  75. <str name="spellcheck.alternativeTermCount">2</str>
  76. <str name="spellcheck.maxResultsForSuggest">5</str>
  77. <str name="spellcheck.collate">true</str>
  78. <str name="spellcheck.collateExtendedResults">true</str>
  79. <str name="spellcheck.maxCollationTries">5</str>
  80. <str name="spellcheck.maxCollations">3</str>
  81. </lst>
  82.  
  83. <!-- append spellchecking to our list of components -->
  84. <arr name="last-components">
  85. <str>spellcheck</str>
  86. </arr>
  87. </requestHandler>

关于velocity这个writer的定义如下:

  1. <!--
  2. Custom response writers can be declared as needed...
  3. -->
  4. <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy"/>

处理一个流程的步骤如下:

1、根据请求url查找相关的配置
则在solrConfig.xml中查找  /browse的配置,可以得出上述所示的结果。

2、其中有关velocity的内容如下:
  1. <requestHandler name="/browse" class="solr.SearchHandler">
  2. <lst name="defaults">
  3. <str name="echoParams">explicit</str>
  4. <!-- VelocityResponseWriter settings -->
  5. <str name="wt">velocity</str>
  6. <str name="v.template">browse</str>
  7. <str name="v.layout">layout</str>
  8. <str name="title">Solritas_test</str>

从上述定义中开始分别查找显示层的内容(vm文件)与处理类的内容(wt的实现类。)


3、定位显示内容模板
根据v.template属性,定义到文件browse.vm,注意在配置中省略了后缀名vm。
由于存在v.layout属性,因此,此属性的值将作为模板,而v.template中的内容将作为$content的内容。
  • v.layout: Template name that wraps main template (v.template). Main template renders to a $content that can be used in layout template.

layout.vm的内容如下:
  1. #**
  2. * Overall HTML page layout
  3. *#
  4.  
  5. <html>
  6. <head>
  7. #parse("head.vm")
  8. </head>
  9. <body>
  10. <div id="admin"><a href="#url_root/#/#core_name">Solr Admin</a></div>
  11. <div id="header">
  12. #parse("header.vm")
  13. </div>
  14. <div id="tabs">
  15. #parse("tabs.vm")
  16. </div>
  17. <div id="content">
  18. $content
  19. </div>
  20. <div id="footer">
  21. #parse("footer.vm")
  22. </div>
  23. </body>
  24. </html>

4、定位ResponseWriter 
 从第2步的结果知道,使用的velocity,然后查找这个wt的定义,可以得到
    <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy"/>
即VelocityResponseWriter实现类,其定义如下:
  1. public class VelocityResponseWriter
  2. extends Object
  3. implements QueryResponseWriter
与Solr返回Velocity相关的类只有4个:

以下是关于VelocityResponseWriter的官方说明:http://wiki.apache.org/solr/VelocityResponseWriter

Introduction

VelocityResponseWriter (aka Solritas) enables
Solr to respond with content generated from Velocity templates. Along with technologies like SolrJS, this makes
Solr itself capable of driving sophisticated search interfaces without the need for an intermediate application server between the browser and Solr.

See SOLR-620 for more
information.

Instructions to use, Solr 1.4+

These steps will get you up and running for the examples below:

  • Download and install Solr 1.4.x
  • Fire up Solr: cd example; java -Dsolr.solr.home=../contrib/velocity/src/main/solr/ -jar start.jar
  • Index sample docs: cd example/exampledocs; java -jar post.jar *.xml
  • Hit the examples below...

Sample Usage

http://localhost:8983/solr/itas

  • Renders browse.vm from conf/velocity. Faceted navigation included.

http://localhost:8983/solr/itas?v.template.header=Custom%20Header

  • Renders browse.vm, but overrides the header.vm from conf/velocity with the specified value.

http://localhost:8983/solr/itas?debugQuery=true

  • Renders browse.vm, adding in explanation views per hit, and a Velocity context dump at the end.

Using the VelocityResponseWriter in Solr Core

The VelocityResponseWriter is still a contrib component in Solr 1.4.x. In order to use it with the core distributions the following steps need to be followed:

The following jars need to be copied from contrib/velocity/src/main/solr/lib/ to $SOLR_HOME/lib:

  • apache-solr-velocity-1.4-dev.jar
  • velocity-1.6.1.jar
  • velocity-tools-2.0-beta3.jar
  • commons-beanutils-1.7.0.jar
  • commons-collections-3.2.1.jar

The VelocityResponseWriter uses a more recent version of the commons lang jar than the current version of Solr core, so the jar commons-lang-2.4.jar from .../contrib/velocity/src/main/solr/lib/
should replace $SOLR_HOME/lib/commons-lang-2.1.jar

Add some configuration for this ResponseWriter to
solrconfig.xml like this:

  1. <queryResponseWriter name="velocity" class="org.apache.solr.request.VelocityResponseWriter"/>

Set up a RequestHandler in
solrconfig.xml:

  1. <requestHandler name="/itas" class="solr.SearchHandler">
  2. <lst name="defaults">
  3. <str name="v.template">browse</str>
  4. <str name="v.properties">velocity.properties</str>
  5. <str name="v.contentType">text/html;charset=UTF-8</str>
  6. <str name="title">Solritas</str>
  7.  
  8. <str name="wt">velocity</str>
  9. <str name="defType">dismax</str>
  10. <str name="q.alt">*:*</str>
  11. <str name="rows">10</str>
  12. <str name="fl">*,score</str>
  13. <str name="facet">on</str>
  14. <str name="facet.field">title</str>
  15. <str name="facet.mincount">1</str>
  16. <str name="qf">
  17. text^0.5 title^1.5
  18. </str>
  19. </lst>
  20. <!--<lst name="invariants">-->
  21. <!--<str name="v.base_dir">/solr/contrib/velocity/src/main/templates</str>-->
  22. <!--</lst>-->
  23. </requestHandler>

Copy the .../contrib/velocity/src/main/solr/conf/velocity directory to $SOLR_HOME/conf/. This directory contains the Velocity templates that will be needed by the VelocityResponseWriter, and
also a style sheet, main.css. The templates and style sheet can be edited to customize the display.

Instructions to use, Solr 4.0+

These steps will get you up and running for the examples below:

Sample Usage

http://localhost:8983/solr/browse

  • Renders browse.vm from conf/velocity. Faceted navigation included.

http://localhost:8983/solr/browse?v.template.header=Custom%20Header

  • Renders browse.vm, but overrides the header.vm from conf/velocity with the specified value.

http://localhost:8983/solr/browse?debugQuery=true

  • Renders browse.vm, adding in explanation views per hit, and a Velocity context dump at the end.

Options (All Versions)

  • v.template: template name to use, without the .vm suffix. If not specified, "default"[.vm] will be used.

  • v.template.<name>: overrides a file system template

  • debugQuery: if true, default view displays explanations for each hit and additional debugging information in the footer.

  • v.json: Escapes and wraps Velocity generated response with v.json parameter as a JavaScript function.

  • v.layout: Template name that wraps main template (v.template). Main template renders to a $content that can be used in layout template.

  • v.base_dir: overwrites default template load path (conf/velocity/).

  • v.properties: specifies a Velocity properties file to be applied, found using the Solr resource loader mechanism. If not specified, no .properties file is loaded. Example: v.properties=velocity.properties
    where velocity.properties can be found using Solr's resource loader mechanism, for example in the conf/ directory (not conf/velocity which is for templates only). The .properties file could also be located inside a JAR in the lib/ directory, or other locations.

  • v.contentType: sets the value of the HTTP response's Content-Type header (in case (x)html pages should be UTF-8 (instead of ISO-8859-1) encoded, make sure you set this option to text/xml;charset=UTF-8 (for
    XHTML) and text/html;charset=UTF-8 (for HTML), respectively)

Velocity Context

TODO

  • Ajax suggest
  • Integrate/adapt to SolrJS
  • Tie in SIMILE Timeline and SIMILE Exhibit
  • Add links in default footer to this wiki page, the Solr request as XML format, and SOLR-620
  • Fix multi-valued fields issue, and fl parameter usage.
  • Work on "dist" target so this works easily with a nightly build.
  • Make Velocity tools and engine configuration pluggable

二、Velocity文件定位过程

1、根据上述分析,首先定位layout.xml

  1. <html>
  2. <head>
  3. #parse("head.vm")
  4. </head>
  5. <body>
  6. <div id="admin"><a href="#url_root/#/#core_name">Solr Admin</a></div>
  7. <div id="header">
  8. #parse("header.vm")
  9. </div>
  10. <div id="tabs">
  11. #parse("tabs.vm")
  12. </div>
  13. <div id="content">
  14. $content
  15. </div>
  16. <div id="footer">
  17. #parse("footer.vm")
  18. </div>
  19. </body>
  20. </html>

2、其中content的内容即为browse.vm

  1. <div class="pagination">
  2. #parse("pagination_top.vm")
  3. </div>
  4.  
  5. ## Show Error Message, if any
  6. <div class="error">
  7. #parse("error.vm")
  8. </div>
  9.  
  10. ## Render Results, actual matching docs
  11. <div class="results">
  12. #parse("results_list.vm")
  13. </div>
  14.  
  15. <div class="pagination">
  16. #parse("pagination_bottom.vm")
  17. </div>

3、browse.vm中最主要的搜索结果为results_list.vm

  1. #**
  2. * Render the main Results List
  3. *#
  4.  
  5. ## Usually displayed inside <div class="results">
  6.  
  7. #if($response.response.get('grouped'))
  8.  
  9. #foreach($grouping in $response.response.get('grouped'))
  10. #parse("hit_grouped.vm")
  11. #end
  12.  
  13. #else
  14.  
  15. #foreach($doc in $response.results)
  16. #parse("hit.vm")
  17. ## Can get an extremely simple view of the doc
  18. ## which might be nicer for debugging
  19. ##parse("hit_plain.vm")
  20. #end
  21.  
  22. #end

一般情况下使用hit.vm作呈现,它对页面作了一些美工。

在某些情况下,如debug的时候,就使用hit_plain.vm进行呈现,此时将所有的属性呈现出来。

二者的对比效果如下:

4、先查看hit_plain.vm

  1. #**
  2. * An extremely plain / debug version of hit.vm
  3. *#
  4.  
  5. <table>
  6. ## For each field
  7. #foreach( $fieldName in $doc.fieldNames )
  8. ## For each value
  9. #foreach( $value in $doc.getFieldValues($fieldName) )
  10. <tr>
  11. ## Field Name
  12. <th align="right" valign="top">
  13. #if( $foreach.count == 1 )
  14. $fieldName:
  15. #end
  16. </th>
  17. ## Field Value(s)
  18. <td align="left" valign="top">
  19. $esc.html($value) <br/>
  20. </td>
  21. </tr>
  22. #end ## end for each value
  23. #end ## end for each field
  24. </table>
  25. <hr/>

就是将属性名与属性值呈现出来。

5、再看看hit.vm

  1. #**
  2. * Called for each matching document but then
  3. * calls one of product_doc, join_doc or richtext_doc
  4. * depending on which fields the doc has
  5. *#
  6.  
  7. #set($docId = $doc.getFieldValue('id'))
  8.  
  9. <div class="result-document">
  10.  
  11. ## Has a "name" field ?
  12. #if($doc.getFieldValue('name'))
  13. #parse("product_doc.vm")
  14.  
  15. ## Has a "compName_s" field ?
  16. #elseif($doc.getFieldValue('compName_s'))
  17. #parse("join_doc.vm")
  18.  
  19. ## Fallback to richtext_doc
  20. #else
  21. #parse("richtext_doc.vm")
  22.  
  23. #end
  24.  
  25. </div>

6、可以直接看richtest_doc.vm

  1. #**
  2. * Render a complex document in the results list
  3. *#
  4.  
  5. ## Load Mime-Type List and Mapping
  6. #parse('mime_type_lists.vm')
  7. ## Sets:
  8. ## * supportedMimeTypes, AKA supportedtypes
  9. ## * mimeExtensionsMap, AKA extMap
  10.  
  11. ## Title
  12. #if($doc.getFieldValue('title'))
  13. #set($title = $esc.html($doc.getFirstValue('title')))
  14. #else
  15. #set($title = "["+$doc.getFieldValue('id')+"]")
  16. #end
  17.  
  18. ## URL
  19. #if($doc.getFieldValue('url'))
  20. #set($url = $doc.getFieldValue('url'))
  21. #elseif($doc.getFieldValue('resourcename'))
  22. #set($url = "file:///$doc.getFieldValue('resourcename')")
  23. #else
  24. #set($url = "$doc.getFieldValue('id')")
  25. #end
  26.  
  27. ## Sort out Mime-Type
  28. #set($ct = $list.get($doc.getFirstValue('content_type').split(";"),0))
  29. #set($filename = $doc.getFieldValue('resourcename'))
  30. #set($filetype = false)
  31. #set($filetype = $mimeExtensionsMap.get($ct))
  32.  
  33. ## TODO: falling back to file extension is convenient,
  34. ## except when you don't have an icon for that extension
  35. ## example "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
  36. ## document with a .docx extension.
  37. ## It'd be nice to fall back to an "unknown" or the existing "file" type
  38. ## We sort of do this below, but only if the filename has no extension
  39. ## (anything after the last dot).
  40.  
  41. #if(!$filetype)
  42. #set($filetype = $filename.substring($filename.lastIndexOf(".")).substring(1))
  43. #end
  44.  
  45. ## #if(!$filetype)
  46. ## #set($filetype = "file")
  47. ## #end
  48. ## #if(!$supportedMimeTypes.contains($filetype))
  49. ## #set($filetype = "file")
  50. ## #end
  51.  
  52. ## Row 1: Icon and Title and mlt link
  53. <div class="result-title">
  54. ## Icon
  55. ## Small file type icons from http://www.splitbrain.org/projects/file_icons (public domain)
  56. <img src="#{url_root}/img/filetypes/${filetype}.png" align="center">
  57.  
  58. ## Title, hyperlinked
  59. <a href="${url}" target="_blank">
  60. <b>$title</b></a>
  61.  
  62. ## Link for MLT / More Like This / Find Similar
  63. <span class="mlt">
  64. #if($params.getBool('mlt', false) == false)
  65. <a href="#lensNoQ&q=id:%22$docId%22&mlt=true">
  66. More Like This</a>
  67. #end
  68. </span>
  69.  
  70. </div>
  71.  
  72. ## Row 2?: ID / URL
  73. <div>
  74. #Id: #field('id')
  75. ##自己修改
  76. ##Time: #field('tstamp')
  77. </div>
  78.  
  79. ## Resource Name
  80. <div>
  81. #if($doc.getFieldValue('resourcename'))
  82. Resource name: $filename
  83. #elseif($url)
  84. URL: $url
  85. #end
  86. #if($ct)
  87. ($ct)
  88. #end
  89. </div>
  90.  
  91. ## Author
  92. #if($doc.getFieldValue('author'))
  93. <div>
  94. Author: #field('author')
  95. </div>
  96. #end
  97.  
  98. ## Last_Modified Date
  99. #if($doc.getFieldValue('last_modified'))
  100. <div>
  101. last-modified:
  102. #field('last_modified')
  103. </div>
  104. #end
  105.  
  106. ## Main content of doc
  107. <div class="result-body">
  108. #field('content')
  109. </div>
  110.  
  111. ## Display Similar Documents / MLT = More Like This
  112. <div class="mlt">
  113. #set($mlt = $mltResults.get($docId))
  114. #set($mltOn = $params.getBool('mlt'))
  115. #if($mltOn == true)
  116. <div class="field-name">
  117. Similar Items
  118. </div>
  119. #end
  120. ## If has MLT enabled An Entries to show
  121. #if ($mltOn && $mlt && $mlt.size() > 0)
  122. <ul>
  123. #foreach($mltHit in $mlt)
  124. #set($mltId = $mltHit.getFieldValue('id'))
  125. <li>
  126. <div>
  127. <a href="#url_for_home?q=id:$mltId">
  128. $mltId</a>
  129. </div>
  130. <div>
  131. <span class="field-name">
  132. Title:
  133. </span>
  134. $mltHit.getFieldValue('title')
  135. </div>
  136. <div>
  137. <span class="field-name">
  138. Author:
  139. </span>
  140. $mltHit.getFieldValue('author')
  141. <span class="field-name">
  142. Description:
  143. </span>
  144. $mltHit.getFieldValue('description')
  145. </div>
  146. </li>
  147. #end ## end for each mltHit in $mlt
  148. </ul>
  149. ## Else MLT Enabled but no mlt results for this query
  150. #elseif($mltOn && $mlt.size() == 0)
  151. <div>No Similar Items Found</div>
  152. #end
  153. </div> ## div class=mlt
  154.  
  155. #parse('debug.vm')

由于本文件是example自带的呈现文件,其属性也按照自带的schemal.xml定义,并不适用于nutch的schema。

因此,若要改变呈现的内容,可以直接修改此文件。如将

  1. ## Row 2?: ID / URL
  2. <div>
  3. #Id: #field('id')
  4. </div>

改为:

  1. ## Row 2?: ID / URL
  2. <div>
  3. ##自己修改
  4. #Time: #field('tstamp')
  5. </div>

则在页面不再显示id,而是显示时间。

【solr专题之四】关于VelocityResponseWriter的更多相关文章

  1. 【solr专题之四】关于VelocityResponseWriter 分类: H4_SOLR/LUCENCE 2014-07-22 12:32 1639人阅读 评论(0) 收藏

    一.关于Velocity的基本配置 在Solr中,可以以多种方式返回搜索结果,如单纯的文本回复(XML.JSON.CSV等),也可以返回velocity,js等格式.而VelocityResponse ...

  2. 【solr专题之四】在Tomcat 中部署Solr4.x

    1.安装Tomcat (1)下载并解压至/opt/tomcat中 # cd /opt/jediael # tar -zxvf apache-tomcat-7.0.54.tar.gz # mv apac ...

  3. 【solr专题之四】在Tomcat 中部署Solr4.x 分类: H_HISTORY 2014-07-17 16:08 1286人阅读 评论(0) 收藏

    1.安装Tomcat (1)下载并解压至/opt/tomcat中 # cd /opt/jediael # tar -zxvf apache-tomcat-7.0.54.tar.gz # mv apac ...

  4. Solr专题(三)SSM项目整合Solr

    一.环境配置 所需要的jar包: org.apache.solr.solr-solrj maven依赖: <!-- https://mvnrepository.com/artifact/org. ...

  5. 【solr专题之二】配置文件:solr.xml solrConfig.xml schema.xml

    1.关于默认搜索域 If you are using the Lucene query parser, queries that don't specify a field name will use ...

  6. 【solr专题之二】配置文件:solr.xml solrConfig.xml schema.xml 分类: H4_SOLR/LUCENCE 2014-07-23 21:30 1959人阅读 评论(0) 收藏

    1.关于默认搜索域 If you are using the Lucene query parser, queries that don't specify a field name will use ...

  7. 【Solr专题之九】SolrJ教程

    一.SolrJ基础 1.相关资料 API:http://lucene.apache.org/solr/4_9_0/solr-solrj/ apache_solr_ref_guide_4.9.pdf:C ...

  8. 【solr专题之三】Solr常见异常

    1.RemoteSolrException: Expected mime type application/octet-stream but got text/html 现象: SLF4J: Fail ...

  9. 【solr专题之一】Solr快速入门

    一.Solr学习相关资料 1.官方材料 (1)快速入门:http://lucene.apache.org/solr/4_9_0/tutorial.html,以自带的example项目快速介绍发Solr ...

随机推荐

  1. 如何禁止C++默认生成成员函数

    前言: 前几天在一次笔试过程中被问到c++如何设计禁止调用默认构造函数,当时简单的想法是直接将默认构造函数声明为private即可,这样的话对象的确不能直接调用.之后查阅了<Effective ...

  2. 慕课linux学习笔记(五)常用命令(2)

    链接命令 Ln [原文件] [目标文件] -s 表示创建软链接 硬链接特征: 拥有相同的i节点和存储block块,可以看做是同一个文件 通过i节点识别 不能跨分区 不能针对目录用 软链接特征: 不同的 ...

  3. angularjs directive 实例 详解

    前面提到了angularjs的factory,service,provider,这个可以理解成php的model,这种model是不带html的,今天所说的directive,也可以理解成php的mo ...

  4. Android平台上使用气压传感器计算海拔高度

    气压传感器两年前已经开始被手机制造商运用在其设备上,但貌似没有引起开发者足够的重视.像Galaxy S III .Galaxy Note 2和小米2手机上都有,不过大家对于气压传感器比较陌生.其实大气 ...

  5. 纯js实现div内图片自适应大小

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. Spring Data JPA之Hello World

    Spring Data Jpa 配置 使用 Spring Data JPA 进行持久层开发需要的四个步骤: 1.配置 Spring 整合 JPA 2.在 Spring 配置文件中配置 Spring D ...

  7. HornetQ

    https://github.com/flsusp/http-queue https://github.com/sfr-network-service-platforms/hq-console htt ...

  8. POJ 2653 Pick-up sticks(线段相交)

    题意:给定n个木棍依次放下,要求最终判断没被覆盖的木棍是哪些. 思路:快速排斥以及跨立实验可以判断线段相交. #include<algorithm> #include<cstdio& ...

  9. LeetCode_Distinct Subsequences

    Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence ...

  10. 《Programming WPF》翻译 第5章 6.触发器

    原文:<Programming WPF>翻译 第5章 6.触发器 目前为止,我们已经看到样式,作为一个Setter元素的集合.当应用一个样式时,在Setter元素中描述的设置不会无条件地应 ...