Wednesday, July 28, 2004

JDBC Connections, Oracle/MySQL/Access/SQLServer

It is pain to look up the connection strings for these databases, here are some snippets. 


-- Oracle --

oracle.jdbc.driver.OracleDriver

  conn =     DriverManager.getConnection("jdbc:oracle:thin:@0.0.0.0:1521:DB_NAME",_username,_password);

note: classes12.zip

-- MySQL --

dbc:mysql://127.0.0.1/MYSQL_DB?user=MY_USER&password=XXX

 
and the Driver

com.mysql.jdbc.Driver

 

-- Sql Server --

public static final String _connectString = "jdbc:jtds:sqlserver://0.0.0.0:1433/SOME_DB;user=BLAH;password=BLAH";
 

try {        
 Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();   _conn = DriverManager.getConnection(_connectString);
 } catch(Exception e) {      e.printStackTrace();
  } // end of the try - catch

Saturday, July 24, 2004

JavaDesktops Cool

I knew there were Java Desktops out there but I didnt know they were so polished, here are some good ones.

http://www.jdistro.com/
http://www.jcraft.com/weirdx/
http://sourceforge.net/projects/jsh/

http://jdx.sourceforge.net/



Tuesday, July 20, 2004

JBOSS and simple session bean tutorial

http://www.retroevolution.com/ejb01.htm

Monday, July 19, 2004

working on web OS

switching gears and going to work more with enterprise systems, I will now be working on a
web based operating-system.

Monday, July 12, 2004

Apple and its move towards the future

I saw aspects of Apple's upcoming release of Tiger, their next OS. It was amazing, including iTunes style interface for searching files or directories, plug-n-play video/audio chat.

Sunday, July 11, 2004

Worked on a wiki/google crawler

If you want to know how to write a webcrawler in a day, wiki crawler in a day, here it is. Actually the goal was to find a set of words and their meanings, tech words mostly. The source is embedded in my larger application, yet the application is so small that it wont be hard to find the relevent code.

WikiSearching Java Code

Here is the core :

StringBuffer _buf = new StringBuffer();
_buf.append("GET /wiki/Special:Search?search=");
_buf.append(URLEncoder.encode(_query, "UTF-8")
+ "&go=Go ");
_buf.append(" HTTP/1.1\r\n");
_buf.append("Accept: text/html\r\n");
_buf.append("Referer: " + _refer + "\r\n");
_buf.append("Accept-Language: en-us\r\n");
_buf.append("User-Agent: Mozilla/4.0 (compatible; ");
_buf.append("MSIE 6.0; Windows NT 5.1; ");
_buf.append("Avant Browser [avantbrowser.com]; ");
_buf.append(".NET CLR 1.1.4322)\r\n");
_buf.append("Host: " + _host + "\r\n" + "Connection: close\r\n\r\n");

String httpPost = _buf.toString();
System.out.print(".");

try {

PrintWriter writer = new PrintWriter(_socket.getOutputStream(),true);

writer.print(httpPost);
writer.flush();

} catch (Exception exception) {

throw new RuntimeException(exception);

} // end of the try - catch ...

BufferedReader bufferedReader = null;
try {

bufferedReader =
new BufferedReader(new InputStreamReader(_socket.getInputStream()));

} catch (IOException ie) {

ie.printStackTrace();

} // end of the try - catch

Coding, Coding

More coding today, probably, I hope to finish my wiki search on my bot project.

Saturday, July 10, 2004

Agile Development

Is agile development the way to go?

Regex and java

I working with parsing HTML, it can get complicated if you are using String.indexOf and parsing it this way. The new(old) java 1.4.2 regex utilities are the way to go, and you probably could write a pretty simple browser in a couple of days or so.

Here is a simple regex expression that works pretty well(uses grouping) :

The first group includes the anchor tag and the text,
The second group includes the text inside the anchor tag

Pattern p = Pattern.compile("({a.*?href=.*?}(.*?){/a})");
Matcher m = p.matcher(some_url_page);

while(m.find()) {

int n = m.groupCount();
....

}

Cool blogging

Ramza = final fantasy tactics character, best game written ever, an amazing piece of creativity.
bean = I am a java programmer, and bean is a big word in the java community
realname = Berlin Brown, a person who lives in Atlanta, born in Austin(woop woop)