Archive for June, 2009

Fav 3 venture capital preferred website

This week, I spend much time on trying those websites which get a lot of money from VC. Those either have terrific unique ideas or have awesome technologies.

1. ScreenToaster This side let you capture screen video on line, it’s perfect for making some computer tutorials and then upload to Youtube or share on other social networks.
2. Alice.com This one is very good for families. Compines like P&G selling their projects directly to customers, the price is much cheaper and shipping is free.
3. animoto This site allows users upload pictures and choose a song as background music from thousands of songs. Then share it on social networks directly. This is not new, but it allows users to do this online.

Build a quick online notepad

What I am thinking is that there is a notepad which can be opened anywhere. I searched online and found there are several such kind of websites, among them ubernote looks very professional. It likes gmail, and have a lot of function. But what if I only want a notepad which is like a post. I input the webpage and start typing, when I use another computer I can also open it fast. I made a tool by myself, called Quick Notes.

The main feature is it’s speed. If a computer is only used by one person, the user can register this computer as a private machine. Whenever, he inputs the URL, the notes opens directly, and there is no need to login. If a registered user use a public computer, it will require username and password to access his notes. This solution extremely shorten the usage process.  However, there is a big issue here. Since there is no login, it may be not secure. So the Quick Notes is designed for normal non-important information. The following is a screen shot of the Beta version. http://notes.programcreek.com

Quick Notes

Quick Notes

With this nice tool, Continue »

Debug program using deleting method

Recently I am maintaining an in-house PHP content management system. There is an error on this page, but only for one record in database. Since the code works well for all other record, it should also work for this one. While I could not find the error, by checking the code line after line. Finally, I decide to delete some parts to find which line has problem. This page contains several sections, such as header, several container sections for ajax to load dynamically, footer, etc.  So I just remove sections first, then I find which section has problem. After getting the wrong section, then I remove functions one after one. Finally, I get to know where the problem is.

The problem is JavaScript. There is a single quote ‘ in a person’s name, like O’lley. The programmer also used single quote in JavaScript, such as:

onclick='show_center("")'

When the page is loaded, the JavaScript becomes:

onclick='show_center("O'lley")'

The solution is to change the single quote ‘ to double quote ” as following:

onclick="show_center(\"\")"

In summary, Deleting is a way to find error in a page, and remember to consider this problem in your JavaScript code.

Prototype of Java Database Class

Can we do a Database connection class which allows us just change the configuration file, and then use the database? I did the prototype of this class which is very simple. But the idea is good, always use a very simple jar file to get setup database which can then do SQL query operations.

package com.programcreek.db;
 
import java.sql.*;
 
public class DB {
 
	private Connection conn = null;
 
	public DB(String url, String user_name, String password) {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection(url, user_name, password);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
 
	public ResultSet runSql(String sql) throws SQLException {
		Statement sta = conn.createStatement();
		return sta.executeQuery(sql);
	}
 
	@Override
	protected void finalize() throws Throwable {
		if (conn != null && !conn.isClosed()) {
			conn.close();
		}
	}
 
}

Here is the code to call the DB class:  Continue »

An Entry Example of Log4j

The log4j can be configured both programmatically and externally using special configuration files. External configuration is most preferred, because to take effect it doesn’t require change in application code, recompilation, or redeployment. Configuration files can be XML files or Java property files that can be created and edited using any text editor or XML editor, respectively.

Continue »

A simple example to show how to use java properties file

I am trying to make a simplified Database class for Database connection and query operation.  It’s a good idea to put the database config information to a properties file. In this way, when my code is packaged to a jar file, other users can just put the different database configuration file in the config.properties file.

Continue »

File Transfer through Java Web Service — Solution

I talked this topic in my previous post. Now I have completed the Centralized Document Transfer and Sharing System. I found that it’s not that useful to put my code here. Only how to solve the problem is worth to write.  I use the Netbeans to build this application which is very fast. Netbeans is a great tool to build web service. Here are the steps to make the application run.

1. Use FTP to upload a file. Set up an FTP server first using FileZilla. Open a count for a client to connect and upload files.

2. Use Netbeans to build web service which can store file’s information including: file name, version number, file type, and all file information. You will need a database to store those informations. The following is the database diagram.

Continue »

Fav 5

The following are some fancy stuff I found in the last few days.

1. Google Wave. I’m waiting Wave to go live, it looks very good. Google always make some good stuff, so it’s worth to look at it.

2. fat jar eclipse plugin. a Deployment-Tool which deploys an Eclipse java-project into one executable jar.

3. Izpack. wrap a jar file to a windows executable .exe file.

4. Google App Engine.

In case you did not hear the news, Google has announced the availability of Java on Google App Engine. Continue »