Guide To Simplified Java Logging using Java Core APIJanuary 17th, 2006 Java comes in with a handy logging package (java.util.logging) which eliminates the need to use external logging packages like Log4J. However it still requires some configuration which makes it cumbersome and repetitive to include in every class.
Writing Obfuscated Code Using Java Generics Part 1November 14th, 2005 Let's begin with a simple example for this installment. import java.util.Collection;
public class TestType {
public static <Collection> Collection myMethod(Collection a) {
return a;
}
public static void main(String ...
Tip: How To Extend HSQLDB RDBMS With Java FunctionsJuly 17th, 2007 HSQLDB is an unique high performing, high quality Java based relational database which can be very easily extended with simple Java static functions. Here we will see how you can easily extend the database capability with a real-life example.
Calculate PI To Arbitrary Precision (Sample Java Code)November 13th, 2007 Sample Java code to calculate PI to arbitrary precision. This uses Machin's formula: pi/4 = 4*arctan(1/5) - arctan(1/239).
Discussion & Examples: Java enums versus public static finalSeptember 23rd, 2008 Should we use to represent a constant String such as browser's user agent or simply use public static final String as before?
Using public static final as enum has many problems, such as:
Not typesafe - Since a type is just an int you can pass in any other int value where a particular type is required, or add two types together (which makes no sense). This is particularly noticeable in C programs where you will find strange constants being used in un-related place and yet it seems to work, simply because the required constant and the provided constant share the same int value.
Core Java: How To Get Java Source Code Line Number & File Name in CodeSeptember 8th, 2008 While debugging code Java programmers often use System.out.println(). It is important to write separate message in each System.out.println() so you can understand from the output where the problem lies.
How To Simulate Telnet Session in JavaFebruary 16th, 2006 Often we come across procedures which need to be performed by issuing commands in a telnet session. It is relatively easy to do it manually but is definitely not suitable for automation.
Understanding Java: Simplified Hello World for Socket ProgrammingApril 15th, 2006 In my experience much of the complexities a newcomer faces in the Java world is understanding extraneous stuff like handling exceptions or formatting data etc. Today I was requested for the nth time (n -> infinity) how to write a simple socket client and server (actually debug one).
JDK1.5 - More painful bugs aka Enumeration-Woes: Solved!August 29th, 2004 Current Status: Solved
Defect:
When more than one annotation type files are compiled in javac(any of the ways like *.java or @srclist or FileName1.java FileName2.java)
then it emits and error message that it cannot find symbol for statically imported Enums. However statically importing one level up and de-referencing works.
Why is Java import static brain dead?August 29th, 2008 Let's begin with an example. Assume a class MQ is in the package com.taragana.mq.
Java Application Security Through Static AnalysisJune 28th, 2008 Extendable (by plugins, ...) Static Analysis tools like FindBugs can enhance the security of your Java applications (web as well as standalone or client-servers applications) in several significant ways. Enforcing security policy compliance
Security policies are espoused by security experts such as OWASP and mandated for compliance by many regulations such as Sarbanes-Oxley that require organizations to demonstrate they have done "due diligence" in safeguarding application security and information privacy.
How To Communicate Between Java AppletsOctober 22nd, 2007 Communication between Java applets has been an interesting topic from the early days of Java. There are several esoteric ways to communicate like using Javascript as a bridge.
Using Assertions in Java TechnologyJuly 18th, 2005 You can use assertions to detect errors that may otherwise go unnoticed. Assertions contain Boolean expressions that define the correct state of your program at specific points in the program source code.
9 Important Tips for Selenium Remote Control (Java client) - Test ToolApril 16th, 2008 Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in many programming languages against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC is a powerful and simple framework for running (scheduled or manually) automated UI centric regression tests for web applications / services.
Java Quiz: Why StringBuilder Should be Used Instead of StringBuffer?August 23rd, 2008 First tell me what is the best way to concatenate large number of String objects? Is it a + b?
Most Java developers know not to use a + b (+ operator) because of huge performance problems, they use StringBuffer instead. In fact I did some tests in the past which confirms this folklore.
July 6th, 2006 at 5:46 pm
That would end the thread and not program execution. (It may result in program termination if you have only one thread.) I guess you know it, but it is more correct put this way :).
July 6th, 2006 at 11:57 pm
You are right. The statement is ambiguous. I will clarify it.
July 7th, 2006 at 12:26 am
The advice on how to handle exceptions in static blocks is actually quite dangerous. See http://twasink.net/blog/archives/2006/07/how_not_to_hand.html for more
(This would have been a trackback, but trackbacks don’t seem to show up here)
July 7th, 2006 at 8:26 am
I have tried to address the concerns raised.
July 11th, 2006 at 7:35 pm
Why not throw an ExceptionInInitializerError()?
static {
try {
// do something that may throw an exception
} catch (ComponentXmlException ex) {
throw new ExceptionInInitializerError(ex);
}
}
August 3rd, 2006 at 5:16 pm
can you send me to my email some smples of a handle exception…..plzzzzzzzzzz app or more
August 3rd, 2006 at 5:17 pm
oh my email is dielli89@hotmail.com
September 13th, 2007 at 3:21 am
sir i want the details of java .
it is here to know about the subject of java.
so iam surfing here.
thankyou.