Friday, August 6, 2010
Wednesday, July 7, 2010
Java Closures
Java 7 is going to have lambda expression("closure"). Some people say it's simplification.
Other says no it's harm. Well anonymous classes was a replacement of closures and
as James Gossling says because of time pressure. But the Java culture of programming is formed and
exists a decade. Just try yourself the examples and ask youself:
Is it improve you code? Ask colleges do they understand your code?
Example 1
val SOME 6 =
withReturn
(fn return =>
(app (fn x =>
if 0 = x mod 2 then
return (SOME x)
else
print (Int.toString x))
[1, 3, 5, 6, 7, 9]
; NONE))
What's the result??? It's simple isn't it? 135
Example 2
new Functor(){public Object f(Object x){ ... }}
vs(lambda (x) ...)
vsnew (){f(x){...}}
Example 3Result: As we see from examples we missing type declaration - so missing the idea
textField.addActionListner( new ActionListener() {
public void actionPerformed( ActionEvent notUsed ) {
textArea.append( textField.getText() );
}
});
vs
textField.addActionListner( ActionListener()
( notUsed )
textArea.append( textField.getText() );
);
of Java as a language. Simplification of lines of code,lines...No the most for you you IDE
does no matter Eclipse, IntelJ or Netbeans. But if you are a vi or notepad geek just
think maybe it's better for you to write on perl or assembler?
Monday, June 28, 2010
Captcha
http://www.javacodegeeks.com/2010/06/add-captcha-gwt-application.html
Friday, June 25, 2010
GIT+Eclipse
http://wiki.eclipse.org/EGit/User_Guide/Remote#Repository_Selection
http://help.github.com/msysgit-key-setup/
http://help.github.com/msysgit-key-setup/
Thursday, May 27, 2010
Modificator for @Autowire
Is it the same?
1. Speed issuer. With a private modificator reflection algorith adds only one additional call which is nano seconds time.
2. But with a private modificator you don't break object encapsulation
@Autowired
public indentifier name
@Autowired
private indentifier name
1. Speed issuer. With a private modificator reflection algorith adds only one additional call which is nano seconds time.
name.setAccessible(true);
2. But with a private modificator you don't break object encapsulation
Wednesday, December 23, 2009
SLF4J
SLF4J-simple can't be configured via log4j.properties. To configure it use slf4j-log4j12
org.slf4j
slf4j-log4j12
1.5.8
Tuesday, November 10, 2009
WINDOW resize handler
public class XXX implements ResizeHandler{
public XXX(){
Window.addResizeHandler(this);
}
@Override
public void onResize(ResizeEvent event) {
//TODO YOUR CODE AFTER RESIZING
}
}
public XXX(){
Window.addResizeHandler(this);
}
@Override
public void onResize(ResizeEvent event) {
//TODO YOUR CODE AFTER RESIZING
}
}
Subscribe to:
Posts (Atom)