Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1446 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Do u know any sample codes on batched data

Thread title: Do u know any sample codes on batched data
Closed Thread    
    Thread tools Search this thread Display Modes  
07-17-2005, 03:33 PM
#1
apple150 is offline apple150
Status: I'm new around here
Join date: Jul 2005
Location:
Expertise:
Software:
 
Posts: 2
iTrader: 0 / 0%
 

apple150 is on a distinguished road

  Old  Do u know any sample codes on batched data

Do u know any sample codes on batched data in the database but not using any sql statements?can post here?thanks!

07-17-2005, 03:34 PM
#2
Anthony is offline Anthony
Status: Sin Binner
Join date: Jul 2004
Location: Yorkshire Coast - UK
Expertise:
Software:
 
Posts: 5,911
iTrader: 29 / 91%
 

Anthony is on a distinguished road

Send a message via MSN to Anthony

  Old

Can you please rephrase your question, it doesn't make much sense at the moment

Thanks

07-17-2005, 04:06 PM
#3
apple150 is offline apple150
Status: I'm new around here
Join date: Jul 2005
Location:
Expertise:
Software:
 
Posts: 2
iTrader: 0 / 0%
 

apple150 is on a distinguished road

  Old

ok,I'm doing a database on hiv drug resistance. I need to access the data via http base and allow batched. For the access part,this is my codes but when I run it, it prompts me to type in the url address and gives mi javascript instead of the data like HIV drugs names. Now I need to batch the data but not using any of the sql statements. So do u know any codes for it? Below is my access codes:

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;

public class Access extends Frame implements ActionListener {

private TextField tf = new TextField();
private TextArea ta = new TextArea();

public void actionPerformed (ActionEvent e) {
String s = tf.getText();
if (s.length() != 0)
ta.setText (fetchURL (s));
}

public Access() {

super ("URL11 Password");

// Setup screen
add (tf, BorderLayout.NORTH);
ta.setEditable(false);
add (ta, BorderLayout.CENTER);
tf.addActionListener (this);
addWindowListener (new WindowAdapter() {
public void windowClosing (WindowEvent e) {
dispose();
System.exit(0);
}
});
}

private String fetchURL (String urlString) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);

try {
URL url = new URL (urlString);

// Popup Window to request username/password password
MyAuthenticator ma = new MyAuthenticator();
String userPassword = ma.getPasswordAuthentication(this, url.getHost());

// Encode String
String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());

// or
// String encoding = Base64Converter.encode (userPassword.getBytes());

// Need to work with URLConnection to set request property
URLConnection uc = url.openConnection();
uc.setRequestProperty ("Authorization", "Basic " + encoding);
InputStream content = (InputStream)uc.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader (content));
String line;
while ((line = in.readLine()) != null) {
pw.println (line);
}
} catch (MalformedURLException e) {
pw.println ("Invalid URL");
} catch (IOException e) {
pw.println ("Error reading URL");
}
return sw.toString();
}


public static void main (String args[]) {
Frame f = new Access();
f.setSize(300, 300);
f.setVisible (true);
}

class MyAuthenticator {
String getPasswordAuthentication(Frame f, String prompt) {
final Dialog jd = new Dialog (f, "Enter password", true);
jd.setLayout (new GridLayout (0, 1));
Label jl = new Label (prompt);
jd.add (jl);
TextField username = new TextField();
username.setBackground (Color.lightGray);
jd.add (username);
TextField password = new TextField();
password.setEchoChar ('*');
password.setBackground (Color.lightGray);
jd.add (password);
Button jb = new Button ("OK");
jd.add (jb);
jb.addActionListener (new ActionListener() {
public void actionPerformed (ActionEvent e) {
jd.dispose();
}
});
jd.pack();
jd.setVisible(true);
return username.getText() + ":" + password.getText();
}
}

}

Thanks!

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed