| applet is not initiallising. |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- 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'
- 5
- [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
- 8
- redirect problemHi 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!
- 8
- 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
- 11
- 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
- 12
- 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
:)
- 12
- 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
- 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.
- 14
- 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
- 14
- 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
- 15
- 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).
- 15
- 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?
- 16
- 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.
- 16
- 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
- 16
- 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
|
| Author |
Message |
Rajkumar Singh

|
Posted: 2006-6-4 17:07:00 |
Top |
java-programmer, 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.
|
| |
|
| |
 |
IchBin

|
Posted: 2006-6-5 3:20:00 |
Top |
java-programmer >> applet is not initiallising.
Rajkumar Singh wrote:
> 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.
>
Try using an IDE debugger. Your error is this..
java.lang.ArrayIndexOutOfBoundsException: 4
at LinearSearch.init(LinearSearch.java:34)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
IchBin

|
Posted: 2006-6-5 3:26:00 |
Top |
java-programmer >> applet is not initiallising.
Rajkumar Singh wrote:
> what's wrong with this source code.
[snip ]
> for(int i=1; i<a.length; ++i)
> for(int j=0; j<=a.length-1; ++j)
Line 34 > if(a[j]>a[j+1])
> {
> int t=a[j];
> a[j]=a[j+1];
> a[j+1]=t;
> }
>
[snip]
> it is asking for no. of elements. and input the numbers. but after then
> applet is not able to initialise.
Try using an IDE debugger. Your error is this..
java.lang.ArrayIndexOutOfBoundsException: 4
at LinearSearch.init(LinearSearch.java:34)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
IchBin

|
Posted: 2006-6-5 3:44:00 |
Top |
java-programmer >> applet is not initiallising.
IchBin wrote:
> Rajkumar Singh wrote:
>> what's wrong with this source code.
>
> [snip ]
>
>> 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;
>> }
>>
> [snip]
It would make better sense to replace the above code with this:
Arrays.sort(a);
Your naming convention is unreadable.
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
Andrew T.

|
Posted: 2006-6-5 13:18:00 |
Top |
java-programmer >> applet is not initiallising.
Rajkumar Singh wrote:
> what's wrong with this source code.
>
> it is showing the message applet is not initiallising.
This message is common for IE that is using the MSVM
(Java 1.1) when you try to use..
....
> import javax.swing.*;
..Swing, or anything else 1.2+.
(Though it seems IchBin has identified further problems in the code.)
Andrew T.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Loop != LoopStephen Riehm schreef:
>
> don't those two loops have different semantics, ie: the scope of myvalue?
> My understanding would be that myvalue in the first loop would be
> overwritten 9 times and then the last value would be available to code
> appearing after the loop. The myvalue in the second loop basically has
> no effect because it falls out of scope (and into the garbage
> collector's hands) as soon as you leave the loop.
>
Oh, it was just a quick example, there supposed to be done something
with myvalue later in the loop. The point was, myvalue is only needed
inside the loop and not outsite.
int myvalue=0;
for (int i=0;i<10;i++) {
myvalue=calculate(i);
.. do something with myvalue
}
.. myvalue no longer needed
for (int i=0;i<10;i++) {
int myvalue=calculate(i);
.. do something with myvalue
}
..my value not needed anymore
I believe this example is somewhere on the web too, but I forgot where
(probably javasoft.com or javaworld.com).
- 2
- JNI QuestionOn Mar 2, 2:17 pm, Gordon Beaton <email***@***.com> wrote:
> On 2 Mar 2007 08:05:22 -0800, Edsoncv wrote:
>
> > If I have only the C part, I would cast the "native1" object, pass
> > to "setup" and cast back the object, but since the setup function is
> > called from java, I don't know how to access native1 object from
> > "setup". Is it possible?
>
> Of course.
>
> Either store it someplace in the native code where it's visible to
> both methods (i.e. not as a local variable in solve() like your
> example).
>
> Or, remembering that even native methods have return values, return it
> to the caller (cast to jlong) so that it can be passed back to the
> next method, where you cast it back to the appropriate pointer type
> before attempting to use it.
>
> /gordon
>
> --
> [ don't email me support questions or followups ]
> g o r d o n + n e w s @ b a l d e r 1 3 . s e
Thanks Gordon, I think I'll pick the second option.
- 3
- 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!!
- 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
- [Update] FreeQueryBuilder 2005.05FreeQueryBuilder.2005.05
http://querybuilder.sourceforge.net
FreeQueryBuilder is a GUI SQL client written in 100% Java.
You can create SQL queries without directly writing SQL.
Works with any JDBC compliant database, including
ORACLE, MySQL, HSQLDB, Firebird, SQLServer.
This release includes FreeReportBuilder, a visual report designer.
- 6
- JMF, FrameAccess, sound, faster processingI used JMF's example class FrameAccess to process audio/video files. The
Processor processes data according to the frame rate specified in the file.
1. Is there a way to do this processing faster? I don't want to view (and listen
to) those vids, just process them. I'm ready to use 100% of the CPU if need be.
2. As the file is processed, a sound is generated and can be listened to through
a sound card's output. Is this entirely necessary? I'm asking because I want to
process files simultaneously and that would result in a cacophony. Besides, say
I want to listen to my own music while the processing takes place.
3. How does one extract sound from a video file? Can it be extracted as a whole?
Can it be broken down into chunks according to extracted image frames? How? In
which formats? I'm stuck in an implementation of Codec interface, much like
JMF's example PreProcessCodec.java, but with AudioFormat (supported ins and
outs), so I can access a sound frame through a Buffer, but I don't know how to
proceed.
Thanks for any insight.
- 7
- RSA ciphered streams problemHi. I've got a problem with the RSA ciphered streams. Here is a piece of
code that generates an exception :
KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");
System.out.print("Generating the RSA key pair...");
KeyPair kp = gen.generateKeyPair();
System.out.println("done.");
Cipher ci = Cipher.getInstance("RSA");
ci.init(Cipher.ENCRYPT_MODE,kp.getPublic());
Cipher cid = Cipher.getInstance("RSA");
cid.init(Cipher.DECRYPT_MODE,kp.getPrivate());
CipherOutputStream cout = new CipherOutputStream(new
FileOutputStream("rsa.dat"),ci);
ObjectOutputStream oout = new ObjectOutputStream(cout);
oout.writeObject(kp.getPrivate().toString());
oout.flush();
oout.close();
CipherInputStream cin = new CipherInputStream(new
FileInputStream("rsa.dat"),cid);
ObjectInputStream oin = new ObjectInputStream(cin); // Exception here
System.out.println(oin.readObject());
oin.close();
The exception is EOFException and it's not very weird because the file
"rsa.dat" is empty after writing to it!! It happens only if object is "big"
( when I try to write some short String, for example, everything's ok ).
When I tried to write an unciphered output ( without using
CipheredOutputStream ) it went well of course.
My question is : can anybody tell me why it happens? What should I do to
write "big" objects to ciphered output stream using ObjectOutputStream
properly?
Thanks for any requests.
Kuba
- 8
- Date problem"Simon" <email***@***.com> wrote in message
news:email***@***.com...
> Ingo R. Homann wrote:
>> You could design a programming language whose array-indices start with
>> -3, that would make as much sense.
>
> So you want array-indices to start with 1? I don't see the analogy.
It's the princple of least surprise. When you design something, you want
to surprise your users as little as possible. To me, it's quite surprising
that 5 refers to June and not May, for example. For array-indices, starting
at 1 or 0 is okay (both makes sense), but -3 or 42 or anything else would be
quite surprising as well.
- Oliver
- 9
- about static variableViv,
Viv wrote:
>I mean to say that the objects will get garbage collected but not the
>static variables. Class will remain in memory till the JVM shutdown.
>
>Roedy wrote :
>The only way you can recover the ram from a static class object is to
>load it with a custom classloader, then drop even the reference to the
>class loader.
>
>You can try what Roedy said.
What means "recover the ram from a static class object"? What do you mean
"recover"? I think there is not static class object -- only static class
members.
Do you know where can I find a sample dealing with how to write a customized
ClassLoader with the functions as you mentioned?
regards,
George
--
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200511/1
- 10
- 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
- 11
- \n troublesOK, again I have troubles dealing with String. I have a field of the type
String which contains some text that is separated into lines at random
places, or in other words, the text contains \n\r (or \n in the case of
linux). I write this field into a file and there it looks ok, but when I
read it back I get the whole string in one line. So I figured I'd add a
separator at the end of each line. However, then I get an empty line after
each line! I'm using GZIP to pack the data, so perhaps that is causing this?
Btw. after each block of text I write an end-of-block string to know that
it's the end of that block.
Here's the explanation in code:
String notes = ""; // the result
String lin = ""; // used to read one line from the file
final String eob = "---$#-||-"; // end of block
lin = filein.readLine(); // I'm reading the 1st line
while (lin.compareTo(eob) != 0) {
notes += lin + System.getProperty("line.separator");
lin = filein.readLine();
if (lin == null) { break; } // this will never occur, but just in case
}
return notes;
//-------------
// filein is a BufferedReader
// I can't change that, don't ask why, and
// because of that this is how I read a file
filein = new BufferedReader(
new InputStreamReader(
new BufferedInputStream(
new GZIPInputStream(
new FileInputStream("testFile.gz"))))));
I figured I could erase one empty line after the reading-in is done, but I'm
not sure if this will happen in every case, on every computer. I'm thinking
it could be an anomaly for Windows files.
Anyway, I'm waiting for some suggestions ;)
Gajo
- 12
- 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.
- 13
- Action or Subclass method?I need to know which is the PROPER way of handling this situation:
I would like to be able to cascade all the JInternalFrames in a
JDesktopPane.
Should I create a
1) cascade() method in a subclass of JDesktopPane? or
2) create a CascadeAction (a subclass of AbstractAction) and pass a
reference of the JDesktopPane?
Both ways work. HOWEVER, which is the PROPER Object Oriented solution?
- 14
- Putting certificates in ldapI have openldap running, and I was able to put java objects there like
so:
Integer i = new Integer( 28420 );
ctx.bind( "cn=myRandomInt", i );
Suppose I already have the cert inside java.security.cert.Certificate
. What would be the correct syntax to add this cert with ctx.bind ? Do
I need to explicitly add this userCertificate;binary to slapd.conf? My
schema is:
database ldbm
#suffix "dc=my-domain,dc=com"
suffix "o=certStore"
#rootdn "cn=Manager,dc=my-domain,dc=com"
rootdn "cn=certManager,o=certStore"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw secret
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd/tools. Mode 700 recommended.
directory /var/lib/ldap_magna
schemacheck off
# Indices to maintain
index objectClass eq
Please help,
iksrazal
- 15
- How to listen out for a stream of data coming from (web)serverHello
I have an applet that connects to a server (same location as web server) and
connects to a server on a socket. This all works fine for sending commands
to this server. But the server can send data to the client at any moment in
time. So how do I listen out for the activity? do I launch a separate thread
that sits listening for incoming data?
What is the way to do it?
Angus
|
|
|