Get Spring Dispatcher servlet Spring context from ServletContext

Noting down a trick which I keep forgetting – in order to be able to look it up in a future.
The way to get Spring’s Dispatcher servlet Spring context from webapp’s ServletContext.

WebApplicationContextUtils.getWebApplicationContext(servletContext, FrameworkServlet.SERVLET_CONTEXT_PREFIX + "dispatcher")

Where “dispatcher” is the name of the servlet as configured in web.xml (i.e. <servlet-name>dispatcher</servlet-name>).

P.S. More info on the subject can be found here.

Advertisements

Eclipse RCP app for Carbon on OS X Yosemite

Had to run old Eclipse RCP app, and since I’m using Mac I’ve got latest OS X Yosemite.

I was also using old Eclipse 3.3 and JDK 6 for OS X downloaded from this location (since newer OS X were only shipped with JDK7 and now JDK8):
http://support.apple.com/kb/DL1572

The RCP app has target carbon and x86. Now when starting the app I had some weird errors about carbon-swt not being in classpath.

The fix turned out to be very simple: parameter “-d32” had to be added to run configuration parameters alongside with platform and the rest.

The hint was found on stackoverflow, with proper explanation of the reasons: “The Carbon SWT libraries are 32 bit only and will not load on a 64 bit runtime.”

Getting maven plugin for old Eclipse 3.3

I was revisiting an old project that was made for old Eclipse 3.3 and didn’t really work on newer versions (and I had no time to fix that) – so I’ve downloaded Eclipse 3.3/Europa and spent quite a long time searching for Sonatype Maven plugin (m2eclipse) for 3.3/Europa.

Long story short – it was found in Sonatype’s repo, but had to be downloaded and installed from local folder in order to work in 3.3. Here’s the link to the version that worked for 3.3:
https://repository.sonatype.org/content/sites/forge-sites/m2e/0.12.2/S/0.12.2.20110415-2017/

My Oh-my-ZSH theme (with command run date output)

I’ve decided to share my Oh-my-ZSH theme.

People used to have themes that include date/time in the prompt, but that’s only useful to know when command before prompt finished executing.
However, it doesn’t say much regarding time of command execution start.

For sure, if you open terminal and get prompt with 13:00:00 you can wait 5 minutes and then exec some command – for example echo or ls.
The command finishes, say, in 1 second, showing you 13:05:01 in new prompt. That lets you know when command finished. But not when it started.

I’ve added additional output of start datetime via preexec_functions hook of ZSH.

Here’s the code (moved to pastebing ’cause can’t get WordPress not to ruin slashes/backslashes )-: ) and a sample screenshot:
http://pastebin.com/cUvrbsgv

UPD: I’ve also fixed colorizing and moved end time to separate output (and also removed timestamp from prompt completely since it’s no longer useful to have it in prompt)

MVMn Oh-my-ZSH theme 2.1.1

UPD: My OhMyZSH themes are now on GitHub – github.com/mvmn/dotfiles/tree/master/.oh-my-zsh/themes