上一页 1 2 3 4 5 6 7 8 9 10 ··· 20 下一页
摘要: 转载: http://www.oschina.net/question/54100_15938使用javascript类库函数时,经常会遇到一个函数,可以使用不同个数的参数的情况比如:exp(var1) exp(var1, var2)但是在实际编写javascript函数时,函数不能同名,所以不可能是不同参数个数分开写;参数个数必须符合函数的设置,所以函数声明里有的就必须有,不可能调用时写少几个;……这个问题是困扰了很久了,一直不知道为什么?!今天一早在看别人代码,无意中竟然看到了~ 原来不是在函数声明中声明参数个数,而是在函数里直接接收使用那怎么接收呢? 就是 arguments 了argu 阅读全文
posted @ 2013-10-04 20:04 卜海清 阅读(848) 评论(0) 推荐(0)
摘要: org.json包里有一个类org.json.XML可以实现XML和JSON之间的转换。 http://www.json.org/javadoc/org/json/XML.html JSONObject json = toJSONObject(""); System.out.println(json.toString()); System.out.println(XML.toString(json)); 阅读全文
posted @ 2013-09-26 11:00 卜海清 阅读(3614) 评论(0) 推荐(0)
摘要: Rhino是JDK1.6里自带的一个Javascript Engine,不过他的书写风格好像有点不是很一样。importPackage(Packages.groovy.util);var o = new Expando() 阅读全文
posted @ 2013-09-25 14:17 卜海清 阅读(298) 评论(0) 推荐(0)
摘要: Link : http://xstream.codehaus.org/index.html http://www.cnblogs.com/hoojo/archive/2011/04/22/2025197.html 阅读全文
posted @ 2013-09-09 11:30 卜海清 阅读(167) 评论(0) 推荐(0)
摘要: 闭包实现了 isCase 方法,这样闭包可以在 grep 和 sw itch 中作为分类器使用,在这种情况下,各自的参数传递给闭包,然后调用闭包进行计算得到一个 Boo lean 值(参考 6.1 节),正如你所见:assert [1,2,3].grep{ it<3 } == [1,2]switch(10){case {it%2 == 1} : assert false}这样可以让我们使用任何逻辑进行分类,又一次证明了这种可能性,因为闭包也是对象。 阅读全文
posted @ 2013-09-03 20:42 卜海清 阅读(519) 评论(0) 推荐(0)
摘要: 一般想到Groovy是JVM上的动态语言,都不知道它还有Static Typeing的功能import groovy.transform.TypeChecked void someMethod() {} @TypeCheckedvoid test() { // compilation error: // cannot find matching method sommeeMethod() sommeeMethod() def name = "Marion" // compilation error: // the variable naaammme is... 阅读全文
posted @ 2013-08-20 16:53 卜海清 阅读(703) 评论(0) 推荐(0)
摘要: 1.JavaScript does not have block scope 2.Scope is determined during function definintion, not invocation -- Closoure 3.Replacing the prototype property with new Object removes the default constructor property 4. the default return value of new constructor is this.var Person = function(){ this.nam... 阅读全文
posted @ 2013-07-23 14:08 卜海清 阅读(240) 评论(0) 推荐(0)
摘要: 如题,,具体介绍请参看:http://refaktor.blogspot.com/2012/07/private-fields-and-methods-are-not.html 阅读全文
posted @ 2013-06-20 12:56 卜海清 阅读(376) 评论(0) 推荐(0)
摘要: Installation:http://rubygems.org/gems/ci_reportersample rakefilerequire 'rake/testtask'require 'ci/reporter/rake/test_unit' # use this if you're using Test::UnitENV['CI_REPORT'] = 'test/reports' test = Rake::TestTask.new do |t| t.test_files = FileList['test/te 阅读全文
posted @ 2013-05-28 11:04 卜海清 阅读(1199) 评论(0) 推荐(0)
摘要: https://rubygems.org/pages/download如果你的Gem版本太低了,可以参考上面的链接说明,升级到合适的Version 阅读全文
posted @ 2013-05-27 17:27 卜海清 阅读(2433) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 20 下一页