| java.net.ServerSocket doesn't catch every connection |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- J2ME - Newbie questionHi NG,
after I've googled now for several hours, I'm more confused then
before. And I thought, what I want to do is a simple every-day
problem.
I want to write an application, that communicates with a palm device,
in this case the m500. Therefore, I neet the following features:
* write/create files from within the palm device to the memory of the
palm
* read this files from within my desktop application.
Most important in my case would be files in xml format. I think this
is a problem many programmers must find when they want to develop
applications that use a palm device. But it seems that there is
nowhere a useful example. If anybody has developped similar things, or
can give me any hint or url, would be a great help.
What I did already: I installed the WTK2.0, build some examples, tried
to install the PDADemo example on my palm and execute it. I get the
error:
can't load javax.microedition.io.file.FileConnector
I think that would be exactly the thing I would need, but it seems not
to work.
Thanks very much in advance for every kind of help,
Bene
- 1
- [longish] Re: help errors[newbie]Madhur Ahuja <email***@***.com> wrote:
> Below is a simple program, which produces couple of errors.
> E:\programs\java1\concept\inner1.java:33: <identifier> expected
> t.somefunc(tt);
> ^
> E:\programs\java1\concept\inner1.java:33: package t does not exist
> t.somefunc(tt);
> ^
> 2 errors
>
> I cant seem to find the reason for these errors. Can anyone help
> me out.
Sure. Beware though, that I have a lot of remarks; also about coding
style and readability. It's a long read, but worth it (IMNSHO).
>
> public class inner1
- This name is confusing: it is an outer class with "inner" in the name...
- Please start class names with an upper case letter as in the JDK; when
most Java programmers read a name starting with a lowercase letter, they
expect a variable.
> {
>
> public static void main(String args[])
> {
> new test1();
> }
> }
This main method does nothing, unless you do everything in the
constructor. That is, your program runs when you create an object. This is
confusing.
>
>
> class test
> {
>
> private int a;
> test(int n)
> {
> a=n;
>
> }
This indentation is hard to read; you may use a bit more: 4 spaces or so.
If you run into the right margin, your code is most likely too complex.
Note that indentation, brace style, etc. is very personal, and has caused
many "holy wars" in the past. However, if it's readable, it's good.
Otherwise, it isn't. Opinions differ on what's readable though...
>
> void somefunc(test a)
> {
> a.a++;
> System.out.println(a.a);
> }
>
> }
>
> class test1
> {
> test t=new test(3);
> test tt=new test(4);
> t.somefunc(tt);
>
> }
This is the heart of the problem:
- t and tt are member variables, as they are defined outside any code
block.
- t.somefunc(tt) is a method call, but is outside a method, constructor or
even an initializer block. The compiler is expecting a definition for a
member variable, constructor, method or initializer.
You could make it work in several ways. Your goal is to understand why
option 2 is preferable.
Option 1:
- Double the braces in the definition of class test1. This creates an
initializer block that makes the lines inbetween into an anonymous
constructor that is always called when instantiating this class.
Option 2:
- Change the content of inner1#main(String[]) to:
test1 testObject = new test1();
testObject.callMethod();
- Perform the change of option 1.
- Between the two opening braces of the class test1, add this:
public void callMethod()
- Reformat the code (especially the class test1).
Regardless of which solution you choose, I advise you to read up on Sun's
coding conventions. Note they're just guidelines: you don't have to agree
with them. However, it helps if you follow them.
The URI is: http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
Following them won't make you a better programmer, but it will help both
you and others to understand your code more easily. This in turn enables
you to get help more easily, and thus learn more.
--
Oscar Kind http://home.hccnet.nl/okind/
Software Developer for contact information, see website
PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
- 1
- JWS consoleRoedy Green wrote:
> Is there a way to view the console or System.err with Java webstart
> apps?
>
File > Preferences > Advanced tab, then select "Show Java Console"
- Alistair
- 2
- jdk1.4.2 & fontsWe seem to be missing some fonts:
hal% ll /usr/local/jdk1.4.2/jre/lib/fonts/
total 2156
-rw-r--r-- 1 root wheel 75144 Nov 13 01:05 LucidaBrightDemiBold.ttf
-rw-r--r-- 1 root wheel 75124 Nov 13 01:05 LucidaBrightDemiItalic.ttf
-rw-r--r-- 1 root wheel 80856 Nov 13 01:05 LucidaBrightItalic.ttf
-rw-r--r-- 1 root wheel 344908 Nov 13 01:05 LucidaBrightRegular.ttf
-rw-r--r-- 1 root wheel 317896 Nov 13 01:05 LucidaSansDemiBold.ttf
-rw-r--r-- 1 root wheel 698236 Nov 13 01:05 LucidaSansRegular.ttf
-rw-r--r-- 1 root wheel 234068 Nov 13 01:05 LucidaTypewriterBold.ttf
-rw-r--r-- 1 root wheel 242700 Nov 13 01:05 LucidaTypewriterRegular.ttf
-rw-r--r-- 1 root wheel 6153 Nov 13 01:05 fonts.dir
hal% ll /usr/local/linux-sun-jdk1.4.2/jre/lib/fonts/
total 2716
-r--r--r-- 1 root wheel 75144 Aug 19 23:53 LucidaBrightDemiBold.ttf
-r--r--r-- 1 root wheel 75124 Aug 19 23:53 LucidaBrightDemiItalic.ttf
-r--r--r-- 1 root wheel 80856 Aug 19 23:53 LucidaBrightItalic.ttf
-r--r--r-- 1 root wheel 344908 Aug 19 23:53 LucidaBrightRegular.ttf
-r--r--r-- 1 root wheel 317896 Aug 19 23:53 LucidaSansDemiBold.ttf
-r--r--r-- 1 root wheel 91352 Aug 19 23:53 LucidaSansDemiOblique.ttf
-r--r--r-- 1 root wheel 253724 Aug 19 23:53 LucidaSansOblique.ttf
-r--r--r-- 1 root wheel 698236 Aug 19 23:53 LucidaSansRegular.ttf
-r--r--r-- 1 root wheel 234068 Aug 19 23:53 LucidaTypewriterBold.ttf
-r--r--r-- 1 root wheel 63168 Aug 19 23:53 LucidaTypewriterBoldOblique.ttf
-r--r--r-- 1 root wheel 137484 Aug 19 23:53 LucidaTypewriterOblique.ttf
-r--r--r-- 1 root wheel 242700 Aug 19 23:53 LucidaTypewriterRegular.ttf
-r--r--r-- 1 root wheel 6153 Aug 19 23:53 fonts.dir
--
Panagiotis Astithas
Electrical & Computer Engineer, PhD
Network Management Center
National Technical University of Athens, Greece
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 2
- 2
- Difficulty resizing window inside an AppletHi all,
I have a Java puzzle written as an applet that I've been working on. So far
I've never been able to figure out how to resize it from inside the applet
itself.
So I created a very elaborate HTML file, where I use JavaScript which:
1. queries the screen resolution and browser,
2. dynamically opens a window based on the values returned from (1),
3. dynamically writes the applet/object tag to that window also based on
(1).
I'd love to get rid of this complicated mess of html/js code and do it from
pure Java if I can. For one thing, having two page refreshes is slow for the
user. I've tried setSize() and setBounds from every component level I can
think of. There are never any errors but it never works either. I noticed
that resize() works from inside a JDialog, but not from JPanel. I'd be happy
to use a JDialog to hold the JPEG image, instead of JPanel, but that doesn't
seem to work.
Also, I'd love to be able to resize on the fly. Is it a big deal to trap the
window/resize event to allow the user to set the size?
I'd greatly appreciate any thoughts or ideas you may have.
Best regards,
Dave
- 3
- Java String.replaceAll() not behaving as expectedGiven a string "s", I'd like to convert all the line separators into
their "escaped" string equivalents. i.e. a dos/windows newline gets
converted into the literal string "\r\n".
I tried this in my java code...
s = s.replaceAll("\n", "\\n");
s = s.replaceAll("\r", "\\r");
but I end up with "rn" instead of "\r\n"
I assume the problem has something to do with the regex pattern
replacement but it seems like it should work.
What am I doing wrong?
...
Krick
- 3
- java.net.ConnectException: Connection refusedHi,
i have something very strange here:
when i try to connect from my Client (written in Java) my Server (also
in Java) i get SOMETIMES
java.net.ConnectException: Connection refused
1. under Gentoo Linux and localhost:4444 NO EXCEPTION
2. under Knoppix + Debian Linux localhost:4444 NO EXCEPTION
3. windows 2000 localhost:4444 EXCEPTION!
4. all the tree systems IP.of.an.other.PC:4444 EXCEPTION!
Does anybody know why?
Another Client/Server Application (BabylonChat) runs well in any
Configuration!!
Have a nice Day.
Karaca
- 3
- 6
- how can write my servlet in weblogichai,
i new to weblogic environment.
i tryed the examples that are mentioned in sample directory of
weblogic.
i need for this purpose to start example server in order to see the out
put.
my question is how to write my own examples in my own directory and
execute them
instead of using sample server.
Thanks in advance.
- 6
- 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
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 6
- Displaying oracle table in jsp as a html tableDear All,
Is there any custom tag, procedure, any mechanism which will let me
put the html code to display the table rows from Oracle database table
into a JSP page?
Any procedure which accepts some parameters like table name, database
connection url, database username, password etc. and display the table
data in a web page?
-Sameer
- 7
- db connectionsGuys,
In a a stateful session bean I'm looking up a data source that wraps a
connection pool and using it to retrieve a connection.
How do I return the connection to the pool when I'm done? Is conn.close()
the right thing to do here?
If I just let it go out of scope I eventually get an exception in the pool
with an "out of resources" error.
- 8
- BoundingSphereHi all!
I have a little ask..how can i create a bounding sphere on a Sphere object.
Sphere gives me only the radius, how can i get the centre?
Andrea Todeschini
- 13
- Sending email in multiple languagesWe're trying to send out HTML emails in multiple languages
(English and Chinese (simplified and traditional)).
The subject as well as the body may contain multi-byte
characters.
We're having trouble making the email readable for all audiences.
Outlook (back to 2003)
On English computer
On Chinese computer
Hotmail
on IE with a chinese (simpl or trad) locale
on Firefox with a chinese (simpl or trad) locale
Yahoo mail
on IE with a chinese (simpl or trad) locale
on Firefox with a chinese (simpl or trad) locale
So far we're base64 encoding with a multipart doc type and
encoding with Big5 or GB1208 depending on the user's locale.
(UTF-8 didn't work very well).
Is there a mostly-universal way of doing this?
Tara
|
| Author |
Message |
mmaenz

|
Posted: 2006-6-25 2:30:00 |
Top |
java-programmer, java.net.ServerSocket doesn't catch every connection
Hi,
My problem is that ServerSocket.accept doesn't catch every connection
made to the socket.
I wrote a little server that gets a connection and spawns a new thread
giving the ServerSocket as parameter to the constructor. Then the
Thread is start()'ed.
The Code is:
ServerSocket serversock = new ServerSocket(port);
while (true) {
Socket socket = serversock.accept();
HandleSocket hs = new HandleSocket(socket);
hs.start();
}
But this code does not catch every connection that will be made to it
and I get a timeout with
the client application. If I retry connection it often works, but the
problem happens randomly.
I can't find anything, that could cause this problem. I'm really a bit
disappointed. I wrote the same application with C++ and had no
problems. But I need it platform independent, thats why I want to use
Java.
Anyone had this problem before? Can anyone help me?
Thanks in advance
- Michael
|
| |
|
| |
 |
hiwa

|
Posted: 2006-6-25 7:37:00 |
Top |
java-programmer >> java.net.ServerSocket doesn't catch every connection
email***@***.com 銇儭銉冦偦銉笺偢:
> Hi,
>
> My problem is that ServerSocket.accept doesn't catch every connection
> made to the socket.
> I wrote a little server that gets a connection and spawns a new thread
> giving the ServerSocket as parameter to the constructor. Then the
> Thread is start()'ed.
>
> The Code is:
>
> ServerSocket serversock = new ServerSocket(port);
> while (true) {
> Socket socket = serversock.accept();
> HandleSocket hs = new HandleSocket(socket);
> hs.start();
> }
>
> But this code does not catch every connection that will be made to it
> and I get a timeout with
> the client application. If I retry connection it often works, but the
> problem happens randomly.
> I can't find anything, that could cause this problem. I'm really a bit
> disappointed. I wrote the same application with C++ and had no
> problems. But I need it platform independent, thats why I want to use
> Java.
>
> Anyone had this problem before? Can anyone help me?
>
> Thanks in advance
> - Michael
Your client code is simply wrong.
|
| |
|
| |
 |
mmaenz

|
Posted: 2006-6-25 17:43:00 |
Top |
java-programmer >> java.net.ServerSocket doesn't catch every connection
hiwa wrote:
> Your client code is simply wrong.
Well, I don't think so. The client is in my case a webbrowser. I tried
Internet Explorer, Firefox and Netscape and the problem exists with all
of them.
I put an archive with source of my program on:
http://downloads.ragnaruk.de:81/JProxy.zip
The goal of the program is to act like a proxy. A incoming connection
is redirected as
described in jproxy.conf. The source is pretty simple. I didn't take
care of anything, just quick and dirty.
Any help is welcome!
thx
|
| |
|
| |
 |
Frank van Schie

|
Posted: 2006-6-25 20:02:00 |
Top |
java-programmer >> java.net.ServerSocket doesn't catch every connection
email***@***.com wrote:
> Hi,
>
> My problem is that ServerSocket.accept doesn't catch every connection
> made to the socket.
> I wrote a little server that gets a connection and spawns a new thread
> giving the ServerSocket as parameter to the constructor. Then the
> Thread is start()'ed.
>
> The Code is:
>
> ServerSocket serversock = new ServerSocket(port);
> while (true) {
> Socket socket = serversock.accept();
> HandleSocket hs = new HandleSocket(socket);
> hs.start();
> }
Mainly some general stuff:
I'm not entirely sure, but wouldn't you want a Thread.sleep(50) or so in
the infinite loop to take care of that 100% CPU load you get with this?
Or does the serversock.accept() do this for you?
In HandleSocket, you create a Thread whose run() method executes
precisely once, with no iteration. Why make it a Thread at all? What if
you get 10000 (or arbitrarily high number) connection attempts per
second with processing times of a second? Stack overflow, that's what.
You also have the overhead associated with it. Better to have a smaller
Thread pool, make HandleSocket implement Runnable (no change in your
code) and hand your HandleSocket objects off to the Threadpool to be
handled. Any backlog that develops can be stored in lists or something.
Oh, and method names start with a small letter, with further
camel-casing. This aids readability, and saves you from getting slammed
in the bean bag with a heavy blunt object by the person who has to
maintain your code. You wouldn't want to get slammed in the bean bag.
> But this code does not catch every connection that will be made to it
> and I get a timeout with
> the client application. If I retry connection it often works, but the
> problem happens randomly.
Is this used for a huge amount of connections? Maximum queue size is 50.
If there are already 50 connections waiting to be accept()'ed, any new
connections are automatically refused.
--
Frank
|
| |
|
| |
 |
Red Orchid

|
Posted: 2006-6-25 20:20:00 |
Top |
java-programmer >> java.net.ServerSocket doesn't catch every connection
email***@***.com wrote or quoted in
Message-ID: <email***@***.com>:
>
> ServerSocket serversock = new ServerSocket(port);
> while (true) {
> Socket socket = serversock.accept();
> HandleSocket hs = new HandleSocket(socket);
> hs.start();
> }
>
As I know as, the following code is one thread model.
<code>
while (...) {
try {
Socket sock = serverSock.accept();
// do something
}
catch (Exception e) {
}
finally {
if (sock != null) {
try {
sock.close();
}
catch (IOException e) {
}
}
}
}
</code>
With this model,
subsequent connection request should wait her turn in a queue
until previous request is completed.
Your code seems to has the above model.
If so, the thread 'HandleSocket' may be wrong.
If you want multi-thread model,
it will be worth to check 'ServerSocketChannel'.
|
| |
|
| |
 |
Chris Uppal

|
Posted: 2006-6-25 22:51:00 |
Top |
java-programmer >> java.net.ServerSocket doesn't catch every connection
email***@***.com wrote:
> ServerSocket serversock = new ServerSocket(port);
> while (true) {
> Socket socket = serversock.accept();
> HandleSocket hs = new HandleSocket(socket);
> hs.start();
> }
Is HandleSocket a subclass of Thread ?
If it isn't then the above won't start a new thread, so connections can be
misses if there's are enough attempts while hs.start() is running.
If it is a subclass of Thread, then it probably shouldn't be. In nearly all
cases it's better to make your class implement Runnable, and then start the new
thread with some variant of:
MyHander handler = new MyHandler();
Thread thread = new Thread(handler);
thread.start();
but making that change probably won't solve your immediate problem.
-- chris
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Displaying error values with Struts Validator FrameworkHi,
I'm using the struts validator framework to validate an email address
in a form.
If the user enters an invalid email address (ie
invalidEmailAddress.com) I'd like to display the following error
message:-
"invalidEmailAddress.com is an invalid e-mail address"
However all I seem to be able to do with the validator framework is
output the following:-
"Email address is an invalid e-mail address"
with messageResources.properties and validator.xml set as follows:-
validator.xml:-
<form name="addressForm">
<field property="emailAddress"
depends="email">
<msg name="email" key="errors.email" />
<arg name="email" key="form.address.label.emailAddress" />
</field>
</form>
messageResources.properties:-
errors.email={0} is an invalid e-mail address.
form.address.label.emailAddress=Email address
I'm using <html:errors /> to output the error list in a jsp.
Is there any way to substitute the actual entered value into the
errors.email message using the struts validator framework? I know it
can be done in the validate() method of the ValidatorForm class but
it there method of simply using the validator framework?
Thanks in advance for your help.
smrimell.
- 2
- JAVA RMI thr HTTP throws NoRouteToHostExceptionHi,
I am developing an application that would be used in a firewall
environment. As part of my test environment, I have blocked port 1099
and have allowed port 80 access on the server. So all the RMI calls
from the client should be tunnelled thru port 80 in the server.
I have ported the java-rmi.cgi script (unix version) to windows
version. So I am confident that my RMI client, java-rmi.cgi are
correct. But I am getting NoRouteToHost Exception and my application
has to exit.
My understanding is that when the RMI client tries to connect 1099 (rmi
port) and if it fails, it will try to connect to port 80 and later all
the rmi calls should be embedded within http commands. Does my
web-server (apache) needs to be configured for this?
I have also tried setting http.proxtHost, but of no avail.
Please let me know of your solutions.
>> Manjunath
- 3
- Samsung Blu-ray pre-orders incredible: Java Blu-ray authoring in high demandNotes on initial responses to Samsung blu-ray launch, people already
buying players before content, and Java BD-J authoring of Blu-ray discs
* Posted while eating late lunch on Nokia 9300 and Opera Mini Java
browser.
http://bluray.highdefdigest.com/news/show/Sony/Samsung/Hardware/Blu-ray_Assault_to_Begin_Samsung_Proclaims_Incredible_Pre-Sales/111
Blu-ray Assault to Begin; Samsung Proclaims 'Incredible' Pre-Sales
After months of speculation, excitement and street date delays, the
Blu-ray
format is set to launch over the next week amid a flurry of marketing
hype
for the format's first player and discs.
Samsung began shipping its first stand-alone Blu-ray disc player, the
BD-P1000, to stores last week in anticipation for its on-sale street
date of
June 25. Sony will prime the pump for the player's debut by issuing
its
first seven Blu-ray disc titles tomorrow, June 20; Lionsgate will
launch its
support for Blu-ray with another six titles on June 27.
Samsung plans to have its player in over 2,000 storefronts nationwide,
including such major chains as Best Buy and Circuit City. In
conjunction
with Sony, the companies will also provide demo players and discs to
retailers to offer side-by-side comparisons with rival HD DVD in order
to
subjectively sell the format to potential consumers.
The electronics manufacturer also claims that interest in the BD-P1000
and
Blu-ray so far has been strong. "Pre-orders have been incredible,"
Samsung
spokesman Jose Cardona told Video Business.
---------------------------------------------
http://www.tgdaily.com/2006/06/20/sony_pictures_blu-ray_movies_today/
With Toshiba having launched its HD-A1 and HD-XA1 HD DVD videodisc
players
in April, Samsung is preparing to be the first brand to formally
launch a
competitive Blu-ray Disc player in North America, with its BD-P1000
set to
premiere on Sunday. Despite that firm date, customers nationwide are
already reporting having purchased BD-P1000s from Best Buy store
shelves -
just sitting there nonchalantly like any other DVD player, as if shelf
stockers didn't know the difference. But today, those early adopters
will
finally be able to play real BD media - not just upconverted SD media
- as
Sony Pictures releases the first batch of BD movies today.
Video outlets today should already have received, and will likely have
displays ready for, 50 First Dates (Adam Sandler, Drew Barrymore),
Hitch
(Will Smith), House of Flying Daggers, the original Terminator, the
sci-fi
"new cult classic" The Fifth Element (Bruce Willis), Underworld
Evolution,
and XXX (the film, not the rating). One title, A Knight's Tale,
originally
scheduled for release today, is being pushed back to 25 July. The
high-energy motorcycle violence film Ultraviolet joins the line-up
next
Tuesday. Lion's Gate Home Entertainment is due to follow up next
Tuesday
with the BD releases of 2006 Best Picture Crash, Terminator 2:
Judgment Day,
the horror flick Saw, Lord of War (Nicholas Cage), and the Marvel
Comics
vigilante piece The Punisher.
------------------------------------------------------------------
Java: Brave New Disc-Authoring World
http://www.pcworld.com/news/article/0,aid,126163,00.asp
Blu-ray Disc relies on BD-Java (BD-J) for its disc-authoring
environment;
HD DVD uses Microsoft's XML-based iHD, or Internet High Definition. "I
think
BD-J is better future-proofed," says Eklund. "But it is complex," and
implementing it properly will take more time, he says.
The switch to BD-J required adding programmers and engineers to the
disc-production mix.
BD-J has two different profiles. Sony's first content will be in what
Eklund
refers to as BD-MV, or "movie mode." "The menus will still be quite
different than what you're accustomed to with DVD," he promises.
"BD-MV is a
powerful format for creating interactive menus, and it will give a
better,
more seamless experience than what users are getting from DVD. You
don't
have to jump around between menu pages as you do with DVD. We use a
graphics
layer to present all of the text information, so you don't have to go
back
and access the disc in order to access the menus. We also have a tool
called
a pop-up menu that the user can use to access disc features during the
movie's playback, so, for example, you can get to a commentary track."
As powerful as BD-MV is, it has its limitations. "We are currently
still
investigating how we're going to author picture-in-picture content,"
says
Eklund. "But I'm sure we will be exploring that later on in the year."
- 4
- How Do I Configure a Tomcat Server for Production?Hello,
I am pretty new to Tomcat. I am wondering if there are any standard
configurations that need to be added/modified as part of a Production
deployment aside from database URLs and those types of values.
Currently, we have mostly the same configuration for Production as we
do for development.
As the load increases are there any obvious values that we should be
changing?
Thanks, Jesse
- 5
- Translator Tools? I was about to throw in the towel on this
project I've inherited. It's about 5,000
Java files, totally undocumented and uncommented.
I asked and looked for tools that would help
me make sense of this mess, so far to no avail.
Now the owner of the company is willing to
consider redoing it in C++. ( In my opinion
there was no good reason for the previous software
engineer to write this in Java. It's a pretty
straightforward Windows desktop app that would
be much easier to understand and maintain had
it been written in VC++. There's some evidence
he chose Java just so he could get some experience
with it,)
Anyhow, I'm not rewriting this by hand.
I came across the following in Bruce Eckel's
'Thinking In Java', "I've even heard it
suggested that you start with Java, to gain the
short development time, then use a tool and support
libraries to translate your code to C++, if
you need faster execution speed."
Has anybody heard of or better still used
such translator tools? Even if it only did
80-90% and the rest required manual intervention
it might work.
TIA for any advice.
Gerry Murphy
- 6
- Nio performance bottleneckHello !
In order to be sure that nio package was more performant than regular
streams, i have tested it with this little piece of code :
// ----------------------------
ByteBuffer loWriteBuffer = ByteBuffer.allocateDirect(1024);
CharBuffer loBuffer = CharBuffer.allocate(512);
Charset charset = Charset.forName("ISO-8859-1");
CharsetEncoder encoder = charset.newEncoder();
long llMillis, llMillis2, llMillis3;
llMillis = System.currentTimeMillis();
try {
FileChannel loChannel = new RandomAccessFile(new
File("C:\\Temp\\Test.txt"), "rw").getChannel();
for (int i = 0; i < 1000; ++i) {
loBuffer.put("ceci est un test\r\n");
loBuffer.flip();
encoder.encode(loBuffer, loWriteBuffer, false);
loWriteBuffer.flip();
loChannel.write(loWriteBuffer);
loBuffer.clear();
loWriteBuffer.clear();
}
loChannel.close();
}
catch (IOException leIO) {
leIO.printStackTrace();
}
llMillis2 = System.currentTimeMillis();
try {
Writer loWriter = new BufferedWriter(new OutputStreamWriter(new
FileOutputStream("C:\\Temp\\Test2.txt"), charset));
for (int i = 0; i < 1000; ++i) {
loWriter.write("ceci est un test\r\n");
}
loWriter.flush();
loWriter.close();
}
catch (IOException leIO) {
leIO.printStackTrace();
}
llMillis3 = System.currentTimeMillis();
System.out.println("Results : nio = " + (llMillis2 - llMillis) + " ms /
standard = " + (llMillis3 - llMillis2) + " ms");
// ----------------------------
I was surprised to see that, on my computer, the regular stream based part
was running about 4 times quicker than the nio based part !!
Here is my question : is my code correctlty optimized ? Anybody already
noticed this performance bottleneck ? Is my test the cause of this problem ?
Thank you !
Jean-Luc
- 7
- Difference in opinion with look and feel !Hi,
I have an interesting problem while using the look and feel. This is my
function:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Well the tool bars, the menu are all system's look and feel. i.e i am
using Windows OS. so i get all windows look and feels. But when i use
the file chooser, I get an open dialog box with look and feel of Sun
Microsystems' solaris.
Does anyone have any idea why this is coming up like this?
Interestingly I am not even able to reproduce this an other project.
Plz help,
Thank you,
Regards,
Rajesh Rapaka.
- 8
- How to create same RSA signature objects in Java and C#Hello,
I have looked through the documentation for the Java and C#
security classes, and I can't find an answer to the following question.
How can the same RSA signature object (class java.security.Signature in
Java
and System.Security.Cryptography.RSACryptoServiceProvider in C#)
be constructed?
What I would like to see is that signatures generated in Java are
recognized as valid by C#, and vice versa. I am assuming this implies
that the RSA signature parameters must be the same in both
languages, but I can't figure out how to make that happen.
According to some sketchy notes I've found through googling,
it is possible, so I'll keep trying. Thanks for any information.
Robert Dodier
- 9
- JavaScript redirect and JSP submitHi,
I've been trying to get the right way to send parameters to a JSP from
a HTML form. The referred JSP must get the values of the selects form,
because it executes queries and does stuff with that values. But the
only thing I've got it's a Tomcat error report.
The menu.jsp is something like this:
... // HTML stuff
<script language='JavaScript'>
function valida()
{
var ok=true;
var indexAccion = document.forms[0].accion.selectedIndex;
var indexTablas = document.forms[0].tablas.selectedIndex;
var indexBDatos = document.forms[0].BDatos.selectedIndex;
if (indexAccion==0 || indexTablas==0 || indexBDatos==0)
{
alert("Elige un criterio");
ok=false;
}
if (ok)
document.forms[0].submit();
window.location.href =
document.forms[0].accion.options[indexAccion].value;
}
</script>
... // HTML stuff
<form method='post' ***SHOULD BE THE accion.selectedIndex.value***>
<select name="accion">
<option value="inicio" selected>Selecciona una opcion
<option value="visualiza.jsp">Visualizar registros de la tabla
<option value="modifica.jsp">Modificar registros de la tabla
</select>
<select name="tablas">
<option value="inicio" selected>Selecciona una tabla
<option value="tbl1">Tabla 1
<option value="tbl2">Tabla 2
</select>
<select name="BDatos">
<option value="inicio" selected>Selecciona una base
<option value="db1">Base 1
<option value="db2">Base 2
</select>
<br><br><br>
<input type="button" value="Aceptar" onclick='valida()'>
</form>
Any ideas to figure it out?
Regards,
- Omar.
- 10
- Run your own Auction Site, Pay per click directory, Google groups email harvestor, Email spider nowFree download full version , all products from Mewsoft dot com
http://netauction10.url4life.com/
Run your own Auction Site. Auction software for your site
----------------------------------------
Run your own auction site in minutes. Open source code in perl. Create
your own auction site in just a few minutes. NetAuction is the
complete auction package for every business from the personal to the
corporate business. SQL database backend for the highest scalability
and performance.
Directory, Pay per click search engine software
------------------------------------------------------------------
Open source code in perl. Build your own pay per click search engine
and build your entire sites in minutes with this software. NetEngine
is turn key Pay per click search engine and content management with
built in portal tools. SQL database backend for the highest
scalability and performance.
Groupawy
---------------
Google Groups Email collector. The first email spider for google
groups. Millions of valid and active emails in one easy location to
collect.
Spiderawy
---------------
Email spider machine. Multithreads and Multiplexed connections per
thread with built in database system for the highest scalability and
performance. Email and URL spider and extractor.
Site builder software
--------------------------------
Open source code in perl. Build and manage your sites with the fastest
browser based site builder and content management software ever.
NetBuilder is a complete package very easy to use for building your
sites online and offline with all the tools you ever need to manage
any site of any size.
Email list manager tools, free download full version
---------------------------------------------------------------------
Full Email lists tools suite. Email Extractor, Spider emails from
online web pages, Filter lists, Merge lists, Remove unsubscribe lists
from lists, Splitter to split larg email list file to smaller files,
Deduplicator to remove duplicated emails.
- 11
- Accessing a Java COM component from .NET.NET framework 1.2
Hello.
We've been accessing a Java COM component from classic ASP for a while now,
which works fine. We now need to access it from .NET, but we have no idea
how to reference this component as we can't find the .dll (or whatever type
of file Java COM components compile to). We do know a couple of things
about the component:
CLSID: {E7DEFE93-E26E-11d2-B3A0-0000E8512796}
Component name: PaymentClient.com.COMClient
Searching the registry for either string yields results, but the only DLL
referenced is msjava.dll which is obviously not what we're looking for.
Can someone give us any hints on how to access this object from .NET.
Thanks,
Mike
- 12
- identical JPanels, repetitive
I need to make a tabbed pane with four tabs, each pane shows text and
images from a List<Room> collection.
I can manually create the four tabs from the netbeans GUI builder, and
maybe use some copy paste so that the four tabs are similar if not
identical.
Staying within the GUI builder, how would four identical JPanel's, which
make up the tabs for a JTabbedPane, get created?
Could I somehow make a JList show as tabs?
thanks,
Thufir
- 13
- Eclipse 2.1.1 does not save my workspaceHi,
Sometimes when I close out Eclipse 2.1.1, it doesn't say my worksapce
settings. Because of this, I cant find projects that I create prior
to this happening
Can anyone shed some light on this issue?
Thank You
- 14
- Eclipse 3.1 crash on sun's jvmHi list,
Eclipse just crashed the jvm when I ran it.
the jvm dump suggest that the gtk smooth lib is to be blamed.
since this happened to me twice on two different machines, I think it
may (or have already) happen(ed) to many other people.
after removing gtk2-engines-smooth eclipse started to work again.
snippet from the jvm dump file:
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,
C=native code)
C [libc.so.6+0x66533]
C [libc.so.6+0x66af2] __libc_free+0x82
C [libglib-2.0.so.0+0x2cc92] g_free+0x22
C [libsmooth.so+0x12416] SmoothFreeArrowStyles+0x46
C [libsmooth.so+0x2784a]
C [libsmooth.so+0x278bf]
Omry.
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 15
- Database access for server and clientI am trying to create a small Internet application to access a mySQL
database on specific client machines around the country and query their
database and send the query result to our web server and then process
further data on the web server. Here is the layout: There are
several client machines around the country that have a mySQL database
installed and will give us certain query privileges for this database.
I need users on these client machines to be able to run an Internet
application from our web server which queries their local database and
then sends information to our server.
I see two options: a trusted, signed applet or a full java application
- also digitally signed - that is deployed through the Java Web Start
technology. (This is a very simple query on the client with a simple
drop-down list for the user to select from the query result - nothing
complicated.)
Does anybody have any suggestion as to which method is preferable? The
end users who will be running this application are not very computer
savvy and might not be able to figure out browser messages like "Your
browser understands the <APPLET> tag but isn't running the applet, for
some reason." For this reason I thought that the Java Web Start method
might be preferable, but I have no idea how reliable this method is and
what kind of kinks I will have to work through.
I also wonder if the Microsoft .net environment might offer an
alternative (our web server is Microsoft IIS and the clients are all
Windows XP or Windows 2000).
Any thoughts?
Thank you.
Anke
|
|
|