Custom Exception Handling for AccessDeniedException

posted by Jake on under Security

Our app throws all sorts of exceptions. Well, it doesn't usually. It shouldn't normally. Er... But, when it does we want to put in some handling so that the app doesn't blow up in some unsuspecting user's face. And even then, sometimes we want special handling for certain exceptions and make sure others are just caught. And that's what we'll do with AccessDeniedException.

'And' Spring @Secured Roles

posted by Jake on under Security

Spring Security (previously Acegi) gives you an awesome AOP way of locking down methods in your Java application. And well-placed lock down is a special power indeed. However, Spring disappoints a bit on this score because it turns out its default behavior is to 'or' the roles listed in @Secured annotation. You'd think the default would be the stricter 'and', but alas. But never fear, there is hope.

Calling Webservices in Java

posted by Jake on under Web Services

In Java Land, everything is tied up in multiple layers of multi-colored wrapping paper. The abstraction often provides niceties and protections and convenience, etc. But, sometimes it practically makes you forget where you are. For instance, why would anyone write a little howto on requesting something over the web from the context of the web. That should be easy, right? Well, yes, I think so. And it turns out it is in Java, as it is in many other languages. It's just that there you're super close to the HTTP protocol all the time, and in many Java ...

django_content_type_app_label_key Constraint on Heroku

posted by Jake on

Django comes with some awesome CLI tools. Manage.py is a beast of magic and lore. And it loves the fantastical kingdom of Heroku, where is romps with merry measure twixt the ether. But, when I've tried to go through a dumpdata of a previous site, syncdb on a migration to Heroku, and loaddata for moving the data, I've run into a snag on django_content_type_app_label_key more than once. Here are some resolutions.

Backbone Views in a Dynamic DOM

posted by Jake on under Rich UI

When you start writing applications with BackboneJS, that means that you're dealing with some dynamic UI. There are elements being pushed into and pulled out of the DOM. I was having problems trying to reference DOM elements that were dynamically inserted into the DOM by other Backbone views. The fix was simple but not immediately obvious without cracking open Backbone.

Backbone and JAX-RS

posted by Jake on under Rich UI

BackboneJS is setup to do some pretty sweet single-page app action. And of course, a single page app will probably be wanting to talk to web services on the server. And if your server code is doing the Java jive, then a great way to expose your REST services is via JAX-RS. It's as easy as Mikey singin' ABC-123!

Stored Procedures in Spring Jdbc

posted by Jake on under Data & Databases

In addition to some sweet Inversion of Control injection action, Spring brings flowers and baby deer. And it brings some nice database connection help. Spring JdbcTemplate is a vanguard of strength and ease for connecting to your favorite RDBMS. And it so happens that the DBA I'm working with right now digs the stored procs. So, we'll meet in the middle with some more goodness born of Spring.

Backbone Inheritance

posted by Jake on under Rich UI

Backbone has a great inheritance mechanism. It's as easy as Backbone.Model.extend(). This much is obvious. Let's try a few other things, like: Subclassing our own classes, calling to super classes, adding subclass attributes, and adding various subclasses to a collection based on a super class.

Django loaddata on Heroku

posted by Jake on

Django's manage.py script comes with some great utilitarian commands. Two of my favorites are dumpdata and loaddata. I've used these commands recently to migrate a Django app's data to the same Django app now running on Heroku. Here's a little taste of the glory.

Test-driven Development on MarkLogic

posted by Jake on under Testing

Unit testing is a required part of a healthy software development lifecycle and a balanced breakfast. But test-driven development is a rockin' part of an *awesome* development lifecycle. What's the difference? If you don't test-drive the dev of your MarkLogic XQuery, you may never come back to test again. Test-driven XQuery development will ease your headaches, put you into the plush seat of a developer with confidence, and rocket you down the road to making all your wildest dreams come true. Kachow!

Software Dev is Hard -- Don't Be Negative About It

posted by Jake on under Developer Thoughts

Is negativism between developers the norm? Probably not, but it's common. Do developers ever compliment each other? Yes, but it sometimes seems rare. When I step back, it does in fact seem that there is sometimes a noticeable wealth of negativism and a noticeable lack of complimenting. The nature of software and its developers may contribute. But we can overcome our challenges.

I18n Strings in Javascript

posted by Jake on under Internationalization

I've seen a number of different ways that internationalized strings get put into Javascript code. Of all of them, I kind of like just bundling the resource bundle of key value pairs in Javascript files themselves, one for each language or something close to that. But, in a recent project, there were a few other constraints, so we did it another way.

Dynamic LINQ Database Selection for Oracle .NET

posted by Bryan on under Data & Databases

Using an Oracle database backend in conjunction with LINQ required use of a 3rd party tool called DevArt dotConnect for Oracle. However, when the database model is configured, it's hard coded to a specific database instance (Dev, Test, etc). I wanted to dynamically select which database instance to run against relative to the lane my tests were running against. It's actually easier than I thought.

Create an IntelliJ Launcher in Ubuntu

posted by Jake on under IDEs

IntelliJ IDEA is a great development environment. I enjoy it very much. It complements the OS of pleasure, Linux. I mostly the Ubuntu distro or a derivative. Here's a easy way to get yourself an IntelliJ launcher so you don't have to run the bin/idea.sh file if you don't want to.