while testing for locale

using firefox, about:config, set en-US to required locale, would help for testing.

Advertisements

IKM hard

some feedback

1. it’s never too old to learn, keep learning, and working harder

2. J2ee technology is unlimited. JAAS, JNDI, LDAP, two phase commit, MVC, JMS, Web Service……………………

 

 

=============

 

Jan 3rd, 2011 10:54pm,

i finnally finished whole timing of the j2ee ikm test, damn difficult.

 

great coverage of various topics,  JMS, XML, JAX-WS, JNDI, two-phase commit, jsp request, servlet, MVC, preparedstatement, SOAP, JSP engine,  InteractionSpec, JAAS, JavaMail, Hacker, JSP:userbean, EJB MDB, EJB Entity Bean, JAXP, Design, JMS, JEE Connector Architecture, JDBC, Java Mail, ……….

 

105 minutes, i only finished 26 questions out of 42. using a lot of googles, still doesn’t work. reasons, 1: extremely wide coverage, popular, or rare. 2: depth of knowledge, actually on rared depth…

 

oooops…

i might need to reconsider how should i judge myself in j2ee skills.

collections

Q 15: What is the main difference between an ArrayList and a Vector? What is the main difference between HashMap
and Hashtable? What is the difference between a stack and a queue? LF DC PI CI FAQ
A 15:
Vector / Hashtable ArrayList / HashMap
Original classes before the introduction of Collections
API. Vector & Hashtable are synchronized. Any
method that touches their contents is thread-safe.
So if you don’t need a thread safe collection, use the ArrayList or
HashMap. Why pay the price of synchronization unnecessarily at
the expense of performance degradation.
Q. So which is better? As a general rule, prefer ArrayList/HashMap to Vector/Hashtable. If your application is a
multithreaded application and at least one of the threads either adds or deletes an entry into the collection
then use new Java collections API‘s external synchronization facility as shown below to temporarily synchronize
your collections as needed: CO
Map myMap = Collections.synchronizedMap (myMap); // single lock for the entire map
List myList = Collections.synchronizedList (myList); // single lock for the entire list

strategy for java jee development

take UI code debug and modification for example. previously, i have been tracing the log, using firebug check the URL address of the link, or better advanced using debug mode. But whatever method it is, i have been making huge effort on making sure, the 100% clear sure flow is made known. click button A —> to ActionA.class —> forward ServiceB.class —> DAOC.class –> JSPD.jsp.

it’s time consuming and effort consuming, yet, still times, there are mistakes. let’s say checking and follow every line, every detail of the code, then i finally modified A.class, D.jsp. Deploy and test, it might still wrong. Might be DAOD, need to be changed.

I just realized, after three years, knowing roughly the usual way of coding, structure, roughly architech, utilizing fiddler, click button A, button B, whatever, then check fiddler record, see what possibly what’s the action, let’s say ActionA.class, then go there, roughly check through, i would quickly decide possible problem occurrence place.

then deploy and test, it probably works.

conclusion is, now since now the “behind” coding (the why, how it works) I have roughly know, so I don’t any more spend so much time effort on tracing so detail, 100%. And utilizing fiddler, httpwatch professional, or debug mode, work is better and faster.

java

double d=24.5/0;
float f=24.5F/0;
int i=1/0;
System.out.println(“\”d=24.5/0;\” result:” + d);
System.out.println(“\”float f=24.5F/0;\” result:” + f);
System.out.println(“\”int i=1/0;\” result:” + i);

result:Exception in thread “main” java.lang.ArithmeticException: / by zero
at com.IB.test.main(test.java:13)

java

double d=24.5/0;
float f=24.5F/0;
//int i=1/0;
System.out.println(“\”d=24.5/0;\” result:” + d);
System.out.println(“\”float f=24.5F/0;\” result:” + f);
//System.out.println(“\”int i=1/0;\” result:” + i);

result:”d=24.5/0;” result:Infinity
“float f=24.5F/0;” result:Infinity

unlimited !


public class Outer2 {
        private int size;

        public Object makeTheInner(final int localVar) {
                final int finalLocalVar = 6;
                class Inner {
                        public String toString() {
                            return ("#< Inner size=" 
+ size +" localVar=" + localVar 
+" finalLocalVar=" + finalLocalVar + " >");
                        }
                }

                return new Inner();
        }

        public class Inner {
                public void doStuff() {
                        size++;
                }
        }
}

测试此类:

public class TestInner {
        public static void main(String[] args) {
                Outer2 outer = new Outer2();
                Object obj = outer.makeTheInner(1);
                // Must create an Inner object relative to an Outer
                Outer2.Inner inner = outer.new Inner();
                inner.doStuff();
                System.out.println(obj.toString());
        }
}

result:
#< Inner size=1 localVar=1 finalLocalVar=6 >