The Java web framework Tapestry 5 has a hot deployment/reload feature, that traverses the classpath, looking for new resources to load. Unfortunately, it is not capable to parse URLs of Jboss’ virtual file system and therefore does not find it’s own core libraries. This issue has been tracked in TAP5-576 and a solution for Jboss-5 and Jboss-6 can be found in the corresponding wiki articles. The same problem remains for Jboss-7. Accidentally the reflective calls to virtual file are restricted. But the solution for Jboss-6.1 does still work. Here is a little tutorial how to achieve this.
Read More
Concurrent conversion of SVG to formats like PNG, EPS or PDF
In this post I’ll show how to use the ExecutorService
of the java.concurrent
package, in order to start as many inkscape shells as processors available on the current machine and to distribute a whole bunch of conversion tasks wisely on the cores. On my quad core I got a speedup of about 3.5, which is really near to 4.
Read More
Informative Exceptions with Java Proxies
Information is essential for reasonable exception handling. Unfortunately, it is not always affordable to write custom exceptions providing all necessary information, especially in test code, e.g. for selenium tests. So, here is an approach to weave informative exceptions into your [test] code.
Read More
Circular Dependencies of Session Beans via Manual EJB Lookup
In my last two posts (Circular Dependencies of Session Beans and Circular injection of Util Classes in EJB 3.0) I wrote, that it is possible to have circular dependencies between session beans via interceptors and manual EJB lookup. In this post I will sketch out how.
Read More
Circular Injection of Util Classes in EJB 3.0
In my last post Circular Dependencies of Session Beans I presented a method to use interceptors in session beans in order to inject beans. This works great until you want to add circular dependencies. Then you have to look up the beans by name and inject them into the bean. But this is kind of cumbersome. So, if it is possible, have a bean structure, which is topologically sortable and inject util classes having circular dependencies between each other. This post shows how to achieve the latter.
Read More
Circular Dependencies of Session Beans
This post is about circular dependencies between session beans (ejb 3.0), which is ‘not possible’ without manual loading. The manual variant might be the solution of choice for you. Therefore, I will sketch it out later in this post. The first part of this post post is about a trial to achieve this with @EJB
annotation only … which failed! But perhaps it will stop some of you to try it out (for nuts) and it’s a great bridge to a solution by a snatch enabling to have circular injection of ‘your own’ beans. I will show you the latter in my next post.
Read More
Reversed Scrolling in Ubuntu
If you have installed ‘xmodmap’ you may add the following command in order to have reversed scrolling experience like in OS X Lion:
echo "pointer = 1 2 3 5 4 6 7 8 9 10 11 12" >> ~/.Xmodmap
The next time you start ubuntu gnome desktop it will ask you, whether it should load the xmodmap (you should add the .Xmodmap file). There you go.
Menus with Icons in Ubuntu Karmic++
With the update to karmic koala ubuntu reversed the color scheme of context menus. Before the foreground had been dark and the background bright. Now, guess what, it’s the other way around. With this change, the property for showing icons in context menus has been disabled, too. This is due to transparency problems. Unfortunately, programs like eclipse make extensive use of this feature. So, not having these icons anymore is more than annoying.
Read More
Tally Clock
This blog entry shows, how to create a tally clock for your website. Below there is a nice one showing you the current time with tally packs (0-5):
div#tally2-clock {
text-align: center;
/* border: solid 1px #CCCCDD; */
min-width: 0px;
}
div#tally2-clock ul li {
display: inline-block;
}
div#tally2-clock ul li.clock0 {
background-image: url(“http://kingsware.kopv.de/wp-content/uploads/sites/3/2011/08/c0.png”);
width: 32px;
height: 32px;
}
div#tally2-clock ul li.clock1 {
background-image: url(“http://kingsware.kopv.de/wp-content/uploads/sites/3/2011/08/c1.png”);
width: 32px;
height: 32px;
}
div#tally2-clock ul li.clock2 {
background-image: url(“http://kingsware.kopv.de/wp-content/uploads/sites/3/2011/08/c2.png”);
width: 32px;
height: 32px;
}
div#tally2-clock ul li.clock3 {
background-image: url(“http://kingsware.kopv.de/wp-content/uploads/sites/3/2011/08/c3.png”);
width: 32px;
height: 32px;
}
div#tally2-clock ul li.clock4 {
background-image: url(“http://kingsware.kopv.de/wp-content/uploads/sites/3/2011/08/c4.png”);
width: 32px;
height: 32px;
}
div#tally2-clock ul li.clock5 {
background-image: url(“http://kingsware.kopv.de/wp-content/uploads/sites/3/2011/08/c5.png”);
width: 32px;
height: 32px;
}
function setClock2(val, idName) {
var tenthval = ((val – (val % 10)) / 10);
var tenval = (val % 10);
var prefix = “tally2-clock-“;
document.getElementById(prefix + idName + “1”).setAttribute(“class”, “clock” + tenthval);
if (tenval < 5) {
document.getElementById(prefix + idName + "2").setAttribute("class", "clock" + tenval);
document.getElementById(prefix + idName + "3").setAttribute("class", "clock0");
}
else {
tenval = tenval – 5;
document.getElementById(prefix + idName + "2").setAttribute("class", "clock5");
document.getElementById(prefix + idName + "3").setAttribute("class", "clock" + tenval);
}
}
function doTime2() {
var currDate = new Date();
var hour = currDate.getHours();
var minute = currDate.getMinutes();
var second = currDate.getSeconds();
setClock2(hour, 'hour');
setClock2(minute, 'minute');
setClock2(second, 'second');
}
function doInterval2() {
setInterval(doTime2, 1000);
}
function oldAndNew(oldfnc, newfnc) {
oldfnc();
newfnc();
}
if(window.onload != null) {
oldf = window.onload;
window.onload = oldAndNew(oldf, doInterval2);
}
else {
window.onload = doInterval2;
}
Convert Programmatically Created Queries to Named Queries
Using named queries has some nice advantages as described in Organize Your Named JPQL Queries. But it is not easy to convert queries to named queries as former are often programmatically created via string concatenation. At a first glance this seems to be a show stopper. In this post I will show two approaches to convert such queries into named queries.
Read More