 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- [junit] Disabling OutputHi,
I have several test cases where I want the output to be displayed when I run
the TestRunner class as a stand-alone app. But, I also want to run a test
suite within an application of mine, but have the System output disabled...
is there a way in the JUnit API to disable the text that is displayed?
Thanks
- 3
- slow axis performance vs JAX-RPC?hi..
i've been mainly using axis framework for webservices becouse it's
simpler, how ever i was told it's the slowers implementions of them
all, are there any non-commercial frameworks ? simple to use? (and
production ready not beta).
- 5
- Math.IEEEremainder vs. %Today I encountered some code using Math.IEEEremainder to calculate the
remainder of two ints, for a simple pagination calculation. I normally
would just use %, but I'm wondering if anyone knows of a specific
reason to use Math.IEEEremainder for this type of calculation instead.
- 5
- difference between endorsed and lib folders?hi..
can somone please explain to me what is the difference between the
endorsed and lib folders in common folder in tomcat? i tried reading
the documentation but i couldn't figure it out.
- 8
- JSTL & Source Code
JavaScript and CSS programmers have for years, been looking for the
"holy grail", i.e., the ability to hide source code.
Take at look at www.dice.com, do a job search then view source.....
nothing there except JSTL noatation per below:
-------------------------- start -------------------------------------
<!--
* $RCSfile: abbreviated.jsp,v $
* $Author: duket $
* $Date: 2005/06/15 13:36:17 $
-->
<!-- START JSTL_INITIALIZATION -->
<!-- FINISH JSTL_INITIALIZATION -->
------------------------ end -----------------------------------------
Was not aware that a fringe benefit of JSTL was the ability to hide
html source code. How secure is this? Can someone hack it to get the
html source?
I'm one of those Java/JavaScript/CSS programmers that has created
graphics with CSS on Web pages and would like to keep the code
private. I have found a crude way but I like the above better.
Thanks
- 8
- static funtionsHello
i have some simple question reguarding static functions:
If i have some class that implements a static function that is called
from many places inside the app would every call have to wait for
termination of a previous call to that static function?
The function is not defined as synchronized.
If not, how is this realized in java? I mean if i understood it right
static functions are functions of the class not of any object so this
function should not be present more than once in memory right? Would i
overwrite the functionstate if i'd call the function eg. from more
threads?
_thanks for your info in advance
PS: the function does some DB calls in a tomcat app where some thousend
people call the function within short time and i'd like to avoid the
waiting, so i thought of changing the function to be nonstatic but
first i'd like to understand how static functions work :)
- 8
- Referencing enclosing class from inner classHi everyone,
I'm trying to understand inner classes, but came across the following
problem. If I define two types (one is an inner class), and each type
has a method with the same name, is there a way that I can call the
enclosing instance's method from within an instance of the inner class?
I'm guessing that (as per the example pasted below) the getValue()
methods aren't overloaded or overridden because the two classes don't
participate in super-class/sub-class OO relationship. I'd be grateful
for any insight.
Thanks,
Jonathan
public class EnclosingClass {
private int _value = 100;
private class InnerClass
{
public int getValue()
{
return _value * 2;
}
public void println()
{
System.out.println(getValue()); //<-- inner
System.out.println(getText()); //<-- enclosing
}
}
public int getValue()
{
return _value;
}
public String getText()
{
return "hello!";
}
public static void main(String[] args)
{
// create an instance of both classes and call the println method of
the inner class
new EnclosingClass().new InnerClass().println();
}
}
- 9
- Taglib to build smart html tablesHello,
I need to build smart html tables (with sortable columns, merged cells,
pictures, different colors and fonts, etc -- all the kind of stuff html &
javascript allow).
I recall I've seen here a post a while ago of such an impressive component,
but I can't find it. :-(
Do you know such components ?
Thanks.
- 11
- [ANNOUNCE] DataDirect Technologies Releases DataDirect XQuery to Simplify XML and Relational Data Integration[ANNOUNCE] BEDFORD, Mass.--Sept. 20, 2005--DataDirect Technologies
(http://www.datadirect.com), the software industry leader in
standards-based components for connecting applications to data and an
operating unit of Progress Software Corporation, today announced the
release of DataDirect XQuery(TM), the first embeddable component for
XQuery that is modeled after the XQuery API for Java(TM) (XQJ).
Developers can download a free trial of DataDirect XQuery today at:
http://www.datadirect.com/downloads/registration/xquery/index.ssp
"Internet developers typically spend much of their time creating and
restructuring XML, using data from many sources, generally including
relational data. This task is much too tedious in most environments.
Using DataDirect XQuery, which is based on the W3C's XML Query
(XQuery), simplifies the programming task significantly, solving the
same problems with much less code," said Jonathan Robie, Program
Manager for DataDirect XQuery and an editor of the W3C XQuery
specification. "Using DataDirect XQuery means that your applications
can run on any Java platform, accessing data from the major relational
databases, using any Web server or application server, or using no
server at all. And DataDirect XQuery performs quite well, even when
your query creates large XML results."
DataDirect XQuery supports all major relational databases, including
Oracle, Microsoft SQL Server 2000, IBM DB2, and Sybase, on any Java
platform, allowing developers to query XML, relational databases, or a
combination of the two. Query results can be used for XML-based data
exchange, XML-driven Web sites, and other applications that require or
leverage the power of XML. DataDirect XQuery provides IT professionals
with a highly productive, powerful, simple, and standards-based
approach to XML and relational data integration.
Simplifying XML and Relational Data Integration
DataDirect XQuery simplifies XML and relational data integration by
providing developers with an XQuery implementation that offers greater
productivity, performance and interoperability for building
standards-based data integration applications, and here's how:
?Productivity: Web services, Web sites, data integration, and
publishing are just a few examples of the many types of applications
that need data from many sources, including relational and XML. For the
first time, DataDirect XQuery enables developers to easily process both
XML and relational data using industry-standard XQuery. DataDirect
XQuery simplifies application development by reducing the amount of
code developers write and maintain to use XML and relational data
together. The result: reduced application complexity, shorter
development cycles and more powerful applications - all based on the
current W3C XQuery standard yet to be finalized.
?Performance: DataDirect XQuery optimizes and mediates query
performance when accessing relational data. DataDirect XQuery is
designed to move the minimum amount of data out of the database - for
example, XQuery code is converted to SQL statements which are executed
on the database server - thus providing the best performance possible.
?Interoperability: It's easy to embed DataDirect XQuery in
applications: it does not require any other product or application
server, it has no server of its own, it is not tied to a specific
vendor database or database version, and it is based on the current
version W3C XQuery and XQuery API for Java (XQJ) standards yet to be
finalized. Application developers can write one easy-to-maintain
application, regardless of the databases and versions they are using -
Oracle, DB2, Microsoft SQL Server, or Sybase. This approach results in
more extensible and interoperable applications which are insulated from
the frequent database updates and changes in the database vendor tools.
"In the past, our web-based XML Human Resources applications generated
and sent XML data using data stored in an Oracle database," said Mark
Zimmerman, VP of IT, at Gevity, a leading provider of employee
management solutions. "We found DataDirect XQuery to be fast, scalable,
and reliable. And because DataDirect XQuery allows us to leave the data
access code in the middle tier, and not tied to a specific database,
our application is insulated from any changes in the back end,
improving application interoperability. Overall, we're very pleased
with DataDirect XQuery."
"Most XQuery implementations either work only with XML files in memory,
or are bound to a particular database or application server - these are
serious restrictions if your organization or partners have different
databases, require scalability, or need to integrate with legacy data,"
said Jerry King, Vice President of the XML Products Group at DataDirect
Technologies. "DataDirect XQuery is the first and only product that
truly makes your XQuery just as portable as your XML - you can use it
on any Java platform, with any major relational database, and it
integrates seamlessly with your Java applications using an industry
standard query language and processing API. DataDirect XQuery is a
quantum leap forward in data integration technology, providing
developers with more power, performance and interoperability than ever
before, and developers can download and try it out today."
Availability
DataDirect XQuery is available today. For more information, please
contact Nancy Vodicka at 919-461-4326, or visit our Web site at
www.datadirect.com/xquery. Developers can also download the DataDirect
XQuery for a free 15-day trial at:
http://www.datadirect.com/downloads/registration/xquery/index.ssp
About DataDirect Technologies
DataDirect Technologies is focused on standards-based data
connectivity, enabling software developers to quickly develop and
deploy business applications across all major databases and platforms.
DataDirect Technologies offers the most comprehensive, proven line of
data connectivity components available anywhere. Developers worldwide
at more than 250 leading independent software vendors and thousands of
corporate IT departments rely on DataDirect?products to connect their
applications to an unparalleled range of data sources using
standards-based interfaces such as ODBC, JDBC and ADO.NET. Developers
also depend on DataDirect to radically simplify complex data
integration projects using XML products based on the emerging XQuery
and XQJ standards. DataDirect Technologies is an operating unit of
Progress Software Corporation, a US$300+ million global software
industry leader. Headquartered in Bedford, Mass., DataDirect
Technologies can be reached on the Web at www.datadirect.com or by
phone at +1-800-876-3101.
DataDirect and DataDirect XQuery are trademarks or registered
trademarks of DataDirect Technologies Corp. in the U.S. and other
countries. Java and all Java based marks are trademarks or registered
trademarks of Sun Microsystems, Inc. in the U.S. and in other
countries. Any other trademarks contained herein are the property of
their respective owner
Contact:
DataDirect Technologies
Nancy Vodicka, 919-461-4326
email***@***.com
- 11
- Finding memory leak in big appI have an application that uses a lot of memory (up to a gig) and I'm
trying to track a memory leak. The problem is that all of the tools I've
found can't handle such large heap sizes. They generally just run out of
memory themselves.
The bulk of the memory is taken up by double[] and char[], but I need to
know who owns these arrays so I can see why there are so many of them. Is
there any tool that will let me track object ownership, or just give me a
useful heap dump that I can parse myself?
I'm running this on red hat advanced server 4 proc/8gig ram.
I can work with any jdk that's version 1.4.0_01 or higher.
Thanks
- 11
- Error Installing Jboss ServerHi,
I am trying to install Jboss application server on linux. When I ran sh
run.sh from Jboss Bin Directory, It gave me the following
messages/Errors.
JBoss Bootstrap Environment
JBOSS_HOME: /home/cabig/jboss-4.0.2
JAVA: /usr/java/j2sdk1.4.2_11/bin/java
JAVA_OPTS: -server -Xms128m -Xmx128m -Dprogram.name=run.sh
CLASSPATH:
/home/cabig/jboss-4.0.2/bin/run.jar:/usr/java/j2sdk1.4.2_11/lib/tools.jar
=========================================================================
Failed to boot JBoss:
java.lang.ClassNotFoundException: org.jboss.system.server.ServerImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
org.jboss.system.server.ServerLoader.createServer(ServerLoader.java:271)
at
org.jboss.system.server.ServerLoader.load(ServerLoader.java:253)
at org.jboss.Main.boot(Main.java:187)
at org.jboss.Main$1.run(Main.java:463)
at java.lang.Thread.run(Thread.java:534)
Kindly let me know what the error is ? How to solve this ?
Appreciate your Help,
Thanks
shan
- 12
- how to add double key listenerhi,
i want to catch the key event when SHIFT+TAB are pressed simultaneously
to shift focus to the previous focusable component. the key event is
caught on a JComboBox. if somebody knows the code to do so plz post it.
thanx in advance.
- 14
- JPogressBar does not update UIHi,
i would like to show a JProgessBar during a longer process. I can show
it, but I cannot get the JProgressBar to update the UI, so it just
appears and at the end it disappears again, but it's not changed in the
meantime.
Example code, JProgressBar in JDialog, Java 1.4.2:
public class DialogProgressBar extends JDialog {
private JProgressBar jpb;
public DialogProgressBar(String title, java.awt.Frame owner, boolean
modal) {
super(owner, title, modal);
jpb = new JProgressBar();
jpb.setStringPainted(true);
this.getContentPane().add(jpb, java.awt.BorderLayout.CENTER);
setSize(300,50);
}
public JProgressBar getProgressBar() {
return jpb;
}
}
and that's how I use the Dialog/JProgressBar.
...
DialogProgressBar pb = new DialogProgressBar("Titel", dialog, false);
...
public void actionPerformed(ActionEvent aE) {
...
else if(cmd.equals("mniSynchronize")) {
int selectedRows = 3;
pb.getProgressBar().setMinimum(0);
pb.getProgressBar().setValue(0);
pb.getProgressBar().setMaximum(selectedRows);
pb.setVisible(true);
for(int i=0;i<selectedRows;i++) {
switch(i) {
case 1: pb.getProgressBar().setString("file001");
storeFiletype001();
break;
case 2: pb.getProgressBar().setString("file002");
storeFiletype002();
break;
case 3: pb.getProgressBar().setString("file003");
storeFiletype003();
break;
}
pb.getProgressBar().setValue(i+1);
}
pb.setVisible(false);
}
}
Thanks,
Aloys
- 16
- Certification is a must in MNCs,the comming Future.Certification is a mark of excellence that you carry with you
everywhere you go.
Integer is a authorised testing center for .Net, Java, J2EE, Testing
etc..... for the clients like Microsoft, Sun, IBM, Exin, Lotus and
many more...
We offer certifications on:
Microsoft
Sun Microsystem
Adobe Systems
Cognos
Comptia
CWNP
EMC2
Enterasys Networks
Exin
Help Desk Institute
Huawei
IBM
Juniper Networks
and many more...
For more details Visit: http://www.integerblr.com
For Registration: http://www.integerblr.com/registration/thomsonprometric.asp
Regards
Ramesh
- 16
- To getenv or not getenvI'm using 1.4.2 for some commecial development. I was just about to set
a property and pass it on the command line when I noticed that System.getenv is
not deprecated in 1.5.0. So is it bad form to use a deprecated 'getenv'
in 1.4.2 given its new lease of life in 1.5.0??
Being 'allowed' to use getenv would make certain parts of the program
more expressive.
Cheers,
Lordy
|
| Author |
Message |
nayajd

|
Posted: 2005-5-10 16:47:00 |
Top |
java-programmer, redirect problem
Hi everyone,
I have a problem, I am connectin to a lotus notes database to download
a file (using URLConnection)
...gbp.nsf/agWebLAL?OpenAgent&UNID=A9D19EDE65447DF5C1256F2000465E87
The thing is lotus notes doesn't give the filename, it redirects me to
something first, then downloads the filename..
Does anyone know of a way on how I can get the final url (the place
where I am being redirected), filename and mimetype
Thanks!
|
| |
|
| |
 |
Will

|
Posted: 2004-4-1 12:48:00 |
Top |
java-programmer >> redirect problem
Test server: Remote server:
Windows XP pro. Linux
Apache 1.3.27 Apache 1.3.27
PHP 4.3.4 PHP 4.3.2
I did a phpinfo() on the two servers and I did n't see any differences
that I thought would cause this but then what do I know.
Pedro Graca wrote:
> Will wrote:
>
>>I downloaded a PHP webcounting script from the web. I got it working on
>>my home test server but the same thing does not work when I put on my
>>hosting server.
>
>
> What are the differences between the two servers?
> Linux/Windows?
> IIS/Apache?
> PHP 4.1.0/PHP 5.0.0?
>
> and most importantly
> home php.ini / host php.ini ?
>
>
> Try inserting at the top of your scripts the two lines that follow so
> that PHP will report the use of uninitialized variables:
>
> error_reporting(E_ALL);
> ini_set('display_errors', '1');
>
>
> Happy Bug Hunting :)
|
| |
|
| |
 |
Pedro Graca

|
Posted: 2004-4-1 16:49:00 |
Top |
java-programmer >> redirect problem
Will wrote:
> I downloaded a PHP webcounting script from the web. I got it working on
> my home test server but the same thing does not work when I put on my
> hosting server.
>
> the string that calls the script is:
><a href="webcounter.php?src=http://www.cnn.com"> CNN </a>
>
>
> The code that handles it is:
>
> $extra_ext = "redirect:";
>
> if (basename($PHP_SELF)=="webcounter.php") {
> // we are indexing a different file
> $source = $_GET['src'];
>
> $tmp = substr($source, 0, 6);
>
> if ($tmp=='http:/' || $tmp=='https:' || $tmp=='ftp://') {
> $location=$source;
> $rpage = $extra_ext.$source;
>
> }
> else {
> $location=$rootpage.$source;
> $rpage = $extra_int.$source;
> }
> webcounter ($ctype,$rpage);
> header ("Location: $location");
Maybe your problem is not the header call, but something on the
webcounter function ...
Try a echo() before and after the call to webcounter()
// since you're debugging this turn on error reporting too
error_reporting(E_ALL);
ini_set('display_errors', '1');
echo 'before webcounter()';
webcounter($ctype, $rpage);
echo 'after webcounter()';
header('Location: ' . $location);
> exit;
> }
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
|
| |
|
| |
 |
John

|
Posted: 2006-7-11 22:18:00 |
Top |
java-programmer >> redirect problem
Hi
I have a page running in a sub folder. In this page I try to redirect to a
page in the Parent (main) root folder of the site like
Response.Redirect("..\staff_login.asp"). The url in the browser
unfortunately translates as;
http://www.mydomian.com/Folder/..%5Cstaff_login.asp
instead of;
http://www.mydomian.com/staff_login.asp
What is the problem and how can I fix it?
Thanks
Regards
|
| |
|
| |
 |
Ray Costanzo [MVP]

|
Posted: 2006-7-11 22:57:00 |
Top |
java-programmer >> redirect problem
Use a forward slash instead of a backslash.
Ray at work
"John" <email***@***.com> wrote in message
news:email***@***.com...
> Hi
>
> I have a page running in a sub folder. In this page I try to redirect to a
> page in the Parent (main) root folder of the site like
> Response.Redirect("..\staff_login.asp"). The url in the browser
> unfortunately translates as;
>
> http://www.mydomian.com/Folder/..%5Cstaff_login.asp
>
> instead of;
>
> http://www.mydomian.com/staff_login.asp
>
> What is the problem and how can I fix it?
>
> Thanks
>
> Regards
>
|
| |
|
| |
 |
gauravkg via DotNetMonster.com

|
Posted: 2006-8-23 16:08:00 |
Top |
java-programmer >> redirect problem
i have twp pages add,and preview
i add page i am doing data entry
i preview i am previewing the data.
n preview have edit button iwant on clicking edit it should go back to add
page with the values of preview page how can i do it.
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200608/1
|
| |
|
| |
 |
Cowboy (Gregory A. Beamer)

|
Posted: 2006-8-23 21:12:00 |
Top |
java-programmer >> redirect problem
Put two panels on a single page pnlAdd and pnlPreview. You now have all of
the data you desire on a single page, but it appears to be two pages for the
user.
When the user clicks the button to "submit" (or preview) on the add page,
you hide the add panel and show teh preview panel. If he clicks the back
button on preview, you show the add panel and hide the preview panel. If he
clicks submit, you can show a third panel: pnlFinished that says he added to
the database.
That is one idea.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************************************************
Think Outside the Box!
*************************************************
"gauravkg via DotNetMonster.com" <u25584@uwe> wrote in message
news:653058dfc1fdb@uwe...
>i have twp pages add,and preview
>
> i add page i am doing data entry
> i preview i am previewing the data.
>
> n preview have edit button iwant on clicking edit it should go back to add
> page with the values of preview page how can i do it.
>
> --
> Message posted via DotNetMonster.com
> http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200608/1
>
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- coordinating eventsHi there,
I'm having difficulty trying to coordinate the sequence of events for
populating a JTree with data received from a server app. I'm so-o-o-o close
and yet no banana! It's proving to be very tricky processing. I could use
some help in trying to make this work properly. Perhaps you may understand
better as to why my efforts are being thwarted by the either the JTree
object or its DefaultTreeModel?
Here's the setup:
1) I have a server app that, when requested from the client app, will
provide a child count on any given directory node on the server. Also, it
will serve up the names of each child node for any given node upon request.
2) The client app contains a JTree object that I'm trying to initially
populate with the root node. Subsequently, the plan is to dynamically
populate any directory node in the JTree whenever the treeWillExpand( ... )
event is triggered as the user tries to expand on a node.
3) Throughout my code I have a number of System.out.println( ... )
statements so that I can see what sequence of events are taking place as the
client app makes requests to the server and receives replies back from the
server. Also, some println(...) statements in some key methods which you'll
see.
4) The sequence of events is supposed to go like so:
i) root node is created
ii) as the root node is passed as a parameter when creating the JTree
object
the getChildCount( ) method of the root node [type DefaultTreeNode
extends DefaultMutableTreeNode ]
is called.
public int getChildCount()
{
if (!hasChildren)
{
defineChildNodes();
}
return(super.getChildCount());
}
iii) Since the root node initially has no children, getChildCount( )
then calls the method
defineChildNodes( ).
protected void defineChildNodes()
{
hasChildren = true;
ref.requestChildCountFromServer(this);
}
As you can see, defineChildNodes( ) simply sets the flag
hasChildren to true then
calls a method requestChildCountFromServer(this) which exists in a
class called Response
referred here by the variable "ref". Also in the Response class
there exists the method
populateTree( ) which initially created the root node and JTree
objects:
protected void populateTree(String NodeName)
{
//System.out.println("Entering populatTree() method");
//This could take a while, so change the cursor icon
//ref.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try
{
String separator = "";
if(ref.serverOS.equals("Windows"))
separator = "\\";
else
separator = "/";
rootNode = new DefaultTreeNode(NodeName, true, separator);
expandingNode = rootNode;
String rootPath = getLeadingPath(ref.rootPath);
rootNode.setLeadingPath(rootPath);
rootNode.setResponseReference(this);
jTree1 = new JTree(rootNode);
jTree1.setRootVisible(true);
jTree1.setShowsRootHandles(true);
jTree1.collapseRow(0);
MouseListener popupListener = new PopupListener(ref);
jTree1.addMouseListener(popupListener);
//Listen to our own expand/collapse events to keep the labels in
sync
jTree1.addTreeWillExpandListener(this);
}
catch(Exception e){System.out.println("Exception in populateTree()
method"); e.printStackTrace();return;}
....
....
}
iv) The requestChildCountFromServer( ) method then makes a request to
the server app for
the child count for the root node.
v) I have a separate thread running that listens for all responses
from the server
called ResponseListener. In its run( ) method I have the
following code:
else if(connected == ref.ref.SENDING_CHILDCOUNT)
{
System.out.println("Received message: ReceivingChildCount");
ref.expandingNode.numChildren = input.readInt();
//expandingNode.setReceivedChildCount(true);
ref.ref.imageLabel.setIcon(ref.ref.blank);
ref.ref.textLabel.setText("");
}
When the root node was originally created I set a reference to it
using a variable
named expandingNode. Here you can see that the root node's
instance variable
named numChildren is set to a value read in by the DataInputStream
object
named input.
vi) The requestChildCountFromServer( ) method in turn calls another
method in the
Response class named RequestChildrenFromServer(String path).
RequestChildrenFromServer(String path) method requests from the
server the names
of all the child nodes for the root node.
vii) ResponseListener then receives a response from the server:
else if(connected == ref.ref.SENDING_TREE_DATA)
{
System.out.println("Received message: SendingTreeData");
ref.expandingNode.TreeDataIncoming = true;
ref.expandingNode.ReceiveChildrenFromServer(input);
ref.ref.imageLabel.setIcon(ref.ref.blank);
ref.ref.textLabel.setText("");
}
Here you can see that the root nodes method named
ReceiveChildrenFromServer(input) is then called
while passing it a reference to the DataInputStream so that the
method can
read in the names of the child nodes as they come in over the
wire.
viii) The root node's method ReceiveChildrenFromServer(input) then
begins receiving the
names of each child node, creates a new DefaultTreeNode object
for each child node
and adds it to the root node, seen below:
protected void ReceiveChildrenFromServer(DataInputStream input)
{
System.out.println("Entering ReceiveChildrenFromServer()");
DefaultTreeNode child = null;
String name = "";
try
{
//ref.ref.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//System.out.println("numChildren = " + numChildren);
int nodeType = 0;//default
//iterate through each of the children as they come in
//from the server.
for(int i = 0; i < numChildren; i++)
{
name = input.readUTF(); //get the name
System.out.println("child node: " + name);
child = new DefaultTreeNode(name); //create a new
child node
//determine if this node is a directory
//or a file. Empty directories are denoted
//as having (nodeType == -1)
nodeType = input.readInt();
//System.out.println("node type: " + nodeType);
if(nodeType == 0)
{
//Since a file is a leaf node
//we won't be needing to continue
//reading in nodes for it.
child.setResponseReference(ref);
child.setAllowsChildren(false);
child.setHasChildren(false);
child.setLeadingPath(getWholeServerPath());
if(ref.ref.serverOS.equals("Windows"))
child.setSeparator("\\");
else
child.setSeparator("/");
}
else if(nodeType == -1)
{
child.setResponseReference(ref);
child.setAllowsChildren(true); //It's an empty
directory
child.setHasChildren(false);
child.setLeadingPath(getWholeServerPath());
if(ref.ref.serverOS.equals("Windows"))
child.setSeparator("\\");
else
child.setSeparator("/");
}
else
{
child.setResponseReference(ref);
child.setAllowsChildren(true); //It's a directory
with child nodes
child.setHasChildren(true);
child.setLeadingPath(getWholeServerPath());
if(ref.ref.serverOS.equals("Windows"))
child.setSeparator("\\");
else
child.setSeparator("/");
}
this.insert(child,i);
}//end for loop
//ref.ref.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}//end try
catch(IOException ioe){ioe.printStackTrace();}
catch(NullPointerException npe){npe.printStackTrace();}
}//end method
IT IS HERE THAT I RUN INTO PROBLEMS!!!!
All the code you see compiles fine. What I found annoying is that, at
run-time, the sequence of events were as I depict them here until I start
reading in the names of the childnodes with the
ReceiveChildrenFromServer(...) method. While it is going through its for
loop, mysteriously the method getChildCount( ) is called again, which in
turn calls defineChildNodes( ), which in turn calls
requestChildCountFromServer(...), which interrupts the processing of the for
loop in ReceiveChildrenFromServer(...) . Here is the read out from the
console to prove it:
***************************************
Entering requestChildCountFromServer
waiting for response...
checking...
Received message: ReceivingChildCount
checking...
got ChildCount: 26 <<<Root node has 26 child nodes
Entering RequestChildrenFromServer()
path is: C:\JavaProjects
Finished calling server for children
Received message: SendingTreeData
Entering ReceiveChildrenFromServer()
checking for tree data ...
child node: AssignmentServer <<<<ReceiveChildrenFromServer(...)
method begins reading in names
child node: AssignmentSubmitter
child node: Borland
child node: ClientServerJTreeProject
child node: DBJavaBean
child node: DirAdmin.bak
Entering requestChildCountFromServer <<<This method is called by
defineChildNodes( ) which was
called by getChildCount( )
waiting for response...
checking...
checking...
Node Expanding.
checking...
checking...
got ChildCount: 0 <<< Don't know
why this is reading zero. It should be 26
child node: DirectoryAdministratorProject <<<For loop from
ReceiveChildrenFromServer(...) method
resumes reading in names
child node: EZSmtp
child node: Icon Editor
child node: images
child node: IniFileProject
child node: J2exe
child node: JCalculator
child node: JGridProject
child node: JSlideShow
child node: MSSTextEditorProject
child node: MySQL_JDBC
child node: PersonalNetSearchProject
child node: Print_Preview
child node: PropertiesFileAccessExample
child node: Sample_EBusiness
child node: SharewareProject
child node: SystemTreeProject
child node: TestProgram
child node: Thread_Pooling
child node: ZeroG
Received message: ReceivingChildCount
*****************************************
Ultimately, I wind up with a root node being displayed in the JTree that
only has maybe five or six child nodes displayed when there should be 26
child nodes.
For further clarity here are the methods requestChildCountFromServer(...)
and RequestChildrenFromServer(...):
public void requestChildCountFromServer(DefaultTreeNode node)
{
System.out.println("Entering requestChildCountFromServer");
String name = "";
try
{
//ref.ref.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
output.writeInt(ref.PATH);
output.flush();
output.writeUTF(node.getWholeServerPath());
output.flush();
output.writeInt(ref.REQUEST_CHILD_COUNT);
output.flush();
System.out.println("waiting for response...");
timer1 = new ChildCountTimer(node);
timer1.start();
timer1.join();
System.out.println("got ChildCount: " + node.numChildren);
if(node.numChildren > 0)
{
//NodeExpanding = false; //reset
RequestChildrenFromServer(node.getWholeServerPath());
//Set up TreeDataTimer so that we know we have a
//response from the server.
timer2 = new TreeDataTimer(node);
timer2.start();
timer2.join();
}
//ref.ref.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
catch(InterruptedException ie){}
catch(IOException ioe){ioe.printStackTrace();}
catch(NullPointerException npe){npe.printStackTrace();}
}
protected void RequestChildrenFromServer(String path)
{
System.out.println("Entering RequestChildrenFromServer()");
//Request Children from server
try
{
//ref.ref.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
output.writeInt(ref.PATH);
output.flush();
System.out.println("path is: " + path);
output.writeUTF(path);
output.flush();
//Sending REQUEST_CHILDREN should cause a response
//from the server: SENDING_TREE_DATA
output.writeInt(ref.REQUEST_CHILDREN);
output.flush();
//ref.ref.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
catch(IOException ioe){ioe.printStackTrace();}
System.out.println("Finished calling server for children");
}
I realize this post is rather lengthy, however, I didn't know how else to
explain my dilemma with this project. If you need more information, just
ask.
Please advise,
Alan
- 2
- openGL java and X - server: a crashHy folks,
I didn't know exactly where to post, in the end I decided for this
forum, since we are talking about java, GL4java on linux environment.
We are developing a java interface for the GIS GRASS
(http://grass.itc.it) using GL4java calls for raster visualization.
I'm not the developer that works on the GL part. On his computer
everything compiles and works alright.
When I run the application, when the first GL call comes (i assume
so), the X server shuts down and restarts. In the /var/log/message the
only line that defines what happened, is:
kdm[2232]: Server for display :0 terminated unexpectedly
Nothing else!
I use Suse 9 (I upgraded from 8.2 hoping to solve that problem, but no
way) which a Toshiba Satellite 5200-801 which loads an NVIDIA GeForce4
460 Go.
I downloaded and installed the drivers supplied by Nvidia and they
work perfect for everything but this.
I know NVIDIA to be unstable with linux nowadays, but I can't work
this way!
Has anyone encountered the same or similar problem?
Regards,
Andrea
- 3
- casting from int to byte problemit looks like I have a strange problem.
I have a small class with several byte 'properties'
and I put a values into them from int values casting them to byte..
but for some values (like 143), casting result (with (byte)) is -113???
it's the same with 147 casted to -109...
and it should be a byte value (means, there should be no negative values)..
value is lowered for 256
why?
did I missed something?
- 4
- OLAP & OLTP schemas and Java App ServerHi,
(I hope this is the right group to post this. If not I apologize and
would appreciate pointers.)
We have a Websphere Applicaiton server for our application. We plan to
have a database that is part relational and part star on DB2 UDB. We
will need an OLAP tool and may use BRIO.
Some questions on this approach:
1. What is the best way to access the OLAP schema from Java (we plan
to use hibernate but are concerned about its suitability for star
schemas).
Some things that I could think of are:
- Use hibernate on the star schema (not sure if this is the best)
- Create as many materialized views as necessary and use hibernate
- Use java objects running on the DBs JVM (db optimized jvm implying
better performance?)
2. Is Brio the right tool to use for this scenario?
I ask because we can't have direct integration with the J2EE
applicaiton server (We have to give the user a different login page to
brio to see the reports. But they may take hours to produce.)
3. What are your experiences in combining star and relational tables
in the same database?
4. Any thoughts on using DB2 OLAP server? Apparently it has reporting
capabilities and Java support, but unsure if it has any advantages
over Brio.
Thanks in advance,
Naga
- 5
- Windows styleHI! I'm developing an application that is going tu run on windows XP
Professinal, and I want that the buttons, combo boxes etc every
component that I use, looks like a windows component, not like a swing
button for example. I don`t know if anyone understands me.
I'm using NetBeans IDE, (using jdk 1-4-2).
When I am designing my form and I drag and drop a button for example,
it has a rounded shape, like a normal windows button, but when I
compile and run my project, the button is not rounded anymore, and
doesn't looks like a Windows Button.
What can I do??
Thaks a lot!!
- 6
- javadoc -linkoffline helpHowdy All!
I am trying to issue a javadoc command with the following linkoffline
option:
-linkoffline http://java.sun.com/j2se/1.4.1/docs/api
C:/java/j2sdk1.4.1_01/docs/api
Both the file path and the url are valid, but I find the generated
links are of the form:
file:///E:/phd/semiInterface/doc/http://java.sun.com/j2se/1.4.1/docs/api/java/lang/reflect/Method.html
Can anyone advise how I can make this work?
Thanks for any help!
Rob
:)
- 7
- Oracle JDBC and AppletHello
I have an applet which download files to local computer from database
(files are saved as BLOB fileds).
Applet is signed bud when I want to get connection to Oracle (method
getConnection from OracleDataSource) i have following error:
java.security.AccessControlException: access denied
(java.util.PropertyPermission oracle.jserver.version read)
Applet working only when I running it from JBuilder. Otherwise the
error comes.
I can't see other posibility than using applets because number of
files is very big. For example 20 000 to take at once, so the normal
download method via http is not good here. Also the size of one
download may be up to 1GB.
Thanks for help
Bartek
- 8
- How to Fail at Software DevelopmentHello,
The book "How to Fail at Software Develoopment" is about all the
strange and funny things people do in the name of developing software.
I worked in software development for over 20 years and found silly
things that were being done in the name of software development were
being repeated again and again. As a matter of fact, most things that
cause software projects to fail are forever being repeated. And you
can spot the symptoms if you know what to look for.
Most people running software projects don't have much software
experience, so their inventions are usually not new. They rediscover
the same mistakes over and over again. It turned out to be a book of
very funny scenarios--some I lived through, and some were lived
through by others.
Those who don't know the history of software failure are doomed to
repeat it. You can find the book on Amazon or wherever.
Arthur Griffith
"How to Fail at Software Development"
http://www.anchorpointbooks.com
- 9
- applet is not initiallising.what's wrong with this source code.
it is showing the message applet is not initiallising.
--------------------------------------------------------------------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class LinearSearch extends JApplet implements ActionListener
{
JLabel enterLabel;
JTextField enter;
JTextArea outputArea1, outputArea2;
JButton search;
String output;
int a[];
public void init()
{
a=new int[Integer.parseInt(JOptionPane.showInputDialog("how many
numbers, you want to input:"))];
for(int i=0; i<a.length; ++i)
a[i]=Integer.parseInt(JOptionPane.showInputDialog("enter the
integer number."));
output="numbers are:\n";
for(int i=0; i<a.length; ++i)
output += " "+a[i];
for(int i=1; i<a.length; ++i)
for(int j=0; j<=a.length-1; ++j)
if(a[j]>a[j+1])
{
int t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
output += "\n\nnow numbers are in ascending order.\n";
for(int i=0; i<a.length; ++i)
output += " "+a[i];
Container c=getContentPane();
c.setLayout(new FlowLayout());
outputArea1=new JTextArea();
c.add(outputArea1);
outputArea1.setText(output);
enterLabel=new JLabel("enter the number, you want to search.");
c.add(enterLabel);
enter=new JTextField(10);
enter.addActionListener(this);
c.add(enter);
outputArea2=new JTextArea();
c.add(outputArea2);
search=new JButton("new search");
search.addActionListener(this);
c.add(search);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == enter)
{
int subscript=linearSearch(a,
Integer.parseInt(e.getActionCommand()));
if(subscript != -1)
outputArea2.setText("number found at position no. "+subscript+"
in the sorted list.");
else
outputArea2.setText("Sorry!!! number not found. \n\nhave a look
on new search");
}
else
JOptionPane.showMessageDialog(null, "Please click on the Applet
menu on the menu Bar.\n"+"click on the clone option.\n"+"Repeat the
search process again.");
}
public int linearSearch(int b[], int k)
{
for(int i=0; i<b.length; ++i)
if(b[i] == k)
return i;
return -1;
}
}
---------------------------------------------------------------------------------------------------------------------------------------
it is asking for no. of elements. and input the numbers. but after then
applet is not able to initialise.
- 10
- tridimensional view in B&WI made a program with java3d and I can print views from it.
I want to print only the lines like the wireframe but without hide lines
Have you same Ideas??
zeno
- 11
- for wanids: very enticing tunes - gudri wonhe - (1/1)On Tue, 06 Sep 2005 23:52:20 +0200, bone wrote:
> Hello all?
Oh, ..you too?
This sh*t is commonly known as SPAM. Stop it, before I
have to send the boys around.
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Who gave you the power? WE DID!!"
Alice Cooper 'Department of Youth'
- 12
- Printing using CUPS in Linux and Java 1.5According to the blurb one of the upgrades in 1.5 is the ability to
print using CUPS in Linux. Does anyone have this working? I cannot get
my Jva application to communicate with CUPS.
Thanks,
Alan
- 13
- Zip file directory creation problemWhile extracting zip files I've come accross a strange error. I use the
code below to check if the directory exists and create it if necessary. The
problem is that it works for most zip files but I have a few zip files that
do not properly extract using this code.
What seems to be happening is the variable e is referencing a ZipEntry that
is a directory but it is not being recognized as a directory in the code.
So I get the following debug info printed:
Extracting AuthorizedDBProject.zip to: D:\zips\AuthorizedDBProject
D:\zips\AuthorizedDBProject\AuthorizedDBProject\AuthorizedDBProject.jpx (The
system cannot find the path specified)
The ZipEntry is: AuthorizedDBProject/AuthorizedDBProject.jpx but
AuthorizedDBProject is not being created before extracting
AuthorizedDBProject.jpx.
Any pointers, suggestions will be appreciated.
Code:
________________
//location - a base directory to extract all the files
try {
in = new BufferedInputStream ( new FileInputStream ( _file ) );
zin = new ZipInputStream ( in );
ZipEntry e;
while ( ( e = zin.getNextEntry () ) != null ) {
File entryPath = new File ( location.toString () + File.separator +
e.getName ());
if ( e.isDirectory () ) {
if ( !entryPath.exists()) {
if(entryPath.mkdir()){
System.out.println (entryPath + " does not exist,
creating..." );
}else{
System.out.println (entryPath + " does not exist and there was
a problem creating it!!!" );
}
}
continue;
}
System.out.println(e.getName() + " is NOT a directory");
System.out.println ( "Extracting: " + e.getName() + " to " +
entryPath );
out = new FileOutputStream ( entryPath );
byte[] b = new byte[ 512 ];
int len = 0;
while ( ( len = zin.read ( b ) ) != -1 ) {
out.write ( b , 0 , len );
}
out.close ();
}
extracted = true;
} catch ( FileNotFoundException ex ) {
System.out.println ( ex.getMessage () );
} catch ( IOException io ) {
System.out.println ( io.getMessage () );
} finally {
if ( out != null ) {
try {
out.close ();
} catch ( IOException ex1 ) {
System.out.println ( ex1.getMessage () );
}
}
...
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
- 14
- reading Mouse MOVE events without moving pointerHi,
Does anyone know of way of setting up a java app so that a instead of
mouse movements being used to update the pointer, the mouse move could
be used to update, say, the viewport of a document?
An example in more detail;
what I want to do is use the mouse MOVE event that is caused by the
movement of the mouse, but not update the pointer position (I would
like the pointer to remain still or be invisble) but to allow me to
update the viewport on a document. ie, user presses a 'trigger' key
to put the code into a receptive mode, then all subsequent mouse
movements (triggering mouse MOVE events) can be captured and used to
update the viewport location- ie, mouse moves left, pointer remains
still, viewport moves left.
I don't know if this is possible due to the OS independance that java
has. Maybe a solution involves the glass-pane in some (I am not
familiar with the glass- yet. It is one of my avenues to search...)
Thanks for any ideas... mucho thanks for any code examples....
M.
- 15
- Extract all dates from text documentHi,
1) I have a bunch of documents, some of which may contain dates.
2) For each document, I would like to identify all existing dates.
3) The dates exist in multiple formats.
Example: (May 5, 1932), (5,5,1932), (5/5/1932), (5-5-1942) etc.
4) I would like to process a single document very quickly. In other
words, i'm looking for a time efficient solution.
Are there any existing parsers that take in a generic text string and
return a collection of dates found in the text string?
Are there any existing flex/cup files that perform this task?
Thanks.
|
|
|