08 2013 档案
摘要:转自:http://my.oschina.net/feichexia/blog/119805函数编程在C#、Python、JavaScript中都得到充分体现。而Java直到最新的Java 8才开始正式支持函数编程,最明显的改进就是对Lamba表达式的支持。正如C#之父Anders Hejlsberg在那篇文章编程语言大趋势中所讲,未来的编程语言将逐渐融合各自的特性,而不存在单纯的声明式语言(如之前的Java)或者单纯的函数编程语言。将来声明式编程语言借鉴函数编程思想,函数编程语言融合声明式编程特性...这几乎是一种必然趋势。如下图所示: ...
阅读全文
摘要:public String getCharset(String file) throws IOException { BufferedInputStream bin = new BufferedInputStream(new FileInputStream(file)); int p = (bin.read() << 8) + bin.read(); String code = null; switch (p) { case 0xefbb: code = "UTF-8"; brea...
阅读全文
摘要:var regex=/(.).*(\1)/; var str="a sa"; console.log(regex.test(str)); //判断用户输入是否有重复字符
阅读全文
摘要:今天偶然看见个代码片段: delegate int Mydg(int a,int b); //声明一个委托 public static class LambdaTest { public static int add(int a, int b) { return a + b; } public static int minus(int a, int b) { return a - b; } public static int oper(this int ...
阅读全文
摘要:下载mongodb之后,扔D盘,配置安装mongodb service服务后,启动出现1053错误。网上各种方法,有改mongod.exe权限,有改成绝对目录的,好吧,自己比较懒,就用最省事儿的方法了,就是扔到C盘。1.将压缩包重解压到C盘根目录,并重命名为mongodb2.创建2个目录:c:\mongodb\logs ,c:\mongodb\data\db3.通过命令行切换目录至c:\mongodb\bin, 如果之前安装过mongodb,那么先执行mongod --remove 然后,输入以下命令:mongod --logpath c:\mongodb\logs\mongo.log -..
阅读全文
摘要:使用代理处理类,需要实现InvocationHandler接口package com.lan.dynamicProxy.myDynamicProxy;import java.lang.reflect.InvocationHandler;import java.lang.reflect.Method;import java.util.Arrays;/** * Created with IntelliJ IDEA. * User: Njoy * Date: 13-8-21 * Time: 上午10:12 * To change this template use File | Settings |
阅读全文
摘要:正则转义字符: Table 10-2. Regular expression character classesCharacter Matches[...] Any one character between the brackets.[^...] Any one character not between the brackets.. Any character except newline or another Unicode line terminator.\w Any ASCII word character. Equivalent to [a-zA-Z0-9_].\W Any ch.
阅读全文
摘要:String.prototype.trim = String.prototype.trim || function () {if (!this) return this;//Don't alert the empty string/* this.replace(/^\s+|\s+$/g, "") 和 this.replace(/^\s+/,'').repalce(/\s+$/,'');相比.后者比前者快150ms左右,如果字符串更长可能差距会更大,所以决定使用高效的方法*/this.replace(/^\s+/, ''
阅读全文
摘要:Closure: JavaScript词缀作用域。javascript的函数在执行时是按照定义作用域链起作用。内嵌函数f()被包含在一个作用域链中,在这个作用域链中scope被赋值为"local scope"。无论f最终在哪里被执行,这种绑定一直存在。var scope = "global scope";function checkscope() { var scope = "local scope"; function f() { return scope; } return f;}console.log(checkscope()(
阅读全文
摘要:1 2 3 4 5 21 83 84 85 86 87 hello world88 89 注意:在if()判断体内自动转为false的是:0,'',undefined,null,NaN。而' ','0'在if()判断体中为true90 91 92
阅读全文
摘要:常用快捷键设置jvm参数:Setting--Compiler--Java Compiler设置自动导入:Setting--Editor--Auto Import更多快捷键用ctrl+j查看,比如sout和eclipse的syso一样。iter:for in循环itar:遍历数组类似的还有fori;热部署:tomcat server--deployment--点击加号--extenal source 指向 webapp 所在的目录。tomcat需要以debug模式启动,启动后修改java文件后,ctrl[+shift]+f9编译文件,就热部署了。也可以打个devevm的jvm补丁,直接就热部署。
阅读全文
摘要:open 主机名用户名密码lcd d:\ #设置本地目录,文件将被下载到此处get xxx #获取主机上的文件将上面保存为任意文件,比如ftp.同级目录下,新建一个bat,内容为c:\windows\system32\ftp.exe -s:ftp保存为xxx.bat.双击xxx.bat即可。
阅读全文

浙公网安备 33010602011771号