Tuesday, September 15, 2009


What is the Mifos Initiative?
Mifos is an industry-wide initiative to address the microfinance industry's information management challenge. Using the open source paradigm, we are creating a new service model that will increase access to technology for all microfinance institutions, ultimately enabling them to extend their reach to the world’s poor.

At the center of the initiative is the Mifos product, a freely available world-class management information system (MIS) that provides the core functionality required by microfinance institutions. The flexibility and scalability of the product means that we'll be able to simultaneously standardize common processes, accommodate regional variations, and scale for new innovations in the future.

We invite you to join with other microfinance institutions (MFIs), IT professionals, software developers, and industry leaders worldwide and become part of the Mifos community. Only with the participation and collaboration of all of us can Mifos have the truly revolutionary impact for which it has the potential.

With Mifos, the microfinance industry as a whole not only benefits from the technology, it contributes to it, improves it, and owns it.

Wednesday, September 9, 2009

Sending Excel file for download from Servlet

Sending Excel file for download from Servlet

In the Tomcat environment you need to add an entry something like this one
to the MIME Type Mappings section of the Tomcat web.xml file. (I don't know
if you can put this in your project's web.xml.)



public static final String CONTENT_TYPE_APP_OCTET_STREAM =
public static final String CONTENT_TYPE_APP_MSEXCEL = "application/
protected void doFileDownload(HttpServletResponse response, String
fileName, String filePath, boolean bFlag) {
try {
File file = new File(filePath + fileName);
String contentType = null;
String headerInfo = null;

if (file.exists()) {
if (type) {
headerInfo = "attachment; filename=\"" + fileName +
} else {
headerInfo = "inline; filename=\"" + fileName + "\"";
} // end if

response.setHeader("Content-Disposition", headerInfo);

// set output stream to the response's output stream
ServletOutputStream servletOut = response.getOutputStream();

// now read file
byte[] dataRead = new byte[(int)file.length()];
FileInputStream fileIn = new FileInputStream(file);

// read in byte data from file and store in byte array
fileIn.read(dataRead, 0, (int)file.length());

// close file
if (fileIn != null) {
} // end if

// write the file to output stream

// flush the output stream
// TODO: handle File Not Found error here
} // end if
catch (Exception ex)
// TODO: handle Exception here

Tuesday, September 1, 2009

Sending Email from java

Code ot Send Email in Java
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

import java.util.Properties;

public class SimpleMail {

private static final String SMTP_HOST_NAME = "smtp.myserver.com";
private static final String SMTP_AUTH_USER = "myusername";
private static final String SMTP_AUTH_PWD = "mypwd";

public static void main(String[] args) throws Exception{
new SimpleMail().test();

public void test() throws Exception{
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");

Authenticator auth = new SMTPAuthenticator();
Session mailSession = Session.getDefaultInstance(props, auth);
// uncomment for debugging infos to stdout
// mailSession.setDebug(true);
Transport transport = mailSession.getTransport();

MimeMessage message = new MimeMessage(mailSession);
message.setContent("This is a test", "text/plain");
message.setFrom(new InternetAddress("me@myhost.org"));
new InternetAddress("elvis@presley.org"));


private class SMTPAuthenticator extends javax.mail.Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
String username = SMTP_AUTH_USER;
String password = SMTP_AUTH_PWD;
return new PasswordAuthentication(username, password);