Aspects with Spring and Maven for getting rid of singletons

January 24th, 2009 Alexander Posted in Programming 1 Comment »

We wanted to update some old hibernate DAOs we had laying around which were implemented using singletons.  Instead of using singletons we wanted to wire these up using the Spring context. This was seemed to be an easy refactoring task. However, diving into the code we came to realize that we had several taglibs developed (extending from SimpleTagSupport) that was using these DAOs. And since you can't have constructors for these tags to dependency inject our DAOs we had to look elsewhere.

Read the rest of this entry »

AddThis Social Bookmark Button

Breaking into the Spring container with singletons

January 15th, 2008 Alexander Posted in Programming 1 Comment »

I was faced with a pesky security library at work. I had written my application with the help of Spring, but the security library was tightly coupled - and I really had viable option of rewriting it as it would break a lot of other applications depending on it. The only bit I could implement myself was the login module - which had to implement an interface with no constructor arguments. So I had to go out and figure out how to break into my Spring container from this login implementation and get a hold of some Hibernate DAOs to do the actual login procedure.

Read the rest of this entry »

AddThis Social Bookmark Button

Maven, Tomcat and Eclipse

January 15th, 2008 Alexander Posted in Programming 1 Comment »

Setting up a productive environment for your web programming experience is going to be a real timesaver once you get it set up correctly. And with Eclipse you can have that Tomcat container of yours up and running with automatic deployment of beans and jsp pages in a snap. Add Maven dependency management into the mix and you have yourself a good coctail to take your mind off those tedious deploy sequences, and instead concentrate on what you love most - hacking the code.

Read the rest of this entry »

AddThis Social Bookmark Button

Creating a folder symlink

February 18th, 2007 Alexander Posted in Programming No Comments »

I've been fiddling about with Applescript recently. And since I have a problem with using iTunes (due to its lack of ogg and flac support), I thought about writing a script which would create a symbolic link to any new artists/albums I added to my music collection.

This would leave me with a list of the newest additions to my music collection as a list of folders in Music:New, for easy playing with Cog.

I wrote the script, but still haven't really gotten past the issue of my need to have a folder action to be recursive. So because I have a "Music:Artist:Album:" structure only new artists are added to my New folder. The only solution I have found is to add this script as a folder action to every Artist folder I got...

Anyways. To use it: ctrl+mouse a folder, select "Attach folder action" and use this script as that folder action. You probably want to edit the paths a bit as well before using it. Its not really production ready.

on adding folder items to this_folder after receiving these_items
tell application "Finder"
if not (exists folder "New" of folder "Music" of folder "kiowa" of folder "Users" of startup disk) then
make new folder at folder "Music" of folder "kiowa" of folder "Users" of startup disk with properties {name:"New"}
end if
repeat with i from 1 to number of items in these_items
try
set this_item to item i of these_items
set the dest to folder "New" of folder "Music" of folder "kiowa" of folder "Users" of startup disk if the container of this_item as alias is this_folder as alias then
make new alias file to this_item at dest
else
display dialog the "container is not root"
end if
on error error_message number error_number
display dialog the error_message
end try end repeat end tell
end adding folder items to

AddThis Social Bookmark Button