This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| public void multithreadTest() throws InterruptedException { | |
| int threadNum = 10; | |
| int loopCount = 1000; | |
| ExecutorService executor = Executors.newFixedThreadPool(threadNum); | |
| final CountDownLatch latch = new CountDownLatch(loopCount); | |
| for (int i = 0; i < loopCount; i++) { | |
| executor.submit(new Runnable() { | |
| @Override | |
| public void run() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var AGENT = navigator.userAgent; | |
| var BROWSERS = { | |
| isMac: (navigator.platform.substr(0,3) === "Mac"), | |
| isPC: (navigator.platform.substr(0,3) === "Win"), | |
| isMSIE: ("ActiveXObject" in window && "clipboardData" in window), | |
| isEdge: ("MSGestureEvent" in window && "chrome" in window && | |
| window.chrome.loadTimes == null), | |
| isFirefox: (!!AGENT.match(/Gecko\//) && !AGENT.match(/like Gecko/)), | |
| isSafari: (!!AGENT.match(/ (Apple)?WebKit\//) && !AGENT.match(/ like iPhone /) && | |
| (!window.chrome || window.chrome.app == null)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setxkbmap -layout us -option ctrl:nocaps | |
| setxkbmap -layout us -option nocaps:ctrl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 托瓦兹称,如果他具有所谓的远见卓识,那么Linux操作系统和Git可能都不会出现。在最近接受采访时,他解释说: | |
| “我当初开发Linux的时候并没有预见到它会取得成功,也许正是因为不知道它将来会怎样才促成了我的成功。如果我从一开始就知道它会取得今时今日的重要地位,那么我可能都不敢随便动手编写它了。 | |
| “正因为我不知道它将来会怎样,所以我对别人的建议和影响才表现得格外开放。如果我已预见到它未来的样子,已经胸有成竹,那么我可能就不会那样开放 了。我想,正是这样的开放性让事情变得容易了许多,有趣了许多,也让我更愿意接纳别人参与到这个项目中。人们不必仰仗别人的远见卓识来获得成功,他们完全 可以跟着自己的感觉走。” |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 若需要对 Jackson 的序列化行为进行定制,比如,排除值为空属性、进行缩进输出、将驼峰转为下划线、进行日期格式化等,这又如何实现呢? | |
| 首先,我们需要扩展 Jackson 提供的 ObjectMapper 类,代码如下: | |
| public class CustomObjectMapper extends ObjectMapper { | |
| private boolean camelCaseToLowerCaseWithUnderscores = false; | |
| private String dateFormatPattern; | |
| public void setCamelCaseToLowerCaseWithUnderscores(boolean camelCaseToLowerCaseWithUnderscores) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| webserverdemo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WebServerOne |
NewerOlder