Everyone is up in a storm since Google announced they were killing Google Reader. Although I liked Google Reader, I believe change creates opportunities and unsurprisingly a better solution for feed reading presented itself almost immediately. In fact it was already installed on my system.
It's called Opera.
I installed Opera to read email when Mozilla killed Thunderbird and after some heavy customisation I'd say it works pretty well. It's much faster than Thunderbird for a start.
Now it looks like Opera is not only going to save my RSS feeds, but make my news reading more organised thanks to it's flexible user interface.
So here is a quick howto with screenshots for people who need to get off Google Reader and want to try out Opera.
Have you ever used a URL pattern something like this?
or perhaps this?
Well, as a JSF developer you've probably already realized a little problem. How do you remember the id from request to request? There are a few simple solutions.
One of the first things you'll notice when you start testing your web application with Selenium WebDriver is that there is no API to get the HTTP status code for a page. If you want to know why, you can go and read WebDriver issue #141. Personally I don't care why - I just want to test my HTTP reponse codes (especially 403 Permission Denied).
There is a fairly simple workaround you can use for WebDriver, but firstly lets look at how to do it without WebDriver. Nobody said you HAVE to use Selenium right?
Here is an annoying problem using JSF error pages for JSF requests. Everything looks just fine, HttpServletResponse.sendError() sends the error page, but JSF continues processing and starts throwing exceptions after the response is complete. This happens even if you call FacesContext.responseComplete(), and also when the error page is sent at different stages of the JSF lifecycle.
It seems like invoking the FacesServlet for sendError() breaks the state of the original FacesContext.
When sending an error during view build I get this exception:
I couldn't figure out why the heck my maven builds where taking so long. I thought Java was supposed to be fast these days and here I am waiting 30 seconds to run a unit test. So I did some digging and eventually found the problem.
On Linux, the default JVM is the Server JVM which does all sorts of useful optimisations for long running server process but is absolutely dog slow for building source code (this could also be a reason why the Linux community thinks Java sucks so much).
To find out what JVM you are running simply type:
$ java -version java version "1.6.0_26"
If you see "Server VM" like the example above do me a favor and time your maven compile (mvn clean compile) then switch to the Client VM, time it again and post your results in the comments below.
Each of my unit tests extends from a different base class depending on what layer of my application they are testing. i.e.
BaseTest `- BaseDBTest `- BaseOpsTest `- BaseUITest
These superclasses are very convenient places to put shared test code like starting a server, opening the database, doing a HTTP get or even just checking that assert is enabled.
When testing the whole application, it doesn't make much sense to me to run tests from all layers in random order. There are clear dependencies between the layers and if a lower layer fails I want to know about it before it blows up into the upper layers (if you believe its better to mock unit test dependencies then you might as well stop reading now).
Hi everybody. In this blog I'm going to share a little trick for creating emails using JSF Facelets templates. The concept is actually independent of JSF and could be used for any servlet-based technology.
Right, so the basic idea is to temporarily trick the ServletResponse object into writing all the content to an in-memory buffer, rather than streaming it to the client's browser. We then manually invoke the JSF render phase for the particular view using the special ServletResponse and voila!, the captured output can be put into an email.
Let's have a look at some of the code.
Okay, Ubuntu Hardy is pretty old now but my Hardy server is still humming along just fine and I don't see a good reason to break it just to run a few Ruby On Rails apps. The ruby, ruby1.9 and rubygems packages on Hardy simply don't work anymore and the rails package is too old to run my app.
So here is how I got the latest rails running on this 4 year old server. I hope it saves you some pain.
1. Install JRuby 1.6.8. The Ubuntu ruby1.9 package just hangs silently when trying to install rubygems, but JRuby does the job.
# cd /opt
2. Install Rubygems 1.8.24
# wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.zip
I've discovered that one reason I don't write as many unit tests as I should is because they live in a separate source tree, out of sight and out of mind. So I've moved my unit tests to be inner classes on the classes they test. A side effect of this is you can easily test the private methods of a class since the inner class has direct access to these methods.
Here is the configuration you will need to do this. Note, I am using TestNG, but it should be pretty similar in JUnit.
Sometimes it's nice to have your projects resource files alongside the java source files they're related to. By default, Maven forces you to have a separate resource tree so, for example, whenever you need to a add a String for internationalization you have to go digging through your project's folders.
The good news is, you can change change maven's default resource folder this with this little bit of XML magic in Maven pom.xml.
Note this overrides the default location, so make sure src/main/resources is empty, or add to the pom.xml like this.
Don't forget to exclude the java files unless you want to ship your source code!
With a TODO list of over 500 items I clearly need advanced software to manage my tasks. And finally I have found just the tool for the job...
After trying web based project trackers, spreadsheets, desktop project management apps, calendar based, email-based, smartphone apps and everything else I could think of, it looks like I'll be sticking with my plain text todo file with a couple of handy VIM scripts.
Here's how it works.
Euch. What a mess. I've hit this bug a few times and have never found the exact cause. So I'm dumping my notes and test case here for next time.
Here are 4 nested templates that should output the following when viewing the deepest template: