Linux, Solr

Install Solr 5 and Zookeeper in a production environment

Recently I had to set up three Solr servers in an AWS environment. I couldn’t find anything specific to help me, so had to locate all the information separately. Hopefully the following may be of use to anyone who has to go through the same. In my situation, I have 3 servers that will sit behind a load balancer. The following describes how I set up each server.

Initially I thought it best to update all packages on each Amazon Linux AMI. I was using a green field environment. You might not be in that situation, so may not want to do the following.

sudo yum clean all
sudo yum update

Solr 5 requires a newer version of Java that was pre-installed on the server. So we need to obtained an updated Java package, and select it as the default version.

sudo yum install java-1.7.0-openjdk
sudo alternatives --config java

Continue reading


TypeScript Sublime Text integration

Something interesting has happened in the world of JavaScript development. Of all people, the folk at Microsoft have developed TypeScript.  If you’re in to such things, I don’t need to explain further.  There is a Visual Studio 2012 plugin, but these days I’ve fallen in love with Sublime Text.  Here’s a quick howto on TypeScript development with Sublime Text, specifically on Windows 7.

First install the Node.js msi package.  Once installed, open a command prompt and type the following to install the TypeScript compiler:

npm install -g typescript

Now grab the Sublime Text syntax hightlight definition file from MSDN. Open the zip and copy the typescript.tmplanguage file to your Sublime Text user packages directory. Mine is located in:

C:\Users\arowland\AppData\Roaming\Sublime Text 2\Packages\User\

Now open Sublime Text. Select Tools -> Build System -> New Build System. Paste in the following:

"selector": "source.ts",
"cmd": ["tsc.cmd", "$file"],
"file_regex": "^(.+?) \\((\\d+),(\\d+)\\): (.+)$"

Save this file. Now you can create a new JavaScript file, and save with the .ts extension. The editor will highlight TypeScript code, and allow you to compile to JavaScript by pressing Ctrl+B.  The build process will create the compiled JavaScript file in the same directory as the source TypeScript.


Entity Framework quick start

Microsoft’s Entity Framework has been around a while, but with it’s latest incarnation it is really shaping up nicely. I’ve been enjoying the ‘code first’ approach in version 4.1 of the framework. This allows you start your application design from POCOs, allowing the framework to infer the database design for you. For example, take the following Member entity model:

	class Member
		public int Id { get; set; }
		public string FirstName { get; set; }
		public string LastName { get; set; }

Continue reading

Codeigniter, PHP

Wolf CMS: Related pages plugin

For many small projects I’ve been using Wolf CMS.  a really nice and fairly lightweight application for managing content.  What I like about it is that the core code is quite minimal, but allows you to extend using plugins.

Recently I’ve been asked to build a site that requires a the ability to relate other pages to the one an editor is currently editing.

The plugin can be downloaded here. Note: This version is for Wolf 0.7.2 and above. The older plugin for Wolf 0.6 is also available. Once installed in the plugins directory and enabled in the administration screen, the following tab is now available when editing pages: Once installed in the plugins directory and enabled in the admininistration screen, the following tab is now available when editing pages:

Related pages plug-in screenshot

See the documention screen for sample frontend code which lists the related pages.

Please be aware that I really did knock this together rather quickly, but it works for me.  If anyone finds any bugs, please let me know.


W3C validation of ASP.Net output

A while ago I had to make certain that a CMS driven site built in .Net met some validation criteria.  Specifically the XHTML markup.  Running it by the W3C validator service, the markup always failed.

I fixed the obvious within the web.config.  For example, the following is needed to force the application to render XHTML:

	<system .web>
		<xhtmlconformance mode="Strict"></xhtmlconformance>

If I painfully cut and pasted the HTML into the Validator’s form field, it passed.  The problem is, is that the service is not recognised by the Web server, and so a helper file in the application is required.
Continue reading