Skip to main content

Posts

North West Tech Talks - Creating a FinTech Bank & Managing change at scale

It was a busy week for me last week with both Wednesday and Thursday evening spent at meetups. Wednesday's was the North West Tech Talks meetup hosted by AO in their very cool building over in Bolton. It's a bit of a trek from Ormskirk and due to traffic took me over an hour to get there but it was well worth it, the content and speakers were great as was the food!

I had two reasons for making the trip to this one, first was the good content listed for the evening but secondly my other remote colleagues were going so we could spend a little face-to-face time together rather than just speaking on the phone. After about thirty minutes to get a drink (beer, wine, soft drinks) and mingle a little it was time for the first speaker.

How the heck do you manage half a million devices?Peter Egerton
First up was Peter with his suggestions on how to be able to correctly manage content distribution to a huge number of devices in multiple regions whilst not failing and ending up in the …
Recent posts

Lancashire Tech Talks #8 - Digital Transformation with DevOps, Docker and the Public Cloud

The 26th September saw the return of Lancashire Tech Talks a meetup group run by Andy Norton and HoiYen Sihapanya in Blackburn. The topics were Docker and migrating to the cloud. HoiYen has been involved with running all eight of the meetups and as I've recently taken over the Liverpool Software Architecture meetup I was keen to pick her brains about how to run a successful meetup evening.

Some beers and soft drinks were on ice when we arrived and lots of people were stood around in small groups catching up with old work colleagues or just networking to make new friends.  After a brief introduction and run through of the format of the evening it was time for the first talk.



Docker: Lies to Children - Jamie Taylor
Jamie's talk was on DevOps and Docker. He ran through where DevOps has come from, explaining about the Toyota Production SystemKaizen and The Three Ways as techniques to help speed up learning and improving processes.  Next he moved onto explaining what Docker was, …

ExpertTalks Manchester - Secrets of an Agile Transformation & Obstacles of Digital Transformation Evolution

It was a busy week for me this week with two meetups that I was planning on attending. The first was on Tuesday over in Manchester hosted by Equal Experts on agile transformations.  The weather was horrendous although it brighten up by 4pm. Drove off to Burscough Bridge station on the Manchester line, bought my ticket only to be informed that the train to Manchester was cancelled. Suggested that I could get a different train on a different line if I drove to Bursough Junction station so off I went. Found out when I got there that this particular train was also cancelled and that I'd have to drive to Wigan to ensure that I could get a train into Manchester. I had planned on being there around 5:30 however I didn't get to the meetup until just after 6:30. This meant that I'd missed the drinks/food/networking that occurs before the talks and walked in with the first talk already in progress!

Obstacles of Digital Transformation Evolution - Ryan Bryers
Ryan's talk was on th…

AWS User Group Liverpool #6 - AWS AppMesh

I've been interested in AWS since it was released and read up on EC2, S3 and SQS but never really had much need to really get into them. I have been using S3 storage for around ten years as a bucket in which to store my podcast recordings but that was it.

Out of the three major cloud providers (Amazon, Google & Microsoft) I've always felt an affinity with AWS, probably born out of the fact that it was the first one that I read into. On browsing Meetup recently I came across the AWS User Group Liverpool and so attended the meetup on Thursday.

Although thirteen people had signed up for it there was a total of five of us there, two of which were the meetup organisers! I still don't understand why more people don't attend these free events, there was pizza and beer, like-minded folk and good content as well as having a chance to chat with some of the DoES people and see what they are building.

This evening's presentation was by Paul Gledhill. He gave a brief round…

ExpertTalks Liverpool - Let’s Talk Automation Strategy & Making Testability Our Mission

On Tuesday evening I attended an "ExpertTalks Liverpool" event organised by Equal Experts. They run a number of meetups across the UK and this was the third one in Liverpool. The evening started with an open bar (with some lovely craft ales available) and some sandwiches and wraps.


First up was Samuel Durand with a lightning talk on "Making a SAAS", discussing the challenges when converting an in-house application into a multi-tenant 'service'. To be honest there was a huge amount of information presented in a very short amount of time so it was hard to keep up! He covered how you need to identify the differences in your clients and your processes to ensure your application can be configurable enough to cope.  The storage of personal data and GDPR was covered not only in how the data is stored but also that you need to consider what personal information may be written to log files, etc. and the access controls that you need in place.  What kind of technical …

Lancashire Tech Talks #7 - Behaviour Driven Development, AI For Ordinary Folk & The Mobile Is Dead

At 6pm on Thursday evening I attended the seventh Lancashire Tech Talks (@LancsTechTalks) based at Graham & Brown in Blackburn. It was a tech meetup entitled "Behaviour Driven Development, AI For Ordinary Folk & The Mobile Is Dead" with three guest speakers and they also provided food and drinks.
Graham & Brown have a great conference room big enough to seat over a hundred people and there were not many empty seats once the talks had started. The room is nicely decorated (not surprising really considering Graham & Brown are a wallpaper and wall-covering company) but the room was also light and airy.
When I arrived there was a good buzz in the room with people conversing in small groups, and the organisers and speakers setting up. Cold soft drinks and beers were provided and what I particularly liked was that recycling of the cans and bottles was being encouraged.

The evening started with the organisers introducing themselves and plotting out the course of the…

Setting up Spring application & webapp contexts correctly in Java integration tests

When integration testing Spring web applications you would often pull in the applicationContext.xml and the appropriate *-servlet.xml file using the @ContextConfiguration annotation within the junit test class. The problem is that this loads both sets of beans into the same context which is different from when tcServer loads the webapp for real. In a real server, the application context is loaded into the 'root' context and each servlet into it's own separate context which is dependent on the root (see my set of previous articles for more details).

To properly set up the contexts in a test environment so that they are loaded and treated the same as in a running tcServer you need to tell the test that it's a webapp test using the @WebAppConfiguration annotation and then use the @ContextHierarchy annotation to set up the order in which to load the contexts:

@RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextHierarchy({ @ContextConfiguration(location…

cvc-complex-type.2.4.c issues - a few things to check

I've battled with the Spring cvc-complex-type.2.4.c issue on a few occasions but with them far enough apart that I can't remember what the steps are to solve it. This time round I thought I would write it down...

You are writing a Spring-based app and you have some of your bean declarations in XML (I also use annotations but that's not important here). You wire your beans, you write your code and you build your application. Everything compiles and builds correctly, you run up your app in your container (in my case the dreaded Glassfish) and BOOM:
Caused by: org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 76; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'jms:listener-container'. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper. createSAXParseException(ErrorHandlerWrapper.java:198) Here are a few things to check:

Check that you have a element in your XML of …

Java Date & Time manipulation using Apache Velocity

Apache Velocity is an excellent tool if you need to bang out a quick bit of XML output or a text file with a particular layout and you don't want to do it all in Java. You create a Velocity template with your text in it and use various place-holders for the dynamic data that will be passed into it from your Java code. Velocity them merges the two together to give you a nicely formatted custom-filled file/document/SOAP request/etc.

It's a great tool but does have it's quirks and downsides and one that I hit upon recently was how to display dates in a particular format. You can call methods on any Java object that you pass to the template but only if it's in the Java bean standard format of getX() and the Date formatting methods don't follow this standard.

The solution was found within the optional Velocity-Tools library - DateTool. DateTool has a number of format methods on it which can twist the dates and times into any format that you need, here are some examples:

Beware of JavaScript's parseInt function - 010 does not equal 10...

I use JavaScript & jQuery quite a bit in my day job helping to add a bit of 'shiny' to our web applications. One feature that I added recently kept a track of the percentages that you had typed in the form.  It told you at the bottom of the page how much percentage you had left - I used JavaScript's parseInt function to help me in this respect.

As the application passed through system test it was found that if you typed '020' as a percentage my application said that you had 84% left to assign rather than the expected 80% - any ideas what's going on?

Yes that's right - the leading zero was causing parseInt to treat the number as an octal (base 8) number and so 020 was two lots of 8 = 16. It appears that this octal recognition is being deprecated but who knows when it will actually go so for now I've had to add ", 10" (i.e. a decimal radix) to the end of all of my parseInt calls:
parseInt(percentage, 10); Double check any code that you use wh…

Do 'is' boolean methods work in JSPs with JSTL?

When coding in JSTL you often want to use conditional logic (I'm thinking and the like) to be able to structure your page correctly. Auto-generated getter & setter methods will normally create isX() methods for the getters of boolean values (at least in Eclipse it does) but can you access this method directly from JSTL without writing a getX() version?

Does JSTL support 'is' boolean methods though? Ask a random poll of Java we developers and you will get conflicting answers so I decided to investigate, want the short answer?

YES - JSTL does support accessing isX() methods directly as if you were accessing a getX() method, but only if the return type of the isX() method is a primative boolean. If you return an object of any kind (such as Boolean isObjectBooleanTrue()) then JSTL fails to find the method and will give you a rather nasty JSP exception:
javax.el.PropertyNotFoundException: The class 'com.andrewbeacock.BooleanTest' does not have the property 'obj…

How to stop Eclipse reformating your Java enumerations & comments

Eclipse is a wonderful IDE for the Java language and I’ve used it daily for at least the past 4 years but it does have some 'issues'. One is regarding it’s code formatting (or reformatting) support, normally it does a great job of putting stuff in the right place but there are occasions where it just fails to get it right.

Enumerations
When I write enums I like to have each item on it's own row, I find it's easier to read and amend in the future:
public enum Family { MOTHER, FATHER, DAUGHTER, SON; } But Eclipse has other ideas and formats it so that it looks like this:
public enum Family { MOTHER, FATHER, DAUGHTER, SON; } A way to get around this (and any other times where you have a few lines of code that you don't want collapsing into one is to add the double-slash style code comments to the end of each line:
public enum Family { MOTHER, // FATHER, // DAUGHTER, // SON; } Block comments

I recently wanted to have a decent sized chun…

Always note DNS server settings offline

Had a strange experience this evening - complete loss of the internet. My router was suggesting that I had ASDL connectivity, and even an IP address but I wasn't able to load any websites. After a bit of debugging with the help of a remote friend I figured out that I wasn't able to connect to my OpenDNS name servers and so google.com wasn't resolving for me.

I updated my router with Google's DNS settings and was back in play - just goes to show that what appears to be an ISP outage can be a case of name servers not being available at that time.

Make sure you make a note of a few free DNS server details (i.e. both OpenDNS and GoogleDNS) offline so you can try them out if you ever end up 'offline'!

Misleading wiring messages with aliased Spring DataSources

When accessing databases in Spring you commonly use a dataSource.xml file of some description to hold the XML stanzas describing the connection details to various databases or schemas.

When dealing with multiple dataSource requirements you might find that more than one logical dataSource bean name actually points to the same physical connection. Rather than define multiple datasource stanzas with exactly the same details, Spring allows the use of the element to point easily to an existing bean but use a different name:<bean id="personDataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> <property name="url" value="jdbc:oracle:thin:@database:port:SID" /> <property name="username" value="USER" /> <property name="password" value="PASS" /> …

Using & comparing enumerations (enums) with JSTL

Often in your JSTL pages you will want to test a value of a particular variable before displaying something on the page. Often you are comparing against primitive types or other objects but what if you want to compare against an enumerated type?

Attempting to access the enumeration directly as Colour.BLUE doesn't work as the class/enum isn't available but what you can do it compare objects against their label or enum name.

If we have a Colour enumeration:
public enum Colour { RED, GREEN, BLUE }and we have a car object which has a getColour() method on it (returning the enumerated type) we can test against it in JSTL by using the specific name:
<c:if test="${car.colour eq 'BLUE'}">

Keyboard shortcut for 'paste as plain text' in Pidgin

I use Pidgin at work for communicating with my remote colleagues and I regularly paste code snippets and log file output into the Pidgin window. Often the text formats completely wrong and you end up sending the recipient a page of garbage rather than the real text.

Pidgin has a right-click context menu option for getting round this called 'paste as plain text' which normally does the trick but what if you normally use CTRL-V to paste your text in? After 2 seconds of experimentation today I found that CTRL-SHIFT-V is the keyboard shortcut for 'paste as plain text', I now feel complete...

Embedding a Google Docs spreadsheet in Blogger

Blogger is an excellent free blogging platform but if you want anything 'dynamic' then it starts to get in the way. One thought I've had recently was to see how I could share information captured in Google Docs Spreadsheet with Blogger.

I've a few ideas which will take a few posts to explain, so let's start with the most basic - embedding a Google Spreadsheet direct into Blogger.

Access the spreadsheet in Google Docs that you want to expose in Blogger, I've chosen a simple table of the most popular programming languages in 2010:


Next you'll want to share this spreadsheet with the rest of the world by publishing it as a web page:


Now you need to select the "HTML to embed in a page" option and copy the HTML code into the clipboard:

 Open a new post in blogger and ensure that the "Edit HTML" tab is selected and paste the code in:


Now publish your post and your spreadsheet will be visable in your blog post:



I didn't say it would be pretty…

How to use MatchMode in your JPA/Hibernate Restrictions & Criteria queries

Back in July I blogged about how to do AND/OR type SQL queries using Hibernate AND/OR JPA using disjunctions. If you looked at the example code you will have seen that I was appending "%" as the wildcard operator in my Restrictions.

Since then I've used Restrictions a couple more times and wondered if there was a better way of specifying them other than string concatenation.

Well there is and it's with the use of the MatchMode class.

Rather than this code:
import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; Criteria criteria = session.createCriteria(Product.class); criteria.add( Restrictions.disjunction() .add(Restrictions.ilike("code", codeOrName + "%")) .add(Restrictions.ilike("name", "%" + codeOrName + "%")) ); return criteria.list();You can now write:
import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Restricti…

Accessing & iterating over a Java Map in a JSP page with JSTL

When you are coding JSP pages using JSTL one thing you use a lot is the <c:foreach> tag. This tag a great for iterating over Lists or Sets but what do you do when you want to display the contents of a Map?

Firstly you need to decide how you are going to use the Map. Do you want to access a 'value' stored within the Map based on a known key or iterate over the Map displaying both key and value?

Access a Map based on a 'key'

This one is pretty straight forward you just need to know the JSTL syntax:
${aMapFullOfKeysAndValues[yourKnownKey]} Two key points:
The key is an existing JSTL variable or a quoted string You use square brackets at the end of the Map nameIterate over a Map pulling out the 'key' & 'value'

This is a little more complex, note the name of the variable that is filled on each pass through the Map ('entry'):
${entry.key} - ${entry.value} Four key points:
The name of the Map is placed as the 'items' attribute of th…