Websites that we have built
Over the years, the coders corner has built lots of websites, working with web writers and graphic designers to help build them. Here are but a handful of my works. Depending upon budget we offer several different solutions, all built entirely in the UK. Our mainstay is building sites using static content management solutions, as they are generally much easier to maintain in the long run. If you need a dynamic site, we also build dynamic content using various technologies and are well versed in Java and Javascript server side technologies.
Recovering from a hacked Joomla site
I’ve recently had to help someone still running Joomla to clean up a hacked site. We are not sure how it happened, as they generally applied updates pretty quickly, but luckily it was detected very quickly and brought down to be fixed. If your site is hacked, consider taking it offline immediately, fixing will not take that long, and if search engines detect the problem, you’ll be taken out of the search results until it’s fixed.
The coders corner and Web design
Web design is a rapidly changing field, both technologies and web-design standards change frequently leaving one with fairly frequent update cycles. In addition to this, any CMS based solution must be updated frequently to ensure that the most recent version. This version will be hardened as much as possible against external attack. If you've not updated your CMS solution in some time, I recommend you do so as soon as you can.
Filtered extraction from zip file using ZipInputStream and Java 8
In the example below we build on the Reading a zip file from java using ZipInputStream page to provide basic filtering. This filtering is provided by the filteredExpandZipFile method taking a Predicate. Every ZipEntry is passed to the predicate, but only ones that match (predicate returns true) are included. Note that the size of an entry cannot be accurately determined in all cases, so it is not safe to perform validation on the this field.
Using Future and ConcurrentMap for a lazy cache
In this example I demonstrate how to use ConcurrentMap along with Future to generate a lazy cache. Concurrent maps are a good choice in some situations, where absolute atomicity can be traded off for performance, some level of control over ordering of events has been traded for performance. Let’s assume for the sake of example that we have an object that is heavy to create. Further, it has to be created on a single thread because it calls into a single threaded maths library.
Writing a zip file in java using ZipOutputStream.
Following on from one of our popular articles on Reading a zip file from java using ZipInputStream we’ve put together a new article on how to create a zip archive using Java. The below example uses ZipOutputStream to create a zip file from all the items in a directory. Zip files are written slightly differently to a normal stream in that each entry is put into the stream one at a time.
Old Generation GC and cache performance?
This is a question as much as a discussion, I can’t find a lot of detail on the state of play in this area and would really welcome any feedback or corrections. Please don’t read this as a negative article as that is not how it is intended; it’s in the optimisation section but I’m not sure what impact it really has. One thing for sure, for 99% of systems you probably don’t have to worry about what’s going on here at all.
Formatting dates in Java with DateFormat
There are several ways to format dates in Java, but by far the easiest is to use DateFormat. Creating a DateFormat is very similar to NumberFormat that we saw on the previous page. Here are the static factory methods called directly on the DateFormat class: getDateInstance(..) getDateTimeInstance(..) getTimeInstance(..) There are several overloaded versions of each method above. We will not cover Locale here as that will be covered in another article on java timezone support.
Setting up a database realm for role based security
Following on from Setting up role based security in tomcat, we now switch from using a memory realm to one backed by a database. Memory realms are great for testing but in any real application is would probably not be acceptable. Normally user credentials are stored in a database, so for this purpose there is a realm based on a datasource. Depending on your view of things, you will either edit server.
Simple uses of CountDownLatch
CountDownLatch provides a means of waiting for a number of asynchronous events before proceeding. In order to do this one constructs a latch providing the event count. Then one thread would normally call await Whilst the other thread calls countDown. Once the count reaches zero the await call returns and the latch is set. If the call to await happens after the latch is set it returns immediately. In our example we need to wait for a thread to initialise before proceeding.