A week where everything looked like it was going to get back to business as usual, and then the days that I was supposed to be going up to London and Reading, things crop up. First the snow has it’s last hurrah, and then sickness sets in… rubbish.
January 16, 2010
January 9, 2010
Roman Holiday
Finally gotten round to putting up some of the photo’s from my holiday to Rome in November. I’ve settled on only 12 pictures from the few days I was there, but I think they show pretty much most of the trip.
January 8, 2010
Working From Home
Day three of not being able to get to work. I feel guilty because I’m working from home yet again, I shouldn’t feel guilty, because I am actually working… most of the time. It’s just very easy to get distracted by things around the flat. I ended up getting my cordless drill out and attempting to fix my sofa at lunch! Here’s to hoping that the snow has cleared by Monday and I can actually make the commute.
I’ve picked up one of two photography related Christmas presents, this is the Magnum portfolio book, hence the resurgence of taking photos. It’s times like this that I’m sorry I gave up on my 365. Maybe I could just try a 52? One a week perhaps?
January 6, 2010
Ice Invaders
Had a snow day working from home today, so I popped out to play in the park at lunch. I’m pretty sure I was the only person wandering around in the snow with a tray of novelty ice cubes!
(and it’s a handy widescreen ratio for wallpapers!)
November 8, 2009
Shamble of the Dead
Just before heading out to Rome (pictures to come of that soon), the Brighton Walk of the Dead shambled it’s way down from Brighton station to the sea front. It was awesome to see so many people really pushing the boat out and making an effort.
Some truly terrifying outfits!
October 23, 2009
Google Analytics – Tracking page categories
I’ve recently been looking at how I can use Google Analytics to track website usage of content based on the category it has been assigned. We are using META tags in the page headings to store the category name and title of the content.
Google have just rolled out a bunch of excessively handy features allowing custom variables in their most recent update to the analytics package, unfortunetly my Analytics account hasn’t yet been updated to include them. As a fall back I’ve used the Event Tracking functionality instead.
At the bottom of each page which I want to track the category of, added the following code;
-
-
<script type="text/javascript">
-
var pageTracker = _gat._getTracker("<%= googleAnalyticsId %>");
-
-
function getMeta(name) {
-
var metas = document.getElementsByTagName(‘META’);
-
for (var i = 0; i < metas.length; i++){
-
if (metas[i].getAttribute(‘NAME’) == name){
-
return metas[i].getAttribute(‘CONTENT’);
-
}
-
}
-
return "null";
-
}
-
-
try {
-
var cat = getMeta("CATEGORY");
-
var title = getMeta("ARTICLE_NAME");
-
-
if(cat != "null" && title != "null"){
-
pageTracker._trackEvent(‘Category’,cat,title);
-
}
-
}catch(ex){
-
/* do nothing */
-
}
-
pageTracker._trackPageview();
-
</script>
-
Using this codes means that I can put these meta tags into the headings of any page;
-
-
<meta name="CATEGORY" content="Analytics" />
-
<meta name="ARTICLE_NAME" content="Custom Variables" />
-
And Google Analytics will track the my each of my articles based on the category they have been tagged with.
October 21, 2009
Spring frustrations
I’m currently developing ten tonne of portlets using the Spring Portlet MVC framework. It’s been a frustrating but rewarding experience. I’ve been struggling with general documentation and examples for a while, and I wanted to make a quick post about a problem I’ve been having. Mainly because I found lots of people with similar issues, but no help at a resolution.
I’ve been using the AbstractWizardFormController, and over-riding the
-
-
public ModelAndView showForm(RenderRequest request, RenderResponse response, BindException errors) throws Exception
-
method to display my view and the
protected Object formBackingObject(PortletRequest request) throws Exception
method to populate my command bean.
My XML looked like this;
-
-
<bean id="menuSpotlightController" class="uk.co.smileham.cms.controller.edit.SpotlightController">
-
<property name="viewName" value="spotlightMenu" />
-
<property name="commandName" value="preferenceCommand" />
-
<property name="commandClass" value="uk.co.smileham.cms.model.PreferenceCommand" />
-
</bean>
-
This all seemed fine to me, however whenever I then tried to use the porlet I’d have a huge exception that went something along the lines of;
-
-
2009-10-21 14:04:28,765 ERROR [http-8080-Processor19] org.springframework.web.servlet.tags.form.SelectTag – Neither BindingResult nor plain target object for bean name ‘preferenceCommand’ available as request attribute
-
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘preferenceCommand’ available as request attribute
-
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
-
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:172)
-
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:192)
-
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:158)
-
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:121)
-
at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:379)
-
at org.springframework.web.servlet.tags.form.SelectTag.writeTagContent(SelectTag.java:198)
-
at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:90)
-
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)
-
at org.apache.jsp.WEB_002dINF.jsp.spotlightMenu_jsp._jspService(spotlightMenu_jsp.java:658)
-
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
-
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
-
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
-
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
-
After much frustration I discovered that the problem was that the “preferenceCommand” was being set in the model, but then being overridden by a new model in my showForm() method.
The solution was to read the documentation (funny that) and eventually found that when using the AbstractFormController you should not directly create a new ModelAndView object to return but instead get the current model from the “BindException errors” variable that has been passed in and then “return super.showForm(request, errors, viewName);”
So my final showForm method went from;
-
-
public ModelAndView showForm(RenderRequest request, RenderResponse response, BindException errors) throws Exception {
-
ModelAndView mav = new ModelAndView(viewName);
-
return mav;
-
}
-
to
-
-
public ModelAndView showForm(RenderRequest request, RenderResponse response, BindException errors) throws Exception {
-
Map<String,Object> model = errors.getModel();
-
return super.showForm(request, errors, viewName);
-
}
-
That may all seem like giberish, but hopefully it’ll mean that someone else seeing the same problem might figure out what’s going on sooner! (That and I shouldn’t fall into this problem again any time soon now.)
October 20, 2009
Redlaser – nerdgasm
Over the weekend I was sitting in a cafe with a friend of mine who works at a supermarket. He mentioned that he’d heard of a program on the iPhone which could read barcodes, RedLaser. I grabbed a copy, and we played around for a moment scanning the shopping we’d just bought.
Then sitting at home this morning, my eyes wandered to my DVD collection, and cogs began to whirr. A few moments later and I started the task of scanning each DVD, with the aim of e-mailing the list of results to myself, thus cataloguing my collection. Next I start on the CDs and books. So yeah, I had a nerdgasm, but only a little one.
October 18, 2009
London Trip
I went on a trip to London last Monday. Taking my mum and sister out for an awesome journey around our nation’s capitol.
We began with some light brunch as Leicester Square, then onto the Tate Modern for the Pop Life exhibit. I think we all enjoyed the Andy Warhol element, but when the hard core pornography was cracked out, my mother needed to leave the room for a breath of fresh air!
The day ended with a little shopping along Oxford street before heading homeward bound just before rush hour.
September 26, 2009
Hare Krishna
Krishna Krishna Hare Hare
Hare Rama Hare Rama
Rama Rama Hare Hare
The International Society for Krishna Consciousness were out along the sea front in Brighton last weekend. It was great to see such a colourful display out on a steel grey day!
We followed along for a few minutes and enjoyed the dancing and the singing, and then carried on homeward bound.
























