 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- 1
- How to solve with aid of Multithreading.. Hi,
Please, could you any one give me the solution for following
problem..
A Dialog box (JDialog) getting input parameters from user..
itself a button attached.. if i click the run
button those parameters are passing to 'C' core which connected by
JNI.. core executing few minutes..
and returning to java.. mean while the dialog box (after
setVisible(false) instuction)
appearing as plain brown box till control return from 'C'..
how can i apply multithreading feature of java's here inorder to
get..
Dialog box should get disappear as soon as button has clicked.
and Percentage of completion should display as in progress bar..
while 'C' running on background..
(or)
Dialog box should get Disappear as soon as button has clicked.
and some processing animation should display till 'C' running on
background...
- 3
- Ethernet ID and system Info in JavaHi,
I want to know if there is a way to get system level information using Java.
I am mostly interested in things like Ethernet ID and serial number of Hard
disk. Some of the values when you type "ipconfig /all" on windows.
I know we can do all this using JNI with the main routines written in C. But
is there a way to do it using Java alone?. I have not seen any API to help
me get such deep system level information.
Thanking you,
- 6
- Applet as DSO in Browser example? MSIE only?Hi,
Recently on the web I came across documentation discussing Data Source
Objects (DSO) in relation to browser and html functionality (in particular
the ability to declare a Java applet as a data source that can be used with
any or the HTML tags that take the src="" attribute). I find it interesting
and potentially *very* useful and would like to know more, so if anyone can
answer any of the following questions that would be great: -
1) Do you have an example of an Applet functioning as an applet to something
like a <Table> that I can see?
2) Is this a MicrosoftIE-only feature? I can't find it in other html tag
reference sites. (I'm using w3schools as a sort of yardstick; is that less
than optimal?) What do other browsers do? Is Microsoft deprecating this
along with other Java stuff?
3) I've searched in c.l.j.p/c.l.javascript and the only references to DSOs
appear to be server based (or data sources other than Applet) I'm guessing
they're entirely different beasts; is that correct?
4) Anyone ever passed a BufferedImage over to Javascript for display on a
web page? (I know it'd be single threaded and all those little .GIFs and
.JPEGs are designed for parallel http webservers, but think of a blob in a
database that has an employee photo of geological survey or something. . .)
Thanks for any help!
Regards Richard Maher
PS. I am already passing result set <options>s back to a <select> list quite
happily; it's the tighter integration between the html tags and my socket
that I'm striving for here.
One of the places I've been looking: -
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/databind/datasources.asp
- 6
- i18n currencyhi all,
i need to internationalize the currency symbol in my application.
please advice on how that can be done
thanks
Chanchal
- 10
- Custom eventHello All,
How can I write a custom event?
I want to create a custom event object and fire it at a particular point in
program.
Thanks in advance!
Regards
Suma
- 12
- Servlet LDAP Web Server AuthenticationThis may not be the correct place to post this; however, please bear
with me.
Platform: Solaris 9
iPlanet Web Server
Java Servlets/JSP website
I have a servlet that displays the contents of a directory as links
available for downloading/viewing. I have also locked this directory
down using LDAP through the web administration page of iPlanet. What
I would like to happen is to authenticate to the web server first,
before the links are displayed, so that when the user clicks on the
links, they are not prompted with the typical gray box asking for a
username and password. I've researched and implemented JNDI,
authenticated to LDAP, tailed the logs, and I authenticate fine. My
servlet loads, and the first thing it does is query ldap and
authenticate. Next it prints out the page containing the links.
(I've even tried not closing the context) But as soon as I click on
the links, I am prompted again. I am assuming (and very fuzzy on how
this works) that yes, I authenticated to LDAP. But the webserver
doesn't know that. So how do I get the webserver to realize that I've
already authenticated? Any help would be appreciated.
Thanks,
Kim
- 12
- JDK 1.1.8 V1999-11-9 on recent FBSD 4Hi all,
I tried to run JDK 1.1.8 V1999-11-9 (ELF version) on my FreeBSD
4.8-STABLE box. It could not run and I had the following message:
% java Linpack
/usr/libexec/ld-elf.so.1: /usr/lib/libm.so.2: Undefined symbol "__stderrp"
% java -version
/usr/libexec/ld-elf.so.1: /usr/lib/libm.so.2: Undefined symbol "__stderrp"
% java
/usr/libexec/ld-elf.so.1: /usr/lib/libm.so.2: Undefined symbol "__stderrp"
% jar
/usr/libexec/ld-elf.so.1: /usr/lib/libm.so.2: Undefined symbol "__stderrp"
% java_g
/usr/libexec/ld-elf.so.1: /usr/lib/libm.so.2: Undefined symbol "__stderrp"
Can the JDK 1.1.8 work on recent FBSD 4 and 5?
How can I avoid this problem?
Kazuyuki Shudo email***@***.com http://www.shudo.net/
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 12
- bsd implementation ofOn Thu, Jan 17, 2008 at 08:13:00PM -0800, Michael Allman wrote:
> There's a bug in the bsd patch to FileChannelImpl.c, as described in the
> subject of this message. FYI, I have verified this using the "current"
> jdk16 freebsd patchset found here:
>
> http://www.eyesbeyond.com/freebsddom/java/JDK16JRLConfirm.html
D'oh...there certainly is.
> I haven't fully analyzed the impact of this defect. I can say that in my
> case, if I call FileChannel.transferTo(0, 100, socketChannel), where 100
> is less than the length of the file in question, it transfers the entire
> file to the destination. According to the docs for this method, it should
> only transfer a maximum of 100 bytes. This is key to my particular usage
> of this method.
The problem is that it ignores the count entirely and just transfers the
whole thing.
> I can attempt to provide a patch, but C is not my thing, and I could not
> make a reliable claim as to the correctness of my patch. Also, there's
> the whole license issue. Fixing this seems simple enough, though. I
> would like to help insofar as I can.
Something like this maybe? (Untested)
--- ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c 6 Mar 2007 17:45:05 -0000 1.11
+++ ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c 18 Jan 2008 08:11:36 -0000
@@ -264,11 +264,12 @@
return IOS_THROWN;
}
- while ((r = pread(srcFD, buf, 4096, offset)) > 0) {
+ while (count > 0 && (r = pread(srcFD, buf, (count < 4096) ? count : 4096, offset)) > 0) {
w = write(dstFD, buf, r);
if (w == -1)
break;
offset += w;
+ count -= w;
}
free(buf);
> Also, I know this is getting pushy, but it seems like fixing this issue
> would be a great time to replace the current implementation of this method
> with a true bsd sendfile() call. I could give that a try, too.
As noted in the comments, you can't since the BSD implementation of
sendfile(2) expects to be sending the file to a socket, not just any old
file descriptor. Solaris and Linux are both ok with any old fd.
--
Greg Lewis Email : email***@***.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : email***@***.com
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 12
- Detecting KeyBoard events on a JDialogHello,
i have a JDialog subclass, with a lot of components in it, and i would
like to detect Ctrl+C on it. I've tried to use this:
protected void register(JComponent jcomp) {
Action action = new AbstractAction("Action") {
public void actionPerformed(ActionEvent evt) {
System.err.println("Action!!!");
}
};
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_C,
KeyEvent.CTRL_DOWN_MASK);
jcomp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(key, "myaction");
jcomp.getInputMap(JComponent.WHEN_FOCUSED).put(key, "myaction");
jcomp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(key,
"myaction");
jcomp.getActionMap().put("myaction", action);
}
wich is call like that:
register((JComponent)getContentPane());
register((JComponent)getGlassPane());
register(getRootPane());
but my action is never performed.
So i've registered a KeyListener recursively on my dialog, and the
keylistener is called with getSource() returning the dialog ref. But the
dialog has no inputMap so how can i do?
I can't use the recursive trick because there are 2 JTables in the
Dialog which must keep its default copy behavior, and a lot of text
fields too.
Thanks for any help.
- 12
- Faster JPEG Decoder?On 19 Aug 2005 16:14:17 -0700, email***@***.com wrote or quoted :
>Currently we use JPEGImageDecoder which is the fastest of the three but
>still it takes up a lot of CPU time.
>
>Any suggestion? Thanks in advanced.
The obvious thing to consider is to predigest your images into some
other format that does not require so much processing to fluff it up.
They will probably be bigger.
When you create the jpg images you can control the
compression/quality. Presumably lower quality images will display
faster.
If you are displaying them or scrolling over them, then you might look
into what speedups are possible with VolatileImage.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
- 12
- Analytical or IntuitiveI have a test online that measures cognitive style. It determines
whether the participant has an intuitive or analytical learning style.
It takes about 5 minutes.
It's here: http://www.elena.com
I'm a long-time software engineer who's thinking about changing
careers, hence the psychology course. I ended up wanting to study
people like me (not surprising I guess).
I know the sample will be non-probabilistic. So this will be a
quasi-experiment.
Elena
- 12
- URL.openConnection bug in 1.6??If a bug report I got is correct, under some conditions JDK 1.6
URL.openConnection returns null without throwing an IOException.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
- 15
- jbutton/jlabel disspearing textHi,
I have created a few JButtons/JLabels but the text on them seems to
disappear depending on the platform the gui is run on (The disappearing text
appears as "..."). How is it possible to set the size of the label/button
according to the length of the text?
Thanks,
Adrien
- 15
- Thread for ProgressBarHi all,
I have a question on threading for the progressbar.
My program will call a few methods and those methods are really time
consuming, the time it takes all depends on how much information are
being pump in, sometimes it can be less than half a minute, sometimes
it can go up to few minutes. So determining the percentage of the
progressbar is impossible.
So how do I find out the total length of the process so that I can
update the progressbar's percentage accordingly?
|
| Author |
Message |
DigitaluX

|
Posted: 2004-6-14 6:25:00 |
Top |
java-programmer, java.net
Hello
How can I get the ip and mac address of the networking device
(eth0)?? is it possible with the InetAddress??
I want to get the ip address given by the ISP.
Sincerly
DigitaluX
|
| |
|
| |
 |
Roedy Green

|
Posted: 2004-6-14 9:13:00 |
Top |
java-programmer >> java.net
On Sun, 13 Jun 2004 22:24:39 GMT, DigitaluX <email***@***.com> wrote
or quoted :
>How can I get the ip and mac address of the networking device
>(eth0)?? is it possible with the InetAddress??
see http://mindprod.com/jgloss/ip.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
Marcin

|
Posted: 2004-9-24 5:38:00 |
Top |
java-programmer >> java.net
Hello,
Does anyone have an idea how can I interrupt
HttpUrlConnection.getInputStream()?
I have 2 threads. First one opens stream using HttpUrlConnection method
getInputStream(). Second one is monitoring transfer in the first thread.
When transfer is below some number second thread tries to interrupt first.
It looks sometimes (in special condition that are caused by me, for
example :I halt internet traffic or do some changes in my proxy
configuration) that getInputStream() method locks and can't be interrupted.
I tried interrupt() method from Thread class, but id doesnn't work.
I tried also to close streams, but it turned out that they were not open
yet.
Is there any technic to take full control over http connection ?
Martin
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- How to use regex to split a sentence with different spaces?Hi,
I saw the following code to split a sentence into words. My question is:
How could I modify the code to split a sentence like(in his example,
the words are separated by EXACTLY ONE SPACE by chance):
"But I'm not dead yet! I feel happy!"
<Code>
// : c12:ReplacingStringTokenizer.java
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
import java.util.Arrays;
import java.util.StringTokenizer;
public class ReplacingStringTokenizer {
public static void main(String[] args) {
String input = "But I'm not dead yet! I feel happy!";
StringTokenizer stoke = new StringTokenizer(input);
while (stoke.hasMoreElements())
System.out.println(stoke.nextToken());
System.out.println(Arrays.asList(input.split(" ")));
}
} ///:~
</Code>
- 2
- Does object pooling *ever* make sense?I've read recently that object allocation in recent JVMs is so fast that
it doesn't make sense to create object pools. Just create a new object
when you need it and let the garbage collector do the work.
Does this hold true when your objects are very large, though? What if
your object contains a byte [] of length 100K? Or 1Mb?
What's the breakeven point beyond which it makes sense to reuse objects?
- 3
- [JavaIDL] Releasing CORBA object references in Java ?<previously posted on comp.object.corba, with no response yet>
Hi all,
I really wonder what's the use of org.omg.CORBA.Object._release() and
_duplicate().
I was thinking that reference counting was the job of GC.
In C++ the reference counting, via the usage or _var and _ptr and methods
release() and duplicate(), is without ambiguity (even if complex and error
prone). But here in Java, the introduction of _release() and _duplicate() is
very strange.
Another point for the discussion: as I am using the JDK ORB implementation,
the Java Doc says:
"
- Object _duplicate()
Returns a duplicate of this CORBA object reference. The server object
implementation is not involved in creating the duplicate, and the
implementation cannot distinguish whether the original object reference or a
duplicate was used to make a request.
Note that this method is not very useful in the Java platform, since
memory management is handled by the VM. It is included for compliance with
the CORBA APIs.
The method _duplicate may return this object reference itself.
- void _release()
Signals that the caller is done using this object reference, so internal
ORB resources associated with this object reference can be released. Note
that the object implementation is not involved in this operation, and other
references to the same object are not affected.
"
My opinion here is that releasing references or not won't make any
difference, and duplicating them is pointless.
But what does the standard says ?
Thanks in advance,
JC.
- 4
- Problem reading from nio socketchannels into a bytebufferAt:
http://www.javanio.info/filearea/bookexamples/unpacked/com/ronsoft/books/nio/channels/SelectSockets.java
There is sample code. In that page there are the lines:
// send the data, don't assume it goes all at once
while (buffer.hasRemaining()) {
socketChannel.write (buffer);
}
// WARNING: the above loop is evil. Because
// it's writing back to the same non-blocking
// channel it read the data from, this code can
// potentially spin in a busy loop. In real life
// you'd do something more useful than this.
In some of my code I have written a line more or less exactly like:
while (buffer.hasRemaining()) {
socketChannel.write (buffer);
}
and the code does just spin. What is an example of "something more
useful than this"?
Jeff
- 5
- help with saving a JPanel to jpgI have a JPanel that I paint with a graph. The upper 40% is a graph
with a grid background, and the rest is a legend for the graph. When I
try to save the JPanel as a jpg, I get an image with the same
dimensions but there is no graph or legend and the grid, which uses the
dimensions to set the upper grid limit, covers the entire panel.
Everything on screen is fine. The current code is below. I've tried
the available varieties of paint and tried using the Robot class
(though this could be explored more). Any tips on where I'm messing up
or what could be changed to get this working would be appreciated.
java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(
panel.getPreferredSize().width,
panel.getPreferredSize().height,
java.awt.image.BufferedImage.TYPE_INT_RGB);
java.awt.Graphics2D g = image.createGraphics();
g.setRenderingHint(java.awt.RenderingHints.KEY_FRACTIONALMETRICS,
java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING,
java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
panel.paintAll(g);
g.dispose();
javax.imageio.ImageIO.write(image, "jpeg",
new java.io.File("./" + jtf.getText() + ".jpg"));
image.flush();
- 6
- JAVA NIOHello,
Somewhat new to JAVA, and I swear I have looked all over on this
problem, and found an answer, but it does not seem to work. I have a
non blocking NIO socket client connection I can send data to the
socket check the input buffer for data and handle it okay. If no
activity occurs in say 10 seconds, I do an input read. From reading
documentation, I would expect a 0 return value for a proper connection
with no data, a -1 return value or IOexception for a bad socket
connection. However, what is happening is that the socket connection
is still open on both sides, the read times out and generates an
IOexception error described as Read timed out. Does the JAVA examples
only work when the server is also a NIO object? I say this because
the server I am using is not written in JAVA. Any help or suggestions
would be greatly appreciated!
Thanks
Ryan
- 7
- Bug tracking tools for Java appWe're looking for a simple bug-tracking app. Jira looks cool, but it's not
cheap. Bugzilla looks complicated.
Any suggestions?
- 8
- Uptodate MSN messenger API?Guys,
Does anyone know of an up to date MSN Messenger API in Java? I've found
similar for Yahoo and Skype, but I'd like to be able to use MSN (mainly
because our company is moving off Yahoo to MSN over the coming year).
I've searched SourceForge but everything there seems to have been
stopped at least a year ago.
Any suggestions appreciated.
Cheers,
Chris
- 9
- sprite & image - j2memidp 2.0
Java SE 5.0
J2ME version 2.2
I'm trying to create an image based on javax.microedition.lcdui.Image
I wish to fill the image with graphic created by the code and not use a real
image... because I want the image to change during program execution.... I
want the image to display a circle filled with a color... I guess there is
no such thing as a circle image so I thought first create a layer with
Alpha=0% (transparent) and then a layer above it containing the
circle...... - giving the impression of a circle image, the corners of the
image object melt into the background
I want this image to be put into a sprite
I'm not sure how to create such an image...
Please if you have any tips about this then tell me, and links to examples
solving this problem is very welcome :-)
Jeff
- 10
- Calculating download time based on bit rate.I have the bps rate that the document is downloading at, the size of
the the document, and how much has been downloaded but I cant seem to
calculate the ETA for it to finish (all I need for now it the time in
seconds.)
for a 9mb file it says 2 seconds left when that is clearly wrong
considering that it takes around 1 minute to finish.
private long getSecondsLeft(long bitRate, long received, long
size)
{
return (bitRate != 0 ? (size - received) / bitRate : -1);
}
- 11
- Cross-platform installer package?Does anyone know of a cross-platform installer package? Scanning
Google, it appears that the installer package landscape is all focused
on specific operating systems.
- 12
- JDBCAdapter & close() method ?Do you know JDBCAdapter from j2sdk TableExample:
JDBCAdapter extends AbstractTableModel {
....
public void close() throws SQLException {
System.out.println("Closing db connection");
resultSet.close();
statement.close();
connection.close();
}
...
}
Who start the close() method on exit of my application???
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.725 / Virus Database: 480 - Release Date: 19.7.2004
- 13
- JAVA scipt neededHi all - I am looking for a JAVA script that automatically downloads
and executes a .exe or .com program upon clicking a link.
Let me know (I'd appreciate an answer to my email address as well)
Thanks ...
- 14
- how to read multiple (binary) lines from text file / stdin?
hi group!
i am writing a small tool to dump data from oracle databases and i want
to implement the possibility to execute sql statements read from stdin
or from a file. i have so far managed to do so, but every sql statement
must be on a single line with no ";" at the end of each line.
i would like to use an input file like this:
-- file statement.sql --
select * from table
where thing = "something";
------------------------
or
-- file statement.sql --
update table
set image = '<binary data>'
where thing = otherthing;
------------------------
this is how the code looks so far:
// code start
BufferedReader in = new BufferedReader(new FileReader(filename));
while (((statement=in.readLine())!= null) &&(!statement.equals(""))){
try {
ResultSet rset = stmt.executeQuery(statement);
[...]
}
}
// code end
i would like 'statement' to contain the multiline sql statement
including all newlines so that also binary data may be inserted into the
db so i tried to use
System.setProperty("line.separator", ";");
but that didn't help and also doesn't seem the right way for what i want
to achieve. could someone please point me into the right direction on
how to do that? the variety of different stream classes is somewhat
confusing in terms of finding the right class for the right job.
big TIA, armin
--
armin walland
focusmr.com
maculangasse 8
1220 wien
- 15
- Tomcat 5.5.X ready for production ?Hi
I need your advices and experiences !
Is Tomcat 5.5.X ready for production ?
I will add some new features to an application running currently on
5.0.X . I consider taking this opportunity to switch to tomcat 5.5.X ,
and at the same time to JDK 5.0 .
--
Jean-Marc Vanel
Consulting & Services / software development
OSS, Web, Java, XML ...
http://jmvanel.free.fr/ ===) CV, software resources
Computer science diary : http://jmvanel.free.fr/computer-notes.html
Worldwide Botanical Knowledge Base : http://wwbota.free.fr/
Test XML query engine: http://jmvanel.free.fr/protea.html
|
|
|