|
|
How does that convert PDF to Excel?
|
|
|
|
|
Hi colleague developers,
I've got a problem in communicating with serial port. In my applcation I have to receive some data from the serial port and to manage them for some operation. For now I'm just trying to write out the data received.
I've create a test class with main() that manage the connection (open the port, set the parameters) and starts a thread. The thread is started in this manner:
try {
(new Thread(new Lettore(port), "Lettore")).start();
} catch (Exception e) {
System.err.println("Errore " + e);
}
where the "port"parameter is the SerialPort object.
The "Lettore" class contains the follow:
SerialPort port;
public Lettore(SerialPort port) throws IOException {
this.port = port;
}
@Override
public void run() {
byte[] buffer = new byte[1024];
int len = -1;
try {
while (true) {
len = port.getInputStream().read(buffer);
System.out.print(new String(buffer, 0, len));
if (len != 0) {
port.getOutputStream().write(buffer, 0, len);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
In this case, the code in the thread seems to be never executed: no characters are show on the terminal and on the other station of the communication. On the other hand, if I write the same code of the run() function in the main, it works fine.
Someone has ever got this problem? Can anyone help me?
modified 27-May-14 3:57am.
|
|
|
|
|
|
Dear Richard,
thanks for the reply. I made the thread runnable by "implements Runnable" on the "Lettore" class definition, now it works. Thank you very much!
The final code is this:
public class Lettore implements Runnable {
SerialPort port;
public Lettore(SerialPort port) throws IOException {
this.port = port;
}
@Override
public void run() {
byte[] buffer = new byte[1024];
int len = -1;
try {
while (true) {
len = port.getInputStream().read(buffer);
System.out.print(new String(buffer, 0, len));
if (len != 0) {
port.getOutputStream().write(buffer, 0, len);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
|
|
|
|
Hi guys, i wrote a desktop programm, that can send sms using a modem via seriaport...on netbeans i run my programm all is ok...i receive my sms on my phone!!...but once a creat an .exe, then i get error reported, i don't understand why...i don't know what to do, i've created my .exe using excelsior jet, and comm.jar for reading serial port....on netbeans i can easely clean and build my project , but once the .exe done i ain't get nothing ...please help!!..
|
|
|
|
|
mtouxx wrote: please help With what? We know nothing about your program except that it does not work. Why not try running it as a proper Java class so you can use the debugger to find out what the problem is?
|
|
|
|
|
|
I want to know, to what extend a XML file can store data???
Means the string limitations, data types and so on.....
-Toywarrior
modified 21-Nov-20 21:01pm.
|
|
|
|
|
Limitations are based on users of the xml not the xml itself.
1. Java can't have a string greater than Integer.MAX (or whatever it is called.)
2. A file can't be bigger than the file system.
3. Java can't occupy more than the allowed user addressable space.
For the second of the above if you are close to those limits than it is unlikely that an XML file is an optimal choice for data storage.
|
|
|
|
|
Message Closed
modified 21-Nov-20 21:01pm.
|
|
|
|
|
Shrikshel wrote: can I actually store images(any medai) in XML file You could, but that is not what XML was designed for. Images are better stored as files, or BLOBs in a database.
|
|
|
|
|
OK. Thanks.
-Toywarrior
modified 21-Nov-20 21:01pm.
|
|
|
|
|
Shrikshel wrote: So, can I actually store images(any medai) in XML file
Can you - yes.
Should you - I seriously doubt it.
Without knowing any thing about what you are doing and presuming you don't want to use a database then if it was me I would use files for each image and perhaps keep meta data in the xml file (such as a pointer to the file path on the file system.) Keeping in mind however that doing that is basically the same as creating a database.
|
|
|
|
|
Hi,
i've a web application which has mysql quesry browser as backened,in database i've stored image data using longblob as datatype with the help of inputsteam.
the application is for peproposal kind of stuff where user get list of question, on selection of question will get answer consist of images that diplayed on one msword .
Now every thing is getting fine but list of answer from database not able to be printed on msword one after another instead last answer get only displayed below is code snipet so please provide any solution .
Thanks in advance,
public Object mapRow(ResultSet rs, int arg1)
throws SQLException {
for(int k=0;k<answers.length;k++){
DomainForm d = new DomainForm();
d.setAnswer(rs.getBinaryStream("Answer"));
InputStream s = (InputStream)d.getAnswer();
System.out.println("This is S values:"+s);
answers[k]= s;
}
return null;
}
});
}
try {
Vector v=new Vector();
for(InputStream is : answers){
v.add(is);
System.out.println("ele"+is);
}
System.out.println("elements"+v.elements());
Enumeration e=v.elements();
SequenceInputStream sis = new SequenceInputStream(e);
byte[] buffer1 = new byte[1024];
int size1 = 0;
response.setContentType("application/msword");
while ((size1 = sis.read(buffer1)) > 0) {
response.getOutputStream().write(buffer1, 0, size1);
}
response.getOutputStream().flush();
sis.close();
} catch (IOException e) {
e.printStackTrace();
}
return ans;
}
|
|
|
|
|
How can i develop an application on a phone without an internet. The banks used it here in South Africa (FNB). Please guide me.
Jimoh H.A
|
|
|
|
|
You don't seriously expect anyone to be able to answer such a wide ranging question in a technical forum? For a start we have no idea what type of phone you are planning to develop for, or what system you hope to connect to, all of which will affect what you need to do. Start by doing some research into the phone system that you want to use, and the possible interfaces available to the bank(s) you wish to work with.
|
|
|
|
|
|
|
I doubt that anyone here is going to provide such a tutorial. Go back to the Jasa site and use the links under Contacts and Support.
|
|
|
|
|
Hello,
Please have a look at readme.md[^] file available with JASA source code.
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
suppose string is "mam is going"..so now finding each character occurances.....
|
|
|
|
|
Here is the function where your get the occurrence of each character in any string with O(n) times.
public static void main(String args[]){
String str="mam is going";
HashMap<String, Integer> freqOfChar=calculateCharFrequency(str!=null?str.trim():"");
printFreeOfChar(freqOfChar);
}
static HashMap<String, Integer> calculateCharFrequency(String str){
HashMap<String, Integer> freqOfChar = new HashMap<String, Integer>();
String ch;
if(str!=null){
for(int i=0;i<str.length();i++){
ch=Character.toString(str.charAt(i)).trim();
if(ch.length()>0){
if(freqOfChar.get(ch)!=null){
freqOfChar.put(ch, (freqOfChar.get(ch)+1));
}else{
freqOfChar.put(ch, 1);
}
}
}
}
return freqOfChar;
}
static void printFreeOfChar(HashMap<String, Integer> freqOfChar){
for (String key : freqOfChar.keySet()) {
System.out.println("Char: "+key+ "; Occurance: "+freqOfChar.get(key));
}
}
output:
Char: o; Occurance: 1
Char: i; Occurance: 2
Char: m; Occurance: 2
Char: a; Occurance: 1
Char: n; Occurance: 1
Char: g; Occurance: 2
Char: s; Occurance: 1
|
|
|
|
|
Why do you do his homework?
Does he pay you?
Does he learn anything?
regards Torsten
I never finish anyth...
|
|
|
|
|
Please let me now how can I set value and text to compbobox
so that I can attach empid and empname both to single combobox, where I want display to empname and on selection I want to fetch other details of emp on empid where empid is FKEY in details datatable.
It is possible in VB by setting value and text, how it possible Java pls anybody have idea pls help me
|
|
|
|