if (x !== undefined){} // gets error if x undeclared if (x !== 'undefined'){} // gets error if x undeclared if (typeof x !== undefined){} // gets error because typeof x returns "undefined" if (typeof x !== 'undefined'){} //right one
Friday
How to check for the existence of undeclared variable in js
You can check for the existence of undeclared variable in javascript without getting ReferenceError:
Tuesday
How to learn which vendor / version is using in jsf webapp? (MyFaces or Mojarra)
You can run the following code fragment in your application:
import javax.faces.context.FacesContext; System.out.println("imp title: " + FacesContext.class.getPackage().getImplementationTitle()); System.out.println("impl vendor " + FacesContext.class.getPackage().getImplementationVendor()); System.out.println("imp version: " + FacesContext.class.getPackage().getImplementationVersion());
Sample output: imp title: Apache MyFaces JSF-2.2 Core API impl vendor The Apache Software Foundation imp version: 2.2.11
Dynamically calling a class - method in java by using reflection
Dynamically call a method on a dynamically given class by using reflection:
import java.lang.reflect.Method; try { String myClassName = "tr.com.xx.xx.xx.Example"; String myMethodName = "exampleMethod"; Class<?> myClassRef = Class.forName(myClassName); Object instanceOfMyClass = myClassRef.newInstance(); //my object input types in order: param1(int), param2(String), param3(MyDTO), param4(List<MyDTO>) Method method = myClassRef.getDeclaredMethod(myMethodName, int.class, String.class, MyDTO.class, List.class); MyResult respoonse = (MyResult) method.invoke(instanceOfMyClass, param1, param2, param3, param4); System.out.println("response" + response.getX()); } catch(Exception e) { //logging System.out.println(e.getMessage());
Hint: shaking problems in Safari
Container has been shaking chidren on safari. However in chrome, ie, firefox it works well.
Advice:
Dynamically height calculation shakes children on safari.
Check for any dynamically calculation for height. Then try to give "position: fixed" or try to avoid giving height dynamically.
Advice:
Dynamically height calculation shakes children on safari.
Check for any dynamically calculation for height. Then try to give "position: fixed" or try to avoid giving height dynamically.
Subscribe to:
Posts (Atom)