 |
 |
Index ‹ java-programmer
|
- Previous
- 3
- 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
- 3
- 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
- 3
- 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?
- 7
- 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.
- 10
- 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
- 13
- Things That People Buy .Hi Antonio ,
Of Sun's press release , You scratch out :
" Makes me not want to buy a new PC just yet . "
Oh God ... Don't hold your breath .
While Sun produces these fantastical press releases ,
Asians are actually shipping things that people buy .
- 13
- 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
- 14
- 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
- 14
- 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
- 14
- 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
- 14
- \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
- 15
- [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.
- 16
- 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).
- 16
- 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?
- 16
- 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.
|
| Author |
Message |
Giulio Ferro

|
Posted: 2007-1-7 22:07:00 |
Top |
java-programmer, Geronimo
Is there anyone who has successfully run this
application server under freebsd? I have problems
with rmi, but since nobody answered my other post
I suppose nobody else came across the same problem?
|
| |
|
| |
 |
auryn

|
Posted: 2007-1-7 22:08:00 |
Top |
java-programmer >> Geronimo
Is there anyone who has successfully run this
application server under freebsd? I have problems
with rmi, but since nobody answered my other post
I suppose nobody else came across the same problem?
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Problem accessing Windows clipboardHi
In my java program I have a class which contains some code which accesses
the Windows clipboard.
When I use this class in a standalone application (JFrame) I can retrieve
data from the clipboard no problem.
When I use this very same class in a JApplet which I run in Internet
Explorer, I cannot get the data from the Windows clipboard.
The line of code that my JApplet gets hung up on is ...
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
This line of code does execute properly when executed in the standalone
application.
My class does contain the line: import java.awt.datatransfer.*;
I am using the following page from the Java Developer's Almanac as a
reference.
http://javaalmanac.com/egs/java.awt.datatransfer/ToClip.html
is there a known issue with this sort of thing that I don't know about?
Hopefully I have provided enough information for you.
Thanks in advance.
Fred.
- 2
- 3
- Database insert taking a long time and causing 500 errorHi,
My requirement is as follows:
Server: Websphere
Framework: Struts
A user will upload excel file. Excel file will have several rows. For
each row, I need to insert one row in oracle database table. And
finally success message is to be shown to the user.
I read the excel file in action class and call a oracle procedure to
insert the records to database.
The issue is that when the size of excel file is large (containing
several records), it is taking a long time to complete insertion and
it shows Internal Server 500 error on the browser. Passing small set
of records to procedure is also not helping.
I think since there is no response from the app server to the client,
this error is coming. Can anybody suggest how to solve this problem?
Thanks in advance,
Palak
- 4
- resolving class loaderHi,
I'm working in an environment with many class loaders. A code in some
class, creates a data for me to persist. In order to read it back, I
must find the right class loader to use. In a simple scenario, if all
the data came from one jar, I could just keep the url to that jar. But,
if the data comes from various jars (say the class loader is a war
class loader, so it has reference to 3rd party libraries), then how can
I resolve it when loading the data? Meaning, what keys do I need to
persist so that I can find the same class loader when reading the data?
Thanx,
Ittay
- 5
- directly assigning to a field (was Java without OO)Isaac Gouy wrote:
>As-far-as-you're-concerned is OO completely defined by Smalltalk practices?
>
>If that's the case then please just write "Smalltalk OO" instead of "OO"
>
Hmm. The point of reading the references might not be to learn
Smalltalk, but to get a different perspective. After having used
Objective-C, C++, Python, and Java (not in that order) I think the
perspective of reading/using other languages is important. It
influences the programmer, and even suggests there may be better
languages to solve problems in than the ones they already use.
I don't think most Java programmers' investment in Java is so frail that
reading a Smalltalk book would shatter their world view. Perhaps it
would simply give them another perspective on their own class designs.
Same reason some people read editorals from multiple political viewpoints.
--
.tom
remove email address' dashes for replies
opensource middleware at <http://isectd.sourceforge.net>
http://gagne.homedns.org
- 6
- help me finding pathHi,
How to find the Path String from jrePath to jawtPath?
Thanks,
Sri
--
Message posted via http://www.javakb.com
- 7
- java access to USB MAC OS XI have a simple requirement at this point an Apple MAC OS X - that is
to detect the presence or lack of a USB device from java.
I have read about JSR 80, javax.usb, jUSB and all indicate not
available in Mac OS X.
I also know that in linux, I can do a "cat /proc/bus/usb/devices" and
get a list of devices connected to the machine.
Now Mac OS X is "linux" - yet there doesn't appear to be /proc/dev/...
etc.
Any suggestions on how to get the presence or lack of a USB device
from java on Mac OS X??
- 8
- JProgressBar bar not showing up till completeHi thanks for reading.
Im sure the answer to this is simple, it just eludes me at this point.
Im tring to use a progress bar to simply show the progress of 55 files
being created and saved to disk. However when I use the JProgressBar
in my code, it only shows up when the task is completed... Obviously I
need it to be shown updating the entire time, seems like im missing
something pretty basic.
heres the code for your perusal, the updates occurs later in the code,
but since its not showing up until it is completed I believe the error
is here + Thanks! :
//start up progress FRAME
JFrame jfrProgress = new JFrame("Creating Movie...");
Container contentPane = jfrProgress.getContentPane();
SpringLayout layout = new SpringLayout();
contentPane.setLayout(layout);
//set up progress BAR
JProgressBar pbProgress;
pbProgress = new JProgressBar(ISTARTFRAME, iFinalFrame);
pbProgress.setValue(ISTARTFRAME);
pbProgress.setStringPainted(true);
pbProgress.setString("Step 1 - Creating Files...");
pbProgress.setSize(500, 40);
//add progress bar to frame
jfrProgress.getContentPane().add(pbProgress);
//display frame
jfrProgress.setLocation(400, 300);
jfrProgress.setSize(250, 100);
pbProgress.setVisible(true);
jfrProgress.setVisible(true);
- 9
- Example of simple SOAP web-service on Resin?Hi group
I want to run my simple web service app on Resin. (I currently run it
on JBoss 3.2.3)
Does anyone have a simple example of how to do this with the
configuration of web.xml etc.?
Thanks in advance
-asciz
- 10
- J2ME . How do I start?Hello,
I need to write an application for MIDP 2.0 phones. Once I write the
application, will it work on every phone that supports MIDP 2.0? What is
the best way to get started? Which tools should I use? Any online tutorial
videos or good books? Thanks a lot.
T.I.
- 11
- Eclipse debugging hanging, causing network problemsHi,
I'm new to Eclipese, and last time I used Java heavily was six years
ago, so may be new to Java as well.
I could install and run Eclipse well, but debugging gives a problem;
after a few (say, 5-10) debugging sessions, the debugger does not
start in the usual way, but gets stuck at launching stage. The status
bar shows "Launching (95%)" and takes minutes to continue from there.
The app is a local java program, very small stuff - a couple of seconds
to run, no network connections etc. If I let the IDE to get past the
launching stage it gives me a debug session, but its either stuck
without running, or extremely slow to run.
Strangely, after this happens, I get other network problems as well -
such as google toolbar (in firefox) being slow to respond etc; The only
remedy is to reboot the machine, and when rebooting, several network
related apps fail to close down and I have to terminate them. I believe
I have reasonably verified that the cause is not an independent network
issue but something associated with the debugger.
.metadata/.log file shows many errors associated with
org.eclipse.jdi.internal, including org.eclipse.jdi.TimeOutException s.
My questions:
1. is this issue known (although I couldn't see anything on the web)
and if so, how can I fix it?
2. Can I setup eclipse to use shared memory transport instead of socket
transport for debugging?
Thanks for your time,
Upali
- 12
- stability problems under eclipse on amd64 platform
I would like the following patch file to be tested and committed to the
java/jdk15 port until patch 6 is released on FreeBSD. This patch has
eliminated crashes for me and has made a significant difference in the
stability of eclipse.
Cheers,
Sean
- 13
- What IDE for Java do you use?nospam wrote:
> Hi...All,
>
> I recently downloaded eclipse IDE with myeclipse web editor
> (myeclipseide.com) . I did not see any views on it in this thread. So,
> would be interested to what your thought are on
> eclipse+myeclipse(struts, EJB....)
The views in Eclipse aren't initially as elaborate as those under WSAD,
but you can change that;
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-02e.htm
and
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-02e.htm
are a good start. Look on sourceforge.net for a variety of plug-ins so
you can enhance your IDE even more. Eclipse Colorer may be of help:
http://eclipsecolorer.sourceforge.net/index_profiler.html and
http://sourceforge.net/projects/eclipsecolorer.
- 14
- finding text in formatted JTextPane by using scannerHello I'm trying to create a program, which reads text from a text
file, by using a scanner, finds definitions for particular phrases,
depending on a rule list and stores the data in a list, by using
objects. For example, there is a rule list with the rules : is
/sentence, means /sentence, is referred to /sentence. If the user
insert the term Hypertension, then there will be a search on the
textfile by using the scanner, find the sentences that contain the
expressions from the rulelist and store them in objects ( Hypertension
is referred to blah blah blah). Each time I create an object, I store
to it the index where the sentence starts and where the sentence ends..
Now the hard part. I display the data in a jlist. They are of the form:
sentencestart, sentenceend,sentence. I need when a user clicks on an
object of this list, a JPane window to popup with the original text
(formatted) and highlight the sentence. The problem that I have is that
while I am using scanner to retrieve the words, it doesn't count the
line return character. So each time I save the place the sentence
starts and ends, it doesn't take in consideration the line return
characters. That leads the program to highlight wrong characters in the
JTextPane.
Is there any way, when I use the scanner, each time it finds a line
break or return character to take it in consideration?
Thank you... :)
- 15
- which vs thatI am writing documentation, and I dawned on me that I don't know the
difference between "which" and "that". I have a vague intuition which
to use, but there is no logic behind it.
In fact I don't think I could define the difference between
what, which and that.
I suspect "which" has to do with picking one from a small set, where
"that" provides an algorithm for inclusion.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|
|
|