blackcarlos Dibia

Greenhorn
+ Follow
since Mar 30, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by blackcarlos Dibia

pls I'm trying to read fro a USB metrologic scanner the code I'm using works but it reads the barcode in two parts
here is the code can anyone help I need it to read the barcode at once

import java.io.*;
import java.util.*;
import javax.comm.*;


public class SimpleRead implements Runnable, SerialPortEventListener
{
static CommPortIdentifier portId;
static Enumeration portList;
InputStream inputStream;
SerialPort serialPort;
Thread readThread;

public SimpleRead()
{
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
} catch (PortInUseException e) {}

try {
inputStream = serialPort.getInputStream();
} catch (IOException e) {}

try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) {}

serialPort.notifyOnDataAvailable(true);

try {
serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {}

readThread = new Thread(this);

readThread.start();
}



public static void main(String[] args)
{
boolean portFound = false;
String defaultPort = "COM5";

if (args.length > 0) {
defaultPort = args[0];
}

portList = CommPortIdentifier.getPortIdentifiers();

while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals(defaultPort)) {
System.out.println("Found port: "+defaultPort);
portFound = true;
SimpleRead reader = new SimpleRead();
}
}
}
if (!portFound) {
System.out.println("port " + defaultPort + " not found.");
}

}



/**
* Method declaration
*
*
* @see
*/
public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {}
}

/**
* Method declaration
*
*
* @param event
*
* @see
*/
public void serialEvent(SerialPortEvent event) {
switch (event.getEventType()) {

case SerialPortEvent.BI:

case SerialPortEvent.OE:

case SerialPortEvent.FE:

case SerialPortEvent.PE:

case SerialPortEvent.CD:

case SerialPortEvent.CTS:

case SerialPortEvent.DSR:

case SerialPortEvent.RI:

case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;

case SerialPortEvent.DATA_AVAILABLE:
byte[] readBuffer = new byte[30];

try {
while (inputStream.available() > 0) {
int numBytes = inputStream.read(readBuffer);
}

System.out.print(new String(readBuffer));
} catch (IOException e) {}

break;
}
}

}
13 years ago
pls I have an application that writes an image to disk
the problem is that I'm using IconImage to display this image in a label
and when the app overwrites the previous image the label does not reflect
the change
is there a way to solve this or do I have to use another technique to
display the image
all I want to do is display the current image written to disk
help pls
13 years ago
pls how can I get data from a metrologic barcode scanner into my java application
14 years ago
I am very sorry if I violated any rule I guarantee no intent involved
as to my name that is strange but it happens to be my name
so I hope I am okay!!!
14 years ago
plsis there a class that can help me show pictures from a webcam on my java interface?
the web cam uses a usb port.
14 years ago
thanks a lot
but I have already tried that may be I need to fully illustrate what
I want
I have a number say 236009 then convert to string then to octet and finally
to hexidecimal output
is this possible???
14 years ago
pls what methods can be used to convert a number to binary then to an octet
and finnally to a Hexdecimal
I know of the toBinary()
for the rest help
14 years ago
I am working on an application that would connect to a database and also be able to receive input from peripherals like a webcam and barcode reader/scanner and send all this information to the database
can anyone help
14 years ago
I am working on an application that would connect to a database and also be able to receive input from peripherals like a webcam and barcode reader/scanner and send all this information to the database
can anyone help
14 years ago
pls have installed j2sdk1.4_2 on RedHat Linux in the \root\home directory how do I go about setting classpath and path
to get to compile code
pls help
14 years ago
pls this is my javamail codes
import java.io.*;
import javax.mail.*;
import java.util.Properties;
import javax.mail.internet.*;
import javax.swing.*;
import java.awt.*;

public class MailOption {
public MailOption()throws Exception {
/*Display the menu options*/
System.out.println("Select Option");
System.out.println("1. Enter SEND to send mail");
System.out.println("2. Enter READ to read mail");
System.out.println("3. Enter QUIT to exit");
/*Accept the option selected by the user */
java.io.BufferedReader bro = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String s = bro.readLine();
if("SEND".equals(s)) {
SendMail sm=new SendMail();
}
else if("READ".equals(s)) {
ReadMessage rm=new ReadMessage();
}
else if("QUIT".equals(s)) {
System.exit(0);
}
else {
System.out.println("Wrong option selected");
System.exit(0);
}
}
}
import java.io.*;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.swing.*;
import java.awt.*;

/* Code the JavaMail app to retrieve mails */
class ReadMessage
{
public ReadMessage() throws Exception
{
/* Accept user input for the IP add of the mail server */
System.out.println("Enter the IP address of the mail server ");
BufferedReader hostAdd = new BufferedReader(new InputStreamReader(System.in));
/* Declare variable to store the IP add of the server */
String hostAddress = hostAdd.readLine();

System.out.println("Enter the Username");
BufferedReader uName = new BufferedReader(new InputStreamReader(System.in));
String userName = uName.readLine();

System.out.println("Enter the Password");
BufferedReader uPass = new BufferedReader(new InputStreamReader(System.in));
String userPass = uPass.readLine();

/* Create an instance of the Properties class */
Properties prop = new Properties();
/* Create a mail session */
Session mailSession = Session.getDefaultInstance(prop,null);
/* Create a store object */
Store mailStore = mailSession.getStore("imap");
/* Connect to the mail store on the mail server */
mailStore.connect(hostAddress,userName,userPass);
/* Open the INBOX folder on the mail server */
Folder mailFolder = mailStore.getFolder("INBOX");
mailFolder.open(Folder.READ_ONLY);
BufferedReader mailReader = new BufferedReader(new InputStreamReader(System.in));
/* Declare an array to store the messages in the mail server */
Message msg[] = mailFolder.getMessages();
/* Retrieve mails from the mail server */
for(int i = 0,j = msg.length; i<j ;i++)
{
/* Print the retrieved message */
System.out.println(i + ":" +msg[i].getFrom() [i] + "\t" + msg[i].getSubject());
System.out.println(" Do you wish to read more messages ?[Enter YES to read/QUIT to end]");

String msgLine = mailReader.readLine();
if("YES".equals(msgLine))
{
/* Display the content of the mail message */
System.out.println(msg[i].getContent());
}
else if("QUIT".equals(msgLine))
{
break;
}
}
/* Close the mail folder and mail store objects */
mailFolder.close(false);
mailStore.close();
System.out.println("Do you wish to perform mail-related operations again ?Enter YES to continue, QUIT to exit ");

String msgLine = mailReader.readLine();
if("YES".equals(msgLine))
{
MailOption mailop = new MailOption();
}
else if("QUIT".equals(msgLine))
{
System.exit(0);
}
}
}

import java.io.*;
import javax.mail.*;
import java.util.Properties;
import javax.mail.internet.*;
import javax.swing.*;
import java.awt.*;

class SendMail
{
public SendMail ()throws Exception
{
/* Accept the user input for the IP address of mail server */
System.out.println("Enter the IP address of the mail server");
BufferedReader hAdd = new BufferedReader(new InputStreamReader(System.in));
String hAddress = hAdd.readLine();


/* Accept the user input for the address of mail sender */
System.out.println("Enter the address of the mail sender");
BufferedReader sAdd = new BufferedReader(new InputStreamReader(System.in));
String sAddress = sAdd.readLine();

/* Accept the user input for the address of mail recipient */
System.out.println("Enter the IP address of the mail recipient");
BufferedReader rAdd = new BufferedReader(new InputStreamReader(System.in));
String rAddress = rAdd.readLine();

/* Create an instance of the Properties class */
Properties prop = System.getProperties();
prop.put("mail.smtp.host", hAddress);

/* Create a mail session */
Session mailSession = Session.getDefaultInstance(prop, null);

/* Create a message object */
MimeMessage msg = new MimeMessage(mailSession);

/* Specify the addresses of the mail sender and mail recipient */
msg.setFrom(new InternetAddress(sAddress));
msg.addRecipient(Message.RecipientType.TO,new InternetAddress(rAddress));

/* Set the mail subject */

msg.setSubject("Sending mail");

/*Set the mail content */

msg.setText("Hey McCoy how far?");

/* Send the mail object to the recipient */
Transport.send(msg);
System.out.println("Mail Sent");
System.out.println("Do you wish to continue ? Enter YES to contiue, QUIT to exit");
BufferedReader opt = new BufferedReader(new InputStreamReader(System.in));
String mailopt = opt.readLine();

if("YES".equals(mailopt))
{
MailOption mo = new MailOption();
}
else if("QUIT".equals(mailopt))
{
System.exit(0);
}
}
}

import java.io.*;
import javax.mail.*;
import java.util.Properties;
import javax.mail.internet.*;
import javax.swing.*;
import java.awt.*;


public class UserAuthentication {
public static void main(String [] east) throws Exception {
System.out.println("Please Enter Your User Name");
/* Initialise the reader class to accept user input */
BufferedReader br = new BufferedReader(
new InputStreamReader(System.in));
String s = br.readLine();
if (s.equals("sanchez") || s.equals("carlito") || s.equals("carlos"))
{
MailOption mo = new MailOption();
}
else {
System.out.println("Sorry, user name is not authentic");
System.exit(1);
}
}

}

all codes compile but when I run the UserAuthentication it reaches a point and throws java.net Exception Connection refused:connect
help needed
please I need help with this jdbc call from a network application
I created a server and a GUI client that retrieves a table from the server appliction which connects to MSSql
here are the codes

this is the client application
but when I run the codes everything is okay but I get 5 rows returned by the server and a java.io.NotSerializable Exception :p ublishers
on the command promt with the server application
and no data is shown on the client
pls help

[edited to add code tags]
[ February 18, 2006: Message edited by: Jeanne Boyarsky ]
15 years ago
Pls trying to use JCA resource adapters but how can I create a .RAR file to deploy the connector modules or is there an alternative
need urgent help pls
PLS SOMEONE HELP ME WITH THIS DATASOURCE PROBLEM
I AM, WORKING ON WINDOWS 2003 PLATFORM
AND HABVE FINISHED CONFIGURING THE DATASOURCE
BUT GET UNABLE TO CREATE SOCKECT ERROR
HELP PLS!!!
I have done you said put the JAR files in the sun/appserver/lib directory
also set classpath to point to the jar files but get new error
Unable to create sockect
pls help Makarand!!!
[ September 23, 2005: Message edited by: blackcarlos Dibia ]