Hi, I'm Karl.

And this is Jambr...

... my attempt at documenting my adventures as a developer.

I regularly come across, or generally do quite interesting things in my day job, so when I have some time I try and write about them. Hopefully you'll find some of the Articles handy.

Karl Stoney

Articles

MongoDB, Elastic Search, Setup

Setting up Elastic Search on MongoDb

Overview

I've been working on another project recently and have decided to stray away from typical relational databases (IE SQL), and get involved in the NoSQL revolution.... Primarily because I was sold the idea by Andy!

This naturally brought up the question of searching, and I found myself looking at solutions such as Lucene, but finally landed on ElasticSearch (which, is based on Lucene).

Getting this to work however with the latest version of MongoDb (2.4.6), proved to be some what of a challenge.  Therefore I've wrote this guide for anyone else suffering!  We will be installing and configuring the following on Ubuntu Server 12.04 LTS:

  1. ElasticSearch 0.90.5
  2. Plugin: MapperAttachments 0.90.5
  3. Plugin: MongoDb River 1.7.1 (currently the master unreleased branch)
 
Karl
 
1367
 
0
 
MongoDb, ElasticSearch

Redis-Sentinel TwemProxy Agent

TwemProxy Redis-Sentinel glue!

Overview

I was recently introduced to Redis by a colleague.  For those of you who don't know what it is, it is essentially an incredibly fast key-value store.

We had decided to adopt this technology at work, so we began to think about Performance, Redundancy etc, and after a day or two of playing around discovered that there isn't really an established solution for what we wanted to do.

As a result I ended up combining a few different technologies to get the setup we required, to give us redundancy, automatic failover, and horizontal scaling.

 
Karl
 
4809
 
0
 
CodeProject, nodejs, Redis

Google Music Sync using Python

A simple script to sync your MP3s to Google Music

Overview

Those of you who are familiar with Google Music know that you can upload up to 20,000 songs free of charge, which you can them stream from your PC/Laptop/iPad/Phone, whatever.  They provide a winky little UI driven client which will automatically upload files in a monitored directory for you.  

I have a media server on my home network where my music files live.  It's the central place that I use to stream music to various devices around my home.   This particular server runs a headless version of Linux and therein lies the problem, I don't have a GUI to use the Google client, and I don't want to install one just for that purpose!

I tried several methods of running the client on a headless box and eventually gave up and decided to write my own Python based script do sync for me.

 
Karl
 
867
 
0
 
Python

Automatic encryption of secure form field data

How to keep secure form data secure

Overview

My article on Throttling Requests got quite a bit of attention, so I thought I would continue the security theme and show you a simple method of automatically encrypting hidden form fields that you don't want the user to be able to change, or know the value of.   I will be making use of an extension to the HtmlHelper, a custom ModelBinder to handle the decryption and also Rijndael encryption to secure your data (you could use any method of encryption you so desire).

I must stress that this is simply one measure to ensure the security of your data, you should always still be validating the action at the code and finally database level, to ensure you have a secure application!

 
Karl
 
2364
 
0
 
.NET, MVC, Security

Generating a valid sitemap automatically with .NET

How to generate a sitemap automatically in .NET

Overview

Jambr is still a baby, as such it's content and structure is changing. 

It originally existed on two urls (www and non-www), and google was indexing both of them and to add to it not long ago I changed the url structure for Articles to be more, SEO friendly. 

All of these changes confuse search engine indexers and one way to help them out is to provide them with a Sitemap.  My rough list of requirements were:

  • To comply fully with the Sitemap protocol
  • To generate automatically, when /sitemap.xml was called
  • To be able to decorate fixed controller actions with an attribute which would include them in the map.
  • To provide a simple way of adding the dynamic content
  • To cache the output for a period of time
 
Karl
 
1361
 
1
 
.NET, MVC

Throttle requests to a .NET MVC action with a custom Action Filter

Protecting your application by throttling

Overview

In my day job I work for HP Enterprise Security Services, part of my role is building secure and robust web applications which do everything possible to prevent malicious attacks.

One of the most simple things you can do in your MVC project is to prevent repeat requests to a page.  This is primarily used in form submissions, for example in the comments box you see on Jambr, I don't want people to be able to repeatedly post to it over and over again, I want to introduce a time limit in-between these requests.

Also, there are going to be a lot of places on a typical site you want to limit such behaviour, but don't want to repeat the code everywhere.  This is where custom Action Filter Attributes come in.

 
Karl
 
1725
 
0
 
.NET, MVC, Security

Creating an RSS 2.0 feed with .NET Syndication Namespace

Creating an RSS 2.0 feed using .NET Syndication

Overview

In my Previous Post I demonstrated how to create an RSS feed using an XML Document.

This got some attention as it was pointed out to me that I could achieve the same result using the .NET Syndication classes.  As a result I have created this programming article with an alternate version of the class, which does away with the XMLDocument manipulation and uses these Syndication classes.

As with any default namespaces and classes in the .NET framework, they expose a lot of things that I quite simply don't need for my simple News or Article RSS feed, so I have wrapped them up as I did last time into a utility class, which enables you to quickly and easily create your feed.

 
Karl
 
785
 
0
 
.NET, RSS

Creating an RSS 2.0 feed with .NET

Creating an RSS 2.0 feed using .NET XmlDocument

Overview

Rather than post another article about setting up and using third party tools with .NET MVC, I thought I would take a slightly different approach this time and write a Programming with .NET article based on something I have had to do whilst creating Jambr.

I had the requirement to create an RSS feed for both the Articles and News sections of the site so you lovely readers could subscribe to either of them, I haven't actually had to create RSS feeds before so had to do some digging to find the best route to go down.  I read numerous programming articles on line and compiled a simple class which enables me to create an RSS2.0 compliant feed, as seen here.

 
Karl
 
921
 
0
 
.NET, RSS

Elmah - Installation and Setup

Error Logging Modules and Handlers for ASP.NET

Overview

As promised, here is my next article regarding another tool I find completely invaluable in my life as a developer, Elmah.

Basically Elmah sites quietly on your site, logging any exceptions (Code based or Web Server, for example, 404) which occur to (in this example) a database.  It then provides a nice neat GUI front end to allow you to view the details of these errors, including stack traces.

If you're anything like me, and are tired of conversations which go like this:

  • User: "Karl, the website crashed earlier"
  • Karl: "Oh right, what were you doing"
  • User: "I don't remember, I was just on it, can you fix it please"
  • Karl: "Well I could do with reproducing it...

You will be happy Elmah exists!

 
Karl
 
1243
 
0
 
.NET, MVC

MiniProfiler - Installation and Setup

Profiling your application has never been so easy

Overview

The primary reason I started this web site was to share with you the things I come across in my day job as a Web Developer, the first batch of articles I am going to write will be around the tools I find invaluable in my role.

So first and foremost, let’s take a look at MiniProfiler.

MiniProfiler is a tool created and used by the StackExchange group of websites and is used for profiling your .NET and Ruby applications.

 
Karl
 
1347
 
0
 
.NET, MVC

Adverts

Recent Articles

Recent Blog Items