So it’s a known fact that Java passes references by value. That means that if I pass an Object of some kind into a method, I can change the values in the object, but not the object reference itself. Likewise, if I pass an int into a method, I can change the value of that [...]
Repost: Rocket Java: Timing Method Calls
My data stores benchmark gives out timings in terms of nanoseconds, by making a list of response times and then applying statistical methods to get data out of the list. However, one part of that comes up every now and then: how do you measure the time it takes to issue a call? After all, [...]
Repost: Rocket Java: Spring Injection of Other Beans’ Properties
Woot, IRC FTW! Someone today asked a question about Spring that was actually relevant for once. The problem was that he wanted to inject not a bean, but a bean’s referenced property into another bean. Put more succintly: He had a bean A, with a property B, and didn’t want to inject A into bean [...]
Repost: Rocket Java: Initializing arrays of arrays
From IRC, from whence many “interesting” questions come: “If I have a 4 dimensional integer array in Java, is there a way to initialise every element in it to a particular value?” Well. First off, you don’t have a four-dimensional array. You have a one-dimensional array of one dimensional arrays of one dimensional arrays of [...]
Repost: Java’s more relevant than you think.
It’s really funny, honestly, but kids, Java isn’t cool. It hasn’t been cool for a long time. Slashdot even posted “The Struggle to Keep Java Relevant,” which … wow. Not only is Java not cool, but it’s not even relevant any more. Now, that article is … odd, because “relevant” apparently means “used by people [...]
Repost: Rocket Java: What is Inversion of Control?
From IRC: “What’s Inversion of Control?” First off: Oh, my. Here’s a quick summary: traditionally, Java resources acquired whatever resources they need, when they need them. So if your DAO needed a JDBC connection, it would create one, which meant the more DAOs you created, for whatever reason, the more JDBC connections you used. It [...]
Repost: Self-censorship.
As an artist – an artiste, thank you – I get all worried about creating stuff that people might find offensive. When I was nine or ten, for example, I wanted to write a poem that used the word “damn.” So I asked my mom – and she said I shouldn’t, that I should use [...]
Repost: It’s all about the boundaries, baby
The key to distributed – and enterprise – computing is boundary management. Even worse, it’s not conceptual boundary management – it’s real boundary management, which is a lot harder to figure out. A boundary is a barrier between things or places, right? Well, consider a web browser and a web server; the TCP/IP layer is [...]
Repost: Rocket Java: if(s==null) {s=t} vs. s=(s==null?t:s);
From online again, names concealed to protect the guilty: I’m trying to figure out the shortest way to do this: if (anotherString != null) s = anotherString; Now, if you’ll pardon the stream of consciousness, through discussion it turns out he’s trying to work out the shortest form: s=((anotherString != null)? anotherString:s); Or, paraphrasing in [...]
Repost: In search of the perfect expression
One of my … flaws, I guess, is that I consider myself an artist. I typically prefer the aural media to visual, but I’m not afraid to try visual media. I guess a few definitions are in order. Aural media is something you hear, obviously, but there are some forms that can be considered aural [...]