Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Arto Pastinen

Ranch Hand
+ Follow
since Dec 13, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arto Pastinen

Hi!

Isn't it against certification rules to ask that kind questions here?!?

- Artsi
Hi!

Does someone know good design pattern or examples for application, which uses JavaNIO?!?
I need patterns to implement client side application, something like command pattern etc., well actually application will be combination from client and server, it is P2P peer client.
I don't need link's to some echo applications with reactor pattern, i have done some small stuff with NIO and i know basics..

Thanks, Artsi
12 years ago
Chat software has already done, and it work's with html/javascript/common browsers.
Now i want to make java standalone client for that web interface.
JEditorPane won't repaint until end of the stream has occured.
[ May 17, 2005: Message edited by: Arto Pastinen ]
13 years ago
Hi!

I need actually what i wrote.

I need to render html (no stream) same time when i read it from stream, because stream is continuous and won't end. Like opera browser, when there is LONG html page, it will something from it when stream has not end yet.

in server side i can write <html><body>xxxxx every new connection without end, and if xxxxx is just text and images, it should be no problem to draw.

well.. application is chat room, and if people chat many hours, there could be so much data that it is not good idea to make loop, because rendering long page one time in second could be too much for slow computers.
13 years ago
Hi!

Is there a way/hack to render HTML at real time from stream in HTMLEditorKit?
.. or is there some opensource renders to do the job? don't offer native stuff or commercial products.. thans.

The page what i will render is continuous, and it won't never stop, so i need to render it in real time.

HTML is very simple, it contains only text and images.

Thnx, Artsi
13 years ago
Hi!

Does someone knows artice how to jUnit test RMI services?
The problem is that i want do automatic testing for my project, and i don't know how to handle rmi registry automatically.

- Artsi
13 years ago
Hi!

I haven't never studied protocol details of RMI and i don't have time for it now, so i hope that someone could help me..

I have RMI server (or is it register..) in remote host. There is two firewall between client&server. If i take telnet from client to server in RMI port, it accept connection, so connection work in that way, but client firewall don't accept incoming connections. What can i do?

I can use RMI fine in other machine, where there isn't any firewalls between this server host and client host.

I will use one RMI method, which i will call in client, and method will return byte array.

Why RMI works this way? If client create socket to server, and it is bidirectional TCP socket, why cannot RMI read inputstream, or does it work other way? is RMI ?

Thanks already!

- Artsi
[ April 08, 2005: Message edited by: Nathan Pruett ]
13 years ago
Rename file so, that it starts with dot.

example:
"myfolder" => ".myfolder"

Same works with files.

.. of course this works only in linux, or maby in mac&solaris, not sure.

- Artsi
13 years ago
Hi!

Have you people ever think that how reliable java's hashCode actually is if hashCode is generated from String by VM's default implementation..

I have think that if i have a map, where i put host names, is it possible that two different host name gives same hashCodes?!? i think

Let's think that we are using unicode charset (not for host's but some other case), and unicode character length is 16 bit, and hashCode is 32 bit length, so we can actually use only two character as key until all possibilies are used..

Please give me comments if i am wrong..

- Artsi
13 years ago
Hi!

I haven't check this from specs, but i think that -1 is assumed to be int, so what compiler real tries to do, is following:

a *= (int) -1;

try this: a *= (byte) -1;

- artsi
13 years ago
Hi!

Can't you run java with sufficient rights? Make a shell script to run JVM, and assign sufficient rights for script.

It is not a good habit to write password to command argument's, because then you can see it with tool like top.

- Artsi
13 years ago
Hi!

Instead synchronizing register, request removeKey and close methods, synchronize values object.

example:

public void close() {
synchronized(values) {
values.clear();
}
}

and other very little performace issue is that you don't have to test is registry null in getInstance.

I usually make singleton class this way:

public class Foo {
private static final Foo instance = new Foo();

private Foo() {}

public static Foo getInstance() { return instance; }
}
Hi!

I think that AOP may help you. I suggest to start with aspectj.

- Artsi
13 years ago
Hi!

Could you post stack trace (that error)

- Artsi
13 years ago
float tmp[] = sampleString.length;
for(int i = 0; i < sampleString.length; i++) {
tmp[i] = Float.parseFloat(sampleString[i]);
}
13 years ago