﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-thinking</title><link>http://www.blogjava.net/alinglau36/</link><description>one platform thousands thinking</description><language>zh-cn</language><lastBuildDate>Tue, 12 May 2026 22:58:41 GMT</lastBuildDate><pubDate>Tue, 12 May 2026 22:58:41 GMT</pubDate><ttl>60</ttl><item><title>Stackoverflow经典Python问答</title><link>http://www.blogjava.net/alinglau36/archive/2018/05/30/433247.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Wed, 30 May 2018 10:26:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2018/05/30/433247.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/433247.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2018/05/30/433247.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/433247.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/433247.html</trackback:ping><description><![CDATA[1. python的string相加<br /><br /><div itemprop="text" style="margin: 0px 0px 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: 1.3; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; font-size: 15px; vertical-align: baseline; box-sizing: inherit; width: 667px; word-wrap: break-word; color: #242729; background-color: #ffffff;"><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; clear: both;">That said, if you're aiming for something like Java's StringBuilder, the canonical Python idiom is to add items to a list and then use&nbsp;<code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; font-size: 13px; vertical-align: baseline; box-sizing: inherit; background-color: #eff0f1; white-space: pre-wrap;">str.join</code>&nbsp;to concatenate them all at the end:</p><pre prettyprint=""  prettyprinted"="" style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; font-size: 13px; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: #eff0f1; color: #393318; word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;"><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">l </span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">=</span> <span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">[]</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;"> <br />l</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">append</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #7d2727;">'foo'</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">)<br /></span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">l</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">append</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #7d2727;">'bar'</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">)</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;"> <br />l</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">append</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #7d2727;">'baz'</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">)</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">  <br /><br />s </span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">=</span> <span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #7d2727;">''</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">.</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">join</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">(</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">l</span><span style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; color: #303336;">)</span></code></pre></div><div mb0="" fw-wrap="" ai-start="" jc-end="" gs8=""  gsy"="" style="margin-top: -4px; margin-right: 0px; margin-left: 0px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; font-size: 13px; vertical-align: baseline; box-sizing: inherit; display: flex; color: #242729; background-color: #ffffff; margin-bottom: 0px !important; flex-wrap: wrap !important; justify-content: flex-end !important; align-items: flex-start !important;"><div mr16"="" style="margin: 4px 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; flex: 1 1 100px;"><div style="margin: 0px; padding-top: 2px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;"></div></div></div><br /><br /><br />以下是转自 https://github.com/qiwsir/StackOverFlowCn/blob/master/README.md<br />&nbsp;<br /><br /><p style="box-sizing: border-box; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; margin-top: 0px !important;">如果你是一名自诩为程序员的，那么，就必须知道stackoverflow.com这个网站。因为它是一个非常好的技术问答网站，里面不仅有高手，更重要的是有对问题进行详细耐心解答的高手。</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;">这里我抽空翻译了一些典型的问答，当然，只能翻译Python语言方面的，其它语言，唯恐因知之甚少而漏洞百出，即便是Python，也会因为才疏学浅，在翻译过程中感到惶恐。所以，读者如果看到错误之处，请不吝赐教。</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;">欢迎访问：<a href="http://www.itdiffer.com/" rel="nofollow" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">www.itdiffer.com</a>，加入学习Python的群组。</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;">#目录</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;">##基本对象和语句</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;"><li style="box-sizing: border-box;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/101.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">Python是否有三元条件运算符</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/102.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何把两个Python字典用一个表达式合并</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/103.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">对Python字典按值排序</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/104.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">append和extend的区别</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/105.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">获得Python的循环索引</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/106.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">判断一个字符串是否含子串的方法</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/107.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">怎样在Python中实现Enum（枚举）的功能</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/108.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">将多行的异常变成一行</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/109.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">解释Python的切片法</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/110.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何在Python中获取当前时间</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/111.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">查看某个给定的键是否已经在字典中</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/112.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何删除Python中的换行符？</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/113.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何将Python列表均匀划分？</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/114.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">join函数为什么是string.join(list)而不是list.join(string)</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/115.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">我如何在Python中检查一个字符串否可转化为数字？</a></li></ul><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;">##文件</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;"><li style="box-sizing: border-box;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/201.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何使用Python来检查文件是否存在</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/202.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何在Python中列出目录下的所有文件</a></li></ul><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;">##函数和类</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;"><li style="box-sizing: border-box;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/301.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">Python中yield关键词的作用是什么</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/302.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">Python中的元类是什么</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/303.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">怎样在Python中创建函数装饰器链</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/304.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;"><code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0.4em; margin: 0px; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px;">if __name__ == "__main__"</code>是做什么用的</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/305.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">@staticmethod（静态方法）和@classmethod（类方法）的区别</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/306.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何通过参数来传递一个变量？</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/307.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">Python中的&nbsp;<code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0.4em; margin: 0px; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px;">__str__</code>和<code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0.4em; margin: 0px; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px;">__repr__</code>之间的区别</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/308.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">如何使用 ' super '</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/309.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">Python中的静态方法？</a></li></ul><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;">##系统</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px;"><li style="box-sizing: border-box;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/401.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">在Python中调用外部命令</a></li><li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://github.com/qiwsir/StackOverFlowCn/blob/master/402.md" style="box-sizing: border-box; color: #0366d6; text-decoration-line: none;">检查目录是否存在，如果有必要就创建一个目录</a></li></ul><p style="box-sizing: border-box; margin-top: 0px; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; font-size: 16px; margin-bottom: 0px !important;">##网络</p><img src ="http://www.blogjava.net/alinglau36/aggbug/433247.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2018-05-30 18:26 <a href="http://www.blogjava.net/alinglau36/archive/2018/05/30/433247.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>gerrit (n/a (unpacker error))异常解决</title><link>http://www.blogjava.net/alinglau36/archive/2018/05/10/433206.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Thu, 10 May 2018 08:36:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2018/05/10/433206.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/433206.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2018/05/10/433206.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/433206.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/433206.html</trackback:ping><description><![CDATA[<div>  <p align="left"><span style="font-size: 10pt; font-family: &quot;Microsoft YaHei UI&quot;, sans-serif;">用如下命令push<br />git push --no-thin origin HEAD:refs/for/</span><span style="font-size: 10pt; font-family: Calibri, sans-serif;">XXX<br /><br /><br /></span><span style="color: #4f4f4f; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; font-size: 16px; text-align: justify; background-color: #ffffff;">error: The following untracked working tree files would be overwritten by checkout&nbsp;</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all; color: #4f4f4f; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; font-size: 16px; text-align: justify; background-color: #ffffff;" /><span style="color: #4f4f4f; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; font-size: 16px; text-align: justify; background-color: #ffffff;">通过错误提示可知，是由于一些untracked working tree files引起的问题。所以只要解决了这些untracked的文件就能解决这个问题。<br /><br /></span><span style="font-family: Consolas, Inconsolata, Courier, monospace; white-space: pre; background-color: #f6f8fa;">解决方式：

打开SourceTree通过命令行，进入本地版本仓库目录下，直接执行git clean -d -fx即可。可能很多人都不明白-d，-fx到底是啥意思，其实git clean -d -fx表示：删除 一些 没有 git add 的 文件；

git clean 参数 

-n 显示将要删除的文件和目录；

-x -----删除忽略文件已经对git来说不识别的文件

-d -----删除未被添加到git的路径中的文件

-f -----强制运行

git clean -n

git clean -df

git clean -f</span></p></div><img src ="http://www.blogjava.net/alinglau36/aggbug/433206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2018-05-10 16:36 <a href="http://www.blogjava.net/alinglau36/archive/2018/05/10/433206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>http://java.dzone.com/articles/immutability-with-builder-design-pattern</title><link>http://www.blogjava.net/alinglau36/archive/2013/01/25/394783.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Fri, 25 Jan 2013 10:16:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2013/01/25/394783.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/394783.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2013/01/25/394783.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/394783.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/394783.html</trackback:ping><description><![CDATA[<div>http://java.dzone.com/articles/immutability-with-builder-design-pattern</div><img src ="http://www.blogjava.net/alinglau36/aggbug/394783.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2013-01-25 18:16 <a href="http://www.blogjava.net/alinglau36/archive/2013/01/25/394783.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jQuery.template()</title><link>http://www.blogjava.net/alinglau36/archive/2011/11/02/362514.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Wed, 02 Nov 2011 02:41:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/11/02/362514.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/362514.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/11/02/362514.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/362514.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/362514.html</trackback:ping><description><![CDATA[<div>http://api.jquery.com/jQuery.template/</div><img src ="http://www.blogjava.net/alinglau36/aggbug/362514.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-11-02 10:41 <a href="http://www.blogjava.net/alinglau36/archive/2011/11/02/362514.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jQuery hoverIntent</title><link>http://www.blogjava.net/alinglau36/archive/2011/11/02/362513.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Wed, 02 Nov 2011 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/11/02/362513.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/362513.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/11/02/362513.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/362513.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/362513.html</trackback:ping><description><![CDATA[<div>http://cherne.net/brian/resources/jquery.hoverIntent.html</div><br /><div>  <div id="pageHeader"> 	<ul id="nav1"><li><a href="http://cherne.net/">cherne.net</a></li><li><a href="http://cherne.net/brian/resume/">Resume</a></li><li><a href="http://cherne.net/brian/portfolio/">Portfolio</a></li><li><a href="http://cherne.net/brian/resources/">Resources</a></li></ul> 	<h1>hoverIntent jQuery Plug-in</h1> </div>  <div id="pageContent">  	<div id="main">  		<h2>What is hoverIntent?</h2> 		<p>hoverIntent is a plug-in that attempts to determine the user's  intent... like a crystal ball, only with mouse movement! It works like  (and was derived from) <a href="http://jquery.com/">jQuery</a>'s built-in <a href="http://api.jquery.com/hover/">hover</a>.  However, instead of immediately calling the onMouseOver function, it  waits until the user's mouse slows down enough before making the call.</p> 		<p>Why? To delay or prevent the accidental firing of animations or  ajax calls. Simple timeouts work for small areas, but if your target  area is large it may execute regardless of intent.</p> 		<p><a href="http://cherne.net/brian/resources/jquery.hoverIntent.js">Download hoverIntent r6 (fully-commented, uncompressed)</a></p> 		<p><a href="http://cherne.net/brian/resources/jquery.hoverIntent.minified.js">Download hoverIntent r6 (minified)</a></p> 		<p>hoverIntent r6 (2011) has all the same functionality of r5 (2007) except that the Google Chrome defect (<a href="http://cherne.net/brian/resources/jquery.hoverIntent.html#defects">known defects</a>) is fixed once you upgrade to jQuery 1.5.1.</p>   		<h2>Translations</h2> 		<p><a href="http://www.designcontest.com/show/jquery.hoverIntent-be" hreflang="be-BY">Беларуская</a> courtesy Martha Ruszkowski</p>   		<h2>Examples</h2> 	 		<noscript><p><em>If you can see this message <strong>JavaScript is disabled</strong>. This plug-in requires JavaScript to be enabled in order for the examples to work. (This is really a note to myself so the next time I look at my web site with JavaScript accidentally turned off I don't freak out and wonder why it's not working)</em></p></noscript>  		<h3>jQuery's hover (for reference)</h3> 		<pre>$("#demo1 li").hover( makeTall, makeShort )</pre> 		<ul id="demo1"><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">hover ignores over/out events from children</li></ul> 		<p>jQuery's built-in hover calls onMouseOver/onMouseOut functions immediately.</p>  		<h3>hoverIntent as hover replacement</h3> 		<pre>$("#demo2 li").hoverIntent( makeTall, makeShort )</pre> 		<ul id="demo2"><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">hoverIntent also ignores over/out events from children</li></ul> 		<p>hoverIntent is interchangeable with jQuery's hover. It can use the  same exact onMouseOver and onMouseOut functions and it passes the same <strong>this</strong> and <strong>event</strong> objects to those functions.</p> 	  		<h3>hoverIntent with configuration object</h3> <pre>var config = {    <br />     over: makeTall, // function = onMouseOver callback (REQUIRED)    <br />     timeout: 500, // number = milliseconds delay before onMouseOut    <br />     out: makeShort // function = onMouseOut callback (REQUIRED)    <br />};<br /><br />$("#demo3 li").hoverIntent( config )<br /></pre> 		<ul id="demo3"><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">&nbsp;</li><li style="height: 50px;">&nbsp;</li><li>&nbsp;</li></ul> 		<p>To override the default configuration of hoverIntent, pass it an  object as the first (and only) parameter. The object must contain "over"  and "out" functions, in addition to any other options you'd like to  override.</p>   		<h2>Basic Configuration Options</h2> 		<p>The "timeout" delay (by default set to 0) will mostly likely be the  one you'll want to override. The "over" and "out" functions are  required but nothing prevents you from sending an empty function(){} to  either.</p>  		<h3>over:</h3> 		<p>Required. The function you'd like to call onMouseOver. Your  function receives the same "this" and "event" objects as it would from  jQuery's hover method.</p>  		<h3>timeout:</h3> 		<p>A simple delay, in milliseconds, before the "out" function is  called. If the user mouses back over the element before the timeout has  expired the "out" function will not be called (nor will the "over"  function be called). This is primarily to protect against sloppy/human  mousing trajectories that temporarily (and unintentionally) take the  user off of the target element... giving them time to return. <em>Default timeout: 0</em></p>  		<h3>out:</h3> 		<p>Required. The function you'd like to call onMouseOut. Your function  receives the same "this" and "event" objects as it would from jQuery's  hover method. Note, hoverIntent will only call the "out" function if the  "over" function has been called on that same run.</p>   		<h2>Advanced Configuration Options</h2> 		<p>When choosing the default settings for hoverIntent I tried to find  the best possible balance between responsiveness and frequency of false  positives. Modify these if you are brave, test tirelessly, and  completely understand what you are doing.</p>  		<h3>sensitivity:</h3> 		<p>If the mouse travels fewer than this number of pixels between  polling intervals, then the "over" function will be called. With the  minimum sensitivity threshold of 1, the mouse must not move between  polling intervals. With higher sensitivity thresholds you are more  likely to receive a false positive. <em>Default sensitivity: 7</em></p>  		<h3>interval:</h3> 		<p>The number of milliseconds hoverIntent waits between  reading/comparing mouse coordinates. When the user's mouse first enters  the element its coordinates are recorded. The soonest the "over"  function can be called is after a single polling interval. Setting the  polling interval higher will increase the delay before the first  possible "over" call, but also increases the time to the next point of  comparison. <em>Default interval: 100</em></p>   		<h2>Notice of DOM Manipulation</h2> 		<p>hoverIntent adds two custom attributes to every DOM element it's  assigned to. For example: &lt;li hoverIntent_t="" hoverIntent_s=""&gt;		</p> 		<ul><li>hoverIntent_t is the polling interval timer, or the mouseOut timer.</li><li>hoverIntent_s stores the state to prevent unmatched function calls.</li></ul> 		<p>Timers are stored as integers, so there should not be any <a href="http://msdn.microsoft.com/library/en-us/IETechCol/dnwebgen/ie_leak_patterns.asp">trouble with memory leaks</a>. hoverIntent state is also stored as an integer.</p>   		<h2>Known Defects</h2> 		<p>hoverIntent r5 suffers from <a href="http://code.google.com/p/chromium/issues/detail?id=68629">a defect in Google Chrome that improperly triggers mouseout when entering a child input[type="text"] element</a>.  hoverIntent r6 uses the same mouseenter/mouseleave special events as  jQuery's built-in hover, and jQuery 1.5.1 patched this issue. Thanks to  Colin Stuart for tipping me off about this and for providing isolated  code to demonstrate/test.</p> 		<p id="chrome9defect" style="background: none repeat scroll 0% 0% #eeeeee; margin-bottom: 1em;">This  page uses jQuery 1.5.1+ and hoverIntent r6, so when your cursor goes  over the text input nothing should change (it should continue to read  "enter parent" because you are still over this paragraph). <br /><input value="" type="text" /><br />  However, if you were using Google Chrome and if this page were using an  older version of jQuery or hoverIntent, moving the cursor over the text  input would improperly trigger the mouseout event, and the value would  change to "leave parent".</p> 		 		<p>If you place an element with onMouseOut event listeners flush  against the edge of the browser chrome, sometimes Internet Explorer does  not trigger an onMouseOut event immediately if your mouse leaves the  document. hoverIntent does not correct for this.</p> 		<p>jQuery's hover can take <a href="http://api.jquery.com/hover/#hover1">both a handlerIn and a handlerOut</a> <strong>or</strong> <a href="http://api.jquery.com/hover/#hover2">just a handlerIn</a>. The current version of hoverIntent requires both handlerIn and handlerOut <strong>or</strong>  a single configuration object. It was not designed to take just a  handlerIn like hover. This will be addressed in a future release.</p> 		<p>Please email me ( <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#37;&#54;&#50;&#37;&#55;&#50;&#37;&#54;&#57;&#37;&#54;&#49;&#37;&#54;&#69;&#37;&#52;&#48;&#37;&#54;&#51;&#37;&#54;&#56;&#37;&#54;&#53;&#37;&#55;&#50;&#37;&#54;&#69;&#37;&#54;&#53;&#37;&#50;&#69;&#37;&#54;&#69;&#37;&#54;&#53;&#37;&#55;&#52;">brian@cherne.net</a> ) if you have questions or would like to notify me of any defects. I will tweet about any updates from <a href="http://twitter.com/#%21/briancherne">@briancherne</a> using the tags #hoverIntent #jQuery.</p>   		<h2>The Future of hoverIntent</h2> 		<p>hoverIntent r7 (in development) will be backwards compatible with  all current implementations and include hoverIntent custom events.</p>   		<h2>Release History</h2> 		<ul><li>r7 = In development. Adding custom events.</li><li>r6 = Current stable release. Updated to correct for Google Chrome defect.</li><li>r5 = Added state to prevent unmatched function calls. This release (and previous releases) suffers from <a href="http://code.google.com/p/chromium/issues/detail?id=68629">a defect in Google Chrome that improperly triggers mouseout when entering a child input[type=text] element</a>.</li><li>r4 = Fixed polling interval timing issue (now uses a self-calling timeout to avoid interval irregularities).</li><li>r3 = Developer-only release for debugging.</li><li>r2 = Added timeout and interval references to DOM object -- keeps  timers separate from each other. Added configurable options. Added  timeout option to delay onMouseOut function call. Fixed two-interval  mouseOver bug (now setting pX and pY onMouseOver instead of hardcoded  value).</li><li>r1 = Initial release to jQuery discussion forum for feedback.</li></ul>  	</div>  </div>    </div><img src ="http://www.blogjava.net/alinglau36/aggbug/362513.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-11-02 10:40 <a href="http://www.blogjava.net/alinglau36/archive/2011/11/02/362513.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>IE9 Only CSS Hack</title><link>http://www.blogjava.net/alinglau36/archive/2011/11/01/362433.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Tue, 01 Nov 2011 03:49:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/11/01/362433.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/362433.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/11/01/362433.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/362433.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/362433.html</trackback:ping><description><![CDATA[<div>http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx</div><br /><br /><div><div><div number1="" index0="" alt2=""><code plain="">#element {</code></div><div number2="" index1="" alt1=""><code spaces="">&nbsp;&nbsp;&nbsp;&nbsp;</code><code keyword="">color</code><code plain="">:orange;</code></div><div number3="" index2="" alt2=""><code plain="">}</code></div><div number4="" index3="" alt1=""><code plain="">#element {</code></div><div number5="" index4="" alt2=""><code spaces="">&nbsp;&nbsp;&nbsp;&nbsp;</code><code plain="">*</code><code keyword="">color</code><code plain="">: </code><code value="">white</code><code plain="">;&nbsp;&nbsp;&nbsp; </code><code comments="">/* IE6+7, doesn't work in IE8/9 as IE7 */</code></div><div number6="" index5="" alt1=""><code plain="">}</code></div><div number7="" index6="" alt2=""><code plain="">#element {</code></div><div number8="" index7="" alt1=""><code spaces="">&nbsp;&nbsp;&nbsp;&nbsp;</code><code keyword="">_color</code><code plain="">: </code><code value="">red</code><code plain="">;&nbsp;&nbsp;&nbsp;&nbsp; </code><code comments="">/* IE6 */</code></div><div number9="" index8="" alt2=""><code plain="">}</code></div><div number10="" index9="" alt1=""><code plain="">#element {</code></div><div number11="" index10="" alt2=""><code spaces="">&nbsp;&nbsp;&nbsp;&nbsp;</code><code keyword="">color</code><code plain="">: </code><code value="">green</code><code plain="">\</code><code value="">0</code><code plain="">/IE</code><code value="">8</code><code plain="">+</code><code value="">9</code><code plain="">; </code><code comments="">/* IE8+9&nbsp; */</code></div><div number12="" index11="" alt1=""><code plain="">}</code></div><div number13="" index12="" alt2=""><code plain="">:root #element { </code><code keyword="">color</code><code plain="">:pink \</code><code value="">0</code><code plain="">/IE</code><code value="">9</code><code plain="">; }&nbsp; </code><code comments="">/*&nbsp;IE9 */</code></div></div></div><img src ="http://www.blogjava.net/alinglau36/aggbug/362433.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-11-01 11:49 <a href="http://www.blogjava.net/alinglau36/archive/2011/11/01/362433.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>The Essentials of Writing High Quality JavaScript </title><link>http://www.blogjava.net/alinglau36/archive/2011/09/16/358793.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Fri, 16 Sep 2011 06:38:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/09/16/358793.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/358793.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/09/16/358793.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/358793.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/358793.html</trackback:ping><description><![CDATA[<div>good stuff:<br /><br />http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/</div><img src ="http://www.blogjava.net/alinglau36/aggbug/358793.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-09-16 14:38 <a href="http://www.blogjava.net/alinglau36/archive/2011/09/16/358793.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hack css in safari and opera</title><link>http://www.blogjava.net/alinglau36/archive/2011/08/11/356312.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Thu, 11 Aug 2011 08:16:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/08/11/356312.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/356312.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/08/11/356312.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/356312.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/356312.html</trackback:ping><description><![CDATA[<div><p>@media all and (min-width: 0px){ }opera和safari都支持<br /> @media screen and (-webkit-min-device-pixel-ratio:0){}<br /> 这个只支持safari，以前做表单统一样式的时候研究过。<br /> 如果想区分opera和safari的话先写<br /> @media all and (min-width: 0px){<br /> }<br /> 然后写<br /> @media screen and (-webkit-min-device-pixel-ratio:0){}<br /> 就OK了</p> <p>div{ width:100px; height:200px;}<br /> @media all and (min-width: 0px){ div{ background:red} }<br /> @media screen and (-webkit-min-device-pixel-ratio:0){div{background:#000}}</p> <p>可以试下</p></div><img src ="http://www.blogjava.net/alinglau36/aggbug/356312.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-08-11 16:16 <a href="http://www.blogjava.net/alinglau36/archive/2011/08/11/356312.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>freemarker数字格式化带来的操作问题</title><link>http://www.blogjava.net/alinglau36/archive/2011/07/13/354284.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Wed, 13 Jul 2011 09:37:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/07/13/354284.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/354284.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/07/13/354284.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/354284.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/354284.html</trackback:ping><description><![CDATA[freemarker在解析数据格式的时候，自动默认将数字按3为分割（1，000），这个问题给操作带来一定的额外处理复杂度，解决方法有如下几种： <br />&nbsp;&nbsp;&nbsp; 1、在模板中直接加.toString()转化数字为字符串，如：${languageList.id.toString()}； <br />&nbsp;&nbsp;&nbsp; 2、在freemarker配置文件freemarker.properties加&lt;#setting number_format="#"&gt;或者&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;#setting number_format="0"&gt;； <br />&nbsp;&nbsp;&nbsp; 3、在模板中直接加&lt;#setting number_format="#"&gt;或者&lt;#setting  number_format="0"&gt;，如：&lt;#if AdminLanguagePaginationMsg?exists&gt; <br />	&lt;#setting number_format="#"&gt;<img src ="http://www.blogjava.net/alinglau36/aggbug/354284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-07-13 17:37 <a href="http://www.blogjava.net/alinglau36/archive/2011/07/13/354284.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>newInstance() 和 new 有什么区别？(转)</title><link>http://www.blogjava.net/alinglau36/archive/2011/04/14/348306.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Thu, 14 Apr 2011 09:37:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/04/14/348306.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/348306.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/04/14/348306.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/348306.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/348306.html</trackback:ping><description><![CDATA[在初始化一个类，生成一个实例的时候；newInstance() 和 new 有什么区别？
<br />
用newInstance与用new是区别的，区别在于创建对象的方式不一样，前者是使用类加载机制，那么为什么会有两种创建对象方式？这个就要从可伸缩、可扩展，可重用等软件思想上解释了。
<br />
Java中工厂模式经常使用newInstance来创建对象，因此从为什么要使用工厂模式上也可以找到具体答案。
<br />
例如：
<br />
Class c = Class.forName(&#8220;A&#8221;);factory = (AInterface)c.newInstance();
<br />
其中AInterface是A的接口，如果下面这样写，你可能会理解：
<br />
String className = "A";Class c = Class.forName(className);factory = (AInterface)c.newInstance();
<br />
进一步，如果下面写，你可能会理解：
<br />
String className = readfromXMlConfig;//从xml 配置文件中获得字符串Class c =
Class.forName(className);factory = (AInterface)c.newInstance();
<br />
上面代码就消灭了A类名称，优点：无论A类怎么变化，上述代码不变，甚至可以更换A的兄弟类B , C , D....等，只要他们继承Ainterface就可以。
<br />
从jvm的角度看，我们使用new的时候，这个要new的类可以没有加载；
<br />
<span style="color: red;">但是使用newInstance时候，就必须保证：1、这个类已经加载；2、这个类已经连接了。而完成上面两个步骤的正是class的静态方法forName（）方法，这个静态方法调用了启动类加载器（就是加载java API的那个加载器）</span>。
<br />
有了上面jvm上的理解，那么我们可以这样说，newInstance实际上是把new这个方式分解为两步,即，首先调用class的加载方法加载某个类，然后实例化。
<br />
这样分步的好处是显而易见的。我们可以在调用class的静态加载方法forName时获得更好的灵活性，提供给了我们降耦的手段。
<br />
<br />
[补充:]
<br />
newInstance: 弱类型。低效率。只能调用无参构造。
<br />
new: 强类型。相对高效。能调用任何public构造。
<br />
newInstance()是实现IOC、反射、面对接口编程 和 依赖倒置 等技术方法的必然选择，new 只能实现具体类的实例化，不适合于接口编程。
<br />
里面就是通过这个类的默认构造函数构建了一个对象，如果没有默认构造函数就抛出InstantiationException, 如果没有访问默认构造函数的权限就抛出IllegalAccessException
<img src ="http://www.blogjava.net/alinglau36/aggbug/348306.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-04-14 17:37 <a href="http://www.blogjava.net/alinglau36/archive/2011/04/14/348306.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于JavaScript中apply与call的用法意义及区别(转)</title><link>http://www.blogjava.net/alinglau36/archive/2011/04/11/348038.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Mon, 11 Apr 2011 02:27:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/04/11/348038.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/348038.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/04/11/348038.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/348038.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/348038.html</trackback:ping><description><![CDATA[<h2>
<a id="ctl01_TitleUrl" href="http://www.cnblogs.com/treasurelife/archive/2008/03/05/1092251.html">关于JavaScript中apply与call的用法意义及区别(转)</a>
</h2>
<div id="cnblogs_post_body">
<p>JavaScript中有一个call和apply方法，其作用基本相同，但也有略微的区别。<br />
<br />
先来看看JS手册中对call的解释：<br />
</p>
<div style="border: 1px solid #666666; background-color: #fafafa;">call 方法<br />
调用一个对象的一个方法，以另一个对象替换当前对象。<br />
<br />
call([thisObj[,arg1[, arg2[,&nbsp;&nbsp; [,.argN]]]]])<br />
<br />
<strong>参数</strong><br />
thisObj<br />
可选项。将被用作当前对象的对象。<br />
<br />
arg1, arg2,&nbsp;&nbsp;, argN<br />
可选项。将被传递方法参数序列。<br />
<br />
<strong>说明</strong><br />
call 方法可以用来代替另一个对象调用一个方法。call 方法可将一个函数的对象上下文从初始的上下文改变为由 thisObj 指定的新对象。<br />
<br />
如果没有提供 thisObj 参数，那么 Global 对象被用作 thisObj。<br />
<br />
</div>
<p>说明白一点其实就是更改对象的内部指针，即改变对象的this指向的内容。这在面向对象的js编程过程中有时是很有用的。<br />
<br />
引用网上一个代码段，运行后自然就明白其道理。<br />
</p>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: #eeeeee;"><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input&nbsp;</span><span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text"</span><span style="color: #ff0000;">&nbsp;id</span><span style="color: #0000ff;">="myText"</span><span style="color: #ff0000;">&nbsp;&nbsp;&nbsp;value</span><span style="color: #0000ff;">="input&nbsp;text"</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br />
</span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000; background-color: #f5f5f5;"><br />
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; background-color: #f5f5f5;">function</span><span style="color: #000000; background-color: #f5f5f5;">&nbsp;Obj(){</span><span style="color: #0000ff; background-color: #f5f5f5;">this</span><span style="color: #000000; background-color: #f5f5f5;">.value</span><span style="color: #000000; background-color: #f5f5f5;">=</span><span style="color: #000000; background-color: #f5f5f5;">"</span><span style="color: #000000; background-color: #f5f5f5;">对象！</span><span style="color: #000000; background-color: #f5f5f5;">"</span><span style="color: #000000; background-color: #f5f5f5;">;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; background-color: #f5f5f5;">var</span><span style="color: #000000; background-color: #f5f5f5;">&nbsp;value</span><span style="color: #000000; background-color: #f5f5f5;">=</span><span style="color: #000000; background-color: #f5f5f5;">"</span><span style="color: #000000; background-color: #f5f5f5;">global&nbsp;变量</span><span style="color: #000000; background-color: #f5f5f5;">"</span><span style="color: #000000; background-color: #f5f5f5;">;<br />
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; background-color: #f5f5f5;">function</span><span style="color: #000000; background-color: #f5f5f5;">&nbsp;Fun1(){alert(</span><span style="color: #0000ff; background-color: #f5f5f5;">this</span><span style="color: #000000; background-color: #f5f5f5;">.value);}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;window.Fun1();&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; background-color: #f5f5f5;">//</span><span style="color: #008000; background-color: #f5f5f5;">global&nbsp;变量</span><span style="color: #008000; background-color: #f5f5f5;"><br />
</span><span style="color: #000000; background-color: #f5f5f5;">&nbsp;&nbsp;&nbsp;&nbsp;Fun1.call(window);&nbsp;&nbsp;</span><span style="color: #008000; background-color: #f5f5f5;">//</span><span style="color: #008000; background-color: #f5f5f5;">global&nbsp;变量</span><span style="color: #008000; background-color: #f5f5f5;"><br />
</span><span style="color: #000000; background-color: #f5f5f5;">&nbsp;&nbsp;&nbsp;&nbsp;Fun1.call(document.getElementById('myText'));&nbsp;&nbsp;</span><span style="color: #008000; background-color: #f5f5f5;">//</span><span style="color: #008000; background-color: #f5f5f5;">input&nbsp;text</span><span style="color: #008000; background-color: #f5f5f5;"><br />
</span><span style="color: #000000; background-color: #f5f5f5;">&nbsp;&nbsp;&nbsp;&nbsp;Fun1.call(</span><span style="color: #0000ff; background-color: #f5f5f5;">new</span><span style="color: #000000; background-color: #f5f5f5;">&nbsp;Obj());&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; background-color: #f5f5f5;">//</span><span style="color: #008000; background-color: #f5f5f5;">对象！</span><span style="color: #008000; background-color: #f5f5f5;"><br />
</span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span></div>
<br />
call函数和apply方法的第一个参数都是要传入给当前对象的对象，及函数内部的this。后面的参数都是传递给当前对象的参数。<br />
运行如下代码：<br />
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: #eeeeee;"><span style="color: #000000;">&lt;</span><span style="color: #000000;">script</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br />
&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">var</span><span style="color: #000000;">&nbsp;func</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span>&nbsp;<span style="color: #0000ff;">function</span><span style="color: #000000;">(){</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.a</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">func</span><span style="color: #000000;">"</span><span style="color: #000000;">}<br />
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">var</span><span style="color: #000000;">&nbsp;myfunc</span><span style="color: #000000;">=</span><span style="color: #0000ff;">function</span><span style="color: #000000;">(x){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">var</span><span style="color: #000000;">&nbsp;a</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">myfunc</span><span style="color: #000000;">"</span><span style="color: #000000;">;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.a);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(x);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;myfunc.call(func,</span><span style="color: #000000;">"</span><span style="color: #000000;">var</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br />
</span><span style="color: #000000;">&lt;/</span><span style="color: #000000;">script</span><span style="color: #000000;">&gt;</span></div>
<br />
可见分别弹出了func和var。到这里就对call的每个参数的意义有所了解了。<br />
<br />
对于apply和call两者在作用上是相同的，但两者在参数上有区别的。<br />
<span style="color: #ff0000;">对于第一个参数意义都一样，但对第二个参数：<br />
apply传入的是一个参数数组，也就是将多个参数组合成为一个数组传入，而call则作为call的参数传入（从第二个参数开始）。</span><br />
如 func.call(func1,var1,var2,var3)对应的apply写法为：func.apply(func1,[var1,var2,var3])<br />
<br />
同时使用apply的好处是可以直接将当前函数的arguments对象作为apply的第二个参数传入</div>
<img src ="http://www.blogjava.net/alinglau36/aggbug/348038.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-04-11 10:27 <a href="http://www.blogjava.net/alinglau36/archive/2011/04/11/348038.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Freemarker操作字符串</title><link>http://www.blogjava.net/alinglau36/archive/2011/02/23/344970.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Wed, 23 Feb 2011 06:04:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/02/23/344970.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/344970.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/02/23/344970.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/344970.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/344970.html</trackback:ping><description><![CDATA[<p>1、substring（start,end）从一个字符串中截取子串<br />
start:截取子串开始的索引，start必须大于等于0，小于等于end<br />
end: 截取子串的长度，end必须大于等于0，小于等于字符串长度，如果省略该参数，默认为字符串长度。<br />
例子：<br />
${&#8216;str&#8217;?substring(0)}&#224;结果为str<br />
${&#8216;str&#8217;?substring(1)}&#224;结果为tr<br />
${&#8216;str&#8217;?substring(2)}&#224;结果为r<br />
${&#8216;str&#8217;?substring(3)}&#224;结果为<br />
${&#8216;str&#8217;?substring(0,0)}&#224;结果为<br />
${&#8216;str&#8217;?substring(0,1)}&#224;结果为s<br />
${&#8216;str&#8217;?substring(0,2)}&#224;结果为st<br />
${&#8216;str&#8217;?substring(0,3)}&#224;结果为str</p>
<p>2、cap_first 将字符串中的第一个单词的首字母变为大写。<br />
${&#8216;str&#8217;？cap_first}&#224;结果为Str<br />
3、uncap_first将字符串中的第一个单词的首字母变为小写。<br />
${&#8216;Str&#8217;？cap_first}&#224;结果为str<br />
4、 capitalize将字符串中的所有单词的首字母变为大写<br />
${&#8216;str&#8217;？ capitalize}&#224;结果为STR</p>
<p>5、 date,time，datetime将字符串转换为日期<br />
例如：<br />
&lt;#assign date1=&#8221;2009-10-12&#8221;?date(&#8220;yyyy-MM-dd&#8221;)&gt;<br />
&lt;#assign date2=&#8221;9:28:20&#8221;?time(&#8220;HH:mm:ss&#8221;)&gt;<br />
&lt;#assign date3=&#8221; 2009-10-12 9:28:20&#8221;?time(&#8220;HH:mm:ss&#8221;)&gt;<br />
${date1}&#224;结果为2009-10-12<br />
${date2}&#224;结果为9:28:20<br />
${date3}&#224;结果为2009-10-12 9:28:20<br />
注意：如果指定的字符串格式不正确将引发错误。</p>
<p>6、ends_with 判断某个字符串是否由某个子串结尾，返回布尔值。<br />
${&#8220;string&#8221;?ends_with(&#8220;ing&#8221;)?string} 返回结果为true<br />
注意：布尔值必须转换为字符串才能输出</p>
<p>7、html 用于将字符串中的&lt;、&gt;、&amp;和&#8220;替换为对应得&amp;lt;&amp;gt;&amp;quot:&amp;amp</p>
<p>8、index_of（substring,start）在字符串中查找某个子串，返回找到子串的第一个字符的索引，如果没有找到子串，则返回-1。<br />
Start参数用于指定从字符串的那个索引处开始搜索，start为数字值。<br />
如果start大于字符串长度，则start取值等于字符串长度，如果start小于0， 则start取值为0。<br />
${&#8220;string&#8221;?index_of(&#8220;in&#8221;) &#224;结果为3<br />
${&#8220;string&#8221;?index_of(&#8220;ab&#8221;) &#224;结果为-1</p>
<p>9、length返回字符串的长度 ${&#8220;string&#8221;?length}&#224;结果为6</p>
<p>10、lower_case将字符串转为小写<br />
${&#8220;STRING&#8221;?lower_case}&#224;结果为string</p>
<p>11、upper_case将字符串转为大写<br />
${&#8220;string&#8221;?upper_case}&#224;结果为STRING</p>
<p>12、contains 判断字符中是否包含某个子串。返回布尔值<br />
${&#8220;string&#8221;?contains(&#8220;ing&#8221;)?string} &#224;结果为true<br />
注意：布尔值必须转换为字符串才能输出</p>
<p>13、number将字符串转换为数字<br />
${&#8220;111.11&#8221;?number}&#224;结果为111.11</p>
<p>14、replace用于将字符串中的一部分从左到右替换为另外的字符串。<br />
${&#8220;strabg&#8221;?replace(&#8220;ab&#8221;,&#8221;in&#8221;)} &#224;结果为string</p>
<p>15、split使用指定的分隔符将一个字符串拆分为一组字符串</p>
<p>&lt;#list &#8220;This|is|split&#8221;?split(&#8220;|&#8221;) as s&gt;<br />
${s}<br />
&lt;/#list&gt;<br />
结果为:<br />
This<br />
is<br />
split</p>
<p>16、 trim 删除字符串首尾空格 ${&#8220; String &#8221;?trim} &#224;结果为String<br />
<br /><strong>
如果本文对您有帮助并且要鼓励我的话，请扫描如下二维码支持本人的劳动成果，多谢了！</strong><br /><br /><img src="http://www.blogjava.net/images/blogjava_net/alinglau36/wcpay.jpg" width="500" height="685" alt="" /><br />
</p><img src ="http://www.blogjava.net/alinglau36/aggbug/344970.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-02-23 14:04 <a href="http://www.blogjava.net/alinglau36/archive/2011/02/23/344970.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>The project cannot be built until build path errors are resolved – Error in Eclipse IDE</title><link>http://www.blogjava.net/alinglau36/archive/2011/02/22/344843.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Tue, 22 Feb 2011 05:59:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/02/22/344843.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/344843.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/02/22/344843.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/344843.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/344843.html</trackback:ping><description><![CDATA[<p>Following content is referenced from</p>
<p>http://www.scottdstrader.com/blog/ether_archives/000921.html</p>
<p>Opening a workspace with several projects, I was presented with the following error for two of the projects:<br />
To resolve this error in eclipse do the following steps.</p>
<p>The resolution was to force a resave of the selected projects (and their .classpath files):</p>
<p>Open the project properties<br />
Select Java Build Path &gt; Libraries<br />
Add a new, arbitrary library (to be deleted later) &gt; OK<br />
Wait for the workspace to refresh (or force a refresh of the project)<br />
The error(s) will go away<br />
Remove the dummy library<br />
The only other references I could find were to make minor alterations of contents of the .classpath file.
</p>
<img src ="http://www.blogjava.net/alinglau36/aggbug/344843.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-02-22 13:59 <a href="http://www.blogjava.net/alinglau36/archive/2011/02/22/344843.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>你不知道的 JavaScript - “this”</title><link>http://www.blogjava.net/alinglau36/archive/2011/02/09/344000.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Wed, 09 Feb 2011 15:25:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/02/09/344000.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/344000.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/02/09/344000.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/344000.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/344000.html</trackback:ping><description><![CDATA[http://www.yaosansi.com/post/1263.html<br />
<br />
pretty good, worth reading. <br />
<br />
<img src ="http://www.blogjava.net/alinglau36/aggbug/344000.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-02-09 23:25 <a href="http://www.blogjava.net/alinglau36/archive/2011/02/09/344000.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>YAHOO.util.Dom之寻找节点(转)</title><link>http://www.blogjava.net/alinglau36/archive/2011/02/01/343835.html</link><dc:creator>lau</dc:creator><author>lau</author><pubDate>Tue, 01 Feb 2011 00:55:00 GMT</pubDate><guid>http://www.blogjava.net/alinglau36/archive/2011/02/01/343835.html</guid><wfw:comment>http://www.blogjava.net/alinglau36/comments/343835.html</wfw:comment><comments>http://www.blogjava.net/alinglau36/archive/2011/02/01/343835.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/alinglau36/comments/commentRss/343835.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alinglau36/services/trackbacks/343835.html</trackback:ping><description><![CDATA[<h2>YAHOO.util.Dom之寻找节点</h2>
<p>YUI的Dom方法一共有45个，在这里谈一下我学习过程遇到的问题和经验，先介绍17个寻找节点类型的Dom方法。</p>
<p>get(el)：记得初学JavaScript的时候，最先认识的两个方法就是getElementById和
getElementsByTagName，这两个东东也基本上能够找到大多数你需要找的东西啦。YUI里的get方法跟getElementById类
似，但是它的能力却要强很多了，el可以是String、HTMLElement或者Array。</p>
<p>getElementsBy ( method , tag , root , apply , o , overrides
)：这个会和getElementsByTagName比较像一点点吧，但是功能差好远，基本上getElementsBy应该可以找到一切你想找的元
素，method是定义一个校验目标元素的方法，返回一个boolean值，tag是目标元素的nodeName，root是指在哪个元素中进行寻找，也
可以说成是一个范围吧。apply，我必须要说下它。。当初它困扰我了半天，YUI给出的解释是&#8220;A function to apply to
each element when found &#8221;，可以理解为一个回调函数吧，再看看YUI的代码，其中有这么一段：</p>
<pre>if (apply) {<br />
Y.Dom.batch(nodes, apply, o, overrides);<br />
}<br />
</pre>
<p>我当时的理解是，因为最终返回的是一个节点的数组嘛，我就以为执行完前边的校验后得到的结果再在apply中进行一次，也就是我在apply中再对
结果元素进行下一步的节点寻找，那么最后返回的应该是apply执行后得到的所有节点集合。。。可是无论我怎么试，最终返回的都是通过method方法所
得到数组，并没有再次通过apply获得更多的元素，嘿嘿，不要见笑哈，当时就是这么想的。。。后来发现，实际上不是这样子，我理解错误的原因只要就在那
个batch上，当时的错误在于，我把batch放进getElementsBy里了，那么在batch里边return后应该不会再继续执行
return nodes了，但是实际上这里的Y.Dom.batch(nodes, apply, o,
overrides)只是一个最终的结果而已，所以return
nodes还是会执行的。那么这个apply的作用在何处呢？其实作用就是执行一次回调嘛哈，它是可以实现我之前的想法的，但是不是直接返回的，举个例
子：</p>
<pre>var uls = YAHOO.util.Dom.getElementsBy(function(el){<br />
return el.className === 'J_tab';<br />
},'ul','content');<br />
</pre>
<p>这是寻找id为content的容器下className为J_tab的节点，那么如果我同时还需要获取每个ul下的所有li节点该怎么做呢，总不能再来一次循环吧，当然也可以啦，不过要好好利用下YUI吧，那就是让它获取ul的同时获取li：</p>
<pre>var lis = [];<br />
function getli(obj) {<br />
lis.push(obj.getElementsByTagName('li'));<br />
}<br />
var uls = YAHOO.util.Dom.getElementsBy(function(el){<br />
return el.className === 'J_tab';<br />
},'ul','content',getli);</pre>
<p>OK，这样子就一举两得了哈~后边的作用域和上下文就不多说啦，关于batch的神奇，下次再说哈，真的很神奇。。。</p>
<p>getElementBy ( method , tag , root )：这个就是通过method校验的第一个元素。</p>
<p>getElementsByClassName ( className , tag , root , apply , o , overrides )：是通过className进行元素寻找，其实这个方法是getElementsBy的一个特殊方法。</p>
<p>getChildren ( node )：这个与Dom中的childNode类似。</p>
<p>getChildrenBy ( node , method )：通过method方法过滤子元素，注意参数的顺序以及node不可为id。</p>
<p>getFirstChild ( node )：寻找第一个子元素，跟Dom中的firstChild有些类似。</p>
<p>getFirstChildBy ( node , method )：寻找第一个通过method校验的子元素，注意参数的顺序以及node不可为id。其实这个等同于getChildrenBy得到的第一个元素。</p>
<p>getLastChild ( node )：寻找最后一个子元素，与Dom中的lastChild有些类似。</p>
<p>getLastChildBy ( node , method )：与getFirstChildBy相反，倒着寻找。</p>
<p>getAncestorBy ( node , method )：寻找父节点，可以无限的往上级寻找，直到找到为止，node不能为id，跟Dom中的parentNode类似，不过这里不用反复的parentNode啦。</p>
<p>getAncestorByClassName ( node , className )：通过className寻找父节点，是getAncestorBy的一个特殊方法。</p>
<p>getAncestorByTagName ( node , tagName )：通过tagName寻找父节点，是getAncestorBy的一个特殊方法。</p>
<p>getNextSibling ( node )：寻找紧挨的下一个同级非文本节点的节点，与Dom中的nextSibling类似，省去了判断文本节点麻烦。</p>
<p>getNextSiblingBy ( node , method )：无限的往下找直到找到通过method校验的同级非文本节点，node不能为id，有了这个方法就不用无限的nextSibling啦。</p>
<p>getPreviousSibling ( node )：寻找紧挨的上一个同级非文本节点的节点，与Dom中的previousSibling类似，可以省去判断文本节点的麻烦。</p>
<p>getPreviousSiblingBy ( node , method )：无限的往前找直到找到通过method校验的同级非文本节点，node不能为id。</p>
<img src ="http://www.blogjava.net/alinglau36/aggbug/343835.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alinglau36/" target="_blank">lau</a> 2011-02-01 08:55 <a href="http://www.blogjava.net/alinglau36/archive/2011/02/01/343835.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>