Posts

Showing posts from March, 2007

Low-level conversion of e.g. "ISO-8859-1" to "UTF-8"

String utf8Title = new String(getTitle().getBytes("ISO-8859-1"), "UTF-8");

design patterns @wikipedia

http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29

Mail API - SEND MAIL‏

package demo.util; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import org.apache.log4j.Logger; import demo.CRM; public class Mail {     static Logger logger = Logger.getLogger(Mail.class);     /**      *      * @param smtpHost      * @param smtpPort      * @param from      * @param to      * @param subject      * @param content      * @throws AddressException      * @throws MessagingException      */     public static void send(String smtpHost, String smtpPort, String from, String to, String subject,             String content) throws AddressException,MessagingException {         // Create a mail session         Properties props = new Properties();         props.put("mail.smtp.host", smtpHost);         props.put("mail.smtp.port", smtpP

Pre-Loading images in HTML

<BODY ONLOAD="MM_preloadImages( 'images/img1.gif', 'images/img2.gif', 'images/img3.gif', ... )">

Web Services Programming Tips and Tricks: Use collection types with SOAP and JAX-RPC

"It is quite common for applications to manipulate collections of objects, passing them as arguments to functions and returning them when the processing is complete. There are many ways to represent these collections in most programming languages. They can be expressed as ordered vectors, unordered groups, linked lists, trees, graphs or other forms that the programming language supports. The Java language provides an entire library of collection types in the java.util package. The question, however, is how should you pass collections across a Web services invocation?" http://www.ibm.com/developerworks/webservices/library/ws-tip-coding/index.html

EMMA

"EMMA is an open-source toolkit for measuring and reporting Java code coverage. EMMA distinguishes itself from other tools by going after a unique feature combination: support for large-scale enterprise software development while keeping individual developer's work fast and iterative. Every developer on your team can now get code coverage for free and they can get it fast!" http://repo1.maven.org/maven2/emma/maven-emma-plugin/ http://emma.sourceforge.net/

URL Encoding

(or: 'What are those "%20" codes in URLs?')

Developing J2EE Applications Using Hibernate Annotations and Spring MVC

http://www.developer.com/java/ent/article.php/10933_3577101_2