“Low quality code is not cheaper; it is vastly more expensive, even in the short term. Bad code slows everyone down from the minute that it is written. It creates a continuous and copious drag on further progress. It requires armies of coders to overcome that drag; and those armies must grow exponentially to maintain constant velocity against that drag.” Robert C. Martin
Thursday, December 17, 2009
Search a date range using a date range in sql
or (@endDate between startDate and endDate)
or (@startDate <> endDate )
If this sql returns greater than 0, that means there exists a conflict with your date interval and the db working set.
Saturday, November 14, 2009
Google Go is coming fast :)
Go is …
… simple
package main
import "fmt"
func main() {
fmt.Printf("Hello, 世界\n")
}
… fast
Go compilers produce fast code fast. Typical builds take a fraction of a second yet the resulting programs run nearly as quickly as comparable C or C++ code.
… safe
Go is type safe and memory safe. Go has pointers but no pointer arithmetic. For random access, use slices, which know their limits.
… concurrent
Go promotes writing systems and servers as sets of lightweight communicating processes, called goroutines, with strong support from the language. Run thousands of goroutines if you want—and say good-bye to stack overflows.
… fun
Go has fast builds, clean syntax, garbage collection, methods for any type, and run-time reflection. It feels like a dynamic language but has the speed and safety of a static language. It's a joy to use.
… open source
Thursday, June 18, 2009
Searching a string in another string
String string = "Madam, I am Adam";
// Starts with
boolean b = string.startsWith("Mad"); // true
// Ends with
b = string.endsWith("dam"); // true
// Anywhere
b = string.indexOf("I am") > 0; // true
// To ignore case, regular expressions must be used
// Starts with
b = string.matches("(?i)mad.*");
// Ends with
b = string.matches("(?i).*adam");
// Anywhere
b = string.matches("(?i).*i am.*");
Thursday, May 28, 2009
Inversion of Control
One of them makes pizza in 20 minutes and the other makes in 50 minutes but both of them makes pizza. We call the interface and never think about the implementation and wait for the process to be completed, may be an example of IOC principle. By using this, we develop our codes by not caring about other peoples code or implementation. And by this we can focus on our active work, and build up a layered architecture.
Tuesday, April 21, 2009
VALIDATION PROBLEMS WERE FOUND problem: cvc-enumeration-valid
Exception:
VALIDATION PROBLEMS WERE FOUND problem: cvc-enumeration-valid:
string value '2.4' is not a valid enumeration value for
web-app-versionType in namespace http://java.sun.com/xml/ns/javaee
Solution:
While I was deploying my project on weblogic server 10.3
I had this exception at deploy ear phase. And I have found
the solution as changing the version of my web.xml
from 2.4 to 2.5.
Wednesday, April 1, 2009
java.lang.NoSuchMethodError: com.lowagie.text.Image.getPlainWidth()F
java.lang.NoSuchMethodError: com.lowagie.text.Image.getPlainWidth()F
at net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:1219)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:675)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:641)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:536)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:323)
I have changed the jasperreports version to 3.5.0 and itext version from 1.3.1 to 2.1.4 then problem resolved.:)
Friday, March 13, 2009
ConcurrentModificationException
for(Personel personel : personelList){
if(!personel.getSelected()){
personelList.remove(personel);
}else{
personel.setParent(parent);
}
}
sun