Play Framework 2.1(Scala) 调用 WebService 返回 Response

在 Play Framework 2.1 中用 Scala 编程进行 WebService 调用想返回 Response,或 xml, json 结果时,初入可能会费些功夫,因为无论是 WS.url.get,或 post, put 方法返回的都是个 Future[Response] 对象,也就是如何从 Future[Response] 如何分离出 Response 对象的问题。

这里我们 map, 或 match/case 也可以取出其中 response 对象来,如果要作为结果返回还要用到 Await.result() 方法。

为了不把代码出现在摘在页面中,这里插点内容,像是拖延时间的战术。

如果你在使用 Play Framework 2 with Scala 时碰到这个错误:

Error: Cannot find an implicit ExecutionContext, either require one yourself or import ExecutionContext.Implicits.global

依照 899 号 Issue, 解决办法是你必须加上这个引入语句:

import play.api.libs.concurrent.execution.Implicits._

因为里面有我们需要用到的隐式的 global 吧。

下面是我用来请求 WebService 返回 Response 的代码: 阅读全文 >>

抢鲜设置 JDK8 的编程环境,印象

和 JDK7 还没有热和,却开始关注 JDK8 起来了,JDK8 已进行到了 M8 开发预览版了,其中包含了一个千呼万唤的功能,即 Lambda 闭包的支持。在当前有对闭包特性的诉求,而 Java 本身不提供时,我们不得不转而求助于 JVM 上的其他的语言, 像 Scala, Groovy, JRuby 等。

不得不说 Scala 给我们带来了不少的快感,以致于想以更多的精力投入到 Scala 编程中去,不过还正在换取项目实践的机会。JDK8 引入 Lambda 后同样也是能更好的解决多核计算的问题,从程序员的角度来看,只要觉得 Lambda 能给我们带来无与伦比的灵活与便利性就足够了,水很深。

JDK8 还有增加的功能就是 JEP(JDK Enhancement-Proposal) 中的了。

来这里 http://openjdk.java.net/projects/jdk8/ 看看 JDK8 的里程碑

2012/04/26     M1     
2012/06/14     M2     
2012/08/02     M3     
2012/09/13     M4     
2012/11/29     M5     
2013/01/31     M6     
2013/06/13     M7     Feature Complete
2013/09/05     M8     Developer Preview 阅读全文 >>

35 个最好的 Ajax jQuery 自动完成插件,带例子

In this article,We are providing the best tutorials of Autocomplete in jQuery , ajax autocomplete and autosuggest with examples. jQuery Autocomplete an input field to enable users quickly finding and selecting some value, leveraging searching and filtering.In these days every body want fast and instant search,for this reason many popular search engines like google are using this feature ajax autocomplete.Combination of Php,ajax and jQuery autocomplete gives some extra feature to autosuggest.

1. Ajax AutoComplete for jQuery

Ajax Autocomplete for jQuery allows you to easily create autocomplete/autosuggest boxes for text input fields. Built with focus on performance – results for every query are cached and pulled from …
Ajax AutoComplete for jQuery

Read More Demo 阅读全文 >>