ITeye博客

feikiss的博客

feikiss · 共 43 篇文章

[置顶] Java中new Integer() 和Integer.valueOf()二者效率的比较

最近在公司参与一个项目,项目挺大,耗时一年左右,具体业务就不说了。。。 8) 之后在项目开发将近结束时,公司用Coverity工具对整体代码进行了检视,结果发现了N多问题,好多都是自己不注意的细节,在感叹此工具的强大的同时,问了下项目经理这个工具的价格,告知,30万$ !!! 纳尼 :roll: 神马!尼玛 :evil: 代码检视这块儿和findbug也差不多啊, 这也忒狠了点吧。。。 8) 不扯淡了,步入正题。 在检视过程中,提到如下一个问题,就是在我们代码中用new Integer(a) 的地方,好多都提示说Ineffective way, use Integer.valueOf(int…

2011-11-30 11:02 · java知识 · 评论(5)

docker use cases

docker exec -it container id /bin/bash

2016-01-21 11:25 · 评论(0)

git 知识点

使用git server 最新版覆盖本地的修改: git fetch --all git reset --hard origin/master OR If you are on some other branch git reset --hard origin/your_branch http://stackoverflow.com/questions/1125968/force-git-to-overwrite-local-files-on-pull

2015-10-23 14:28 · 评论(0)

golang 常见知识点

如何将int64转换为string: package main import ( "fmt" "strconv" ) func main() { var val int64 = 123456789 str := strconv.FormatInt(val, 10) // use base 10 for sanity purpose fmt.Println(str) // int64 converted to string! fmt.Printf("After conversion : %v \n", val) // alternate method works too! } 2, golan…

2015-09-23 10:35 · golang · 评论(0)

使用Putty 调用GUI

http://www.geo.mtu.edu/geoschem/docs/putty_install.html

2015-03-04 16:41 · 评论(0)

sublime 快捷键

-----windows下的快捷键-------- Alt+R : 开启正则表达式功能 Alt+Enter: 找到匹配目标后全部选择 Ctrl+R:前往 method(mac下⌘R) Ctrl+M:跳转到对应括号 按Ctrl+Shift+上下键,可替换行 Ctrl+D:选择单词,重复可增加选择下一个相同的单词 Ctrl+L:选择行,重复可依次增加选择下一行 Ctrl+Shift+P:打开命令面板 Ctrl+P:搜索项目中的文件(mac下⌘P),在里面输入: admi@auto 可以定位到相应文件夹(admin.html)下的相应方法(auto)。 Ctrl+G:跳转到第几行 Ctrl+W:关…

2015-01-30 13:37 · 评论(0)

Best Practices for Designing a Pragmatic RESTful API

Best Practices for Designing a Pragmatic RESTful API Your data model has started to stabilize and you're in a position to create a public API for your web app. You realize it's hard to make significant changes to your API once it's released and want to get as much right as possible up front. Now, t…

2014-10-17 01:39 · Effective java · web · 评论(0)

CURL基本命令

作者: nickwolfe@CCF 从某网站上面看到的,觉得讲的很精彩,故借鉴过来。 CURL? 嗯,说来话长了~~~~ 这东西现在已经是苹果机上内置的命令行工具之一了,可见其魅力之一斑 1) 二话不说,先从这里开始吧! curl http://www.yahoo.com 回车之后,www.yahoo.com 的html就稀里哗啦地显示在屏幕上了~~~~~ 2) 嗯,要想把读过来页面存下来,是不是要这样呢? curl http://www.yahoo.com > page.html 当然可以,但不用这么麻烦的! 用curl的内置option就好,存下http的结果,用这个option: -o…

2014-08-06 06:07 · web · 评论(0)

做个谦卑的架构师【转】

谦卑并不是软件架构师一个非常常见的特质。我曾与一些可怕的架构师共事过,最近也与一位非常棒的架构师合作过。基于此,我根据每个架构师都喜欢的方式将我过去的经验汇聚起来,以规则集的形式写出来,与大家一起分享并讨论。 规则0:不要愚蠢地做出假设 看起来有些架构师会觉得一旦让开发者自行处理某些事情,那么他们就会像猴子那样杂乱无序。根据我的经验,这种情况其实是很少会出现的。只有一种情况会让开发者做傻事,那就是他们在心里默默抵触架构师。如果遵循着这条原则,那么其他的都将是细节问题。 规则1:你可能是错误的 在审查某人的设计想法时,我更倾向于以坦诚布公的方式询问问题。也许我觉得开发者忽略掉了某个关键的事实,…

2014-01-01 16:50 · 评论(0)

java socket performance investigation

these days I'm confused about the Tcp performance while using java socket. In fact the java code is very simple. details as below: server open a port and begin to listen. client request and after connect to server, client begin to write to socket. after server got the request, it will open a new th…

2013-07-17 18:26 · java知识 · socket · 评论(2)

[java] change the env in java code

In Java API, there is the method System.getenv(), but no interface to set the env. This is because Java forbid the operation based on platform. But sometimes we need to change the env to finish some unit test. The following way just like a hack but it is ok to unit test: private void setNewEnvironm…

2013-05-30 17:04 · java知识 · 英语学习 · 评论(0)

[unit test] how to test real-time based method. (for example new Date() )

While we are writing the unit test cases, we may meet some method that is real-time based. It'll be a challenge to get the expected result as they are changing with time, then it's time to use the Mock tool. today I meet the same issue, I need to test one method timeFormat(), this method is to form…

2013-05-30 16:59 · java知识 · 英语学习 · 评论(0)

Eclipse Shortcuts

Editors are an integral part of a programmer’s life. If you have good proficiency in using an editor thats a great advantage. It comes very handy to debug. Traditional notepad and SOPs (System.out.println) are the way we start learning a language but that is not sufficient, so beginners start using…

2013-01-24 17:00 · 评论(0)

java中多维数组探讨及发散思考

今天在stackoverflow上面看到一个帖子讨论说关于提高数组效率的问题,看了下他的问题,是关于一个四维数组的效率问题,四维数组类似这样子: ushort[, , ,] map = new ushort[3000, 3000, 3, 3]; 暂且先不管为啥要搞一个四维数组(毕竟四维已经超出了人的立体思维想象了-_-),我随手写了一个测试类来测试,但是发现了一个更有意思的现象,数组声明方式不同会导致初始化的效率极大区别: 声明方式一: int [][][][] map = new int[3000][3000][3][3]; 声明方式二: int [][][][] map2 = new i…

2012-12-10 18:19 · 评论(0)

日常笔记(持续更新记录中)

以此作为笔记,记录一些小碎片,省得以后再去找。 如何读取和当前class位于同一目录下的文件,也可以是其他相对路径: xml在随意某个包路径下: String s_xmlpath="com/spf/web/ext/hotspot/hotspotxml/hotspot.xml"; ClassLoader classLoader=HotspotXmlParser.class.getClassLoader(); InputStream in=classLoader.getResourceAsStream(s_xmlpath); 在Eclipse中运行java程序时,如果报栈溢出异常,在Eclips…

2012-12-03 18:44 · java知识 · 杂七杂八 · 评论(0)