 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- 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
- 4
- 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
- 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'
- 4
- 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
- 4
- 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
- 5
- 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
:)
- 5
- 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?
- 6
- 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.
- 8
- 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
- 9
- 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
- 9
- 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
- 10
- 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! =-----
- 11
- 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
- 16
- 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.
- 16
- 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.
|
| Author |
Message |
George2 via JavaKB.com

|
Posted: 2005-11-17 23:16:00 |
Top |
java-programmer, about static variable
Viv,
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
|
| |
|
| |
 |
George2 via JavaKB.com

|
Posted: 2005-11-17 23:16:00 |
Top |
java-programmer >> about static variable
Viv,
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
|
| |
|
| |
 |
George2 via JavaKB.com

|
Posted: 2005-11-17 23:20:00 |
Top |
java-programmer >> about static variable
Roedy,
Roedy Green wrote:
>>What mean "static class"? You mean the static variable of a class?
>
>There is a lump of memory reserved for the static variables of a
>class, and the methods themselves( both instance and static) There is
>also a java object associated with each class you can get at with
>.getClass(). Precisely how that is organised is not specified by the
>JVM spec or the language spec.
>
>So what I meant by that imprecise phrase "static class" is the
>per-class RAM overhead of the class.
"per-class RAM overhead "? What is it? Can you show your concept in a simple
sample? I am a little more confused. :-)
regards,
George
--
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200511/1
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-11-18 4:46:00 |
Top |
java-programmer >> about static variable
On Thu, 17 Nov 2005 15:15:53 GMT, "George2 via JavaKB.com"
<u14844@uwe> wrote, quoted or indirectly quoted someone who 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.
If you have a class called Dog there is a corresponding Class object
called Dog.class. There is also an object in the JVM corresponding to
the class which is not directly accessible. It contains the static
fields, and the code for both static and instance members.
All that junk can be garbage collected if you loaded your class in a
custom classloader.
See http://mindprod.com/jgloss/classloader.html
http://mindprod.com/jgloss/garbagecollection.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-11-18 4:47:00 |
Top |
java-programmer >> about static variable
On Thu, 17 Nov 2005 15:19:34 GMT, "George2 via JavaKB.com"
<u14844@uwe> wrote, quoted or indirectly quoted someone who said :
>
>"per-class RAM overhead "? What is it? Can you show your concept in a simple
>sample? I am a little more confused. :-)
You are asking about JVM internals, which are not even specified in
the JVM spec. For a start study the JVM spec. See
http://mindprod.com/jgloss/jasm.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Passing large C buffers to Java (via JNI) without copying?I'm trying to determine whether this is even possible... I have a
_very_ large buffer malloc'd on my C heap that I would like to hand
over to Java, preferably as a Byte[]. So far, every example of this
that I have come across involves _copying_ the data from my C buffer
into java storage. Is there any way to avoid this expensive (very
expensive in my case) operation?
- 2
- Question regarding Java's OOP implementation.According to Wikipedia, one of the core concepts of OOP is
Encapsulation; being defined as follows: "ensuring that users of an
object cannot change the internal state of the object in unexpected
ways; only the object's own internal methods are allowed to access its
state. Each object exposes an interface that specifies how other
objects may interact with it. Other objects will rely exclusively on
the object's external interface to interact with it." Not that I
regard Wikipedia's definition of OOP as the leading authority, it just
happens to be handy and provides a definition that fits my own ideas.
On to the question; If I create a class called AClass and inside
declare a class level variable with the private modifier and some other
methods, e.g.
public class AClass {
private int number;
public AClass(int num) {
number = num;
}
public void setAnotherAClass(AClass anotherAClass, int num) {
anotherAClass.number = num;
}
public int getAnotherAClass(AClass anotherAClass) {
return anotherAClass.number;
}
public void display() {
System.out.println("Number: " + number);
}
}
And a class to test AClass:
public class Test {
public static void main(String[] args) {
AClass one = new AClass(1);
AClass two = new AClass(2);
one.display();
two.display();
one.setAnotherAClass(two, 3);
two.display();
}
}
I would expect the compiler first to complain that number has private
access in AClass... Barring that I'm not sure what I'd expect it to
complain about, but something doesn't seem right. Child classes
derived from AClass were not able to make changes to objects of type
AClass which is what I would expect. But because one and two are
distinct objects the fact that they belong to the same class shouldn't
mean they can change each other's private instance variables. I
wasn't able to find anything directly relating to the question in an
hour or so of Googling. I also read through Java's tutorials on OOP to
see if they had anything specific to say, which they did not.
Thank you for your time and ideas.
Carl Summers
- 3
- 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
- 4
- 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.
- 5
- 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
- 6
- 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
- 7
- Opening Image files with IE as default always ( using Browser Launcher)Hi,
I have downloaded some image files by connecting to a URL and I am
trying open that image file using BrowserLauncher.
I am using windows xp and the default one to open image files is
windows picture and Fax Viewer.
I could not see the image in Internet Explorer when I am trying to
open the image files. But when I set in the properties of image files
from "windows picture and Fax Viewer" to "Open with internet
Explorer", I could see the image.
Some trasfer details..
File Type : .jpg
HTTP/1.0 200 Ok
MIME-version: 1.0
Content-Length: 297362
Content-type: application/jpg
I tried to change in http headers , but could not succeed in opening
the image.
can anybody suggest me that,
I change the properties of the image file ( or http headers) such that
it should be open with internet explorer by default,after the image
downloaded.
Any suggestions or help is appreciated.
Regards,
Hari.
- 8
- commons-logging: runtime change of propertiesHi,
I try to use commons-logging with the logs methods of J2SE 1.4.2 to
generalize the logging in my appl.
Doesn't exists a method to upload the defaul file properties of J2SE
at run time and not usig the -D option at startup?
Exists e method to change the propeties of the logger at runtime? for
example the output file path...
Thanks Cristian
- 9
- Sun's OpenJDK in Debian?Hi,
I'm surprised that this wasn't discussed already in the past on this list
(or in the BTS of some important java packages), but what is the status
of Sun's Java architecture in Debian?
It is licensed under GPL2 and should be compatible with DFSG.
As far as I know only a few components are not yet freely available,
especially all which are subject to the Assembly Exception
(http://openjdk.java.net/legal/exception-modules-2007-05-08.html,
http://www.sun.com/software/opensource/java/faq.jsp).
Is this the main blocker for accepting OpenJDK in Debian? Would it be
possible to just omit the binary modules or to replace these with free
implementations from other free projects?
Please CC: me.
Jens
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 10
- 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.
- 11
- 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
- 12
- \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
- 13
- [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.
- 14
- 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?
- 15
- 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).
|
|
|