高阶函数val list =List(1,2,3,4,5,6,7,8)val newList = list.map((x:Int) => 2*x) //map表示映射list中的每一个元素的值为原来的2倍//newList中的值为2,4,6,8,10,12,14,16也可直接写成val newLis...
分类:
其他好文 时间:
2014-08-18 01:29:13
阅读次数:
260
我所知道的Scala持久层框架有: 1、Slick? 2、Squeryl 3、Anorm(Play的持久层) 4、ScalaActiveRecord?(基于Squeryl之上) 5、circumflex-orm web框架的话 1、Spray(build on akka,完全异步,非阻塞,非常有...
分类:
其他好文 时间:
2014-08-16 21:13:41
阅读次数:
180
数组要点
若长度固定则使用Array,若长度可能有变化则使用ArrayBuffer;提供初始值时不要使用new;用()来访问元素;用for(elem
例子:
import scala.collection.mutable.ArrayBuffer;
object HelloWorld {
def main(args: Array[String]) {
//实现一个可...
分类:
其他好文 时间:
2014-08-16 17:10:40
阅读次数:
211
AJAXXMLHttpRequest,是AJAX得以实现的基础他是一个对象,有几个需要记住的方法和属性:XMLHttpRequest方法open(method, url, async, username, password)method: post或geturl: 请求地址async: boolea...
分类:
其他好文 时间:
2014-08-16 16:15:30
阅读次数:
208
baksmali首先执行的第一个main函数publicstaticvoidmain(String[]args)throwsIOException{
Localelocale=newLocale("en","US");
Locale.setDefault(locale);
CommandLineParserparser=newPosixParser();
CommandLinecommandLine;
try{
commandLine=parser.parse(options,args..
分类:
其他好文 时间:
2014-08-15 02:53:47
阅读次数:
261
最近发现一款文法分析神器,看完官网(http://goldparser.org/)的介绍后感觉很犀利的样子,于是就拿来测试了一番,写了一个数学表达式分析的小程序,支持的数学运算符如下所示:常规运算:+ - * / ^ sqrt sqrt2(a,b) pow2(a) pow(a,b)三角函数:si.....
分类:
其他好文 时间:
2014-08-14 20:24:49
阅读次数:
372
1、Async library ? ? ?SIP-14 Futures and Promises ? ? ?http://docs.scala-lang.org/sips/completed/futures-promises.html ? ? ?http://en.wikipedia.org/wiki/Futures_and_promises 2、Akka ? ? ...
分类:
其他好文 时间:
2014-08-14 11:06:58
阅读次数:
200
REPL
在Scala中的书籍中会提及REPL,REPL(Read-Eval-Print
Loop);这被称为“读取-求值-打印”循环。
不带参数的Scala方法通常不使用圆括号,例如,StringOps类的API显示它有一个distinct方法,不带(),其作用是获取字符串中不重复的字符。调用如下: print("hello".distinct);
Scaladoc
...
分类:
其他好文 时间:
2014-08-13 22:33:57
阅读次数:
281
spark版本:spark-1.0.2-bin-hadoop2.tgz下载链接:http://www.apache.org/dist/spark/spark-1.0.2/Scala版本:scala-2.10.4.tgz下载链接:http://www.scala-lang.org/files/arch...
分类:
其他好文 时间:
2014-08-13 17:48:06
阅读次数:
156
jQuery获取URL信息有很多方法,但是使用这个插件就非常爽了。 托管地址在:http://github.com/allmarkedup/jQuery-URL-Parser // http: //localhost:19090/home/index?id=1 ...
分类:
Web程序 时间:
2014-08-13 14:34:37
阅读次数:
258