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
Author: jonny
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
Optional ‘Paths’ in JPQL Queries
There exists a phenomenon in JPQL/SQL that isn’t quite intuitive in the first place, but gets clearer after you have understood how it works. A normal JOIN in a JPQL query is evaluated as an INNER JOIN. That means, that a row will not be selected, if the right hand side of the JOIN is NULL
. This may sometimes lead to unexpected results…
Read More
Transaction Handling in Tapestry5 with Jboss-5.1.0GA
edit: This works with JBoss-7.0.2, too
In a session bean every method has set the transaction attribute REQUIRED
by default, i.e., calling it without an active transaction results in the creation of a new transaction. In a tapestry application you may inject session beans and call methods on them. Unfortunately, every call will open up a new transaction being ‘commited’ as the method returns. This has the disadvantage, that the first level cache of the transaction will be cleared after every call, for example. In this post, you will learn how to set up a transaction before a page or component render request and commit it right after the request is completely processed.
Read More
Backup Rotation with Date
Again (see ring buffer), this is a post, which shows an approach I will not need, since my backup script will change encore un fois.
I began to write a backup script using hard links and rsync in order to have incremental backups inspired by incremental backups with rsync. But after a little bit of hassle with bash script a friend gave me the hint that rsnapshot is out there and this little perl tool is either enlightened by Mike Rubels approach. So I will have to change my backup strategy from ‘push’ to ‘pull’ and make some other subtle changes, but don’t have to bother with ring buffers and backup rotation, because rsnapshot has already worked that out for me.
Read More