Dynamic proxies are one of those topics along with Reflection (to a lesser extent) that seem like magic in Java. They exist outside of the safe, procedural oriented nature of the language and add useful complexity and color to an otherwise dull language.
What are Dynamic Proxies exactly? Dynamic Proxies allow you to run custom code before, after, (or before and after) other pieces of code. For example:
class Blah {
public void myMethod() { System.out.println("I ran!"); }
}
Say I wanted the above method to run before every call to Math.cos(). So, I would extend a new class from the Proxy class and tell it to intercept calls to Math.cos(). The I could tell it that instead of calling Math.cos() call my code instead. In my Proxy class, I would have the option of calling the original function or not.
Buzzword Bingo
Essentially, we have created a "logger" for Math.cos. Logging is frequently referred to as a "cross cutting concern". I point this out now to perhaps trigger recognition that one of the chief reasons to use Dynamic Proxies is to insert code around methods in an independent fashion without affecting the original code. Dynamic Proxies are basically what AOP frameworks like SpringAOP and Guice use under the hood to provide their functionality. (psst!
Typical use cases for Dynamic Proxies:
- Unit Testing frameworks such as Butterfly Testing tools.
- Event Listeners
- Anything that's a cross cutting concern that you didn't use AOP for, such as usage logging, security, database connectivity.
Rules and Limitations, more to follow
There are rules and limitations to doing the above, but for today, we'll leave it at that.
I would like to document my experience installing and using GWT. Very quick background: I used GWT way back in 2007. I even reported a bug that I didn't follow up on
.
I'm using Eclipse 3.6. I first tried using the update site but it timed out on the spectacular number of .jar files that it tried to pull down. (after a solid two hours of downloading) Typical of Eclipse and java, seemingly uncomplicated simple things (downloading a set of files) is difficult and error prone.
I recommend using the "download method"for installation which comes in at a hefty 160mb zip file. (but the single file downloads in a browser in less than a couple minutes for those of you with decent connections)
Installation from the zip files seems like a breeze, but the designer fails to show. I'm able to do some things like kick off the "Google Development Mode" server. For a Eclipse noob like me, it's not clear why the designer fails to show. The FAQ provides a hint:
The most important piece missing from some Eclipse distributions is the Eclipse PDE (Plug-in Development Environment). You can correct this problem by launching Eclipse and selecting Help > Software Updates. Select The Eclipse Project updates from the list of sites and select the "Eclipse Plug-in Development Environment" to install.
So, why then isn't it one of the checked requirements? I found a description of how to install PDE but don't have any more time to check this out. (much time wasted in the original two attempts to install from the Eclipse Update site)
Adam Goucher has a great blog. I only recently started following him on twitter but I've learned quite a bit from him already.
I'm putting together a presentation on how to write Selenium tests for our company and wanted to extend the Selenium-IDE for Firefox. Adam wrote a great series of posts on this, but unfortunately, didn't tie them together (at least anywhere that came up in Google). So I've done that below.
- The Selenium-IDE 1.x plugin API (Part 1) – Build and Preferences
- The Selenium-IDE 1.x plugin API (Part 2) – The Toolbar
- The Selenium-IDE 1.x plugin API (Part 3) – The Sidebar
- The Selenium-IDE 1.x plugin API (Part 4) – Extending the Selenium API
- The Selenium-IDE 1.x plugin API (Part 5) – Publishing Updates
- The Selenium-IDE 1.x plugin API (Part 6) – Formatters
- The Selenium-IDE 1.x plugin API (Part 7) – Packaging Nuances
- The Selenium-IDE 1.x plugin API (Part 8) – Localization
- The Selenium-IDE 1.x plugin API (Part 9) – Secure Password Storage
- The Selenium-IDE 1.x plugin API (Part 10) – Registering your plugin
- The Selenium-IDE 1.x plugin API (Part 11) – Exporting New Commands
I always wondered what people use to create windows executables for Java apps. Launch4j is a pretty good option. It's free for commercial use, and is open source itself. The interface is a little clunky and takes some getting used to, but it does the job and has plenty of options:
- Maven AND Ant integration
- Splash screens
- Set JVM options via a config file
For me I needed to identify the process name. I'm surprised I hadn't found this sooner.
Tasklist and Taskkill are built into Windows XP and Windows 7. I've used PS Tools for a number of years and this is the first I had heard of the built in tool. They do what you might expect a tool named as such do which is manage tasks via the command line.
For my purposes, one thing that the built in TaskKill did better than pskill -- kill children processes. For some reason, pskill wasn't killing children processes (even with -t specified) spawned by launch 4j so this is illuminating. Kudos to MS for putting this built in. Now if we can just get robocopy and powershell, we'll be all set.
Google voice disallows dialing into conferences and meetings? But there is a work around for Android. This definitely breaks the of least astonishment.
Google impresses me less and less.
In Pocket Wars and Cores, Douglas Eadline makes a curious observation. The x86 CPU no longer dominates the world of computing. For the reasons mentioned in the article, this is a good thing.
Desktops haven't been the most influential disruptive platform for probably a solid 4-5 years, and articles are circulating that we have reached the post-pc era.
What does this mean for GPUs? Nvidia and others certainly make compelling computational devices. How will they fit into this new world of "processor instruction set" agnostic languages?
<t:form >
<t:input type="textField" t:id="componentfield" t:value="${componentfield}" />
<input t:type="submit" value="${message:continue}" />
</t:form>
This should be replaced with:
<t:form >
<t:input type="textField" t:id="componentfield" t:value="componentfield" />
<input t:type="submit" value="${message:continue}" />
</t:form>
The t:value attribute is expecting a property reference, not a value, which is what the first example is. Granted, the error message does very little to point in the right direction, but hey, maybe if you're getting this error, you'll run upon this page and be ok. 