Pages

Tuesday, 4 October 2011

ASP.NET MVC 4

 

Download ASP.NET MVC4

ASP.NET MVC 4 is a framework for building scalable, standards-based web applications using well-established design patterns and the power of ASP.NET and the .NET Framework.

Top Features :

  • Refreshed and modernized default project templates
  • New mobile project template
  • Many new features to support mobile apps
  • Recipes to customize code generation
  • Enhanced support for asynchronous methods
  • Read the full feature list in the release notes

ASP.NET MVC 4 can be installed and can run side-by-side with ASP.NET MVC 3 on the same computer, which gives you flexibility in choosing when to upgrade an ASP.NET MVC 3 application to ASP.NET MVC 4.

Upgrade ASP.NET MVC3 Projects to ASP.NET MVC 4:

You can upgrade your an ASP.NET MVC 3 Project to ASP.NET MVC 4

To manually upgrade an existing ASP.NET MVC 3 application to version 4, do the following:

  1. In all Web.config files in the project (there is one in the root of the project, one in the Views folder, and one in the Views folder for each area in your project), replace every instance of the following text:
     
    System.Web.Mvc, Version=3.0.0.0
    System.Web.WebPages, Version=1.0.0.0
    System.Web.Helpers, Version=1.0.0.0
    System.Web.WebPages.Razor, Version=1.0.0.0

    with the following corresponding text:

     
    System.Web.Mvc, Version=4.0.0.0
    System.Web.WebPages, Version=2.0.0.0
    System.Web.Helpers, Version=2.0.0.0,
    System.Web.WebPages.Razor, Version=2.0.0.0,

  2. In the root Web.config file, update the webPages:Version element to "2.0.0.0" and add a new PreserveLoginUrl key that has the value "true":
    <appSettings>
      <add key="webpages:Version" value="2.0.0.0" />
      <add key="PreserveLoginUrl" value="true" />
    <appSettings>

  3. In Solution Explorer, delete the reference to System.Web.Mvc (which points to the version 3 DLL). Then add a reference to System.Web.Mvc (v4.0.0.0). In particular, make the following changes to update the assembly references. Here are the details:

    1. In Solution Explorer, delete the references to the following assemblies:

      • System.Web.Mvc (v3.0.0.0)
      • System.Web.WebPages (v1.0.0.0)
      • System.Web.Razor (v1.0.0.0)
      • System.Web.WebPages.Deployment (v1.0.0.0)
      • System.Web.WebPages.Razor (v1.0.0.0)

    2. Add a references to the following assemblies:

      • System.Web.Mvc (v4.0.0.0)
      • System.Web.WebPages (v2.0.0.0)
      • System.Web.Razor (v2.0.0.0)
      • System.Web.WebPages.Deployment (v2.0.0.0)
      • System.Web.WebPages.Razor (v2.0.0.0)

  4. In Solution Explorer, right-click the project name and then select Unload Project. Then right-click the name again and select Edit ProjectName.csproj.
  5. Locate the ProjectTypeGuids element and replace {E53F8FEA-EAE0-44A6-8774-FFD645390401} with {E3E379DF-F4C6-4180-9B81-6769533ABE47}.
  6. Save the changes, close the project (.csproj) file you were editing, right-click the project, and then select Reload Project.
  7. If the project references any third-party libraries that are compiled using previous versions of ASP.NET MVC, open the root Web.config file and add the following three bindingRedirect elements under the configuration section:
    <configuration>
      <!--... elements deleted for clarity ...-->
     
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers"
                 publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc"
                 publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages"
                 publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>

 


ASP.NET MVC 4 Developer Preview


ASP.NET MVC 4 Mobile Features


image

Edit In Place Plugin Using jQuery

Edit In Place means : User clicks text on web page. Block of text becomes a form. User edits contents and presses submit button. Changes are sent via JavaScript which normally would be used to update the text and save it. Form becomes normal text again.

image

Demo using MVC Application:

1- First you must add jQuery , plugin and style sheet to _Layout.cshtml file.

<head>

    <title>@ViewBag.Title</title>

    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

    <link href="../../StyleSheet.css" rel="stylesheet" type="text/css">

    <script src="@Url.Content("~/Scripts/jquery-1.6.4.js")" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/EditableText.js")" type="text/javascript"></script>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

    @RenderSection("head", required: false)

</head>

2- Pass the elements you want to make editable to the plugin. In this example I marked editable elements with "editableText" class.

<p class="editableText">

When you roll your cursor over the element , the background changes to a dashed darkorange line.

3- Looks for the div with id=”editableText” and tells jQuery to do something when the div is clicked. (Make the new line is not allowed )

jQuery(function ($) {
           $('p.editableText').editableText({
               newlinesEnabled: false
           });

           $.editableText.defaults.newlinesEnabled = true;

           $('div.editableText').editableText();

           $('.editableText').change(function () {
               var newValue = $(this).html();
           });
       });

Clicking the text will start some DOM (Document Object Model) magic resulting in the element being replaced by a textarea input — with the text to be edited inside.

In a real world application you would add in some additional safety checks, and then update your database with the new information and send back information that tells jQuery if the changes were successful.

4- Create a function that will do something with the new value of the editable element. Bind it to the element using change event. (Edit, Save and cancel events)

var editEl = buttons.find('.edit').click(function () {
                startEditing();
                return false;
            });

            buttons.find('.save').click(function () {
                stopEditing();
                editable.trigger(options.changeEvent);
                return false;
            });

            buttons.find('.cancel').click(function () {
                stopEditing();
                editable.html(prevValue);
                return false;
            });

check the “EditableText.js” file

 

See all the Demo code : Download

 

Useful Links :

- http://plugins.jquery.com/project/edit_in_place

- http://plugins.jquery.com/plugin-tags/edit-place


Monday, 19 September 2011

NuGet

NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio that use the .NET Framework.

If you develop a library or tool that you want to share with other developers, you create a NuGet package and store the package in a NuGet repository. If you want to use a library or tool that someone else has developed, you retrieve the package from the repository and install it in your Visual Studio project or solution.

A brief introduction to NuGet.

You can download NuGet

When you install NuGet package, it copies the library files to your solution and automatically updates your project (add references, change config files,… etc.). If you remove a package, NuGet reverses whatever changes it made so that no clutter is left.

NuGet Features :

1-  When creating a new ASP.NET MVC 3 project template with preinstalled NuGet Packages, the jQuery script libraries included in the project are actually placed there.

 

The Manage NuGet Packages Dialog Box :

Click on the Online tab to see packages available in the official feed.

Manage-NuGet-Packages-Dialog

 

Finding and Installing a NuGet Package Using the Package Manager Console:

Install, remove, and update NuGet packages using PowerShell commands.

Using PowerShell commands is required if you want to install a package without having a solution open. It's also required in some cases for packages that create commands that you can access only by using PowerShell.

See this useful link Finding and Installing a NuGet Package Using the Package Manager Console

Supported Operating Systems:

The PowerShell cmd lets require PowerShell 2.0. Therefore, NuGet requires one of the following operating systems:

  • Windows 7
  • Windows Vista SP1
  • Windows Server 2008
  • Windows Server 2008 R2
  • Windows Server 2003 SP2
  • Windows XP SP3

Useful links :

NuGet in CodePlex

The easy way to publish NuGet packages with sources

Mongo DB

MongoDB is an document-oriented DBMS. Think of it as a persistent object store. It is neither a relational database, nor even "table oriented" like Amazon SimpleDB or Google BigTable. If you have used object-relational mapping layers before in your programs, you will find the Mongo interface similar to use, but faster, more powerful, and less work to set up.

mongo_3

You can download and extract the binaries from here

Features of using Mongo DB:

1- MongoDB is in the sweet spot of performance and features. Its rich data types, querying, and in place updates reduced development time to minutes from days for modeling rich domain objects.  Chandra Patni

2- With foursquare’s growing popularity, we were fast approaching the point where it would no longer be feasible to store user check-ins on a single physical machine. MongoDB's auto- sharding capabilities enabled us to easily transition to a multi-node cluster that will enable us to continue to grow for the foreseeable future.    Harry Heymann

3- MongoDB supports full consistency and transactional updates.

4- MongoDB aims to provide greater agility and scalability for many applications by eliminating joins and relational modeling

 

You will find some useful tutorials for MongoDB : Tutorial here such as How to run MongoDB , Getting a database connection …. etc.

Sample code to connect to MongoDB :

string ConnectionString = "mongodb://localhost/Persons";

var server = MongoServer.Create(ConnectionString);
var db = server.GetDatabase("Persons");

MongoCollection<Person> collection = db.GetCollection<Person>("Persons");
var personRecords = collection.FindAll();
foreach (var p in personRecords)
{
      dataGridViewPersons.Rows.Add(p.Id, p.Name);
}

Some useful links and resources :

How to use MongoDB update operators

MongoDB and C#

CSharp Driver Tutorial

Connections

Saturday, 27 August 2011

Introduction for Microsoft Visual Studio LightSwitch

 

Microsoft Visual Studio LightSwitch is a simplified self-service development tool that enables you to build business applications quickly and easily for the desktop and cloud.

image5

LightSwitch offers downloadable starter kits and flexible deployment options that help you create and easily release custom business apps that look professional and polished, with no coding required.

LightSwitch includes customizable templates and enables you to write custom business logic that applies to your organization’s specific needs, helping you create an experience that your users will love.

Easily expand your LightSwitch application’s functionality by adding extensions and components from third-party vendors.

Now you can see firsthand why building business apps has never been easier. Download the free 90-day Trial , watch the LightSwitch Launch Keynote and get general product information on the LightSwitch site

Video:  Build your first LightSwitch app

To Discover the Top 10 Benefits of Visual Studio LightSwitch and compare it with Visual Studio Pro Download the LightSwitch datasheet .

Microsoft Visual Studio Lightswitch 2011 [X86 - LULZ ISO]

kindly Wait for the coming posts related to LightSwitch

Thursday, 25 August 2011

Microsoft Web Platform Installer

Microsoft Web Platform Installed is a simple.

It’s a free tool that makes you can download and install all of Microsoft's entire web platform in one step using the Web Platform Installer’s user interface including :-

  1. IIS
  2. Visual Web Designer
  3. SQL Server 2008 Express Edition
  4. Microsoft .Net Framework
  5. Silverlight Tools
  6. and more ……

You can choose to install either specific products or the entire Microsoft Web Platform onto your computer.

The Web PI also helps keep your products up to date by always offering the latest additions to the Web Platform.

Web PI 1.0 supports Windows XP, Windows 2003, Windows Vista and of course Windows 2008.

Web PI 3.0 supports Windows 7, Windows Vista SP2, Windows XP SP3+, Windows Server 2003 SP2+, Windows Server 2008, Windows Server 2008 R2.

Download Web PI 3.0

Web PI starts up on the "Spotlight" tab, where we highlight products and applications that we think will be the most interesting for our users

web-platform-installerFigure 1: “Web PI Spotlight” tab

 

Web PI separates the components you can install into two main categories:  Products and Applications.

In the Products tab, you will find all the components you need to build and maintain your web sites.  The Applications tab is home to our wide collection of open-source applications that you can use as a great starting place for developing your sites.

 

The “Products” tab shows the four main components: Server, Frameworks, Database and Tools.

IC477051

Figure 2: “Products” tab

Wednesday, 24 August 2011

Windows 8

 

Windows 8 new features !!!!!

Introduces Windows 8

 

Windows 8 interface, navigation features

 

Building Windows 8 news features copy move rename delete

They wanted to do an early Windows 8 post about one of the most used features, and one They have not improved substantially in a long time. With the increasing...

 

 

USB 3.0 in Windows 8

 

 

Windows 8 Video Preview