| Reading file lines into large List |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- setCursor() for a ContentPanel
Joana,
I was having a similiar problem and did some searching and found the
following forum:
http://forum.java.sun.com/thread.jsp?forum=57&thread=110928
Basically, I think you need to use setCursor on the GlassPane. I used
the following code in my application and it seems to work.
Component gp = getGlassPane();
gp.setVisible(true);
gp.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//do your computations
gp.setCursor(Cursor.getDefaultCursor());
gp.hide();
Hope this helps,
Kin Wong
On 14 Jun 2003 09:09:45 -0700, email***@***.com (Joana)
wrotE:
>Hi!
>
>May I ask you for a favour ... a hint would please me a lot ...
>
>When the Graph is completely shown in the window I can see no
> WAIT_CURSOR, but DEFAULT_CURSOR.
>When I move the mouse out of the window and hit back the window area I
>get the WAIT_CURSOR.
>
>Could You please tell me, where is my bug or better what should I do,
>to get the WAIT_CURSOR during the graph computing process
>
>Thanks a lot for every single answer!
>
>Best regards,
>Joana
- 3
- Finding BeanInfo for superclass?Hi,
I'm having a problem or a misunderstanding with BeanInfo.
I have a class Alpha, and a class Beta. Beta extends Alpha. I've
created an AlphaBeanInfo class.
The following code works fine:
BeanInfo info = Introspector.getBeanInfo(Alpha.class);
...
Problem is though when I call the following code:
BeanInfo info = Introspector.getBeanInfo(Beta.class);
...
AlphaBeanInfo is not returned, nor are any of its methods called
(verified via debugging)
Shouldn't this be returned by the Introspector? I could of course write
a BetaBeanInfo, but this seems silly to have to do this.
Any ideas/clarifications?
Many thanks,
M
- 3
- Will MS be less evil now?I don't understand Gates. If he wants to do good deeds and be a
philanthropist, why limit such good deeds to healthcare and
education? Why not also do a good deed in the computer
industry? In this industry he is known less for his innovations
than for tactics such as sabotaging Java and cutting off
Netscape's air supply. He has done the industry and consumers
immeasurable harm, for example, by freezing the development
of web browsers. Here's an idea for Gates: Unfreeze the web
browser. Take web browsing to the next level. Start by
implementing SVG, the W3 standard for vector graphics, in IE.
- 3
- Tomcat and QueueHi,
Does any one know about the Coyote connector queue in Tomcat?
How does it work? if a connection gets queued then when does it get a
thread? will it be given preference over the requests arriving after
its arrival??
rgds,
Prashant
- 3
- What is Delegation, versus inheritence, examples in C or C++"Bernard" <email***@***.com> wrote:
> I apologize if this has been brought up here before.
> Searching through the newsgroup I found variants of
> my question, but not exactly what I am thinking about.
>
> I am trying to learn UML from a well publicized book,
> "Instant UML" Wrox press by Pierre-Alain Muller.
>
> While I may admire the book for its conciseness, I
> have difficulty following its examples and explanation
> of Delegation. He explains Delegation mechanism by
> a diagram of client communicates with an interface that
> propagates questions to one or more delegates. It is
> not clear but is on page 53. Next page he has some
> discussion of the "covariance problem" which he discusses
> earlier but never defines, leaving a vague understanding.
> On p54, he also has example of how inheritence is simulated
> by hand using delegation and talks of X-windows which is
> written "entirely in C". There is no example. Where
> ever I was able to understand his discussion, it was
> due to prior knowledge of the field. If some kind
> soul has been able to follow this book and can give
> explanations with reference to page numbers that would
> be very nice.
>
> Thanks++,
I looked for your concept of "Delegation" in the only book that I have
on UML. This is by Craig Larman. Its index does not evennnnn list it.
You should expand your query to other language groups. I can do it
for you. OOP implementation questions have been asked there before
Monica
- 7
- Junit: overriding original class private methodsI have a class that when run will call a private sendEfvent() method
that sends data to an external process. I would like to override that
behavior in testing and just report what is set to avoid the
complications, etc of having to use external processes during unit
testing.
I don't think I can just use an assertTrue() because I also want to
know how many times this private method is called (i.e. is it sending
the correct number of copies out)?
Is there a way I can cause Junit to stop the JRE from calling the true
sendEvent() method and instead call something in my test class??
-Robert
- 7
- Displaying multiple beans in a struts formI have a list of beans that I retrieved from a database. These beans
are all of the same class. Now I want to display these beans in a
struts form so that the user can modify the data in the beans and save
it back to the database.
Can anyone help with this problem? Is there any sample code out there
that would show how to do this?
Thanks
- 8
- 9
- "CallByName" in Java?Hello,
is there any way to do the job "CallByName" (as in VB) for Java? We want to
build a hashtable which has the
names of java methodes with their parameters, and later all the methodes
will be called only by
names automatically.
Thanks,
Le
- 9
- Preverifier error in Sun Java Wireless ToolkitHi ppl,
I'm using an SDK provided by my client and building a MIDlet
application which does ApiCalls on this SDK. I copied all the jar files
from the SDK and put it into my lib folder of my MIDlet project so that
it could add it to the classpath during build. But when I build it
shows the following error:
Error preverifying class com.myClient.sdk.attributes.AttributesMaster
VERIFIER ERROR
com/myClient/sdk/attributes/AttributesMaster.addErrorElements(Lorg/w3c/dom/Document;Lorg/w3c/dom/Node;[Lcom/myClient/sdk/attributes/model/ErrorSet;)Lorg/w3c/dom/Node;:
Cannot find class org/w3c/dom/Node
If I don't use that particular jar, and the rest of the jars, it
shows this error:
Error preverifying class com.myClient.sdk.call.AddDisputeCall
java/lang/NoClassDefFoundError: com/myClient/sdk/ApiCall
I read that this is because I might be using a class library created
for the J2SE platform and hence it doesn't work for the J2ME Wireless
toolkit which uses a limited JVM and APIs. Is there any way I can merge
it into my MIDlet so that it will use it?
P.S: I'm comparatively new to J2ME :( Also i'm using the Sun Java
Wireless Toolkit 2.3 Beta. Please help...
Thanks in advance,
Sajida Abdul Salam
- 12
- ADT's vs. interfaceswhat is the differences between ADT's and interfaces? also what are
abstract classes? can you also include examples?
thnks
- 15
- JBOSS and IPlanet setupHi,
This is a generic architectural question. I am not sure if this can
be posted at this forum.
I am using JBOSS as App server and Iplanet as WebServer and Reverse
Proxy plugin to forward all the JSP requests from Iplanet to JBOSS.
Both Web Server and App server are on different boxes.
When I request a JSP page, its coming up fine. But if that JSP page
has a 'response.sendRedirect' in it, then its failing to redirect to
the specified page. Instead its going to the webserver root.
Also, this behaviour is not consistent - meaning, sometimes it goes
through and sometimes its coming back to webserver root.
Using 'response.forward' fixed the problem.
But I do not want to use 'forward' in the web application because of
the obvious diff between 'forward' and 'redirect'. (Using the forward
doesn't change the URL and upon browser refresh, the same form gets
submitted again and again)
Are there any alternatives to fix the redirect problem?
Any help is appreciated.
Thanks,
-Sudheer
- 15
- What is J2EE and an application server?Can someone explain to me what java enterprise edition is?? I've been
looking into the web for some info, but can't really make sense of the
info found. Is there also an tutorial avaible?
I've found one at the java site, but there it was attached to an
application server. And that's my second question, what is a
application server and what can u do with it??
Thnx someone.....
- 15
- USENIX Security '08 Call For Papers Reminder---------------------------------
Call for Papers
17th USENIX Security Symposium
July 28-August 1, 2008
San Jose, CA, USA
http://www.usenix.org/sec08/cfpb/
Submissions Deadline: January 30, 2008
---------------------------------
Dear Colleague:
I'm writing to let you know that the paper submissions site for the 17th
USENIX Security Symposium (USENIX Security '08) is now open and can be
found here:
http://www.usenix.org/events/sec08/cfp/submit_form.html
Please submit all work by January 30, 2008.
Refereed paper submissions are solicited in all areas relating to
systems and network security, including:
* Adaptive security and system management
* Analysis of network and security protocols
* Applications of cryptographic techniques
* Attacks against networks and machines
* Authentication and authorization of users, systems, and applications
* Automated tools for source code analysis
* Botnets
* Cryptographic implementation analysis and construction
* Denial-of-service attacks and countermeasures
* File and filesystem security
* Firewall technologies
* Forensics and diagnostics for security
* Intrusion and anomaly detection and prevention
* Malicious code analysis, anti-virus, anti-spyware
* Network infrastructure security
* Operating system security
* Privacy-preserving (and -compromising) systems
* Public key infrastructure
* Rights management and copyright protection
* Security architectures
* Security in heterogeneous and large-scale environments
* Security policy
* Self-protecting and healing systems
* Techniques for developing secure systems
* Technologies for trustworthy computing
* Usability and security
* Voting systems analysis and security
* Wireless and pervasive/ubiquitous computing security
* Web security
Please note that the USENIX Security Symposium is primarily a systems
security conference. Papers whose contributions are primarily new
cryptographic algorithms or protocols, cryptanalysis, electronic
commerce primitives, etc., may not be appropriate for this conference.
Submissions are due January 30, 2008, 11:59 p.m. PST
(firm deadline).
For more details on the submission process, please see the complete
Call for Papers at:
http://www.usenix.org/sec08/cfpb/
We look forward to receiving your submissions!
Paul Van Oorschot, Carleton University
USENIX Security '08 Program Chair
email***@***.com
---------------------------------
Call for Papers
17th USENIX Security Symposium
July 28-August 1, 2008
San Jose, CA, USA
http://www.usenix.org/sec08/cfpb/
Submissions Deadline: January 30, 2008
---------------------------------
- 15
- Labels and paint questions...I have an applet, here
http://www.aquaticwhirlpools.com/sean/selectMenu.html
What I need is for the select menus to have some space between
them so that I can have the orange/yellow images next to each one.
As you can see, there is a bit of one of the images next to
"by product size" and a full image next to "by model".
The space between the two "by product size" and "by shape" is
created by an empty label. The image is placed in the paint method.
The problem is that without the empty label, the menus have no space
between them, as with "by shape" and "by model". Is there any other
way to create that space... or is there a way to make the images 'paint'
on top of the labels?
Thanks for any help.
|
| Author |
Message |
iksrazal

|
Posted: 2005-9-13 19:54:00 |
Top |
java-programmer, Reading file lines into large List
Hi all,
I have tried posting this problem a few times looking for a solution.
What I have works but is slow.
I have to read unordered data from a text file. Data A has a
one-to-many relationship with Data B, and Data B has a one-to-many
relationship with Data C . Once I find Data A, Data B and Data C could
be anywhere in the file. So I do a RandonAccessFile.seek(0) . This
needs to be repeated hundereds of times for lots of Data B and Data C
relationships.
I'd like to put the file in memory. However, I'm using Scanner and
regex to get the data. I don't think I can run Scanner on ByteBuffer
per line.
So my latest idea is to read the file per line and store it in List. So
a 10,000 line file would have a 10,000 size List. That way I could run
Scanner on the Strings in the List, and Iterate repeatably. The data in
the List would be read only.
Any advice appreciated.
iksrazal
|
| |
|
| |
 |
jan V

|
Posted: 2005-9-13 20:09:00 |
Top |
java-programmer >> Reading file lines into large List
> I'd like to put the file in memory. However, I'm using Scanner and
> regex to get the data. I don't think I can run Scanner on ByteBuffer
> per line.
>
> So my latest idea is to read the file per line and store it in List. So
> a 10,000 line file would have a 10,000 size List. That way I could run
> Scanner on the Strings in the List, and Iterate repeatably. The data in
> the List would be read only.
Maybe iterating over a List would itself greatly slow down things... not
because of the pure iterating overhead, but because you would force the
regex engine to get going for every line. Why don't you
a) store your entire text file in one (1) String
b) scan it once to locate all the line start offsets, storing these in a
separate data structure
c) use the regex engine to find what you need
d) then map the match offset to a line number
At the expense of slightly expensive b) and d) steps, you give step c) the
simplest possible data structure in which to search.
[BTW, I'm assuming you've already profiled your app and rejected the current
algorithm as a result of your findings]
|
| |
|
| |
 |
Chris Uppal

|
Posted: 2005-9-13 20:49:00 |
Top |
java-programmer >> Reading file lines into large List
email***@***.com wrote:
> So my latest idea is to read the file per line and store it in List. So
> a 10,000 line file would have a 10,000 size List. That way I could run
> Scanner on the Strings in the List, and Iterate repeatably. The data in
> the List would be read only.
>
> Any advice appreciated.
But what exactly is your problem ? How to represent that data in memory ? How
to get it into memory ? How to search it once it is in memory ? Something
else ?
-- chris
|
| |
|
| |
 |
iksrazal

|
Posted: 2005-9-13 21:14:00 |
Top |
java-programmer >> Reading file lines into large List
Chris Uppal escreveu:
> email***@***.com wrote:
>
> > So my latest idea is to read the file per line and store it in List. So
> > a 10,000 line file would have a 10,000 size List. That way I could run
> > Scanner on the Strings in the List, and Iterate repeatably. The data in
> > the List would be read only.
> >
> > Any advice appreciated.
>
> But what exactly is your problem ? How to represent that data in memory ? How
> to get it into memory ? How to search it once it is in memory ? Something
> else ?
>
> -- chris
My problem is simply speed. Doing lots of RandomAccessFile.seek(0) is
too slow. I'm using JAXB to collect the data - but that is not the
bottleneck. So searching in memory is what I'd like to try. I currently
use a regex per line via Scannner, and I'd like to accomplish the regex
in a different way, ie, not using seek(0).
iksrazal
|
| |
|
| |
 |
iksrazal

|
Posted: 2005-9-13 22:06:00 |
Top |
java-programmer >> Reading file lines into large List
That all seems like a good idea. I'm going to try and simply put the
data into List first, and then profile the speed difference versus
RAF.seek(0) . If speed is still an issue, I'll try and implement steps
a,b,c,d that you outlined and give it a shot.
Thanks!
iksrazal
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-9-14 3:41:00 |
Top |
java-programmer >> Reading file lines into large List
On 13 Sep 2005 04:54:14 -0700, email***@***.com wrote or quoted :
>However, I'm using Scanner and
>regex to get the data.
Make sure you compile your pattern only once, not once per search.
See http://mindprod.com/jgloss/regex.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2005-9-14 10:40:00 |
Top |
java-programmer >> Reading file lines into large List
email***@***.com wrote:
> Hi all,
>
> I have tried posting this problem a few times looking for a solution.
> What I have works but is slow.
>
> I have to read unordered data from a text file. Data A has a
> one-to-many relationship with Data B, and Data B has a one-to-many
> relationship with Data C . Once I find Data A, Data B and Data C could
> be anywhere in the file. So I do a RandonAccessFile.seek(0) . This
> needs to be repeated hundereds of times for lots of Data B and Data C
> relationships.
>
> I'd like to put the file in memory. However, I'm using Scanner and
> regex to get the data. I don't think I can run Scanner on ByteBuffer
> per line.
>
> So my latest idea is to read the file per line and store it in List. So
> a 10,000 line file would have a 10,000 size List. That way I could run
> Scanner on the Strings in the List, and Iterate repeatably. The data in
> the List would be read only.
Your latest idea is your original idea in different clothes. Yes,
getting all the data into memory has a chance of speeding things up
some, but if you're talking about a file of 10,000 lines of (say) 256
characters or less, then the total size of the file is less than 64 KB,
and your OS' filesystem cache probably holds the whole thing in OS
memory anyway. The margin to be gained by moving it into user memory is
probably not enough to go from "slow" to "fast". That would probably
still be true even if the file *wasn't* in the OS' cache.
You want a solution that requires fewer scans of the data -- preferably
just one. You didn't describe how references from A to B and from B to
C are encoded in the data, nor what distinguishes an A from a B from a
C, but chances are good that you would get a significant speedup from
building an index and then using that instead of repeatedly scanning the
data from the beginning. For instance, read the whole file, once,
constructing as you go structured representations of data A, B, C, D, Q,
and Z. Store these data in memory a Map, using for the key whatever
substring is used for linking these things together. It may also be
convenient to build separate Lists (or Maps) of all the A's, B's, and
C's as you go, if indeed they are distinguishable. Once you've parsed
the file use the Map to find / resolve all the references.
If you haven't used Maps before, don't be scared of HashMap. Many
novices seem to gravitate to TreeMap, perhaps because they understand
trees better than they understand hashing, but HashMap is frequently the
better choice.
I hope this helps.
--
John Bollinger
email***@***.com
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-9-14 12:35:00 |
Top |
java-programmer >> Reading file lines into large List
On Tue, 13 Sep 2005 21:40:19 -0500, "John C. Bollinger"
<email***@***.com> wrote or quoted :
>If you haven't used Maps before, don't be scared of HashMap.
see http://mindprod.com/jgloss/hashmap.html
http://mindprod.com/jgloss/hashcode.html
http://mindprod.com/jgloss/hashtable.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
iksrazal

|
Posted: 2005-9-14 19:44:00 |
Top |
java-programmer >> Reading file lines into large List
> Your latest idea is your original idea in different clothes. Yes,
> getting all the data into memory has a chance of speeding things up
> some, but if you're talking about a file of 10,000 lines of (say) 256
> characters or less, then the total size of the file is less than 64 KB,
> and your OS' filesystem cache probably holds the whole thing in OS
> memory anyway. The margin to be gained by moving it into user memory is
> probably not enough to go from "slow" to "fast". That would probably
> still be true even if the file *wasn't* in the OS' cache.
>
> You want a solution that requires fewer scans of the data -- preferably
> just one. You didn't describe how references from A to B and from B to
> C are encoded in the data, nor what distinguishes an A from a B from a
> C, but chances are good that you would get a significant speedup from
> building an index and then using that instead of repeatedly scanning the
> data from the beginning.
<snip>
I know the whole collections framework a little bit ;-) .
Actually just changing RandomAccessFile.readline and
RandomAccessFile.seek to putting all 10,000 lines into List<String> and
using Iterator, boosted performance 60 times. It went from 14 minutes
to 14 seconds. Which for practical purposes solves my problem.
My file:
2056482 BSS0
I have about 20 of these.
I'm using List with the ArrayList, which seems to be fine but another
List implementation may be better for large indices of read-only data.
Now what you took the time to describe - thanks - is similair to what
another poster described, ie 'building an index'. It is the better
approach. I'm not sure just yet if going, say from 14 seconds to 4, is
neccesary in this app.
Incidently, the data is stored in a Hibernate persisted DB using the
composite pattern for the tree, but is using JAXB to build the tree on
another system as a first step.
I hope this help others - I'm convinced that using List to store all
file lines can achieve much better perfomance then RAF.seek. Using an
index as described would be a good experiment.
Thanks!
iksrazal
|
| |
|
| |
 |
jan V

|
Posted: 2005-9-14 21:16:00 |
Top |
java-programmer >> Reading file lines into large List
> Actually just changing RandomAccessFile.readline and
> RandomAccessFile.seek to putting all 10,000 lines into List<String> and
> using Iterator, boosted performance 60 times. It went from 14 minutes
> to 14 seconds. Which for practical purposes solves my problem.
So, additionally, there might be a lot more to gain from further optimizing
by using some of the other suggestions in this thread..
> I'm using List with the ArrayList, which seems to be fine but another
> List implementation may be better for large indices of read-only data.
IMO, None of the standard List implementations would improve on ArrayList.
Though a custom List implementation just might.
> Now what you took the time to describe - thanks - is similair to what
> another poster described, ie 'building an index'. It is the better
> approach. I'm not sure just yet if going, say from 14 seconds to 4, is
> neccesary in this app.
Never optimize beyond what the client is prepared to pay for. ;-)
>Using an index as described would be a good experiment.
I've written a TextBlock class which I subclass in various applications.. it
allows a linear character offset to be mapped to a line number. Very
handy... makes handling line numbers in all kinds of applications a doddle.
TextBlock takes a block of text, and does a one-off scan to create a private
data structure to make offset-to-line nos lookups very, very fast.
Additionally the constructor takes a performance hint so that you can tune
the performance of this lookup: you can have O(1) lookups if you're prepared
to pay in RAM..
|
| |
|
| |
 |
Joan

|
Posted: 2005-9-15 2:36:00 |
Top |
java-programmer >> Reading file lines into large List
<snip>
> I'd like to put the file in memory. However, I'm using Scanner
> and
> regex to get the data. I don't think I can run Scanner on
> ByteBuffer
> per line.
I have an application that reads in unordered text files of size
8,250 lines
and puts them into an array of String[][]. It uses readline and
split.
Starting and running the prog takes about 1-2 sec. Then I scan
the
whole list for a match on user input casting the strings to
(CharSequence)
and using matcher. It is very fast.
>
> So my latest idea is to read the file per line and store it in
> List. So
> a 10,000 line file would have a 10,000 size List. That way I
> could run
> Scanner on the Strings in the List, and Iterate repeatably. The
> data in
> the List would be read only.
>
> Any advice appreciated.
> iksrazal
>
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Crystal Report Change Data SourceI have a few crystal reports (XI) that uses JDBC to connect to MS SQL
Server. The JDBC Driver is JTDS 1.1. Now I am trying to update the data
source definition to include JNDI name so it can be more portable. The
trouble is I can't update it.
Here's what I've tried on existing working reports:
- Go to "Set Datasource Location" dialog, expand current data source
properties, add JNDI connection name. Crystal now pops up a dialog box,
asking me to confirm connection info. So I put in user ID and Password.
Clicking "Finish" and Crystal pops up a message saying "Logon failed.
Details: SQL Exception: [SQL State:] 08501 [Error Message:] Network
error IOException: Connection refused: connect". Then the same
connection fonfirmation dialog come up again as if i typed in wrong
user name and password.
- The next thing I tried (since I can't manually add JNDI name) is to
replace existing datasource with another one. Again, I go to "Set
Datasource Location". I've already defined another JDBC connection with
JNDI name in it. now selecting existing connection in the tree at the
top and select the new connection in the tree at the bottom, click
"Update". Now connection confirmation dialog pops up. After entering
user id and password, I click Finish. Then Crystal says
- "Data Object cannot be opened/accessed."
- "Database Connector Error: 'Unexpected error'"
- "Data Object cannot be opened/accessed."
- "Database Connector Error: 'Unexpected error'"
- "Some tables could not be replaced, as no match was found in the
new data source. Please specify the table required for any unmodified
tables."
Some more information regarding existing reports. When I created the
reports, Crystal complains about not able to find the tables and offer
me to remove the related fields from the report. I clicked "No" and the
reports still runs perfectly fine.
There isn't much I can do after this. So I look up on the web, I think
it may have to do with the not so well implemented "verify database"
functionality, but I have no way to prove or solve it.
Can anyone help me on this? The database is the same, so theoretically
there shouldn't be any problem updating the datasource defintion,
especially when the datasource is the same as before. And adding JNDI
name to the report shouldn't be a problem either because it won't get
use until a Java app try to run it.
Any suggestions?
Thanks,
Jo
- 2
- Hot opportunities for Java Consultants in ClevelandHey All -
I'm putting out an A.P.B. for Java Developers in the Cleveland area,
or folks who are willing to work in Cleveland. Sun Certification is a
huge plus, and consulting experience would make you a rock star.
Contact me via e-mail with a resume if you're interested, and feel
free to tell friends!
Thanks,
Jerome
- 3
- jxta in subnetHallo,
i have a broblem with the jxta technology. I build up a testbed
consisting of a server a router and two clients. The router is
connected to the two clients and the server. Any connection from one
client to another or from one client to the server goes through the
router. Client 1 is configured with ip 192.168.100.1, client two with
172.16.0.1 and the server with 10.0.0.2. So the router routes for
three different subnets. No machine has access to the another (except
the router). There is also no connection to the internet.I wrote an
application built on jxta. The application runs on the server and the
two clients. I configured the peers as rendevouzs and added to every
peer the ip's of the two others to the list of known rendevouzs peers.
When i run my application, the peers can find each other, BUT it needs
a lot of time, somtimes about 10 miutes. I cannot understand this,
because the peers know each other by the list of known rendevouzs. How
can i improve the time the peers need to find each other? I think my
configuration settup is ok (, otherwise the peers never would find
each other?).
Can anyone help me ?
Michibeck.
- 4
- Fwd: Reminder: Call for FreeBSD status reports!FYI.
Ernst
---------- Doorgestuurd bericht ----------
Subject: Reminder: Call for FreeBSD status reports!
Date: maandag 29 september 2003 23:33
From: Scott Long <email***@***.com>
To: email***@***.com
All,
Don't forget to submit your FreeBSD status reports by Oct 1, 2003!
These reports are open to not only official project memebers, but also
to anyone who is engaged in the development of projects that relate to
FreeBSD. Kernel, userland, ports, documentation, installation,
integration, etc, reports are all welcome and encouraged. Reports should
be 1-2 paragraphs in length, focus on one topic, and should follow the
template that is available at
http://www.freebsd.org/news/status/report-sample.xml.
Submissions must be made to email***@***.com. Submissions for multiple
projects per person are welcome.
Thanks!
Scott Long
Robert Watson
-------------------------------------------------------
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 5
- Automated Basic Authenication with an Applet for the Browser ?I like to automate web access to secure pages and proxies, which are
proteced with a Basic Authenication scheme.
The Basic Authentication within an Applet works really well, I get all
the information I need when I attach the
Authorization: Basic base64encodeUID_PW to the request Header.
or
if I use the Authenticator Class of the JDK1.5.
My problem is that the browser does not notice that I already have
a UID/Password combination for the desired web page.
When I did the same with a form based authorisation the URLConnection
was setting the Cookie inside the browser implicitly, the
showDocument() method displayed the secure page, because the browser
used the cookie to access it.
Is there any way to access the cache for the UID and Password of the
browser to set these values that when I invoke the showDocument() to
display the page inside the browser, I don't have to enter the UID and
Password again?
My current code to authenticate myself is this, I also tried a direct
socket connection and a HttpURLConnection there was no difference:
String urlString =
"http://www.demo.com/basicprotectedpage/index.html"
AppletContext appCont = getAppletContext();
//created password authenticator.
mmAuthenticator myPassAuth = new mmAuthenticator(uid,pw);
//setting password.
Authenticator.setDefault(myPassAuth);
//URL created.
URL url = new URL(urlString);
//opening connection
URLConnection conn = url.openConnection();
//setting do input and do output.
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(true);
//Data Input Stream
BufferedReader bin = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
String inputLine;
System.out.println("web page data " );
while ((inputLine = bin.readLine()) != null)
System.out.println(inputLine);
bin.close();
appCont.showDocument(new URL(urlString)); // this should
display the secure page without the prompt for uid password
Thank you in advance. Have a nice day.
FB
- 6
- 7
- User privilege for getMetaData()When using a basic user with only data query and update privileges I
cannot get column data from the DatabaseMetaData object returned from
getMetaData() (on a connection using the JDBC Oracle thin driver).
When I use the schema owner with full privileges, I get the column
data. What privilege is necessary to get column information from
getMetaData?
- 8
- Great Documentation for Investment and Trading SystemsJust wanted to let people know about a new, free Encyclopedia for Investors
and Traders who are building or maintaining systems:
Http://www.itsdoc.org
"itsdoc" stands for "It's Documentation."
The site attempts to provide highly accurate documentation in an
encyclopedia format. It's 100% free, with no
advertising whatsoever and no soliciting. The entity is entirely non-profit.
Users are invited to contribute high quality material to the site and also
draw
from the considerable knowledge base hosted there. If you are coding
investment
and trading systems you will probably find this site extremely helpful.
It's new, the official launch isn't until January so the site has a few
rough
edges right now. Still, its very useful.
I hope you get a lot out of it. Please help promote it and put something
back into it too.
Rick
- 9
- ReportViewer.jarI need ReportViewer.jar file which is required to call Crystal Reports
within Java. All other required .jar files, I have got.
Please provide me this file at <email***@***.com>
imediatly, if you have. I will be very thankfull to you.
HERE IS CODE:-
*/
import java.awt.*;
import javax.swing.*;
import com.crystaldecisions.ReportViewer.*;
// Use these to talk to RAS
import com.crystaldecisions.sdk.occa.report.application.*;
import com.crystaldecisions.sdk.occa.report.reportsource.*;
public class HelloWorldSwing
{
private static void createAndShowGUI()
{
try
{
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(false);
//Create and set up the window.
JFrame frame = new JFrame("HelloWorldSwing");
frame.setTitle( "Testing 1, 2, 3");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ReportViewerBean viewer = new ReportViewerBean();
viewer.init( new String[0], null, null, null);
ReportClientDocument rpt = new ReportClientDocument();
// FLui: set the RAS server if you are using RAS
rpt.setReportAppServer( "localhost" );
rpt.open( "ras://C:\\Reports\\MyReport.rpt", 0 );
IReportSource rptSource = rpt.getReportSource();
viewer.setReportSource( rptSource );
frame.getContentPane().add( viewer, BorderLayout.CENTER );
frame.setSize( 700, 500 );
frame.setVisible(true);
viewer.start();
}
catch ( Exception exception )
{
System.out.println( exception.toString() );
}
}
public static void main(String[] args)
{
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
//
com.crystaldecisions.ReportViewer.ReportViewerFrame.main( args );
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
createAndShowGUI();
}
});
}
}
- 10
- Connection Pooling in Java application for interacting with Websphere MQI have following infrastruture at my site.
1> Machine #1 has below
- Websphere MQSeries 6.0 (client setup - Slim Client)
- OS = Windows 2003
- i/p address : 10.1.11.10
- Tomcat web server 5.5
- No Websphere Application Server.
2> Machine #2 has below
- Websphere MQSeries 6.0 (Server setup)
- OS = Windows 2003
- i/p address : 10.1.11.21
- Queue Manager Name : qMngr
- Queue Name (client will put the message) : toServerQ
- Queue Name (client will get the message) : fromServerQ
- I have developed the web application in Tomcat web server 5.5 using
MQ base classes for accessing the Websphere MQ.
- Since it is web application there can be atleast 25 request at
time.
i.e. when client#1 request data from queue he must get data related
to client#1 only not other than client#1.
- For accessing the websphere MQ, I am using websphere MQ base classes
in Client mode. (Not JMS)
==>>>> Source Code as follows
Class MQInterface (Servlet) is used for getting the web request from
user and reply the response in html format.
------------------------------------------------------------------------------------------------------
public class MQInterface extends HttpServlet {
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String Output = "";
System.out.println("!! Entered into Banking Servlet !!");
String requestParam = request.getParameter("OPRN_CODE");
if (requestParam.equalsIgnoreCase("GET_NAME_DETAIL")){
String id = request.getParameter("id");
Output = MQDataObject().getNameDetail(id);
return Output;
}
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println(Output);
}
Class MQDataObject is used for getting and putting data(message) into
Websphere MQ.
------------------------------------------------------------------------------------------------------
public class MQDataObject {
private String hostname = "10.1.11.21";
private String channel = "Chnl1";
private String qManager = "qMngr1";
private MQQueueManager qMgr;
private ISISSSLAdaptor ssl;
private ISISConfigHelper ConfigHelper;
private String Output;
public MQDataObject(){
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_CLIENT);
MQEnvironment.sslCipherSuite =
"SSL_RER_WERH_3KIUD_EQW_CRT_SSA";
try{
ssl = new DEMOSSLAdaptor("DEMOSSLAdaptor.config");
ConfigHelper = new
ISISConfigHelper("MQConnection.config");
}catch(Exception exception){
System.out.println("Exception Details => " + exception);
}
}
public String getNameDetail(String sendMessage){
....
....
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_CLIENT);
String msgText = "";
try
{
....
....
// Create a connection to the Queue Manager.
qMgr = new MQQueueManager(qManager);
// Set up the options on the queue we wish to open
int openOutOptions = MQC.MQOO_OUTPUT;
// Specify the queue to open and open option
MQQueue sendingQueue =
qMgr.accessQueue("toServerQ",openOutOptions,null,null,null);
// Define the MQ message and write some text in UTF
format
MQMessage sendingMessage = new MQMessage();
sendingMessage.writeUTF(sendMessage);
// Specify the message options..
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put message on the queue
sendingQueue.put(sendingMessage,pmo);
// Close Sending Queue
sendingQueue.close();
// Receiving the message back
// Wait for 5 seconds to get reply from receiving queue
Thread.sleep(5000);
// Set up the options on receiving queue we wish to open
int openInOptions = MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_OUTPUT;
MQQueue receivingQueue =
qMgr.accessQueue("fromServerQ",openInOptions,null,null,null);
MQMessage receivingMessage = new MQMessage();
// Set and Get the message options
MQGetMessageOptions gmo = new MQGetMessageOptions();
// Receiving the message off the queue.
receivingQueue.get(receivingMessage,gmo);
// Get the message from the receiving queue.
msgText =
receivingMessage.readStringOfByteLength(receivingMessage.getMessageLength());
// Close Receiving Queue
receivingQueue.close();
// Close a connection to the Queue Manager.
qMgr.disconnect();
// Parse the received message using parser.
String output = new IFXXMLParser().runExample(msgText);
}
catch (MQException mqex){
System.out.println("MQ Error : " + mqex);
}
catch (Exception ex){
System.out.println("General Error : " + ex);
}
return Output;
}
}
The message for sending the receiving is in XML format.
Could any one help me following in questions.
1> Since there is 30 request at time so for improve the performance
and resources I need to do connection pooling.
How can I achieve this using base classes.
2> While retrieving (getting) the message for particular request how
can I identify the response message.
i.e. when client#1 request data from queue he must get data related
to client#1 only not other than client#1.
because In above scenario there are separate queues for getting the
message and putting the message.
I have read the tutorial on connection pulling but I am little
confused.
Thanking in Advance
Sanjeev
- 11
- A little optimization question: Local var allocationI often wonder: Does it make any difference in EXECUTION TIME which
version I choose:
#1:
String st;
while (true){
st=dis.readLine();
if (st==null) break;
< do something else >
}
#2:
while (true){
String st=dis.readLine();
if (st==null) break;
< do something else >
}
It's obvious that st is valid outside the loop in #1. But does it get
allocated on the stack for every iteration in #2, or just re-used? If
not, I suppose #2 is preferred as far as limiting the scope, enabling
gc, is an issue.
Chris
- 12
- MacOS X (was javax.usb)Steve W. Jackson wrote:
>>http://en.wikipedia.org/wiki/Macos#Mac_OS_X
>>
>>Mac OS X brought Unix-style memory management and pre-emptive
>>multitasking to the Mac platform. It is based on the Mach kernel and the
>>BSD implementation of UNIX, which were incorporated into NeXTSTEP, the
>>object-oriented operating system developed by Steve Jobs's NeXT company.
>>
>>Cheers,
>
>
> That's an interesting read, but it should not be taken as any form of
> "gospel" since it contains some inaccuracies of its own.
It's easily fixable, should you be so inclined. What's wrong with it
though - it's what I've read in the past, that MacOS X is the Mach
microkernel (tightly) wed to bits and pieces of a BSD (I'm not sure
which, I think FreeBSD or NetBSD).
--
David N. Welton
- http://www.dedasys.com/davidw/
Linux, Open Source Consulting
- http://www.dedasys.com/
- 13
- JTextArea append method doesn't always appendI have an application with many custom loggers, and a number of JTextArea
instances for displaying the log entries written to the loggers. Each
JTextArea has a thread associated with it that continuously pulls entries
out of a particular logger and appends that text to the JTextArea. Thus,
each entry written to a logger should show up in the associated JTextArea.
The problem I have is that not all the log entries show up in the text area,
and what shows up and what does not can change with each execution. I've
put print statements before and after the log statements, and before and
after the text area append, and all the expected log entries show up at all
those places. Only in the JTextArea is there variability in what shows up.
Is this a bug in JTextArea, or is this some known behavior?
--
=================
Lee Graba
email***@***.com
=================
- 14
- Mixed SAX and DOM processing: echoing with occassional changes.I need to write a tool which will allow me to process a huge document
with chunks of it in memory. The procedure is to echo XML coming from
some input to an output, then when I hit a certain type of element,
read all of its children into a DOM and somehow manipulate it
(specifically, the goal is to hand it to a rules engine which will add
flags). After that is complete, serialize it right back out to the
stream and resume processing.
My approach currently involves a ContentHandler object which simply
serializes every event using a TransformerHandler object. When I see
the element I want, I start creating Node objects in a stack and
assembling them into a DOM as I hit closing elements. The problem is
that there is no direct way of serializing that DOM to the same output
stream without violating encapsulation. At first I thought that I
would be able to pass the DOM to a SAX ContentHandler (which I would
provide with a reference to the TransformerHandler doing the
serialization). However, it turns out that isn't the case. I do not
want to reinvent the wheel and walk the DOM manually nor do I want to
create (potential) side-effects by writing directly to the OutputStream
wrapped by my Result object using XMLSerializer on the DOM. XMLFilters
do not appear to be a solution because I cannot apply my rules in a
streamable fashion (and getting a DOM from the incoming stream is not
the difficult part anyway).
I've looked around and found a variety of mixed parsing techniques, but
it seems that none of them quite meet my needs. Writing a class which
takes a DOM, walks it, then calls the appropriate ContentHandler
methods would not be too painful, but this seems horribly inelegant to
me. Also, I cannot even begin to fathom that I am the only person who
wants to do this.
Any suggestions?
(What follows is some code which may give an idea of where I am at.
Simplified for brevity.)
// Initial invocation
final SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
final SAXParser parser = factory.newSAXParser();
final XMLReader reader = parser.getXMLReader();
final TransformerHandler handler = getTransformerHandler(System.out);
reader.setContentHandler(new EvaluationHandler(handler));
reader.parse("foo.xml");
// EvaluationHandler (derives from a class which echoes to a provided
ContentHandler)
public void startElement(final String uri, final String localName,
final String qName, final Attributes attributes) throws SAXException
{
if (performDOMProcessing())
{
final Element element = this.host.createElementNS(uri, qName);
addAttributes(element, attributes);
this.buffer.push(element);
}
else
{
super.startElement(uri, localName, qName, attributes);
}
}
public void endElement(final String uri, final String localName, final
String qName) throws SAXException
{
if (performDOMProcessing())
{
final Node element = this.buffer.pop();
if (this.buffer.isEmpty())
{
if (this.host.hasChildNodes())
{
final Element root = this.host.getDocumentElement();
this.host.removeChild(root);
}
this.host.appendChild(element);
// Do processing against this.host with rules engine.
// Pass off to serialization.
}
else
{
this.buffer.peek().appendChild(element);
}
}
else
{
super.endElement(uri, localName, qName);
}
}
public void characters(final char[] characters, final int start, final
int length) throws SAXException
{
if (performDOMProcessing())
{
final String text = new String(characters, start, length);
final Text textNode = this.host.createTextNode(text);
this.buffer.peek().appendChild(textNode);
}
else
{
super.characters(characters, start, length);
}
}
- 15
- Struts Readonly...Hi,
can anybody tell me, if it's possible to set sturts fields in an jsp
site to readonly via an action?
Hope it is understandable what I want, my englisch isn't the best...
Greetings
Laverna
|
|
|