| java script problems XP dpreview and other sites |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- A Pixel Matching Problemthis problem is like a miniature OCR problem.
Let's say you have some images that contain text, or screen snapshots
obtained by the Robot class. How can you extract the text from them?
You have the advantage that you probably have access to the fonts used
to create the text.
How might you go about creating an OCR for images? I was thinking of
writing this up as a student project.
The advantage you have over true OCR is all matches will be exact.
The complications are a variety of colours for foreground/background,
antialiasing and painting over muticoloured backgrounds. For JPGs you
may not have the fonts used. The edges of the text may be tweaked in
various ways, e.g. 3D, blurred, warped.
I thought you might proceed like this:
1. find rectangular regions containing only two colours.
2. draw an e in 10 font sizes for each font as your search templates.
3. look for a hole the right shape. When you find one, check all the
e's you have with that size/shape hole to see if you have a match on
the entire letter, check the whole rectangle.
4. if you have a match, calculate the baseline and starting point. now
draw a template ea in that same font and compare. If it fails try eb
etc. Work your way both left and right pulling that line.
You might construct a hashMap indexed by a digest of the glyph so you
can more rapidly check for matches. Your digest algorithm might trim
the glyph top/bottom/left/right so you don't need the stringWidth
information by actually drawing the character pair.
5. You carve the rectangle out of the bigger one, and break the
remaining into rectangles.
6. repeat until there are no more rectangles.
7. export the text each labelled with x.y where it was found.
8. In another program allow the user to highlight text, e.g. a column
or box to determine the linear order of the text desired.
Potential uses for such software include:
1. capturing filenames, error messages, crash locations that were
displayed in a non-cut/pasteable way.
2. by people trying to defeat my email munger. See
http://mindprod.com/applets/masker.html
3. by blind people extracting textual information from images.
4. To allow you to copy from any Swing Component.
5. to extract information from a screen snapshot without having to
retype it.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
- 5
- 5
- record numbersMaybe my question is stupid and wrong but I hope that you will understand.
So, image that you need to create web application which will used by many
peoples in one LAN. They processing some documents and every person has the
particular number of documents in particular order (1. person has documents
from 1 to 100, second from 101 to 200 etc), which process with the
particular number (first document -> number 1 in a database). If they all
work in a same time, what is the easiest and the most safety way to manage
that? Adding number manually is the logical solution but if 2 person put the
same number, can they freeze the database or databases are imune on that ?
- 9
- GridBag Layout queriesIt might appear long, but I think the answers will be of
just a few words describing the correct command/syntax.
After the Jbutton part has run successfully, the following
difficulties are coming in the next step.
- Individual buttons are not coming as same width. Whichever
button has more text or wider letters is coming wider, and
others are coming less wider.
- though left edge of a column of button is duly aligned,
the right edge is becoming zigzag due to the above.
- width of the largest button in a column is deciding the
width of the the entire column.
how to force all button to be of same width? If all buttons
in a column are of same width, the above are automatically
solved.
I am also finding that the three characters I have to
display are appearing in the centre, and there is huge space
left at the left and right of my text in the button.
Because of this, I have to unncessary keep my window wide so
that characters remain visible, otherwise several characters
are not becoming visible.
When I put setmargin I got this compile error.
setMargin(java.awt.Insets) in javax.swing.AbstractButton
cannot be applied to (int,int,int,int)
button[gridY1][gridX1].setMargin(0,0,0,0);
The best method would have been if we could have just given
a single width for all buttons, and it would have compressed
whatever text within that width.
- Even after giving gridwidth as 2 or 3, though the button
is reserving the width of those many columns, its width is
still that of a single button. the area next to it is coming
blank.
how to make it wider to fill the columns it is covering.
- Even after giving gridheight as 2, though the button is
reserving the height of those many rows, its height is still
of a single button. the area below it is coming blank.
how to make it taller to fill the rows it is covering.
ipadx or ipadx are not working. while trying to use
gridBagL.setConstraints(button, gridBagC);
it is giving error
setConstraints(java.awt.Component,java.awt.GridBagConstraints)
in java.awt.GridBagLayout cannot be applied to
(javax.swing.JButton[][],java.awt.GridBagConstraints)
what is the default height and width of a button?
in place of using an icon in setrolloverenabled(), can we
have some way to make it display whatever text is there in
the button, in a larger font size?
to set the horizontal alignment, if I am giving
button[gridY1][gridX1].setHorizontalAlignment(0);
it is still appearing at the centre. what are the options
for (int) are not shown in the tutorial.
Thanks.
-Rawat
- 10
- Fax QuestionHas anyone used 'RFax 1.0 - Java [TM] fax component' from
http://www.java4less.com/java_fax.htm?
Good or bad (other comments)?
thanks!
- 10
- Java Technology Concept MapThe Java Technology Concept Map 1.0 is an interactive diagram,
a web of linked terms, to show the relationships among and uses
of the Java technologies. You can use the Map to get an overview
of the Java landscape as well as learn more about the details of
its components.
Launch the Map here:
http://java.sun.com/developer/onlineTraining/new2java/javamap/intro.html?ssobm=ng
- 11
- Array List IssueI have been having this unique issue with Array List I am trying add
say about 10 Objects in an Array List and conevr that to an Array.
Later when I parse through the Array i am having an Array of length 10
however i am only having the same element for all the 10 of them. can
anyone out there throw some light onto what i am doing wrong here here
is the peice of Code I am using
Course course = null;
for(int i=0;i<10;i++){
course = new Course();
course.setCourseName( "Course ".concat(Integer.toString(i)));
aList.add(course);
System.out.println(course.getCourseName());
}
Course[] courses = (Course[]) aList.toArray(new Course[0]);
Thanks
Sri
- 11
- Thunerbird help... [not java related , but please help if you can!]Hi all...
I know this is not a java question, but after seeking help on the
Thunderbird newsgroup, I was not able to get an answer to my question.
So since i know there are a lot of smart people in this group, I thought
of asking here.
here is the link to my question on the Thunderbird forum, please read,
and offer your insight!
http://forums.mozillazine.org/viewtopic.php?t=334466
many thanks
- 15
- Swing Threading issue?Hi,
My UI hangs whenever I m trying do something without threading. I'm
quite amatuer with threads and need help please.
How can i make my UI thread safe?
THANKS!
/**
*
* @author Ho Wai Kit
*/
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
public class Stratego extends JFrame implements ActionListener{
private static final int ROWS = 5;
private static final int COLUMNS = 5;
private final Card[][] cards = new Card[ROWS][COLUMNS];
private JPanel centerPnl, boardPnl, rightPnl;
private Client clientGame=null;
private Server serverGame=null;
private AIGame aiGame=null;
private Socket con;
boolean isStarted, isConnected, isClient, isServer;
private Card inHand, target;
private String otherHostname = "";
private JLabel statusLbl;
private JMenuItem menuItemNewGame;
private JMenuItem menuItemLoadFile;
private JMenuItem menuItemSave;
private JMenuItem menuItemSaveAs;
private JMenuItem menuItemConnect;
private JMenuItem menuItemCloseConnection;
private ConnectionManager conMan;
private GameLogic gl;
private Protocol protocol;
DataOutputStream output;
DataInputStream input;
private char[] pieces = {Card.FLAG, Card.BOMB, Card.BOMB,
Card.MARSHAL, Card.MINER, Card.CAPTAIN, Card.GENERAL, Card.CAPTAIN,
Card.GENERAL, Card.SPY};
/** Creates a new instance of Stratego */
public Stratego(){
super("Stratego");
initCenterPnl();
conMan = new ConnectionManager();
//menu bar
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu gameMenu = new JMenu("File");
JMenu settingsMenu = new JMenu("Network");
menuBar.add(gameMenu);
menuBar.add(settingsMenu);
menuItemNewGame = new JMenuItem("New game");
menuItemNewGame.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
playAIGame();
}
});
gameMenu.add(menuItemNewGame);
menuItemLoadFile = new JMenuItem("Load file...");
menuItemLoadFile.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
//if (isFileChanged())
// askForSaving();
JFileChooser fileChooser = new JFileChooser();
//fileChooser.setCurrentDirectory(new
java.io.File(fileChooserDir));
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.resetChoosableFileFilters();
//fileChooser.addChoosableFileFilter(new
PGNFileFilter());
int choice = fileChooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
//loadFile(fileChooser.getSelectedFile());
//fileName =
fileChooser.getSelectedFile().getName();
//setTitle(TITLE + " - " + fileName);
//fileIsChanged = false;
}
}
});
gameMenu.add(menuItemLoadFile);
menuItemSave = new JMenuItem("Save");
menuItemSave.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
//if (fileName != null && fileName.length() > 0) {
// save(fileName, false);
//} else {
// saveAs();
// }
}
});
gameMenu.add(menuItemSave);
menuItemSaveAs = new JMenuItem("Save as...");
menuItemSaveAs.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
// saveAs();
}
});
gameMenu.add(menuItemSaveAs);
gameMenu.addSeparator();
JMenuItem item2 = new JMenuItem("Exit");
item2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
if (clientGame!=null||serverGame!=null) {
int choice =
JOptionPane.showConfirmDialog(null, "Are you
sure?", "Close connection?", JOptionPane.YES_NO_OPTION);
if (choice == JOptionPane.YES_OPTION) {
closeConnections();
} else
return;
}
System.exit(0);
}
});
gameMenu.add(item2);
JMenuItem serverSettingsItem = new JMenuItem("Host Game");
serverSettingsItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
playGameAsHost();
}
});
settingsMenu.add(serverSettingsItem);
menuItemConnect = new JMenuItem("Join Game");
menuItemConnect.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
String input = JOptionPane.showInputDialog(null,
"Connect to IP : ");
if(input.trim().equals("")||input==null){
JOptionPane.showMessageDialog(null, "No IP
specified", "Error", JOptionPane.ERROR_MESSAGE);
}else{
playGameAsClient(input);
}
}
});
settingsMenu.add(menuItemConnect);
menuItemCloseConnection = new JMenuItem("Close connection");
menuItemCloseConnection.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
int choice =
JOptionPane.showConfirmDialog(
null,
"Are you sure?",
"Close connection?",
JOptionPane.YES_NO_OPTION);
if (choice == JOptionPane.YES_OPTION) {
//boardConnector.closeConnection();
//connectionClosed();
}
}
});
settingsMenu.add(menuItemCloseConnection);
menuItemCloseConnection.setEnabled(false);
//end of menu
Container c = getContentPane();
c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));
c.add(centerPnl, BorderLayout.CENTER);
}
public void initCenterPnl(){
centerPnl = new JPanel();
centerPnl.setLayout(new BoxLayout(centerPnl,
BoxLayout.X_AXIS));
boardPnl = new JPanel();
fillBoard();
boardPnl.setSize(450, 450);
boardPnl.setMinimumSize(new Dimension(450, 450));
boardPnl.setMaximumSize(new Dimension(450, 450));
initRightPnl();
centerPnl.add(boardPnl);
centerPnl.add(rightPnl);
}
public void initRightPnl(){
rightPnl = new JPanel();
statusLbl = new JLabel();
rightPnl.setBorder(BorderFactory.createTitledBorder("Game
Status"));
//rightPnl.setSize(100, 450);
rightPnl.add(statusLbl);
rightPnl.setMinimumSize(new Dimension(250, 450));
rightPnl.setMaximumSize(new Dimension(250, 450));
}
public void fillBoard(){
boardPnl.setLayout(new GridLayout(ROWS, COLUMNS, 1, 1));
boardPnl.setBorder(BorderFactory.createTitledBorder("Board"));
for(int i = 0; i < ROWS; i++)
{
for(int j = 0; j < COLUMNS; j++)
{
cards[i][j] = new Card(Card.GRASS, i, j);
cards[i][j].addActionListener(this);
cards[i][j].setXCoordinate(i);
cards[i][j].setYCoordinate(j);
boardPnl.add(cards[i][j]);
}
}
//initialise water
cards[2][2].setCardType(Card.WATER);
cards[2][2].drawImage(Card.WATER);
}
public void closeConnections(){
if(isServer&&isConnected){
conMan.allDone = true;
isServer = false;
}else if(isClient&&isConnected){
isServer = false;
}
try{
con.close();
}catch(Exception e){
e.printStackTrace();
}
isConnected = false;
}
public void playAIGame(){
newGameBoard();
aiGame = new AIGame(cards, this);
System.out.println("AI game started");
isStarted = true;
placeCards(cards, Card.RED_PLAYER);
}
public void playGameAsHost(){
try {
JDialog notify = new JDialog();
conMan.start();
JLabel notifyLbl = new JLabel("Listening for connection...
...\n", 0);
notify.setTitle("Server IP : "
+InetAddress.getLocalHost().getHostAddress());
notify.getContentPane().setLayout(new FlowLayout());
notify.getContentPane().add(notifyLbl);
notify.setLocation (400, 300);
notify.setSize (250, 90);
notify.setVisible(true);
//ServerSocket server = new
ServerSocket(ConnectionManager.PORT_NO,
ConnectionManager.MAX_CONNECTIONS);
while(true){
con = conMan.getConnection();
//con = server.accept();
if(con!=null){
notify.dispose();
break;
}
}
isServer = true;
isConnected = true;
//serverGame = new Server(this, con);
System.out.println("Hosting Game");
isStarted = true;
placeCards(cards, Card.RED_PLAYER);
//repaint();
protocol = new Protocol(con, this);
input = new DataInputStream(con.getInputStream());
output = new DataOutputStream(con.getOutputStream());
InputReader inReader = new InputReader(input, protocol);
inReader.start();
//gl = new GameLogic(this, protocol);
sendMessage("server cone");
//readInput();
}catch(Exception e){
e.printStackTrace();
}
}
public void playGameAsClient(String ip){
try{
con = new Socket(InetAddress.getByName(ip),
ConnectionManager.PORT_NO);
if(con.isConnected()){
isConnected = true;
isClient = true;
System.out.println("Joining game");
isStarted = true;
placeCards(cards, Card.BLUE_PLAYER);
//repaint();
//clientGame = new Client(this, con);
protocol = new Protocol(con, this);
//gl = new GameLogic(this, protocol);
input = new DataInputStream(con.getInputStream());
output = new DataOutputStream(con.getOutputStream());
//usage of thread to read data (works)
InputReader inReader = new InputReader(input,
protocol);
inReader.start();
//end
sendMessage(Protocol.ATTACK_NOTIFICATION);
//without implementing a thread(does not work)
//readInput();
}else{
JOptionPane.showMessageDialog(null, "Connection cannot
be established.\nServer might not be active.", "Error",
JOptionPane.ERROR_MESSAGE);
}
}catch(Exception e){
e.printStackTrace();
}
}
//place the cards automatically(testing)
public void placeCards(Card[][] cards, String playerColor){
int k=0;
for(int i = 3; i < 5; i++){
for(int j = 0; j < COLUMNS; j++){
cards[i][j].setExposed(false);
cards[i][j].setOwn(true);
cards[i][j].setCardType(pieces[k]);
cards[i][j].setPlayerColor(playerColor);
cards[i][j].drawImage(pieces[k], playerColor, true,
false);
k++;
}
}
}
public void wonGame(){
if(aiGame!=null){
aiGame.killAI();
aiGame=null;
}
//clientGame=null;
//serverGame=null;
}
private void lostGame(){
}
public void newGameBoard(){
for(int i = 0; i < ROWS; i++){
for(int j = 0; j < COLUMNS; j++){
emptyField(cards[i][j], cards);
}
}
cards[2][2].setCardType(Card.WATER);
cards[2][2].drawImage(Card.WATER);
}
public void emptyField(Card inHand, Card[][] cards){
int x = inHand.getXCoordinate();
int y = inHand.getYCoordinate();
cards[x][y].setCardType(Card.GRASS);
cards[x][y].setExposed(false);
cards[x][y].setOwn(false);
cards[x][y].drawImage(Card.GRASS);
cards[x][y].setSelected(false);
cards[x][y].setPlayerColor(Card.NULL_PLAYER);
}
public void sendMessageToLbl(String msg){
statusLbl.setText(msg);
}
public void actionPerformed(ActionEvent e){
Card card = null;
if(isStarted){
card = (Card)e.getSource();
if(aiGame!=null){
if(card.getCardType()!=Card.WATER){
if((inHand==null||inHand==card)&&card.isOwn()){
if(card.getCardType()!=Card.BOMB&&card.getCardType()!=Card.FLAG){
inHand = aiGame.selectCard(card, cards);
}
}else{
target=card;
if(aiGame.move(inHand, target, cards)){
inHand=null;
target=null;
}
}
}
}else if(isConnected){
if(card.getCardType()!=Card.WATER){
if((inHand==null||inHand==card)&&card.isOwn()){
if(card.getCardType()!=Card.BOMB&&card.getCardType()!=Card.FLAG){
inHand = gl.selectCard(card, cards);
}
}else{
target=card;
if(gl.move(inHand, target, cards,
Card.BLUE_PLAYER)){
inHand=null;
target=null;
}else{
JOptionPane.showMessageDialog(null, "You cannot
move back and forth between two tiles for three consecutive
turns!\nPlease try again.", "Invalid move", JOptionPane.ERROR_MESSAGE);
}
}
}
}
}
repaint();
}
public void paint(Graphics g){
super.paint(g);
}
public static void main(String args[]) {
JFrame.setDefaultLookAndFeelDecorated(true);
Stratego t = new Stratego();
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception e){
}
t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
t.setSize(600, 500);
//t.setResizable(false);
t.setVisible(true);
}
public void sendMessage(String msg){
try{
output.writeUTF(msg);
output.flush();
}catch(Exception e){
e.printStackTrace();
}
}
public void readInput(){
while(true){
String msg="";
try{
msg = input.readUTF();
}catch(Exception e){
}
if(msg!=null&&!msg.equals("")){
System.out.println(msg);
protocol.handleInput(msg);
msg="";
}
}
}
}
- 15
- HTTP creepIf you look at the packet headers going back and forth to your HTTP
server, you will discover a HECK of a lot of blather that really is
not doing much.
It is made worse by it all being human readable without abbreviations.
Add this overhead up on all packet headers being transferred each day
and you see a stupendous waste of bandwidth.
HTTP should be put on a diet, with rigid defaults, bitfield headers,
and compressed messages.
The original protocol was designed for maximum flexibility. Now we
have some experience, we can tighten it up.
It matters now that you have tiny handhelds trying to surf the net
over limited bandwidth.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
- 15
- Java Printing API and Tobit FaxWareThis example for the Java Printing API
http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html#printable
creates different output in Suns JRE 1.4 and 1.5 (tested with Windows
2000). This can be easily checked using the 'print to file' option.
The different behaviour of the new 1.5 JRE is causing problems with the
Tobit FaxWare printer driver.
Tobit FaxWare detects special command strings in the document, which
start with @@, followed by a command name and optionally a space
character ($20, #32) and a character, finally @@ again. For example, the
receiver fax number is encoded as @@NUMMER +4996421@@. If a document is
printed on the FaxWare printer driver using JRE 1.4, the document will
be sent as a Fax to this number.
In JRE 1.5 however, the printer output contains the character $a0 (#160)
instead of space, this is causing an error message in Tobit FaxWare.
I would like to find the reason for this change but could not find
information in the JRE 1.5 releasenotes
(http://java.sun.com/j2se/1.5.0/compatibility.html#incompatibilities),
is there another place where i could find informations about the
background of this change?
Many thanks in advance,
Michael
- 15
- socket & JVMThis is a multi-part message in MIME format.
Hi i'm trying to create a some sort of JAVA print server:
I've a machine that accept (throught a socket) some spool file........
Here's the JAVA code:
ServerSocket TServer;
int i = 0;
try{
TServer = new ServerSocket(TPort);
while( true ){
//frame.TModel.addElement("+++ WAITING REQUEST " + i );
Lpd_request request = new Lpd_request(TServer.accept(),frame,PQ,NumQueue);
request.start();
i = i + 1;
}
}
the problem is: every request launch another JVM for handle the print and create a pdf of the the spool data: for some reason if i create a batch that launch 5 spool file one after the other, the print server launch 5 thread, but some thread terminate not correctly.
In particular the exit code are 1-0-1-0-0 so the first fail, the second is executed and so on.....
Can I put a delay between thread execution for solve the problem???
Any suggestion????
--
---------------------------------------------
Mauro Anceschi
IT Department
Global Service Srl
Gruppo Motor Power Company Srl
www.motorpowergroup.com
Tel +39-0522-688189
Fax +39-0522-683552
IMPORTANT: This e-mail message is intended only for the named recipient(s) above and may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this e-mail message.
--------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Hi i'm trying to create a some sort of JAVA print
server:</FONT></DIV>
<DIV><FONT face=Arial size=2>I've a machine that accept (throught a socket) some
spool file........</FONT></DIV>
<DIV><FONT face=Arial size=2>Here's the JAVA code:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>
<P><FONT face=Arial size=2>ServerSocket TServer;</FONT></P>
<P><FONT face=Arial size=2>int i = 0;</FONT></P>
<P><FONT face=Arial size=2>try</FONT><FONT face=Arial size=2>{</FONT></P>
<P><FONT face=Arial size=2> TServer = new
ServerSocket(TPort);</FONT></P>
<P><FONT face=Arial size=2> while( true )</FONT><FONT
face=Arial size=2>{</FONT></P>
<P><FONT face=Arial size=2>
//frame.TModel.addElement("+++ WAITING REQUEST " + i );</FONT></P>
<P><FONT face=Arial size=2> Lpd_request
request = new Lpd_request(TServer.accept(),frame,PQ,NumQueue);</FONT></P>
<P><FONT face=Arial size=2>
request.start();</FONT></P>
<P><FONT face=Arial size=2> i = i +
1;</FONT></P>
<P><FONT face=Arial size=2> }</FONT></P>
<P><FONT face=Arial size=2>}</FONT></P></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>the problem is: every request launch another JVM
for handle the print and create a pdf of the the spool data: for some reason if
i create a batch that launch 5 spool file one after the
other, the print server launch 5 thread, but some thread
terminate not correctly.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>In particular the exit code are 1-0-1-0-0 so the
first fail, the second is executed and so on.....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can I put a delay between thread execution for
solve the problem???</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any suggestion????</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><BR><FONT
face=Arial size=2>--
<BR>---------------------------------------------<BR> <BR>Mauro
Anceschi<BR>IT Department<BR> <BR>Global Service Srl<BR>Gruppo Motor Power
Company Srl<BR></FONT><A href="http://www.motorpowergroup.com"><FONT face=Arial
size=2>www.motorpowergroup.com</FONT></A><BR><FONT face=Arial size=2>Tel
+39-0522-688189<BR>Fax +39-0522-683552<BR> <BR> <BR>IMPORTANT: This
e-mail message is intended only for the named recipient(s) above and may contain
information that is privileged, confidential and/or exempt from disclosure under
applicable law. If you have received this message in error, or are not the named
recipient(s), please immediately notify the sender and delete this e-mail
message.<BR> --------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>
- 16
- "cannot find CactusTask" errorHello:
I am attempting to use the <cactifywar> and <cactus > tasks in an Ant
build file. I have set up <taskdef> element to point to all the
necessary jar files, including cactus-ant-1.6.1.jar as below:
<taskdef resource="cactus.tasks">
<path>
<pathelement location="${lib}/cactus-ant-1.6.1.jar"/>
and so on and so on.
</path>
</taskdef>
The CactusTask class is inside cactus-ant-1.6.1.jar but upon execution
I received the following error:
"cannot find org.apache.cactus.integration.ant.CactusTask"
Well, Ant must have found "cactus.tasks" inside cactus-ant-1.6.1.jar
or else it wouldn't have known the classname in the error message!
Now . . . junit.jar is also on my classpath. Is there a difference
between the junit.jar that comes with Cactus and the jar named
ant-junit.jar that comes with Ant? I put both in my classpath but to
no avail.
Help!
Eric Hamacher
email***@***.com
Madison, Wisconsin
- 16
- Going to NMU jikes (C++ ABI update)
I'm notice on <URL:http://people.debian.org/~mfurr/gxx/rebuild.html>
that jikes need a rebuild due to the new C++ ABI. I asked on
#debian-java if anyone is working on that, but got no reply. It is a
build-dependency on 119 packages, so it is probably a good idea to do
it quickly. I plan to do the NMU myself shortly, so this is just an
warning email.
I only change debian/changelog, adding this entry:
jikes (1:1.22-2.1) unstable; urgency=low
* Non-maintainer upload to get a rebuild with the new C++ ABI.
-- Petter Reinholdtsen <email***@***.com> Fri, 22 Jul 2005 01:08:42 +0200
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 16
- Eclipse jboss toolsHi,
has been any efforts to ports jboss tools plugin for Eclipse?
It contains some parts written in C (i think having to do with GUI editors).
Using eclipse-devel 3.3.2 and jboss tools 2.1.1 (previously known as JBossIDE and
now commercially named as "Jboss developer studio).
Installing the jboss tools plugins from within eclipse, asis, results in a highly unstable eclipse
environment.
Any ideas?
--
Achilleas Mantzios
|
| Author |
Message |
Albert Voss

|
Posted: 2004-1-2 6:07:00 |
Top |
java-programmer, java script problems XP dpreview and other sites
Mainly on the popular digital photo site dpreview.com but
unfortunately not restricted to this site I sooner or later run into
the problem that the site navigation and posting does not work any
more: Normally a list of available sub items is displayed on the left
side, when positioning the cursor on any a specific pull down pops up.
But every other week or so the site is displayed with an empty
background where the menu normaly is and therefore no further
navigation ist possible. I Opera I get the menus but when I click the
javascript enabled send button for posts nothing happens too.
I am running Windos XP Home with all current updates with Norton
Internet Security 2002 and Norton System Works 2002. Even after a
clean reinstall of all apps with all updates I don't get a stable
system. My only rescue so far is to load a system partion image of a
good status some weeks ago. But as I said, this does not last for
long.
I tried reinstalling Windows Script 5.6, but it did not help.
Albert
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- 360degree rotation in Java2DI have a bit of a problem rotating Shapes using the Graphics2D function
rotate(theta).
My high-school trig lessons indeed tell me that sine and cosine functions go
between -90 degrees and +90 degrees (or 0 and 180, if you like), and I can
see why this means that when I call the rotate(...) function, it will not
rotate the object all the way round the whole 360 degrees.
Currently, I have a duplicate Shape object which is flipped so that for one
half of the rotation the original shape is drawn, and for the second half,
the other...
There must be a better way!
Any ideas?
Cheers :o)
Will
- 2
- [Static Classes]Hi All,
Can someone explain when and why we use 'static classes' in Java ?
Also why 'method local classes' are used and what is their significance
?
Plz reply
- 3
- jdbc commit issueHi,
I'm facing some problems with the JDBC connection commit.
I'm using an Oracle8i client and server.
The jdbc library is classes12.jar
My application uses eclipse3.1 as an IDE and the jdk version is
jdk1.5.0_01
The flow of logic is such that I acquire 2 to 3 connections to my
database repository. On each of these connections some update/insert
statements
are executed (through jdbc PrepareStatement->executeUpdate())
After the update statements I issue a connection.commit() on each of
the connections where update statements are fired.
I have noticed sometimes that although connection.commit has been
issued, my DB does not have any data.
If anyone has any clue to this please let me know.
Thanks for your time.
Arti
- 4
- jdk1.6 - has no applet pluginHello
I cannot find the plugin that, I thought, should
come with jdk1.6.
Have I lost my mind or have they hidden it somewhere?
Thanks for your time.
dkr
- 5
- _scripting engines for java applications_Hi All,
I've written java app with classes that strickly corresponds to user's
business domain. Now I want to add scripting feature to my program to
enable user to create own scenarios of processing objects of those
business classes. Where to start? Is there any scripting languages
implemented in java?
thanks,
Andrey
- 6
- evaluating the computers TCP and UDP socket statesI am looking to be able to read the TCP and UDP socket states of the
computer using Java2.
I want to be able to determine when a certain TCP socket is listening
vs. connected, etc.
Does the java2 API cover this sort of ability?
thanks,
Dave Haga
p.s. just to be clear, I want to understand the state of ALL sockets,
not just the ones opened by Java. for instance, "netstat -a" on a
windows platform provides the status of all TCP and UDP sockets.
- 7
- SendMailServlet example & server setup ?I tried this example :
// import the JavaMail packages
import javax.mail.*;
import javax.mail.internet.*;
// import the servlet packages
import javax.servlet.*;
import javax.servlet.http.*;
// import misc classes that we need
import java.util.*;
import java.io.*;
public class SendMailServlet extends HttpServlet {
String smtpServer;
public void init(ServletConfig config) throws ServletException
{
super.init(config);
// get the SMTP server from the servlet properties
smtpServer = config.getInitParameter("smtpServer");
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
// get the message parameters from the HTML page
String from = req.getParameter("from");
String to = req.getParameter("to");
String subject = req.getParameter("subject");
String text = req.getParameter("text");
PrintWriter out = res.getWriter();
res.setContentType("text/html");
try {
// set the SMTP host property value
Properties properties = System.getProperties();
properties.put("smtp.mail.yahoo.com", smtpServer);
// create a JavaMail session
Session session = Session.getInstance(properties, null);
// create a new MIME message
MimeMessage message = new MimeMessage(session);
// set the from address
Address fromAddress = new InternetAddress(from);
message.setFrom(fromAddress);
// set the to address
if (to != null) {
Address[] toAddress = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.TO, toAddress);
}
else
throw new MessagingException("No \"To\" address specified");
// set the subject
message.setSubject(subject);
// set the message body
message.setText(text);
// send the message
Transport.send(message);
out.println("Message sent successfully.");
}
catch (AddressException e) {
out.println("Invalid e-mail address.<br>" + e.getMessage());
}
catch (SendFailedException e) {
out.println("Send failed.<br>" + e.getMessage());
}
catch (MessagingException e) {
out.println("Unexpected error.<br>" + e.getMessage());
}
}
}
and got this:
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
java.lang.NullPointerException
java.util.Hashtable.put(Hashtable.java:396)
SendMailServlet.doPost(SendMailServlet.java:40)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
with : properties.put("smtp.mail.yahoo.com", smtpServer);in line
40.That is my first servlet so if you be so kind to give me a detailed
answer.
- 8
- Basic Struts loggingI'm learning Struts and I've got a simple example app running. I wanted
to get logging working, so in the perform() method of my Action I put
the code:
ActionServlet as = getServlet();
as.log("hello world");
This compiled with no errors and ran without any problem; but the string
was not written to either of the log files catalina.out or
localhost_log.2004-09-21.txt (this is on Tomcat).
Any hints or clues about how to get simple logging working? I looked at
log4j and commons-logging but I want to start simpler.
- 9
- javax.mail truncated urlHi!
I use javax.mail to send http mails that include urls. On some mail
clients, including Lotus iNotes, urls contained in the mail are
truncated. For example:
http://www.crappysite.com/index.html?param1=foo¶m2=bar
becomes
http://www.crappysite.com/index.html?param1
Encoding in the email is set to "quoted-printable". I tried to set it
to "base64" but it didn't resolve the problem.
Thanks!
Alex
- 10
- Together J 5.5Hi,
once there was a "community version" of TogetherJ. I have a 5.5 on CD
from a Together Presentation long ago but I am missing the community
"licence.tg". It was free (long time ago) but no longer available now.
Anybody out there with one of theses files?
Thx,
Christian
- 11
- Site about CoffeeIf you're interested in the world of coffee, please check out
www.thecoffeeresource.com
The site will be updated somewhere this week with new content.
Thanks for your time,
TheCoffeeresource.com
- 12
- Using wildcard character in web.xml in Tomcat 5I am trying to achieve the following:
<url-pattern>/a*</urlpattern> then go into servlet A. This would
include /a, /aa, /abc/123 etc.
I notice that servlet 2.4 doesn't treat * as a wildcard character in
this case. Therefore, servlet A would only be called if the URL is
exactly /a*.
I need to create this pattern for all characters and numbers except
when the path starts with '/_'. Therefore, I can not use a '/*'
notation. Can anyone suggest a workaround to this issue?
Thanks,
TC
- 13
- Get the Verb of request in jspHi Guys,
Would anyone mind telling me how to get the verb of a request in jsp?
I would like to know whether the user is using a POST or GET request.
Thanks,
James
- 14
- CLASSPATH?WinXP Pro, JRE 1.4.2_03
I've just discovered that according to my Environment Variables section of
the System icon (Control Panel), I don't have a CLASSPATH variable. I used
SET from a command prompt to confirm that this is the case. No such
variable. So how come I can run basic (UI) Java programs OK? Shouldn't
CLASSPATH be pointing to the jar file containing these basic classes I'm
using? The problem is, JMF installation instructions seem to say I should
add the path to the jar file to CLASSPATH, but how can I if I have no such
variable? {:v)
Am I missing something?
--
- 15
- awt default toolkitThe following will not show the image nor will it throw any exceptions. Not
throwing exceptions doesn't surprise me because the documentation show that
it won't. That is a little surprising in itself. I am not using Swing
components.
public void paint(Graphics g){
String fileName = "dir/a.gif";
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image img = toolkit.getImage(fileName);
// an awt panel's Graphics context doesnot show the image
g.drawImage(img, 0,0, null);
//this works fine
g.drawString("aString",50,50);
}
thanks, mike
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
|
|