Tuesday, September 20, 2011
Friday, September 16, 2011
java to javascript in wicket
//
//---- code in wicket page constructor ----
//internationalised message to javascript visible in html page
String contributor = "";
add(new StringHeaderContributor(contributor));
//
Domain driven vs service oriented architecture/design
Domain driven design and service oriented design are opposite approaches, while service oriented approach is more stateless (SOA) and more procedural programming like, the domain driven approach is more stateful and object oriented.
The best practices in each case tend to become anti-patterns in the other case.
The best practices in each case tend to become anti-patterns in the other case.
Labels:
sw design
Thursday, September 15, 2011
md5 in java whitout reading file in a buffer
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Scanner;
public class MD5 {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
String[] cmd = new String[]{"md5sum","/home/user/workspace/project/buildfile"};
ProcessBuilder pb = new ProcessBuilder(cmd);
Process p = pb.start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = br.readLine()) != null) {
sb.append(line).append("\n");
}
String answer = sb.toString();
int val = p.waitFor();
String md5 ="";
if(val == 0){
Scanner s = new Scanner(answer);
if(s.hasNext()){
md5 = s.next();
System.out.println(md5);
}
}else{
System.out.println("Error executing command md5sum");
}
}
}
Thursday, September 1, 2011
JQuery - select html elements with id starting with given string
//select all divs with id starting with 'jpassword'
$("div[id^='jpassword']").style.display = 'none';
Labels:
jquery,
Web Developement
Subscribe to:
Posts (Atom)