Learning Journal

Jonathan's software development notes

EPiServer Blog Templates

EPiServer installs with demo templates that you can use as the basis for a new site. Part of this is some blog functionality. Unfortunately there is no documentation (at least none that I could find) about how to “install” only the blog functionality into an existing site. I ended up decompiling the EPiServer blog dll [...]

Recursive EPiServer page tree methods

Invoking JavaScript Functions

These are my reading notes from  Douglas Crockford, “JavaScript: The Good Parts” mixed with my own understanding. Objects are linked to Object.prototype, functions are linked to Function.prototype, which is linked to Object.prototype. Functions are objects. Functions can be defined anywhere that an expression can appear (examples of an expressions are literals like “hello world” and built-in [...]

cascade=”all-delete-orphan” doesn’t delete orphans

This snippet from stackoverflow is key to this problem (which really confused me)… when NHibernate doesn’t delete orphaned child objects when inverse=”true” (child owns the relationship). child.Parent = null may disassociate the parent from the child. But if it doesn’t also disassociate the child from the Session, and if the collection is marked inverse=”true” indicating that the child owns [...]

Three SagePay Integration Methods

Sage Pay are a payment gateway that works with the seller’s merchant bank and the buyer’s card issuer to provide e-commerce functions. The Sage Pay process is explained by this page: http://www.sagepay.com/payment-processing-technology. The parties involved in the process are: The sellers website/software/point of sale The payment gateway  The payment processor used by the merchant’s acquiring bank The card association (e.g., Visa/MasterCard) [...]

Sage Pay Form Integration

The Sage Pay Form integration method is designed for merchants who use shopping carts, have less experience in server side scripting, or who use shared web servers that do not offer database services. With Sage Pay Form, all transaction information is held at Sage Pay, including the full shopping basket contents, and e-mails are sent [...]

WordPress on IIS7

Lots of information here: http://learn.iis.net/page.aspx/280/install-wordpress-on-iis/ Because IIS does not support mod_rewrite module for rewriting URLs, you may need to use an ISAPI filter to achieve this in IIS, see http://www.deanlee.cn/wordpress/url-rewriting-for-wordpress-under-iis/.      

What’s the IIS7 anonymous authentication account?

In IIS7 the IUSR built-in account replaces the IUSR_MachineName account. The IIS_IUSRS built-in group replaces the IIS_WPG group. http://learn.iis.net/page.aspx/140/understanding-built-in-user-and-group-accounts-in-iis/  

Log4Net examples

Log4Net is a very useful open source project that has reams of documentation but it’s just quite hard to find snippets of information quickly. There are also many different ways of doing things. So I like to write up a working example to help remind myself. My main source of information is the Log4Net introduction page. Loggers and Appenders [...]

Git notes

I’m reading http://think-like-a-git.net and making notes… Graph theory is useful for understanding Git. Graphs are made up of nodes (dots) and edges (lines joining up dots). And edges can be directional. A Git repository is a graph. Commits are nodes on the graph which point to their parent commits. So from a commit you can follow the [...]

EPiServer Full Text Service & Windows Authentication

After publishing a new EPiServer 6R2 site to a UAT environment with Anonymous access disabled in IIS7.5, the EPiServer Full Text Search didn’t work. Navigating to the service URL (mysite.co.uk/IndexingService/IndexingService.svc) I got the error below, which summed up the problem: Security settings for this service require ‘Anonymous’ Authentication but it is not enabled for the [...]

Good article about ASP.NET HttpHandlers and HttpModules

http://codebetter.com/karlseguin/2006/05/25/httphandlers-%E2%80%93-learn-them-use-them/ http://codebetter.com/karlseguin/2006/06/12/global-asax-use-httpmodules-instead/        

IIS 7.5 Application Pool Identity

Windows Server 2008 SP2 introduced Application Pool Identities into IIS7. These allow you to have a unique user account for each app pool, and they are automatically created. So you can set your site folder permissions to an account such as “IIS AppPool\www.jonathansewell.co.uk”. Read the details here http://learn.iis.net/page.aspx/624/application-pool-identities/.

IIS7 “process cannot access the file”

I revived this error from IIS7 on my development machine when I tried to create a new site using port 80: The process cannot access the file because it is being used by another process It seemed like port 80 was already in use by something else, so openned up a command prompt and ran “netstat -ano” So process [...]

Keeping Umbraco connection strings out of source control

I like to keep connection strings out of source control, or rather I dislike having my connection strings overwritten when I update from source control. With a team of developers there are often multiple databases versions, and multiple database servers, depending on what you’re all working on and geographical separation. So connections strings will differ for [...]

How to: set up SMTP on Windows Server 2008

Some notes on how to ensure SMTP is set up correctly on a Windows Server web server, because I don’t do this enough to remember it. Check the Simple Mail Transfer Protocol (SMTP) service is enabled and running Open IIS6 (Internet Information Services (IIS) 6.0 Manager) The SMTP virtual server in the left hand column should display [...]

Unable to cast object of type ‘EPiServer.Core.PageData’ to type ‘Project.Web.PageTypes.Home’.

I kept getting this error when trying to cast from PageData to a PagtTypeBuild PageType: Unable to cast object of type ‘EPiServer.Core.PageData’ to type ‘Project.Web.PageTypes.Home’. I was also getting this on the home page: The current page is not of type ProjectPageBase. This often occurs when no id query string parameter is specified. The solution [...]

Write access for WordPress on IIS6 (and FastCGI)

Notes from solving problems with WordPress file access rights on IIS6 using FastCGI and PHP5. The identity of an application pool is the name of the account under which the application pool’s worker process runs. By default, application pools operate under the Network Service account, which has low-level user access rights. That is, this account provides [...]

Notes on Lucene.Net

Lucene.Net is a C# search engine library ported from Lucene (Java). Lucene allows us to create indexes of documents and their properties (fields), and to search those indexes. It’s on version 2.9.2 right now. Concepts of Lucene.Net Directory The storage mechanism for the index, eg. file system or memory. Document and Field The index contains entities called [...]

Notes on Extreme Programming

Notes on reading http://xprogramming.com/what-is-extreme-programming/. These are my reading notes summarising the article. The team forms around a business representative “the customer” Simple planning (the planning game) Shot release cycles Releases pass tests defined by the customer Work in pairs or as a group Obsessively testing Consistent coding style throughout the team Sustainable pace Whole Team A [...]

Running Umbraco in Visual Studio 2010

Most of the blog posts on the subject of setting up Umbraco involve setting up the Umbraco website in IIS, and using a separate Visual Studio project which makes use of post-build XCOPY commands to copy your new templates/user controls/css/images/etc into the Umbraco website. I’ve heard advocates for this approach talk about a clean separation of the Umbraco [...]

Reset forgotten Umbraco password

I installed Umbraco (version 4.7.1) on my laptop to have a play around with it last week, and of course forgot the password I used for the admin user. I found a quick way to get the password back . I don’t have an SMTP server on my laptop for a password reset email and [...]

Keep your connection strings out of source control

Checking out a project and finding your connection string has been overwritten is one of life’s cumulative annoyances… this is a technique that helps to avoid this: Move the connection strings config into its own file (see http://stevenharman.net/blog/archive/2007/06/07/tip-put-connection-strings-in-their-own-configuration-file.aspx). And add the connectionString.config to .gitignore. Create a copy called connectionString.config.tmpl and add it to git, then [...]

The new EU Cookie Law

The Information Commisioners Office has produced an advice document on the new EU cookie law. I have summarised parts of it below. The law has changed because the European directive on which the law is based has been revised, and UK law has to change to implement the changed directive. The law applies to all technologies [...]

MVC 3 Futures

Anyone using ASP.NET MVC 3 should have a read through the features of the MVC Futures project, outlined here: http://weblogs.asp.net/imranbaloch/archive/2011/07/26/using-the-features-of-asp-net-mvc-3-futures.aspx You can add it from nuget: http://nuget.org/List/Packages/Mvc3Futures Remember to add an entry for Microsoft.Web.Mvc to the <pages><namespaces> section of your web.config file so you don’t get compiler warnings (like “Incorrect number of parameters”).             [...]

Download and install Umbraco

Notes on getting an Umbraco instance up an running on my laptop running Windows 7. Download the Umbraco “binaries” from Codeplex. Unzip to you local development folder. I’ve put it in C:\Development\Umbraco4.7.1. Open IIS manager and create a new website. Point it at the “build” folder in the new Umbraco folder, and set the application [...]

Create an EPiServer 6 site with Deployment Center

This post is about how to get an EPiServer 6 site running in Visual Studio 2010 on your development machine. This method uses the EPiServer Deployment Center to create a new site and SQL Server database. Another option is the Visual Studio template, but it involves a bit of messing around to get it working [...]

NHibernate in a Web context

A web application has the concept of requests, a request from a button click for example is often intended to change the state of the application domain. So web requests can be mapped easily to the unit of work pattern: “A unit of work keeps track of everything you do during a business transaction that can affect the database. [...]

Bug hunting with Git Binary Search

Today I had a difficult problem, some of my colleges had made some security enhancements to a site, and a few days later the client reported a broken feature in a complex third-party plugin. The only clue to the problem was a generic JavaScript error. I looked for obvious problems but quickly ran out of [...]

A cautionary tale of scripts in a CMS

This is a problem I came across today, a JavaScript reference was added to a masterpage referencing JQuery 1.4.2: <script src=”/script/jquery-1.4.2.min.js”></script> The problem came when in EPiServer CMS a plugin (Composer) loaded a different version of JQuery which conflicted with the version loaded by the page. The solution, check before you load JQuery: <script>!window.jQuery && document.write(‘<script src=”/script/jquery-1.4.2.min.js”><\/script>’)</script> Update: The escape [...]