|
thanks for replied.
The test.jsp is just for testing purpose. In fact i want to "import" a graph that is created by chartDirector, i dont knw how to display it as a portlet in liferay.
Can anyone show me the example of how to accomplish this?
|
|
|
|
|
Repeating your original question is unlikely to yield a different answer. Try the documentation first and search for other liferay users or forums on the internet. They are much more likely to get you the answer you need.
It's time for a new signature.
|
|
|
|
|
i found a way already.
firstly, build a .war file for the web site.
then in liferay, install the .war, and it is prepared to be drag and drop as a new application.
|
|
|
|
|
Hi,
I am able to extract the text from the PDF file using the PDFStripper, but I would like to read the Table of content of the PDF document. How can I do that? How do I know the Page I am reading is Table of Contents? and also how to differentiate the Chapter heading and the subsection of chapter of the Table of Content?
Any help in this is highly appreciated.
Thanks
Neil
|
|
|
|
|
Do NOT cross post in multiple forums. I makes collaborating on an answer near impossible.
|
|
|
|
|
hi !
I am interfacing microcontoller to my pc and I am looking for a simple java code that will do the following :
1- send a flag char say '^' on serial port and wait for response with a '^' from micro.
2- if response found then go ahead and read the serial buffer (preferably circular )
3- do something here
4- go back to step 1.
I found online code called SimpleRead.java , it does read the incoming data but is acting strange by printing the same data multiple times, putting extra spaces between charaters etc.
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 static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals("COM1")) {
// if (portId.getName().equals("/dev/term/a")) {
SimpleRead reader = new SimpleRead();
}
}
}
}
public SimpleRead() {
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
} catch (PortInUseException e) {System.out.println(e);}
try {
inputStream = serialPort.getInputStream();
} catch (IOException e) {System.out.println(e);}
try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) {System.out.println(e);}
serialPort.notifyOnDataAvailable(true);
try {
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {System.out.println(e);}
readThread = new Thread(this);
readThread.start();
}
public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {System.out.println(e);}
}
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[20];
try {
while (inputStream.available() > 0) {
int numBytes = inputStream.read(readBuffer);
}
System.out.print(new String(readBuffer));
} catch (IOException e) {System.out.println(e);}
break;
}
}
}
|
|
|
|
|
Your code is difficult to read, please place between <pre></pre> tags as referenced in the Forum Guidelines[^].
It's time for a new signature.
|
|
|
|
|
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 static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals("COM1")) {
SimpleRead reader = new SimpleRead();
}
}
}
}
public SimpleRead() {
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
} catch (PortInUseException e) {System.out.println(e);}
try {
inputStream = serialPort.getInputStream();
} catch (IOException e) {System.out.println(e);}
try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) {System.out.println(e);}
serialPort.notifyOnDataAvailable(true);
try {
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {System.out.println(e);}
readThread = new Thread(this);
readThread.start();
}
public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {System.out.println(e);}
}
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[20];
try {
while (inputStream.available() > 0) {
int numBytes = inputStream.read(readBuffer);
}
System.out.print(new String(readBuffer));
} catch (IOException e) {System.out.println(e);}
break;
}
}
}
|
|
|
|
|
Did you notice that it is still not formatted properly? Please edit your original message, don't post a new one, and ensure the indentations are correct. When you have finished your edit use the preview button to check that it is correct.
It's time for a new signature.
|
|
|
|
|
<pre>
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 static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals("COM1")) {
// if (portId.getName().equals("/dev/term/a")) {
SimpleRead reader = new SimpleRead();
}
}
}
}
public SimpleRead() {
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
} catch (PortInUseException e) {System.out.println(e);}
try {
inputStream = serialPort.getInputStream();
} catch (IOException e) {System.out.println(e);}
try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) {System.out.println(e);}
serialPort.notifyOnDataAvailable(true);
try {
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {System.out.println(e);}
readThread = new Thread(this);
readThread.start();
}
public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {System.out.println(e);}
}
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[200];
try {
while (inputStream.available() > 0) {
int numBytes = inputStream.read(readBuffer);
}
System.out.print(new String(readBuffer));
} catch (IOException e) {System.out.println(e);}
break;
}
}
}
</pre>
|
|
|
|
|
Amazing! do you find it impossible to understand what you are asked to do and also to review the results of your efforts.
It's time for a new signature.
|
|
|
|
|
what are you talking about ? I put the code between <pre> and </pre> and its FORMATTED.
please be nice , just being good in tech thing doesnt make you a nice person.
|
|
|
|
|
Firstly I suggested that you edit your original question and not post a new one for each attempt at formatting your code. Secondly if you look at the last post you will notice that the pre tags show up at the top and bottom, so they have been encoded rather than interpreted as HTML; I guess you did a copy and post operation. I will allow that you could be forgiven for thinking that it was correct.
Be that as it may I have looked at your code, and the original article which I think is this one[^] and can see nothing wrong. It may well be that the information you are receiving from the serial connection is not as you expect. I suggest using your debugger to trace the data as it arrives in your application.
For the record when using the <pre></pre> tags your code should look like this:
public class SimpleRead implements Runnable, SerialPortEventListener {
static CommPortIdentifier portId;
static Enumeration portList;
note the colour scheme.
But not like this:
<pre>
public class SimpleRead implements Runnable, SerialPortEventListener {
static CommPortIdentifier portId;
static Enumeration portList;
</pre>
It's time for a new signature.
|
|
|
|
|
Thanks for your suggestion Richard I will try to debug !
|
|
|
|
|
Maybe this thread belongs in the Design forum?
|
|
|
|
|
If I commented "Straight through to the keeper", would you get the reference?
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I'd probably call upon the referee.
|
|
|
|
|
please dont waste my time and the forum bandwidth , i am here to learn and do not want to indulge in childish behavour. If you have anything valuable to contribute to my question please respond otherwise do not reply.
|
|
|
|
|
aliyesami wrote: please dont waste my time and the forum bandwidth
If you wish to be a member of this forum then you have to accept its rules. Anyone is allowed play, any time; and sometimes they also have to accept the consequences.
It's time for a new signature.
|
|
|
|
|
We're thinking about switching technology for our future projects going from c++ to java or c#. So naturally there's a big discussion going on right now what to choose. The problem is that none of us has industry experience with emf or rcp, which would be quite nice to have if it fits our needs.
so i wanted to ask you what you would prefer. our program is:
- gui heavy (lots of dialogs, properties)
- quite big models (serialized xml takes up about 15mb right now)
- application should be integrated into our framework-application-center
- data format (xml and binary) has to be the same as our current format
- graphical editing is needed (creating, moving, connecting shapes + editing their properties)
- lots of similar but tiny different objects in data model
and the actual questions are:
- is there an equivalent to emf in c#?
- is there an equivalent to rcp in c#? (e.g. commands to edit data model, gui frontend, ...)
- is the gui editing in rcp as good and flexible as with windows forms or wpf?
- how rigid/flexible is emf?
- we've got lot's of interdependencies between data models (some control others or allow different options on them) - how would you model these?
- what of the options would you choose?
thanks very much for any advice or opinions
manni
|
|
|
|
|
I never worked with C# but I've worked with RCP and GMF.
If your application consists of views and documents (so, similar to what Eclipse does), then RCP is a very good choice. There's a lot of features built-in and once you know the framework you can do a lot quite fast. Of course, you'll need some time to learn the framework but it's not that difficult.
Now for the GMF part: you are talking about EMF but I guess you means GMF ? EMF is focused on generating code for a model, it doesn't support graphical editing. On top of that, you have GMF that allows you to create a graphical editor on top of EMF. GMF is a very powerfull technology too, and I honnestly don't think you will be able to find something that let's you create a graphical editor so easily. On the other hand, it is rather complex to learn and there's almost no advanced tutorials on the web (you'll need to buy a book). Once you now a bit GMF, creating a simple editor with all the features (drag and drop, connectors, editing properties, ...) can be done in something like one day. But, once you want to do something a bit more specific you'll have to dig and search to find a solution. Unfortunately, the GMF forum is not very alive (a lot of people asking questions but not a lot of answers).
For the flexibility of GMF, it really depends on what you mean. GMF in itself is very flexible concerning the editor part: you can provide your own custom figures for the nodes, you can specify how they interract together, you can even edit the generated code to adapt it to your needs, ... But, as far as I know, you cannot specify your own saving format: gmf saves the data for you (in one file, model + editor data or in two spearate files).
I can't really help more because I can't make a comparison with C# but if you have specific questions about RCP or GMF, I can try to answer them (try to make them as concrete as possible then).
|
|
|
|
|
hi i have successfully done the backup process of mysql in java but when it came to restore i failed after trying for three hrs. and i desperately need it i dont know what i am doing wrong in my code , currently my IDE is netbeans
String ip="localhost";
String port="3306";
String database="dbname";
String user="user";
String pass="pass";
String path;
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.showSaveDialog(null);
path = chooser.getSelectedFile().getAbsolutePath();
System.out.println(path);
String dumpCommand ="mysql" + " -h" + ip +" -port"+ port + " -u" + user +" -p" + pass+" "+ database +" <"+path;
Runtime rt = Runtime.getRuntime();
File test=new File(path);
PrintStream ps;
try{
Process child = rt.exec(dumpCommand);
ps=new PrintStream(test);
InputStream in = child.getInputStream();
int ch;
while ((ch = in.read()) != -1) {
ps.write(ch);
System.out.write(ch);
}
JOptionPane.showMessageDialog (null,"BackUP Successfully Completed");
InputStream err = child.getErrorStream();
while ((ch = err.read()) != -1) {
System.out.write(ch);
}
}catch(Exception exc) {
exc.printStackTrace();
}
it always shows some sql help commands in system.out and the command "<" is surely not accessing in java code instead by using it , it gives the output as unknown command \b (start of backupfile name as c:\backup.sql)
|
|
|
|
|
how can one have application include its database in the jar file?
|
|
|
|
|
I'm not sure what you mean by that. Do you mean that you want the database code included (i.e. the JDBC driver or whatever)? Or do you mean that you want the application to create its own database when it starts up? Or do you mean that you have some data that you want to deliver in the jar file with the application?
|
|
|
|
|
Hello Friends
I created a jar applet with java update 20. but when I update java to update21 then its not working in browser.
I dont want to build my application with newer version every time and this is not a good practice even.
Any Ideas??
Thanks & Regards
Yogesh
|
|
|
|