Simplest Captcha in Java

Published on January 22, 2011 by Amir Sedighi

This is a simple captcha image renderer. I just modified this sample and make it a bit hard to recognize for software robots. I hope it remains still readable to the human. Just add it as a simple servlet and enjoy it. package datis.general.util; import java.awt.Color; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.awt.RenderingHints; import [...]

Posted in Java

Sending HTML emails with attachments via SMTP and Java mail API.

Published on December 9, 2010 by Amir Sedighi

The code is clear enough and you won’t need any explanation… package mail.send.datis.com; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage.RecipientType; import javax.mail.internet.MimeMultipart; import java.util.ArrayList; import java.util.Date; import java.util.Properties; public class SMTPClient { private final String _CONTENT_HTML = “text/html”; private final String _CONTENT_HOST = “mail.datispars.com”; private final String _PORT = “25″; [...]

Posted in Java

How to access the folders outside Tomcat

Published on September 7, 2010 by Amir Sedighi

The best way for accessing the folders outside Tomcat webapps folder is mapping folders using mount-points. Assume the application folder located in below path: (MyApplication) /home/amir/java/tomcat/webapps/MyApplication/ I need to upload files into another machine so I just created a folder “hugeSizeFolder” into the “MyApplication” folder. Then I mapped it to a remote shared folder. Assume [...]

Posted in Java, Linux

Exploring under hood of Java applications using JMX – Part 2

Published on August 28, 2010 by Amir Sedighi

Introduction Here you will find how to monitor an application which is hosted in Apache Tomcat. There are many reasons for monitoring an application in run time. In our case the client was looking for some measurable factors that shows slap of business ratios on demand. Moreover, the technical department was looking for fine-grain informations [...]

Posted in Java, Linux, Software Engineering

Exploring under hood of Java applications using JMX – Part 1

Published on August 25, 2010 by Amir Sedighi

Introduction. A business company was looking for a proper method to monitor it’s business applications. They were almost implemented by Java. Firstly I was going to implement another application for this purpose. Fortunately a friend of mine shows the way. We planned to use JMX. Here is a tutorial that clearly shows you how to [...]

Posted in Java, Linux, Software Engineering

Parsing Huge Text Files Using Java or Linux commands

Published on June 19, 2010 by Amir Sedighi

First Scenario: Using Java as programming Language A friend of mine and I decided to parse a huge size text file that consists some reports of legacy devices. After few times trying we got that, opening and parsing huge text files in Java is a pertty time and resource consuming. We started with a 35MB [...]

Posted in Java, Linux

OutOfMemoryError: PermGen

Published on June 8, 2010 by Kamran Vatanabadi

“OutOfMemoryError: PermGen” or simply “PermGen” is familiar Tomcat (or any Tomcat base app server like JBoss and …) error message for those who has large and/or long running application on Tomcat or do deploy/undeploy many applications on Tomcat. Sorry but if you haven’t seen this message on Tomcat’s console before, you are still a beginner [...]

Posted in Java

Object caching in Java Applications (OSS Story)

Published on June 4, 2010 by Kamran Vatanabadi

Simple things can save your project I’m not going to sequentially write about the OSS project as things happened. So here I bring one of the most important things we have done in this project which saved our career and let us to continue working on this project, it is Object Caching. Consider a web [...]

Posted in Java, OSS

Categories

Archives