Tag Archives: C#

ASP.NET MVC – Pretty URLs

As the little Harris Benedict Calculator application stands, the only way to get some sort of answer out of it is to fill in the form. What if you wanted to pass someone a URL that takes them directly to … Continue reading

Posted in Software Development | Tagged , , | Leave a comment

ASP.NET MVC – Server Side Validation

So far, we’ve built up a basic application and got some client side validation working. However, client side validation only goes so far. While it can prevent unnecessary trips to the server, it doesn’t prevent invalid data getting to the  … Continue reading

Posted in Software Development | Tagged , , | 1 Comment

ASP.NET MVC 3 – Introduction to validation

In my previous post on MVC 3 I started a project to calculate a calorific intake required to maintain a stable weight. In this post I’ll extent that to add some validation to the inputs. At the moment, since there … Continue reading

Posted in Software Development | Tagged , , , | Leave a comment

Starting an ASP.NET MVC 3 application

In this post, I’m going to show the basics of starting an application with ASP.NET MVC 3. The demo application will be a simple calorie counter that takes in a number of values from the user that is then used … Continue reading

Posted in Software Development | Tagged , , , , | 2 Comments

Custom error pages and error handling in ASP.NET MVC 3

In ASP.NET MVC 3 a new bit of code appeared in the global.asax.cs file: public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } The above method is called from the Application_Start() method. Out of the box, what this does is … Continue reading

Posted in Software Development | Tagged , , , | 10 Comments

Tip of the day #22: Obtaining all subdirectories recursively

This is an example of how to obtain a list of all subdirectories using a recursive method with the .NET Framework. public static List<DirectoryInfo> GetSubdirectories(DirectoryInfo directory) { // Set up the result of the method.List<DirectoryInfo> result = new List<DirectoryInfo>(); // … Continue reading

Posted in Tip of the Day | Tagged , | Leave a comment

Parallelisation Talk Example – Aggregate Exceptions

The two code examples here show what happens when exceptions are thrown within tasks that are not handled within the task. In each case the task that has the error throws an exception. In the first example, only one task … Continue reading

Posted in Parallelisation Talk Examples, Parallelization Talk Examples, Talk Examples | Tagged , , , , | 1 Comment

Parallelisation talk example – Independent Object Graphs

Parallelised code works best when data is not shared. This example shows a simple piece of parallel code where each task operates independently on its own object graph without dependencies on other objects outside its own graph. Each iteration of … Continue reading

Posted in Parallelisation Talk Examples, Parallelization Talk Examples, Talk Examples | Tagged , , , , | 1 Comment

Prallelisation Talk Example – Tasks within Tasks

In this example I’m showing the launching of further tasks within an existing task. The Main method launches a single task (of course, it would likely be many tasks in a real system) which is implemented by MainTask and then … Continue reading

Posted in Parallelisation Talk Examples, Parallelization Talk Examples, Talk Examples | Tagged , , , , , | 3 Comments

Parallelisation Talk Example – Parallel.Invoke

Parallel.Invoke is the most basic way to start many tasks as the same time. The method takes as many Action<…> based delegates as needed. The Task Parallel Library takes care of the actual scheduling, degree of parallelism etc. Parallel.Invoke itself … Continue reading

Posted in Parallelisation Talk Examples, Parallelization Talk Examples, Talk Examples | Tagged , , , , , | 6 Comments