JSF/Primefaces Multilingual calendar

Reading Time: 2 minutes At work in my current project the customer has delivered their immediate need in the Turkish translation. Our project is multilingual that support English and Turkish. I’ve conducted a research on how to implement a multiple language support on our project, first of all I’ve managed to find Primeface’s prior manual site being hosted on google,

Converting in between Blob and StringBuilder

Reading Time: 1 minute From StringBuilder to Blob @Autowired private SessionFactory sessionFactory; //saving the blob field java.sql.Blob blob = org.hibernate.Hibernate.getLobCreator(sessionFactory.getCurrentSession()).createBlob(errorDescs.toString().getBytes()); From Blob to StringBuilder StringBuilder errorDescs = new StringBuilder(); //error description if (order.getBatchErrorDescription() == null){ errorDescs.append(response.getErrors().getDescription().toString() + “;”); } else{ try { Blob blob = order.getBatchErrorDescription(); byte[] byteData = blob.getBytes(1, (int) blob.length()); String data = new String(byteData); errorDescs.append(data) .append(response.getErrors().getDescription().toString()

Java SMTP mail sending code

Reading Time: 1 minute final String username = “xxx”; final String password = “xxx”; Properties props = new Properties(); props.put(“mail.smtp.auth”, “true”); props.put(“mail.smtp.host”, “HOSTNAME”); props.put(“mail.smtp.port”, “587”); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(“abc@yahoo.de”)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(“rec1@yahoo.de, rec2@yahoo.de”)); message.setSubject(“YOUR SUBJEC”, “utf-8”); String content