Paul Labis: This is a personal blog where everyone can read my experiences, ideas and thoughts about programming, latest gadgets and other information technology related topics, lifestyle and many other stuff I would like to share to the public.

Commons Email - Examples

I found another good apache tool for sending emails.
Its easy to use and has good documentation.
Below is an example of an easy way to sending an email.
It is explained properly on apache user guide page which is embedded on the bottom part of this article.


import org.apache.commons.mail.*;
...

// Create the attachment
EmailAttachment attachment = new EmailAttachment();
attachment.setPath("mypictures/john.jpg");
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setDescription("Picture of John");
attachment.setName("John");

// Create the email message
MultiPartEmail email = new MultiPartEmail();
email.setHostName("mail.myserver.com");
email.addTo("jdoe@somewhere.org", "John Doe");
email.setFrom("me@apache.org", "Me");
email.setSubject("The picture");
email.setMsg("Here is the picture you wanted");

// add the attachment
email.attach(attachment);

// send the email
email.send();


Sending Mail with SMTP

I was was having problem on sending emails through Java.
I researched and found this apache API SMTP for sending email.
I just want to share this simple tutorial article on Discursive blog to everyone who needs it.

10.16. Sending Mail with SMTP | Discursive

Check Ubuntu laptop temperature

I noticed my laptop temperature is getting hotter. I was a bit worried so I made a little research on how to check the temperature via the internal chip sensors and Ubuntu terminal/command line. The quickest way so far is through below:

1. Make sure you lm-sensors are already installed. (In latest version as of 2010 - this was already configured) To know more about it goto http://packages.ubuntu.com/lucid/lm-sensors

2. Open you terminal/command line and enter the command "sudo sensors-detect". You will be asked which hardware sensors to scan. Answer it yes or no.

3. Get the temperature by running command "sensors" on your terminal.

There we have it! Thats how I check my laptop temperature. There other ways to check and are probably better and accurate. Have fun and enjoy.

April Blogging Comeback

Oh yeah! Techieboy is back in sharing his experiences!

Its been a while since I created an article on my experiences with technology. It was around October last year since I stopped due to busy schedules and work. I was also sent to Chicago, Illinois to assist our company client.

It had a wonderful experience though. I was able to see and experience what politics was in software industry. I was exposed to high-end technologies such as Spring Roo and JQuery. Learn a lot on how to deal with management stuff particularly on strategies of motivating employees to make them productive. I had been quite on most of the time, but, I am very observant of thing happening around me.

Anyway, I will cut this article for now. There will be a lot of articles coming up in few days. Have fun and keep in-touch.

DDSteps Testing with Ant Tutorial

It has been almost a year that I've been using DDSteps for testing a back-end project module and I haven't been able to share or create an article about it. So to those people reading this article, I hope this helps you get started on DDSteps testing.
DDSteps is an integrated tool stack, combining the best open source testing tools for Java and adding the ability to resuse test cases and test data.


DataDriven so that when you want to test "sign up" on your site, you can test the same flow with both "George Bush" and "Владимир Путин". Just add another row to spreadsheet, that's all! - by ddsteps.org 
In this tutorial, I will discuss a little about this simple java application I made focus on testing and generating html test results using ant. We will not deal much on the theories since those kind of information are already provided on www.ddsteps.org. I usually use eclipse as my preferred IDE in developing the application. The application makes use of ant to generate the HTML JUnit reports.