UG Session - 25th Feb at Zenith Hall, UST Global, Technopark,Trivandrum
Agenda
09:30 - 09:45 Opening / Welcome Note
09:45 - 10:30 Sharepoint tricks by Shoban
10:30 - 11:15 Advanced Windows Debugging by Sujith
11:15 - 11:30 Tea Break
11:30 - 12:00 Windows Phone Programming for beginners By Deepthi
12:00 - 01:00 ASP.NET MVC3 by Shalvin
01:00 - 01:15 Closing Note
Venue
UST Global
6th Floor,Bhavani,Technopark
Trivandrum-695581
Kerala
Detrails
Tuesday, February 21, 2012
Kerala Microsoft User Group Meeting
Tuesday, February 7, 2012
Asp .Net MVC 3 Getting Started
Asp .Net MVC is a complete alternative to Asp .Net Web Forms. Asp .Net emphasizes testability, doesn't conceal how the web works and has excellent control over HTML.
Asp .Net MVC is based on MVC pattern which dates back to 1978 and the Smalltalk project at XEROX PARC. Asp .Net MVC is built as a series of independent replaceable components and the developers can choose the routing system, the view engine, the controller factory or ORM.
Asp .Net MVC 3 is built on .Net 4. It comes with a new view engine called Razor and tighter integration with jQuery.
Still Asp .Net Web Forms is the superior technology when it comes to intranet applications. ASP .Net 4 has become more web standard compliant and you can use Razor view engine. Just like Asp .Net MVC, Asp .Net 4 also support excellent URL routing features.
Let's start creating an Asp .Net MVC 3 project. The blog Asp .Net MVC 2 with Visual Studio 2010 or Visual Web Developer 2010 I had covered the basics of getting started with MVC 2.
So I am selecting Razor as the View engine.
If you navigate to Scripts folder in the Solution Explorer of Asp .Net MVC 3 project you can lot more jQuery files that the previous version.
Controllers and Action Methods
In MVC architecture, incoming requests are handled by controllers. In ASP.NET MVC, controllers are just simple C# classes .
Each public method in a controller is known as an action method. You
can invoke an Action Method from the Web via some URL to perform an action.
The MVC convention is to put controllers in a folder called Controllers, which Visual Studio created for us when it set up the project.
The controller’s job to construct some data, and it’s the view’s job to render it as HTML. The
data is passed from the controller to the view.
One way to pass data from the controller to the view is by using the ViewBag object. This is a member
of the Controller base class. ViewBag is a dynamic object to which you can assign arbitrary properties,
making those values available in whatever view is subsequently rendered.
I have already covered creating controllers in the blog Asp .Net MVC 2 with Visual Studio 2010 or Visual Web Developer 2010 which remains the same in Asp .Net MVC 3.
When we return a ViewResult object from an action method, we are instructing MVC to render a view. We create the ViewResult by calling the View method with no parameters. This tells MVC to render the default view for the action.
We can return other results from action methods besides strings and ViewResult objects. For instance a RedirectResult can be used to redirected browser to another URL. If we return an HttpUnauthorizedResult, we force the user to log in. These objects are collectively known as action results, and they are all derived from the ActionResult class.
The Razor view is quite different from that of Web Forms View Engine. Refer my blog Razor View Engine and Visual Studio for more information on Razor View Engine.
@{ ViewBag.Title = "Index"; } <h2>Index</h2>
using System.Web.Mvc; namespace MvcApplicationShalvin.Controllers { public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { ViewBag.Name = "Shalvin P D"; ViewBag.Site = "http://shalvin.net"; return View(); } } }
@{ ViewBag.Title = "Index"; } <h2>Index</h2> @ViewBag.Name <br /> @ViewBag.Site
F# 2.0 Console Application with Visual Studio - II
This is part of the blog that explore F# 2.0
F# 2.0 with Visual Studio 2010
In the previous blog we explored a Hello world application with F# using the REPL support it is providing.
open System
Console.Write "Enter your name : "
let strName = Console.ReadLine()
Console.WriteLine("Hello " + strName)
let c = System.Console.ReadLine()
let is the single most important keyword you use in F# programming: it’s used to define data,
computed values, functions, and procedures.
F# is statically typed. F# also supports type inferencing.
What you see is a full functioning F# application. Notice the code reduction in comparison to other .Net languages like C# or VB .Net.
Let's run the application instead of using F# interactive.
Creating and calling functions
let square n = n * n
let result = square 3
Console.WriteLine(result)
Functions are central to Functional programming. Functional programming views all programs as collections of functions that accept arguments and return values.
Function with Parameters
open System
let add(a, b) =
let sum = a + b
sum
Console.WriteLine(add(45, 45))
Indenting denotes the body. There is no curly brackets to denote the body of a function. White spaces are relevant in F#.
Creating a Windows Form
open System.Windows.Forms
let form = Form(Visible = true, Text = "Shalvin")
let btn = new Button(Text = "Helo")
form.Controls.Add(btn)
Here I am setting a reference to System.Windows.Forms and creating a form with a Button.
What enthralls me the most in F# is its terseness.
Monday, February 6, 2012
F# 2.0 with Visual Studio 2010
F# is a functional programming language initially developed by Don Syme now developed by Microsoft. Though it is inherently functional in nature it supports imperative and Object Oriented programming.
It is yet another .Net language ie. it emits IL and an excellent starting point for .Net professionals to explore functional programming.
F# supports Read Eval Print Loop (REPL) which makes it easy to learn a language.
F# is included in Visual Studio along with C#, VB .Net and Visual C++.
I am starting an F# application and creating a conventional Console Application.
open System
Console.WriteLine "Shalvin"
open in F# is equivalent to using statement in C#
For using REPL highlight the code segment and press Alt + Enter. You can see the output in the F# Interactive at the bottom of the IDE.
Friday, February 3, 2012
Timeline of major programming languages
1957 Fortran
1958 Lisp
1959 COBOL
1968 Smalltalk
1972 C
1972 Prolog
1975 Scheme
1983 C++
1986 Erlang
1987 Perl
1990 Haskell
1991 Visual Basic
1995 Java
2001 C#, VB .Net
2007 Clojure