Juvenile Diabetes Research Foundation (JDRF)

by Aref Wed, September 07 2011 11:00

 

 

Nearly 10% of all Canadians live with diabetes today of which 10% live with Type 1 diabetes. According to JDRF, “Canada has the sixth highest incidence rate of type 1 diabetes in children 14 years of age or younger in the world.”

Type 1 diabetes is an auto-immune condition where the body’s immune system attacks itself (pancreas) affecting the normal production of insulin. This nasty affliction does not discriminate and directly affects our precious children.

Since its founding in 1970 by parents of children with type 1 diabetes, JDRF has funded over $1.4 billion in diabetes research, including more than $101 million in 2009. In 2009, JDRF funded research projects in 22 countries throughout the world, including more than 40 human clinical trials. We are accelerating the pace of research to a cure, and helping people with diabetes live longer, healthier, lives.

Please join me in support for this worthy cause by sponsoring me as I ride towards a cure for Juvenile Diabetes!

 

Please lend your support, click here.

THANK YOU!!!!!

 

 

Tags:

Lifestyle

How do I install SQL Server Management Studio Express 2008?

by Aref Wed, July 13 2011 16:27

I don’t know how many times I have run into the situation where I have installed SQL Server Express 2008 and now need to install SQL Server Express Management Studio 2008. Each time it takes me a while to figure it out and then, in my exhilaration, I forget to document it only to tear my hair out (whatever’s left of it) the next time I am in the same situation.

Well, this time I am documenting this, if nothing else, for the sake of my own sanity and scalp.

The trick is to NOT choose the option to, “Add features to an existing instance of SQL Server 2008”!

After you launch the installer, choose Installation from the “SQL Server Installation Center” and select, “New SQL Server stand-alone installation or add features to an existing installation.”

Wait for SQL Server to process the operation, finish the process and run the “Setup Support Rules/Files”. Complete the process and choose, “Perform a new installation of SQL Server 2008”. Click through the wizard until you get to see the “Shared Features” and check/select the “Management Tools – Basic” option.

Complete the installation.

Tags:

SQLServer

ASP.NET MVC3 with MvcScaffolding

by Aref Mon, July 04 2011 18:57

Do you find yourself repeating the same set of arduous and potentially error-introducing tasks each time you sprint or create a new project? Do you work with databases and typically write code to link up the data model to EF/Code and then do additional plumbing for managing entity relationships in your views and controllers? What about consistent validation across the EF code first to the controller and the views?

This article assumes that you have installed the latest MVC 3 bits into your development environment. I am using Visual Studio 2010 Ultimate. If you haven’t installed the latest MVC 3, you should do that first by going here: http://bit.ly/jnsOR0

In an over-simplification, MvcScaffolding is to your web application, what Code Snippets is to your document (code, xml, etc.). In other words, using MvcScaffolding you can, for instance, automatically generate

1.       Database contexts from your model,

2.       Controllers for creating, viewing, updating and deleting instances of your model or your viewmodel,

3.       Corresponding Views for creating, viewing, updating, and deleting data,

4.       Catalyze the generation of a database model including support for one-to-many relationships and more…

In addition, you can customize your own scaffolding for instance to provide for default Localization support, custom authentication/authorization support, etc.

In this article we will walk through the creation of a read/write/update/delete of Recipes and its related (many) Ingredients using MvcScaffolding and MVC 3.

Start your engines…

(often-times, the launch of Visual Studio seems like it given the time that it takes)

Step 1. Ensure that your development environment (again, I am using Visual Studio) has the latest MVC 3 bits installed. See above if you haven’t done so already.

Step 2. Create a new MVC 3 Project

         

Choose the ASP.NET MVC3 Web Application Template as shown above,

       

 

I selected the Intranet Application option, you may use Internet or Intranet. Make sure that you are using the Razor View Engine and continue by clicking on OK.

Step 3. Deploy the latest MvcScaffolding

Now you are ready to deploy the latest MvcScaffolding package to your solution. To do this,

First launch the Package Manager Console

         

You will see the console with a PM> prompt. Type the following as shown below

                PM> Install-Package MvcScaffolding

         

You should then get the following results (you must be connected to the internet in order for this to work).

         

Step 4. Create your models

Here we are using Entity Framework 4’s code-first magic to first create classes for our entities.

Let us start by creating a class for Order (many side of the one-to-many relationship).

         

Let us now create a class for Customer (one side of the one-to-many relationship).

         

You will notice that we have included a foreign key for Customer in the Order class. Also, we have included a virtual collection of Orders in the Customer class to represent the orders placed by that customer and likewise, we have placed a virtual Customer member in the Order class to represent the customer for that order. You will see shortly how this plays out.

Step 5. Scaffold your models

Now the magic begins. For each of your models (Order, Customer) use the Package Manager Console to scaffold out the database plumbing, controllers and views.

Let us start by scaffolding the Order model by running the following

                PM> Scaffold Controller Order –For ce

         

Now do the same for the Customer model.

Step 6. Compile and run your application

…the moment of truth. Run your application and browse to the Customers controller default view as shown below

         

Create a few customers (notice how the validation is working)

         

Now create a couple of orders for one of your customers. (Notice how the drop down brings in the customer names to choose for the order. Nice eh?)

         

         

Now list your orders (Notice how it shows the customer name for each order)

         

List the customers (Notice how it shows the total number of orders for each customer)

         

Browse away and enjoy.

Notes.

I hope that you have found this useful. Scaffolding is a powerful concept to quickly build out functionality to your MVC applications. Maybe you can customize the scaffolding to include internationalization/localization support and share it back with us? I have attached the source code for this project.

Downloads


Download Source Code (2.68 mb)

 

Download as PDF (941.45 kb)

Tags: , , ,

.NET MVC