My MSN

Click OK to add this content

 
Content Preview: rss
-+Closure
454 days ago
Martin Fowler     http://martinfowler.com/bliki/Closure.html Closure design 8 September 2004 Reactions As there is a growing interest in dynamic languages, more people are running into a programming concept called Closures or Blocks. People from a C/C++/Java/C# language background don't have closures and as a result aren't sure what they are. Here's a brief explanation, those who have done a decent amount of programming in languages that have them won't find this interesting. Closures have been around for a long time. I ran into them properly for the first time in Smalltalk where they're called Blocks. Lisp uses them heavily. They're also present in the Ruby scripting language - and are a major reason why many rubyists like using Ruby for scripting. Essentially a closure is a block of code that can be passed as an argument to a function call. I'll illustrate this with a simple example. Imagine I have a list of employee objects ...
-+Moonlight Shadow
622 days ago
The last that ever she saw him carried away by a moonlight shadow He passed on worried and warning carried away by a moonlight shadow Lost in a river last saturday night far away on the other side He was caught in the middle of a desperate fight And she couldn't find how to push through The trees that whisper in the evening carried away by a moonlight shadow Sing a song of sorrow and grieving carried away by a moonlight shadow All she saw was a silhouette of a gun far away on the other side He was shot six times by a man on the run And she couldn't find how to push through I stay, I pray, I see you in heaven far away I stay, I pray, I see you in heaven one day Four A.M. in the morning carried away by a moonlight shadow I watched your vision forming carried away by a moonlight shadow Stars moved slowly in a silvery night far away on the other side Will you come to talk to me this night? But she couldn't find how to push through I stay, I pray, I see you in heaven far away I stay, ...
-+2007年10月20日,HO1120,成都至上海的航班上
771 days ago
2007年10月20日,HO1120,成都至上海的航班上      今天终于离开了生我养我的家乡-四川,23年了,第一次离开四川去寻找属于自己的世界,一直以来我都认为我是生性好动的,讨厌平淡安逸的生活,喜欢漂泊与挑战,就像每年的旅行一样,期望去发现能刺激我的元素。记得八年前当我第一次来到上海时,那天的天很蓝,蓝的超出了我的想象(四川盆地感觉随时都是雾蒙蒙的,特别是成都),蓝天下整个现代化的都市使我相当震撼,繁华、高节奏、竞争与机会,充满了那么多能刺激我的元素,那时我就知道总有一天我会回到这里的。从高考的失败,到毕业后的犹豫,今天我终于决定出发了,1800公里,2小时40分钟的航程,我的人生一定会从今天开始改变。      现在飞机是不是在绝恋妹妹生活的城市上空喃?嘿嘿      一直以来都想离开成都,但是当今天真正离开时,我发现还是很舍不得,熟悉的街道、亲人、朋友,还有我深爱的人,这一切都将远离,今天家人给我送别时我发现我居然有点想哭的冲动,o(∩_∩)o...还好拒绝了所有朋友的送别,不然真的哭了就丢脸了。其实时间还是过的蛮快的,都已在成电工作一年了,当时应聘成电时的场景都还历历在目,7个部门领导的面试感觉就像在审犯人一样,当然袁主任还是那么的和蔼、有魅力,:-)。在成电一年收获还是蛮大的,认识了一些朋友,关键还有电信小妹哦,^_^      还有20分钟就要到上海了,本来还有很多要写的,只有等下飞机后继续了,飞机即将降落,我的梦想即将起飞,fighting,nothing is impossible.
-+add sequence
985 days ago
interface Selector {    boolean end();    object current();    void next(); }   public class Sequence    private Object[] obs;    private int next=0;    public Sequence(int size){        obs=new object[size];    }    public void add(object x) {        if(next < obs.lenght) {           obs[next] = x;           next++;           }    }    private class SSelector implements Selector {       int i = 0;       public boolean end() {           return i == obs.lenght;       }       public object current() {           return obs[i];       }       public void next() {          if(i < obs.lenght) i++;       }    }      public Selector getSelector() {        return new SSelector();    }    public static void main(String[] args) {       Sequence s = new Sequence(10);       for(int i = 0; i<10 ; i++)          s.add(Integer.toString(i));       Selector sl = s.getSelector();       while(!sl.end()) {           ...
-+Hibernate
985 days ago
Hibernate是一个免费的开源Java包,它使得与关系数据库打交道变得十分轻松,就像您的数据库中包含每天使用的普通Java对象一样,同时不必考虑如何把它们从神秘的数据库表中取出(或放回到数据库表中)。它解放了您,使您可以专注于应用程序的对象和功能,而不必担心如何保存它们或稍后如何找到它们。      大多数应用程序都需要处理数据。Java应用程序运行时,往往把数据封装为相互连接的对象网络,但是当程序结束时,这些对象就会消失在一团逻辑中,所以需要有一些保存它们的方法。有时候,甚至在编写应用程序之前,数据就已经存在了,所以需要有读入它们和将其表示为对象的方法。手动编写代码来执行这些任务不仅单调乏味、易于出错,而且会占用整个应用程序的很大一部分开发工作量。      优秀的面向对象开发人员厌倦了这种重复性的劳动,他们开始采用通常的“积极”偷懒做法,即,创建工具,使整个过程自动化。对于关系数据库来说,这种努力的最大成果就是对象/关系映射(ORM)工具。      这类工具有很多,从昂贵的商业产品到内置于J2EE中的EJB标准。然而,在很多情况下,这些工具具有自身的复杂性,使得开发人员必须学习使用它们的详细规则,并修改组成应用程序的类以满足映射系统的需要。由于这些工具为应付更加严格和复杂的企业需求而不断发展,于是在比较简单和常见的场景中,使用它们所面临的复杂性反而盖过了所能获得的好处。这引起了一场革命,促进了轻量级解决方案的出现,而Hibernate就是这样的一个例子。      Hibernate的工作方式      Hibernate不会对您造成妨碍,也不会强迫您修改对象的行为方式。它们不需要实现任何不可思议的接口以便能够持续存在。惟一需要做的就是创建一份XML“映射文档”,告诉Hibernate您希望能够保存在数据库中的类,以及它们如何关联到该数据库中的表和列,然后就可以要求它以对象的形式获取数据,或者把对象保存为数据。与其他解决方案相比,它几乎已经很完美了。      由于本文只是一篇介绍性的文章,所以不会引入构建和使用Hibernate映射文档的具体例子(我在《Hibernate: A Developer's ...
© 2009 MicrosoftMicrosoft