2010年2月20日

今天废了老劲了,终于找到为何deploy/lib目录下一个包从哪里来的了。在项目的dependency里没有发现这个包,但是deploy目录下总可以找到。

查了半天,终于发现了,在项目dependency里依赖到的第三方的一个包里它依赖到了我需要查找的包,导致这个包被貌似莫名其妙的进入到了deploy/lib下面。
posted @ 2011-10-30 18:56 simplelove 阅读(215) | 评论 (0)编辑 收藏

Attended Scrum training theses two days.

Some highlights from the training:

  1. Scrum master is a facilitator, does not assign task. Team owns tasks itself.
  2. Each feature has a unique rank, decided by product owner and scrum master and the team. Always finish rank high feature first, before continue rank low feature.
  3. Scrum always encourage communication and collaboration.
  4. Scrum is not a project management, but a framework for all the teams to do the things in same way. Project management methodology is still needed in Scrum.
  5. Scrum deliver value sooner than waterfall method.
  6. Scrum fits the product/project that requirements are not so fixed.
  7. Each team/person has its own customer.
  8. Successful software development projects are mainly based on people interactions.
  9. Advocate zero defect in iterations, ready to release after each iteration.
  10. XP is next level of Agile after Scrum.
posted @ 2010-08-18 10:48 simplelove 阅读(268) | 评论 (0)编辑 收藏

I upgraded to IntelliJ IDEA 7.0 the day it came out and was, at first, let down by how poorly it performed on my machine. Since then, I tweaked a bunch of settings, and now have it performing just as fast as IDEA 5 ever did on the same box. Enjoy, and happy coding!
1. Change your Look and Feel
Change your look and feel to something other than native. On Windows, the “IDEA (4.5 Default)” look and feel performs much better than the native one. On Mac, just pick something other than the native. The new graphics will bother you for about 30 minutes and then you’ll forget all about them. This setting is in the Settings (Ctrl+Alt+S) -> Appearance (B) dialog. (Tip courtesy of Howard Lewis Ship)
2. Use Structure View Instead of Project View
In IDEA 7.0.2 on Windows, I seem to pay a heavy performance price for the Project View (Alt+1), especially with autoscrolling to and from source enabled. My alternative is to use the Structure View (Alt+2) as my default sidebar and rely on the Navigation Bar (View->Navigation Bar) for project navigation. I find I actually prefer this setup and 7.0.2 performs noticeably faster.
3. Turn off Synchronize Files
When you activate the IDEA frame, IDEA will scan the disk for file changes, giving you a nice progress bar to wait for. If you’re not editing files outside of IDEA then turn this feature off in Settings (Ctrl+Alt+S) -> General (A). Uncheck “Synchronize Files on Frame Activation”. Now you’ll have to manually synchronize the files using Ctrl+Alt+Y (File->Synchronize on the menu). (Tip courtesy of Tyler)
4. Disable Spring Model Validation on Build
I used to get a progress bar every time I ran or debugged my project, with the message “Validating Spring Model”. I don’t need this feature except when I’m working on the Spring files, so I turned it off. Settings (Ctrl+Alt+S) -> Project Settings (1) -> Modules… then click Spring, then click the Options Tab. Deselect the checkbox for “Enable Spring model validation on build”.
5. Disable Unused Plugins
Disable all of the plugins you are not currently using. For example, if you’re not using Geronimo, Commander or Jabber, then turn them off. Settings (Ctrl+Alt+S) -> Plugins (T). Uncheck anything you have installed that is unused (Tip courtesy of Carl)
6. Use Scopes to Speed Up Searches
I rarely really want to search my entire project for a string or reference. Any search dialog allows you to pick a custom scope, such as production files or test files. But “Changed Files” is a helpful option too. On large, monolithic projects you may want to define your own to only search certain packages. A little time creating new scopes will save you a lot of time in waiting for searches to complete. Define scopes in Settings (Ctrl+Alt+S) -> Scopes (5).
7. Increase Your Heap Size
Several sources include directions on increasing your heap size in IDEA. This is changed in your idea.exe.vmoptions file.
8. Always Get the Latest Version
I’ve already suggested this, so I’ll be brief. Each minor release seems to have good performance improvements.
9. Reduce Size of Local History
Another blog recommended that you turn off or reduce Local History. I love this feature so I’ll never turn it off, but the default is to save 3 days worth of work. I typically check in to version control more often than that, so I trimmed it up to 1 day of history. Do this in Settings (Ctrl+Alt+S) -> Local History (J).
10. Optimize Your Disk?
I haven’t tried this myself, but the tip came directly from JetBrains. Beyond just defragmenting, you can also optimize the MFT tables, disk folder structure, and the paging file. Direction appear on their site. Simply upgrading to a newer hard drive is find at home, but I don’t have that much control of my work machine. It’s Friday, so I’ll try this today. If things go horribly wrong I’ll redact the entry!
————————————————————————————————————————————————————————————————————————————
IntelliJ IDEA Performance
There're some concerns about IntelliJ IDEA Performance. And here is the tips that I used to make mine run fast. Some of them come from my own experience, some of them come from the know-everything internet.
    * Make sure you have all your libraries on your local harddrive (as opposed to mounted network drive). After I moved all my libraries from a network drive to local harddrive, the time for a 'make' on the project is reduced from around 60 seconds to just 5-7 seconds!
    * Defragment your Disk and reboot your computer. IDEA creates lots of small files and too much fragmentation is a nightmare.
    * Turn off Anti Virus completely. Yes I mean completely. It affects the performance dramatically.
    * Turning off Local History or even reducing the number of history days improved the performance significantly.
    * Adjust VM settings. Here is my idea.exe.vmoptions file (on windows):
-Xms512m
-Xmx512m
-XX:MaxPermSize=99m
-ea
Change it as you see fit per your hardware configuration.
More information is available at http://blogs.jetbrains.com/idea/2006/04/configuring-intellij-idea-vm-options/.
    * The Debugger in IDEA may work slowly if the Force classic VM option is not selected in the File Project Properties Debugger dialog. Using Method Breakpoints may also slow down the debugging process. I had two breakpoints on the method name instead of the first line of the method. It was taking a half hour to get to the breakpoint Changing these to line breakpoints gave me two orders of magniture
    * You may notice IDEA hang for several seconds when you switch to it from other applicationDisable Settings General Synchronize files on frame activation.
    * Disable windows paging file if you have enough memory. Get more memory if you don't have enough. Swapping is a performance nightmare.
    * Turn off windows indexing services, either set it to Disabled or Manual unless you do lots of file system search (even you do, I recommend Google Desktop Search). IDEA use lots of small files so background indexing can have a big negative effect on it's performance.
    * Control Panel/System/Properties/Advanced/Visual Effcts, Adjust for best performance. Unless you're willing to sacrify performance for visual effects like windows animation, fading/sliding etc.

posted @ 2010-07-30 01:40 simplelove 阅读(1407) | 评论 (0)编辑 收藏

一般而言,兔子在出生两个月后,就有繁殖能力,一对兔子每个月能生出一对小兔子来。如果所有兔都不死,那么一年以后可以繁殖多少对兔子?

  我们不妨拿新出生的一对小兔子分析一下:

  第一个月小兔子没有繁殖能力,所以还是一对;

  两个月后,生下一对小兔民数共有两对;

  三个月以后,老兔子又生下一对,因为小兔子还没有繁殖能力,所以一共是三对;

  ------

  依次类推可以列出下表:

  所经过月数:0、1、2、3、4、5、6、7、8、9、10、11、12

  兔子对数:1、1、2、3、5、8、13、21、34、55、89、144、233

  表中数字1,1,2,3,5,8---构成了一个序列。这个数列有关十分明显的特点,那是:前面相邻两项之和,构成了后一项。

  这个数列是意大利中世纪数学家斐波那契在<算盘全书>中提出的,这个级数的通项公式,除了具有a(n+2)=an+a(n+1)/的性质外,还可以证明通项公式为:an=1/√5[(1/2+√5/2)^ n-(1/2-√5/2)^ n](n=1,2,3.....)(√5表示根号5)

  这个通项公式中虽然所有的an都是正整数,可是它们却是由一些无理数表示出来的

posted @ 2010-06-30 09:17 simplelove 阅读(297) | 评论 (0)编辑 收藏

If you want the entry to be garbage collected, use WeakHashMap. Once the key is not strongly referenced, the entry will be automatically reclaimed.

 

Here is a good article to understand this:

http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html

posted @ 2010-06-08 20:40 simplelove 阅读(293) | 评论 (0)编辑 收藏

附录 A. 需要搞清楚几个问题
A.1. Maven2的优点
  1.
  对第三方依赖库进行统一的版本管理。
  只要用了Maven2就不用再为每个项目复制spring.jar和hibernate.jar了,Maven2会在你需要的时候,自动把这些第三方依赖库找到,你需要编译,Maven2就把这些jar包放到classpath里,你需要打包,Maven2就帮你把需要的jar包都复制到WEB- INF/lib/目录下。
  2.
  统一项目的目录结构。
  可以保证所有项目的目录结构都是一样的,目录结构统一的好处就是,你要找源代码就去src/main/java/下,你要找需要放到classpath下的资源,就去src/main/resources/下,你要找单元测试对应的代码和资源,就去src/test/下。每个目录下放什么东西,程序编译,发布的时候,每个目录起什么作用都很清楚明了,不会出现打开项目找不到要找的文件的情况。
  3.
  统一软件构建阶段
  Maven2把软件开发的过程划分成了几个经典阶段,比如你先要生成一些java代码,再把这些代码复制到特定位置,然后编译代码,复制需要放到 classpath下的资源,再进行单元测试,单元测试都通过了才能进行打包,发布。
  以前使用Ant,最令人头疼的就是要为不同的项目写很多build.xml脚本,而且这些脚本还不太通用,现在我们可以使用Maven2提供的这些经典构建阶段,让每个项目就经过相同的步骤,从源代码一步一步变成可以部署的成品。如果想要什么附加功能,把对应的插件绑定到一个构建阶段上,那么到了执行这个构建阶段的时候,就会执行绑定的插件了。
  4.
  支持多种插件
  在http://maven.apache.com/和http://mojo.codehaus.org/上可以找到大量的Maven2插件,通过这些插件可以完成多种多样的扩展功能。
  不过,如果比插件的易用性,Ant的插件实际上更简单方便,与之相比,在Maven2中配置插件的步骤太复杂了,既要配置groupId和 artifactId,还要配置绑定在哪个阶段运行。
  不过因为Maven2可以把插件连同第三方依赖一起进行统一版本管理,所以这方面也算比Ant有一点儿优势,至少使用时不需要自己再去下载插件的发布包了。
  5.
  自动生成项目网站和报表
  如果说Ant可以使用ivy实现第三方依赖库的统一管理,如果说Ant可以自己统一项目的目录结果,如果说Ant支持插件更灵活,那么这个特性绝对是 Ant无法比拟的。
  Maven2 可以自动为项目生成一个网站,里面包含了项目信息,参与人,项目管理相关的资源,第三方依赖库,使用的插件,以及通过其他扩展插件生成的各种报表。Ant 使用某些插件也可以生成html格式的报表,但是各个报表之间都没什么关联,不像Maven2中将网站和报表都关联在一起,查看起来十分方便。
A.2. Maven2的问题
  1.
  Maven2使用前需要像Ant一样需要配置环境变量。
  本来绿色安装是一件好事,但是因为太多人都只会用IDE,不了解如何配置环境变量,所以这第一步就很成问题。
  2.
  Maven- 2.1.0本身只有2.844M,可是这只是一个核心,实际使用时,还需要去公网上的资源库下载各种插件,然后才能实现各种功能,问题是公网上的资源库一般都是在国外,网路速度稍慢就无法完成下载,没法下载就没法使用Maven2里提供的那些功能,Maven2就用不起来。
  尤其对于新手来说,第一次下载插件的过程,实在是太痛苦了,大多数人都在这一阶段放弃了对Maven2的尝试。
  3.
  第三方依赖库版本混乱。
  java的依赖库管理一直没有约定规范,导致多个项目,引用多个第三方依赖,这些第三方依赖又使用同一个项目的不同版本的发布包,最后就是弄得一团糟。
  Maven2 尝试通过一些约定解决这个版本混乱的问题,但实际上并没有达到预想中的效果。例如,commons.apache.org中的项目,本来应该放在 org/apache/commons/目录下,现在却都各自放在commons-logging,commons-lang,commons- beanutils目录下,估计这是因为刚开始使用Maven2的那些人,懒得把常用包放到那么深的目录结构中,偷懒放到了顶级目录下。可随着 Maven2的发展,加入资源库的包越来越多,他们又把新发布的依赖包按照正常的方式,放到了org/apache/commons/目录下,而旧依赖还有很多人在用,所以也不能删除,这就造成了现在这种一种依赖库多种存放形式的问题。
  每次在资源库上找依赖都要花费很多时间,因为你不清楚它究竟使用的哪种目录形式,比如sourceforge.net上的项目就有两种目录形式,一些项目放在net/sf /目录下,而另一些例子放在net/sourceforge/目录下,所以你就算知道项目的网站地址,也要在多个目录下都找一遍。
  4.
  缺乏详细的教程
  入门教程一般都很简略,现在似乎使用的人多了起来,可以在网上找到一些新手教程,但是一般都很简略,只能自己玩玩,实际中遇到问题的话,还是很难解决。
  实际上Maven2的教程一直是一块短板,就算是国外的两本书《Maven: The Definitive Guide 》和《Better Build With Maven》也没有涉及到富含价值高级技术。
  就算是讲的比较详细的Maven2教程,也都是停留在Maven2本身的使用上,或者稍微提及一下使用到得官方插件,对于很多强力的扩展插件都没有介绍。
  至今很多人用Maven2都处在摸索阶段,没看到谁总结出使用Maven2最佳实践。这点上,一般都是把国外开源项目中的pom.xml拿来研究学习。
  5.
  资源库不完整
  一般来说,我们可以从Maven2的资源库上下载到我们所需要的第三方依赖库,但是有些依赖库在Maven2的资源库上是找不到的。
  其中有因为发布协议的限制,比如j2ee的一些规范api。有因为项目所在厂商的原因,比如jbpm。有因为项目社区的问题,比如birt。还有很多情况是因为Maven2官方处理事情太慢,很多小型开源项目,比如dozer,虽然两个月前就已经提出了最新版本的上传申请,但是迟迟没有给予答复。
  在这种情况下,我们只能自己在本地资源库中安装需要的依赖了,造成的问题是,如果相关的项目使用了Maven2的项目管理文件,那么可以使用Maven2 将项目发布到本地库中,这样一来就可以获得项目自身的依赖设置。如果相关项目没有使用Maven2的项目管理文件,那么需要自己再去为这个项目找到所需要的依赖,并配置到对应的pom文件中,着实非常麻烦。
  6.
  Maven2没有IDE支持
  没有良好的IDE支持也是个大问题,虽然说有m2eclipse,但是实际上似乎没那么易用。
  本身我们没有使用m2eclipse,而是使用maven2 + editplus的组合,不过介于广大开发者还是要用eclipse的,所以稍后我们还是会讨论到m2eclipse的相关知识。

posted @ 2010-06-04 15:49 simplelove 阅读(5580) | 评论 (0)编辑 收藏

follow steps 不用netbean,按照下文的指示手工操作。

http://dev.firnow.com/course/3_program/java/javajs/20090507/166773.html

碰到问题:

在执行 ant -f build.xml setup的时候会报一个错误
连接到端口1527上的服务器localhost 时出错,消息未connetion refused:connect

 

原因是java derby db 没有启动。

解决方法:启动它

<glassfish_dir>/bin/asadmin start-database

<glassfish_dir>指的是glassfish的安装目录

posted @ 2010-05-23 15:51 simplelove 阅读(337) | 评论 (0)编辑 收藏

image

I got above error notes shows google take serious consideration about its security.

posted @ 2010-04-16 11:26 simplelove 阅读(152) | 评论 (0)编辑 收藏
  • must end with a new line
  • Main-Class attribute is case sensitive
  • file name is random, file extension is mf, eg. mymanifest.mf
  • example jar command to package a app: jar cfm myapp.jar MANIFEST.MF *.*
eg:

Manifest-Version: 1.0
Main-Class: ButtonTest


posted @ 2010-02-20 14:15 simplelove 阅读(737) | 评论 (0)编辑 收藏

导航

<2010年2月>
31123456
78910111213
14151617181920
21222324252627
28123456
78910111213

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜