Need a quick over view of how MVC can help you, take a look at these series of videos by Bill Burrows, all very simple and easy to follow videos, and what's more he is running the demos in VB.NET
The Model-View-Controller Framework
Dime Casts has a good selection of videos to watch
Okay, I've learn't something new today, so I'd thought I would share it with you, it's the yeald keyword, the reason why I think I have not used or know about it before is that it is used for an IEnumerable collection, which has come more in to play with LINQ, here is a short example of how it can be used:
This generates the following output:
It just makes sense to do it this way, much cleaner and much more efficient.
For more details check of MSDN on yeald.
It's worth noting that Yield is not support with VB.NET
To understand the the power of MVC you need to understand the Life Cycle, I could go in to great detail about the ASP.NET Lifecycle, but I have found a number of very good articles already providing good amount of information on the LifeCycle. Before going to the pages here is a simple flow diagram of the steps the MVC process goes through
The ASP.NET MVC Pipeline - Steve Sanderson
ASP.NET MVC - Living in a Web Forms World
When I am writing an application it is so important to make sure you record and log information correctly, there are a number of free loggers you can use
I have come to use NLog, by Jaroslaw Kowalski, it's so easy to use and get up and running, which is what you really need if you are using a logger of any type.
But what is the best practice when using a log in a live environment?
Or more importantly what and how do you configure you configuration file to make sure you are logging all your information?
The way I see it is, capture your logging to the Event Log and a Database for information and tracing.
When it comes to Errors and Fatal logging then, write it to as many places as you can, an Error file, the Event Log, a Database Log, and perhaps a special Exception Database Log, because if something has failed, you'll want to shout about it, and you want to record it in as many places as possible.
Here is an example of an NLog configuration
NLog.config (2.63 kb)
To setup the database use the following creation creation script
NLogDatabase.sql (1.16 kb)
Make sure within the SQL Database you have a user "nloguser", with a password of "nlogpassword", these are both defined in the NLog configuration file, and can be changed if need be.
That is it, all you have to do now is wait for your live application to log some information.
I am sure there are a few other configuration options available and I welcome anyones comments on how to improve this configuration file.
When you need to find if any records exist in a table or a selective snap shot of a table, you are prehaps like me in using the COUNT(*) SQL transaction and see if there are zero counts, but is this the most efficient method?
After a performance issue on one of my applications I found a new extension to LINQ to SQL called ANY(), from Ray Booysen on StackOverflow, here is an example of the SQL that is generated from LINQ:
SELECT COUNT(*) AS [value] FROM [dbo].[Employees] AS [t0]
SELECT (CASE WHEN EXISTS(SELECT NULL AS [EMPTY] FROM [dbo].[Employees] AS [t0]) THEN 1 ELSE 0 END) AS [value]
As you can see LINQ wins the day again.
Quite often when I start at a new client they ask me what are the benefits of TFS (Team Foundation Server), as they can not justify the cost, as it is very confusing (like may of Microsoft pricing structures)
I found this about "How much does Team Foundation Server REALLY cost vs SourceSafe?" by Eric Nelson, which is just what I have been looking for, as you can see the cost is not that much more than SourceSafe, and you gain huge benefits from TFS, as it is not just a Source Control, it's much much more.
How may time does it take to lose import files or photos held on your computer before you put in place a backup strategy to protect your files.
I thought I'd share my personal backup strategy, as I don't just reply on one process, in fact I have three sync/backup methods
Windows Live Mesh
This just has to be the best sync application around, so easy to configure, all you need is a Windows Live Signin and download a small local application and then just select which folders you want to sync.
Once you have sync'ed your folders they are available online or anyother machine you have installed Live Mesh application on to.
With a built in Remote Desktop application allow you to connect to your pc when you are away from home, this is a god send if you forgot something you left on you machine, or you just need to access one of your applications when you are away from your computer.
Currently Live Mesh is in Beta, I think this is due to the fact that it is running on Microsofts Cloud which is not full live yet.
The other draw back is it currenly only supports up to 5GB of storage, so you need to pick and choose what you want to sync, but for most users this is more than enough storage space.
This is an online backup storage application, unlike other backup applications it just works and does not get in the way of your working. With unlimitted online storage it is perfect for high end users such as myself. Only limitatation is a maximum file size of 2GB, which is not normal an issue.
External Hard Drive (Allway Sync)
With external hard drive so cheap this is a must have, and so easy to setup just purchase, it arrives in the post, plug it i, format and you are away. The final step is to find an application that will sync to the external hard drive. I choose Allway Sync, free download, a little techincal in setting up and getting going, would have been nice if this application had a noddy setup and looked at what and how your machine was configured and prompted you with a possible suggestion for sync. But it's free and it works.
So there you have it, three places where I keep all my files, and two places for my music, photos and videos
Online Storage Services Review
The Online Storage Gang
I've been looking around for some Data Grid's and as I love jQuery throught I'd share some Grid written in jQuery, well only one at present, froma Russian developer
So many places have so many different ideas on what and how things should look, as a developer it is just a cause of accepting what they supply. But from time to time, more often then not, the customer asks to see what you have produced, and even though you may have spent hours or even days getting the code to work correctly, the plain and simple fact is that it look and feels really bad.
Come on we are developers not designers.
So in order to help us developers out it would be good to have a set of images or library images you can look up and use when you needed them?
Well I came across Tango Desktop Project today, which helps the open source community to ensuring that people like me have access to the right images, even though they might change on the final release, but at least it will get you going and just make your application look great.
Tango Desktop Project
First of you are going to need to download and install SubSonic
Once installed just follow the steps below
Within Visual Studio
Title "SubSonic DAL"
arguments generate /out App_Code\Generated
Initial directory $(ProjectDir)
Prompt for arguments
use output window
scripting Schema and Data
You can script out your schema and data (and then version it in your favorite source control system) using SubCommander. Simply use the command "version" and tell SubCommander where to put the data:
sonic.exe version /out Scripts
This will output a script file (.sql) to the local scripts directory of your project
Generate a Version of the Database and Data
Title Subsonic DB
Arguments version /out App_Code\DB
Initial directory $(ProjectDir)