Jan 31

TheServerSide now running on Tapestry/Kodo JDO

JDO, Java, ORM, Tech, Web Frameworks 2 Comments »

TheServerSide communities are now running on Tapestry on the front end, and Kodo JDO for the data access.

We had known for awhile that it was ready for a change, and it was an interesting experience choosing what we wanted to port TSS over too.

There are many great web frameworks, and data solutions, but we definitely ended up happy with what we got.

The port was done in record time, in no part thanks to having Howard Lewis Ship on the team. If you are ever doing a Tapestry project, you owe it to yourself to bring him in for a bit. Not only does he obviously know Tapestry inside and out, but he is just a top class developer which great ideas!

Looking at the before and after version of TheServerSide is very interesting. Now TSS has a great, component-based version which is easy to extend. Before, it was always a fight to change / add anything.

It also doesn’t hurt that the site is faster and more stable than ever before. Kodo JDO has been top notch on that scale, and it has the solid Tangosol Coherence under the scenes as the distributed cluster technology.

Read more: How TSS Converted to Tapestry

Jan 31

Having to move almaer.com

Personal No Comments »

So, I had to move almaer.com last weekend. I have been wanting to move my domain elsewhere, but it always seems to be the last thing on the list to do.

The problem came when my blog was using up all of my bandwidth.

I thought that it would be simple to just add some bandwidth and be on my merry way. However, the hosting provider wouldn’t let me do this (well they would, but at a ridiculous cost PER MB).

They wanted me to cancel my account, create a new one, and move over to that. Well, if I am going to go to all of that trouble? why not move somewhere else?

So, now I am moved, and hopefully I won’t have the same annoying bandwidth issues going forward!

Jan 31

Heinz tricks Java by Mangling Integers

Java, Tech 4 Comments »

I always enjoy the Dr. Heinz Kabutz Java Specialists’ Newsletter .

He often seems to find the most bizarre corners of Java and the JVM.

A long time ago he showed how he could get:

(”hi there”.equals(”cheers !”)) == true

Now he shows how auto-boxing allows him to cheat the flyweight pattern of: Integer valueOf(int) (and for the other primitives).

Each class seems to keep a cache of its values, and if a security manager isn’t setup, we can dip into this cache and make some changes via:

try {
Class[] classes = Integer.class.getDeclaredClasses();
for (Class clazz : classes) {
if (clazz.getName().endsWith("IntegerCache")) {
Field cacheField = clazz.getDeclaredField("cache");
cacheField.setAccessible(true);
Integer[] cache = (Integer[]) cacheField.get(null);
for (int i = 0; i < cache.length; i++) {
cache[i] = new Integer(0);
}
}
}
} catch (Throwable e) {
// we silently pretend we didn't want to destroy Java...
}
Jan 31

Do you remember when email was reliable?

Tech 33 Comments »

The electronic postman is drunk on the job.

I remember when email was, at least, kinda reliable.

These days I have an eerie feeling in my loins that I have:

  • Somehow not received an important email
  • Somehow someone didn’t get one of my emails to them

I have this worry, as I actually find out about these mistakes from time to time.

Did you get my email?

Erm, what email?

*checks outbox, and inbox for sending errors*

Part of the problem is spam filters getting eager, but it is more than that. Some of my mail just dissapears as if it was never written. A scary thing…

Jan 31

Iteration.each(): A closure view of iteration

Tech No Comments »

Looping through items in Java can be annoying. The most annoying part is how the construct for looping through an array/collection/string are not consistent.

E.g

for (int i = 0; i < objectArray.length; i++) {

for (Iterator iterator = collection.iterator(); iterator.hasNext();) {

We shouldn’t have to think about this, and languages like Groovy let us get around it. Since, I like this, I decided to back-port the idea into Java code, so now I have the following available to me in Java:

Iteration.each(collection, new ObjectUser() {
public void use(Object o) {
// do something with the element from the collection
}
});

Iteration.each(objectArray, new ObjectUser() {
public void use(Object o) {
// do something with the element from the Object[]
}
});

Iteration.each(string, new ObjectUser() {
public void use(Object o) {
// do something with the Character from the String
}
});

And there is also reverseEach(..) for the various data structures.

Small things. NOTE: Commons-Collections does this

Jan 31

Iteration.each(): A closure view of iteration

Tech No Comments »

Looping through items in Java can be annoying. The most annoying part is how the construct for looping through an array/collection/string are not consistent.

E.g

for (int i = 0; i < objectArray.length; i++) {

for (Iterator iterator = collection.iterator(); iterator.hasNext();) {

We shouldn’t have to think about this, and languages like Groovy let us get around it. Since, I like this, I decided to back-port the idea into Java code, so now I have the following available to me in Java:

Iteration.each(collection, new ObjectUser() {
public void use(Object o) {
// do something with the element from the collection
}
});

Iteration.each(objectArray, new ObjectUser() {
public void use(Object o) {
// do something with the element from the Object[]
}
});

Iteration.each(string, new ObjectUser() {
public void use(Object o) {
// do something with the Character from the String
}
});

And there is also reverseEach(..) for the various data structures.

Small things. NOTE: Commons-Collections does this

Jan 27

Killing our planet: New Climate Change Warning

Personal No Comments »

“A new grid computing climate research project, climateprediction.net, has come up with its first major results, and they’re really not good news for the planet according to the BBC. The simulations suggest that over the next hundred years we could see average rises of average temperatures of up to 11K, more than twice what was previously thought.”

Scary stuff. I talked to someone who worked at NASA trying to work out the effects of our abuse on the planet (were we seeing natural changes in climate?) and after 10 years the results weren’t good then, and these look worse.

The big question: IS IT TOO LATE

Jan 26

OGNL and Spring

Java, Lightweight Containers, Tech No Comments »

Drew Davidson, of OGNL fame (amongst other), has written an OGNL-based property configurer (BeanFactoryPostProcessor implementor) that evaluates OGNL expressions in <value>, <map> and <list> entries, etc in the Spring configuration.

I get to use OGNL whenever I am working on either of my favourite web frameworks for Java: Tapestry and WebWork2.

It is one of those small languages that does one thing, and does it really well. It is a lot more powerful than the EL.

So, I am excited to see the like of OGNL, and Groovy, for configuring and wiring my components together. Thanks for this work Drew!

Jan 26

AOP: No more need for a standard in the Java space

AOP, Java, Tech No Comments »

From time to time the question has come up:

Do we need to have any standardization in the AOP space?

Of course, the first question that comes to mind, is what do you want to standardize?

The AOP Alliance got together several years ago, and gives you an API for dynamic proxy impls to play nice together (you can reuse advice and such with Spring AOP, dynaop, AspectWerkz, etc). However, the effort has stalled to some extend (maybe because it has done its job).

I think people wanted standardization because they wanted to be able to plugin different AOP systems like dynaop/Spring AOP/AspectWerkz/AspectJ. But we haven’t been in a place to do that yet, as the different platforms were really very different. We also don’t want to restrict to a low denominator too early, as we need to allow different frameworks to experiment and push things.

The AspectJ and AspectWerkz merger may well be the end of standards talk. When AspectJ 5 comes out it will be a top solution. We will have the full power of the AspectJ semantic model, yet for those who want it, they can use a Java/annotations view of things versus the AspectJ language.

AspectJ 5 will become the absolute de facto standard. I think it will be great for AOP as people will be able to get stuck in, and move on to more interesting problems, such as practices for using AOP, and even the holy grail of reuseable, REALLY USEFUL aspects :)

Jan 25

Alt+Enter: The IntelliJ IDEA Saviour

Tech No Comments »

I love the tips that IntelliJ IDEA gives you. I often hover over some bad code, waiting for the lightbulb to show up on the left hand side.

Sometimes, it doesn’t quite show up. Other times, it shows and sneaks away as my mouse gets near.

I got to get good at coaxing the lightbulb out of its shell. I sneak my mouse up to the code in question and surprise the underlined area, teasing the bulb.

Then I realised that I could just hit ALT + ENTER and the lightbulb now has to listen to my every whim.