Tag Archives: Java

How to Export Data to Excel without hassel

Saving query to excel format could go through Microsoft Office Interop services or some third party libraries. However there is a simpler way. CSV file formats are wuite simple and one could simply read queries and save them into a text file format with CSV as the extension (myfile.csv).

The tricks would be to have the data read from database by query and write each record as a line and semicolon to separate the column vales.This is actually language independent and one could implement it by C#, Java or any other language that could execute queries on a database.

JavaMail, sending emails from your Java application

The JavaMail API provides a platform-independent and protocol-independent framework to build mail and messaging applications. The JavaMail API is available as an optional package for use with Java SE platform and is also included in the Java EE platform. Download JavaMail jar files from here. Full JavaMail API. For a full example with source code of JavaMail, click on “more” link down here. Continue reading

Dashed line at Java/Processing

This code is a little bit edited and re-posted again from a post I found on Processing forum. Check the source at the bottom of the post for the original post.
import java.awt.*;

float[] dashes = { 16.0f, 8.0f, 4.0f, 8.0f };
BasicStroke pen;

void setup(){
size(400, 400);
pen = new BasicStroke(4.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 4.0f, dashes, 0.0f);
Graphics2D g2 = ((PGraphicsJava2D) g).g2;

void draw(){
line(0, 0, width, height);
line(0, height, width, 0);
source : http://processing.org/discourse/yabb2/YaBB.pl?board=Syntax;action=display;num=1217445670