karl koch

Ranch Hand
+ Follow
since May 25, 2001
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 karl koch

there are a lot of java cache implentations, ranging from simple to complex. there is definetly no need to implement a cache by yourself.
if you use hibernate to access the DB, then you can transparently plug the cache in (it is called second level cache in hibernate) and enable your objects for caching by modifying the hbm file. if you use some other methods, you might have to do the putting/retrieving from cache yourself:

pseudocode:
public Object getObject() {
Object obj = cache.getObject("foo");
if (obj == null) {
obj = database.getObject("foo");
cache.putObject("foo", obj);
}
return obj;
}


have a nice evening
k
12 years ago
did you try and read the API doc of the window (perhaps its JFrame or so) ?
there is probably something like getDimension(), getWidth()/getHeight(), getSize().
and if you find the size... your halfway there :-)
API Docs


K
12 years ago
uuhhh ehm... i did not understand your question.

do you want to drag around an object on the screen ?
take a look at MouseListener and MouseMotionListener. You can subscribe for events and are able to find out were the mouse pointer currently is. then you could check if the current point is in one of those regions you need to check.


greets

k
12 years ago
be careful with singleton pattern.
i consider it an evil-bad-anti-dont-use-no-go-pattern.


search the web for why singletn is evil...

k
12 years ago
sounds like you want to build a tree ?
the parent needs to have a datastructure that holds all the child nodes (e.g. a Set)
then in your (parent) node you need a method like addChild(SomeObject obj) which adds the object to the datastructure.
also you will need methods to retrieve the childreen and so on...

k
12 years ago
thanks!

from the link above:


JK2 has been put in maintainer mode and no further development will take place. The reason for shutting down JK2 development was the lack of developers interest. Other reason was lack of users interest in adopting JK2, caused by configuration complexity when compared to JK.

JK2 will have it's successor within core Apache2.1/2.2 distribution. We have developed new proxy_ajp that is an addition to the mod_proxy and uses Tomcat's AJP protocol stack. It is developped in httpd-2.1 and integrated in it. We have also developed a new proxy_balancer module for load balancing http and ajp protocol stacks.

JK will be fully supported for all other web servers. The next JK release is planned for the end of November. Lots of code from JK2 has been ported to JK

13 years ago
now that i have to deal with load balancing... some more questions pop up.

mod_jk, mod_jk2, webapp, warp, mod_proxy_ajp ???
does anyone know what connector to use (now) between tomcat and apache ??
it seems that jk/jk2 are deprecated and the others are not available :-)


thanks


karl
13 years ago
hi

i configured load balanced tomcat/apache with mod_jk and this works fine. now we have more requirements and i am not sure on how to do this. perhaps someone can help or point me in the right direction:

- since we have sticky sessions without session replication (no transparent failover) we would like apache to show the user a custom error page when "his" tomcat goes down. after this error page he can start over on a new tomcat

- configure a session limit on apache. if this limit is exceeded, then only error page is shown (e.g. please try again later and stop hitting the reload button because this just makes it worse :-) )

is this possible in mod_jk configuration ? is it possible at all ?

thanks for your help.

karl
13 years ago
put the mapping files on the classpath, that should work.

karl
hi

yes, since this is just a test i can format the return in whatever format i want to....
but i want to return a java util date (this is a test of several remoting mechanism including springs httpinvoker, hessian, burlap and rmi and they all work without any troubles with java.util.Date).
this is more a "i'm sure this is possible; i must be doing something wrong" thing :-)

so how do i return a java.util.Date with axis ? the doco says it's supported but i found this article http://www-128.ibm.com/developerworks/xml/library/ws-tip-roundtrip1.html which says that Date does not roundtrip.

but again since this is just a demo i might swallow my prode and use java.util.Calendar instead :-)


thanks for your help....

karl
13 years ago
hi all

i am new to sopa/ws/axis and trying to implement a simple time service. i have built an working service which returns the time in milliseconds (a long) which works but when i try to return a java.util.Date object, then i get a class cast exception (i use springframework and its webservice support proxies).

after some searching i found an article that says that axis will serialize Date objects perfectly but will create a java.util.Calendar on deserializing. is this true ? how can i change this ? any hints for how to do this in spring ?

thanks for your help

k
13 years ago
hi


check out http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-id

the primary key is generated trough a generator (you can pick from several generators: sequence, hilo, uuid, native, ...).


k
hi

1. i think hibernate takes snapshots and compares the snapshots with the "real " objects. take a look at "Interceptor" class.

2. hibernate only provides an interface for a cache but not an implementation. the caches used are all standalone. so just use one of them


k
hi

use a java.util.Set implementation (e.g. HashSet) to "store" you numbers.
You can only add Objects to a Set so you need to create Integer (or Float, Double, Long,...) Objects from your random number.

Then you just keep adding numbers until the size of the Set has reached 20


You might want to get some information on the Object.hashCode() and Object.equals(Object obj) method to understand why equal Objects are only added once to the Set.

Hope that helps
Karl
13 years ago
Hi

why your application demands 444'444 Objects to be created ? you probably wont use them all at the same time ? so just create the objects you need (e.g. 20 items displayed in a list and if the user scrolls down you discard the ones not visible and create the new ones).


k
13 years ago