mvn dependency:tree
Friday, 28 October 2011
Tuesday, 25 October 2011
How to create java object in Freemarker?
- Application - servlet context attributes hash model
- JspTaglibs - jsp tag lib factory model
- Request - request attributes hash model
- Session - session attributes hash model
- request - the HttpServletRequst object for direct access
- response - the HttpServletResponse object for direct access
- stack - the OgnLValueStack instance for direct access
- ognl - the instance of the OgnlTool
- action - the action itself
- exception - optional : the JSP or Servlet exception as per the servlet spec (for JSP Exception pages)
- struts - instance of the StrutsUtil class
In the ftl code you can use struts variable:
struts.bean("java.util.Date")It will return object of this type, constructed with zero parameter constructor.
Format date in java with months' name changed
I was given the task to format dates. The requester needed months' name appropriate case endings.
It can be done be SimpleDateFormat class: (this example is for Polish language)
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy"); DateFormatSymbols dfs = new DateFormatSymbols(); dfs.setMonths(new String[]{"stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"}); sdf.setDateFormatSymbols(dfs); String output = sdf.format(new Date());
Heap pollution
Java Language Specification, Third Edition
§4.12.2.1 Heap Pollution
It is possible that a variable of a parameterized type refers to an object that is not of that parameterized type. This situation is known as heap pollution. This situation can only occur if the program performed some operation that would give rise to an unchecked warning at compile-time.
Here is an example:
List l = new ArrayList(); List l1 = l; l.add("one"); Integer i = l1.get(0);
In java 7 the following additions help to deal with Heap Pollution:
- A new mandatory compiler warning is generated on declaration sites of problematic varargs methods that are able to induce contributory heap pollution.
- The ability to suppress those mandatory warnings at a declaration site using an @SuppressWarnings("varargs") annotation. The warnings may also be suppressing using the -Xlint:-varargs option to the compiler.
- If the @SuppressWarnings("varargs") annotation is used on a problematic varargs method declaration, the unchecked warnings at call sites of that method are also suppressed.
Saturday, 22 October 2011
SpeakIt! - Chrome extension
Limit on Post Request - maxPostSize
I've found in the Tomcat and Jboss Connector configuration that we can define a constant maxPostSize that is the maximum size in bytes of the POST request that is handled by the container FORM parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
Wednesday, 19 October 2011
STS 2.8.0 released. Supports Java 7
For more details browse to: http://www.springsource.org/node/3287
How to exclude folders from searches in Eclipse?
Class Currency
java.util.Currency
It represents a currency. The currencies are identified by their ISO 4217 currency codes. Visit the ISO web site for more information, including a table of currency codes.
http://download.oracle.com/javase/7/docs/api/java/util/Currency.htmlJRebel Newsletter
LiveRebel is also worth mentioning. This product allows Java EE Hot Update without downtime, no lost session, no OutOfMemoryErrors, fully automated. Here is the demo.
Wednesday, 12 October 2011
Download AppDynamics Lite 2.0
- monitor JMX metrics
- include proactive email alerts when errors are found
Alfresco Certification
More details here: http://university.alfresco.com/accreditation.html
Tuesday, 11 October 2011
Spring roo fixes bugs.
Thursday, 6 October 2011
Use Tomcat for EJB?
Alfresco 4
Alfresco Community 4, the first open platform for social content publishing is now available to download for free. Alfresco 4 includes new tools which allow developers to create social and cloud-scale, content-rich applications. Further, it includes a new, extensible service to publish content and status updates to social sites, including YouTube, Facebook, LinkedIn, Twitter, Flickr and SlideShare.
See details here
IBM SDK Java Technology Edition Version 7
Wednesday, 5 October 2011
Assertiveness training
Remark: This advice is relevant to Polish language and culture. In many others it could be seen as impolite or without any sense. ;-)
Assertive refusal has to have three parts:- The word No
- Information on how you will behave
- Short explanation
- Expression of your being sorry
It is important not to excuse yourself to much. If not, it will be harder to stop repeated requests. There are some techniques that can be used if you are asked for something again and again:
- Broken record - repeat still the same explanation
- "I am elephant" technique - Say slowly, ask, paraphrase.
- Jujitsu - If you are faced with the argument that a he/she has helped you in past, but now you are not willing to help him. Remember to thank him, but tell him that this time you cannot help.
- authority - refer to the standards or authority
- Think what will happen if you don't succeed.
- State your request in a short and logic way.
- End with a question about the actual decision (time or price).
Reaction for judging critique
You have two possibilities. You can say:- I agree. That's what I think.
- I do not agree. I don't think about myself that way.
Feedback can be positive and negative. It has to contain 3 parts:
- Fact - that has happened
- Attitude - how do I feel about it
- Expectation - what do I expect, how this person should behave.