ASP.NET Bootcamp 2010

Posted: 26th January 2012 by admin in Courses
Comments Off

This week we finished covering all 18 topics of the ASP.NET Bootcamp at Benchmark Learning. In this course we briskly covered topics:

  1. Introducing C# and the .NET Framework
  2. Using C# Programming Constructs
  3. Declaring and Calling Methods
  4. Handling Exceptions
  5. Creating New Types
  6. Inheritance
  7. Using Collections
  8. Creating ASP.NET Web Forms applications
  9. Adding Functionality to ASP.NET Web Forms
  10. Implementing Master Pages and User Controls
  11. Validating User Input
  12. Managing Data with Entity Framework and LINQ
  13. Creating AJAX enabled Web Applications
  14. Consuming WCF Services
  15. Managing State in Web Applications
  16. Configuring and Deploying Web Applications
  17. Securing ASP.NET using Microsoft Membership Provider

All in all, it was a great week. Any week dedicated to building and learning web application development is fun.

Here are the files we created throughout the week for my students to reference, use, and experiment with: NonProfit

Remember that other resources include:

Thanks again and feel free to contact me in the near future.

Silverlight & WCF

Posted: 20th January 2012 by admin in Uber Micro
Comments Off

This post is for my students this week. Follow up on how to connect Silverlight to WCF interacting with a database.

.NET & PowerShell Cmdlet and Custom Collection Data

Posted: 12th January 2012 by admin in Uber Micro
Comments Off

This post is an extension from the post I did earlier this week on the Powershell Course. Found here: http://www.brianlockwood.info/2012/01/11/powershell/

Quick summary from my previous post: “Powershell is a scripting language that is deeply engrained in windows operating systems. It is a programming language for powerful automation, it can be used to interrogate and manipulate windows operating systems in a robust and scalable way.”

At the time of this writing, I’m unsure of the best practices so this is my “gut feeling”. If you have feedback I’d love to hear it.

All Microsoft products have or will have a Powershell layer that will allow IT professionals to automate those Microsoft products. As a developer I need to make sure my applications have this abstraction layer as well. I should not rely on or require administrators to interact with my application GUI to execute some functionality. They need to be able to automate not only the capabilities of my application but potentially some of the business logic as well.

Building a snapin for an application that manages courses at Benchmark Learning.

Objectives:

  • Add a powershell abstraction layer for an application that manages courses
  • Create a custom powershell snapin
  • Add the custom snapin (aligning to framework version) to powershell
  • Call the cmdlet’s for my application from within powershell

Adding a powershell abstraction layer

Most tiered applications leverage the downward stream of calls to lower layers. In this project I decided to add a class library in Visual Studio to provide my powershell abstraction. See code here:

In order to derive my custom commandlet from the framework using System.Management.Automation dll and namespace needed to be added to the project. This dll was found in the powershell reference assemblies folder: [C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0]. From here it is required to override the ProcessRecord method as it is called by powershell when the commandlet is used.

In the example above, I wanted to give my administrator the ability to find course information by supplying a name parameter of the course. By annotating the Name property with the Parameter attribute it provides the meta data needed for powershell to understand its use. If the property was not annotated with this attribute the property would be encapsulated within the object itself.

In addition to the name parameter the actual data used will be returned as a collection of custom educator objects. The definition of the educator class contains a firstname and lastname, as see here:

.NET Educator Class

By using WriteObject the results of my commandlet can be returned to Powershell. In this scenario I’m returning the collection of educators to Powershell. Although returning a string is straight forward and easy, I have decided to return a collection of educators so we can use powershell commands such as Get-Member, Format-Table, Format-List etc.

Create a custom powershell snapin

The next step is to create a custom powershell snapin that will allow powershell to leverage the commandlet created earlier. Below is what was required to do so. It is required to override the description, name, vendor and cmdlets properties.

Custom powershell Snapin in .NET

Two notes about the custom snapin.

  1. It is possible to add multiple commandlets in one snapin by using the cmdlets collection property.
  2. In order to register the assembly to the system we need the RunInstaller attribute defined in the custom snapin

Start off by deriving the custom snapin from the CustomPSSnapIn class found in the  System.Management.Automation namespace. Define the values for the vendor, description, and name. In addition to this, it is possible to add an xml file reference that describes the help documentation for the commandlets defined within the snapin (this has not been done in this example). When adding the commandlet to the cmdlet collection provide the command name such as Get-Course in the constructor of the CmdletConfigurationEntry object.

Add the custom snapin to powershell

Before adding the snapin to powershell the assembly needs to be registered to the system. To do this, in the console window navigate to your framework version folder for example: [C:\Windows\Microsoft.NET\Framework\v4.0.30319] and run the installutil executable.

.NET Install Utility command executable

Note: Make sure it run successfully. It will generate a log file for review if necessary to troubleshoot the installation.

Once the assembly is registered in the system Powershell needs to know it can use it. This is where the custom snap in can be built into the user profile of Powershell or for one time use only (as seen in this sample). To make sure the assembly is registered, open powershell, and use the Get-PSSnapIn -Registered command in powershell. The commandlet should be listed:

Powershell Get-PSSnapIn

Note: In the configuration used for this sample, Powershell by default, knew to use the 2.0 version of the .NET framework however the application/commandlet is a 4.0 version commandlet. In order for Powershell to recognize the latest version of the framework to use with the custom snapin the following step needed to be completed:

Navigate to [C:\Windows\System32\WindowsPowerShell\v1.0] and there should be a Powershell.exe.config file. If there is not, create one.

Contents of Powershell.exe.config:

<?xml version=”1.0″?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy=”true”>
<supportedRuntime version=”v4.0.30319″/>
<supportedRuntime version=”v2.0.50727″/>
</startup>
</configuration>

Call the commandlet

Within powershell add the custom snap in via the name (as seen in the results of Get-PSSnapin -Registered). Use the command Add-PSSnapIn GetCourse and then use powershell to call the custom commandlet. In this scenario it is possible to use the -Name parameter of the course as well as piping the results into a formatted table.

Using the powershell snapin

Get-Help is available on the custom commandlet. The details of Get-Help will depend on the detail provided by the developer in the attributes of the commandlet.

Summary

Creating a custom powershell commandlet required some work but now this abstraction layer can be used by powershell to call into the business logic of the application. I would consider this internal integration with powershell with my .NET application. Remember that we can also use powershell to automate the installation and configuration of the custom applications as well.

 

Powershell Course

Posted: 11th January 2012 by admin in Uber Micro
Comments Off

This week (of Jan 9, 2012) I am taking the Powershell v2.0 course at Benchmark Learning with eduator Lu Patrick (my colleague). It’s been a very interesting week. As a developer it’s actually been very easy to understand, pickup and use. In fact, with powershell leveraging the .NET framework it made it easy to understand 80% of the content. Now that said here are some thoughts.

What is my definition of powershell: Powershell is a scripting language that is deeply engrained in windows operating systems. It is a programming language for powerful automation, it can be used to interrogate and manipulate windows operating systems in a robust and scalable way.

Having achieved my Microsoft Certified Systems Engineer (MCSE) on NT4.0 in 2001 and working for a couple of years as a network engineer and IT manager, I was able to grasp some of the concepts and context on how and where to use Powershell. That said, this was also one of the hardest areas to understand. The coding, variables, scoping, and even piping was relatively easy. The questions around IT Pro job tasks were difficult. Such as, how do you find out membership information for a user in active directory or how do you use Powershell to remotely manage multiple servers.

The more I understand of Powershell, the more powerful I think it can be in my applications. For example I could use Powershell to automate the installation of my WCF service on multiple servers. However I would consider this as external to my application. We could use commandlets and powershell commands as a layer within our .NET applications. Then we could leverage the powerful interrogation techniques of powershell to, lets say, return server and process information for all servers within my environment to my ASP.NET MVC intranet application.

So about that Powershell? My take aways were three essential commands:

  • Get-Help
  • Get-Member
  • Get-Command

Get-Help

Get-Help is a great way to find out more. As you’ll know/find in .NET, it’s impossible to think you can memorize the framework. So having commands like this help you interrogate the powershell framework to find out how to achieve a particular task.

Get-Member

As a developer I have always used MSDN and intellisense within Visual Studio to find out how to use classes and objects within the .NET framework. These features are also available in Powershell. For example:

In this example I’m using Get-Help and Get-Member in one attempt. Notice that TypeName looks very similar to a .NET namespace as you’d find on MSDN. In addition it provides synopsis, members and examples of how to implement it. In fact, Powershell is extensible and Lu Patrick showed us how to update powershell so you could call .MSDN() on your commandlet and it would open up an MSDN article on that topic.

Get-Member builds on top of Get-Help and provides you the methods and properties available on that object of choice.

Get-Command

Gets basic information about commandlets (cmdlets) and other elements of Windows PowerShell commands. The fun part about this is that Powershell will not only return the properties and methods of the objects available in the system but also massages those objects with addition powershell scripting options.

Powershell Get-Command

I can also pipe (concatenate) the results of Get-Member (using alias gm) to a list. Basically piping consists of building additional queries based on the results of a prior query/command. In this example I’ve taken the resulting Get-Process cmdlet and gathered all of the members (ie properties and methods) and display the results in a Formatted Table (ie ft).

What do these three key commands do for me?

This helps me solve problems until I’m comfortable at memorization. Because I don’t know what I don’t know. This is why this has become the biggest take away from the course.

.NET & Powershell

As a developer/network engineer I want to make sure both parties (from whichever side I’m on at the time) are happy. Developers should be able to build UIs in their rapid application environment (ie Visual Studio) and administrators should be able to automate tasks the application may perform. Not all environments allow for draggy droppy mouse clicky. Administrators like to interrogate, interact and automate applications the developers build. For the most part, most developers will not provide the powershell layer in their applications to return the favour.

Want to see how to create a custom powershell commandlet in .net? See my post .NET PowerShell Cmdlet and custom collection data.

 

Comments Off

By: Lisa Seery
Education Advisor − Developer Technologies Specialist at Benchmark Learning

Every day clients discuss their interest in attaining a Visual Studio certification in what they already know or what they are interested in learning. The steps on how to go about this varies, depending on your background. I make it a point to go over several steps that are the same, no matter what, with all clients I speak with about this process. Some benefits to consider on certification include:

  • showing your employer you are willing to continue your education and improve your IT career by getting Microsoft certification
  • to help bolster your resume and get you into better-paid positions
  • proving to yourself that you do know what you specialize in at work each and every day
  • and the list goes on

The Microsoft Certified Technology Specialist (MCTS) or Microsoft Certified Professional Developer (MCPD) designation can put you in the top-tier of candidates for jobs in the programming world. Get the certification you need by following these steps.

1. Choose the certification exam(s) you would like to take based on the knowledge and skills you already have or are learning (Visual Studio version and specialty area – such as Visual Studio 2008 ASP.NET focus). Microsoft offers several designations giving you a wide range of options. The path to MCPD is a combination of 1 or several MCTS’s, allowing you to get a base certification now and expand it later. View all path options here: http://www.microsoft.com/learning/en/us/certification/cert-vstudio.aspx

2. Once you’ve chosen your path, work with me on identifying your strengths and gaps via our CareerBooster assessment process. This assessment lets you know where you are in terms of your knowledge of the .NET Framework and area of specialty that you will be tested on. Use this information to help determine the best path for your MCTS designation and any education or self-study you will need to focus on prior to heading to the test center. http://cb.benchmarklearning.com/common/CB_Intro.aspx?sid=1

3. Based on your assessment scores, you and I will determine what makes sense for next steps, which may include a plan of self-study materials, instructor led training and practice test preparation. Microsoft offers self-paced training kits, including book, CD’s with labs and practice exams, though several of my clients see a lot of value in the structure of a classroom for areas where their knowledge may be a little light.

4. You and I will discuss a timeline for the completion of your desired certification. This deadline may coincide with graduating from college, changing jobs or it may be a deadline you create to help yourself along. This timeline should include time to study, take practice exams and prepare for the real thing. I then put together a customized plan just for you taking all factors into consideration.

5. Once you are ready, we move forward with your plan of action and of course we stay connected to ensure you are accomplishing your goals based on your timeline and/or adjusting your plan as needed along the way.

6. Another important strategy I mention to candidates I work with on certification is the difference between learning and testing. It’s important to separate these tasks in two as follows: when learning/educating yourself on a topic, immerse yourself into the learning aspect of it via self-study, classroom, whitepapers, forums, etc. Learn as much about all areas that you will be tested on eventually when ready. When you are ready to prepare for testing, it’s important to incorporate practice testing and examining the scores by category and then working your way backwards to the education tools where needed. Once you are getting an overall score on your practice test of 85-95%, you are ready for the real deal.

Now that you have all these steps in front of you, the only thing left is to give me a call so we can get started on YOUR personalized plan of action!

Hope to hear from you soon!

Lisa Seery, Developer Technology Specialist
p: 952.896.6869 | e: lseery@benchmarklearning.com

Comments Off

Course demo solution built in class: 10266CourseDemos

Resources:

http://www.codeproject.com/KB/architecture/OOP_Concepts_and_manymore.aspx
http://www.oodesign.com
http://www.brianlockwood.info
http://www.stackoverflow.com
http://hfpatternsincsharp.codeplex.com/
http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612
http://www.asp.net/mvc
http://www.asp.net/web-forms/videos/aspnet-35/how-do-i/how-do-i-get-started-with-the-entity-framework
http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
http://ui-patterns.com

Minnesota IT Government Symposium – Sessions

Posted: 6th December 2011 by admin in Uncategorized
Comments Off

Rolling down the developer highway

Update: The files for today’s session can be found here:

- Solution : RollingOnTheDeveloperHighway

- Database Schema (3 tables)

System requirements and settings:

* updates that are not pre installed in service packs

Visual Studio 2010 Sp1
Link: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=23691

Windows 8 Developer Preview *
Link : http://msdn.microsoft.com/en-us/windows/apps/br229516

NUnit (available via NuGet)

NuGet Package Manager *
Link : http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c

ASP.NET MVC 3 Tools Update
Link: http://www.microsoft.com/download/en/details.aspx?id=1491

Windows Azure Tools *
Link #1 : http://www.microsoft.com/windowsazure/sdk/
Known Issues: http://msdn.microsoft.com/en-us/library/gg508668.aspx

Other: Download the latest Azure Tools (Current version of this posting is November 2011 Tools)

Interactive web applications with jQuery

Resources

Downloadable demos
ASP.NET MVC3 Version: InteractiveWebpagesWithjQuery_ASPMVC
HTML Version: InteractiveWebpagesWithjQuery_HTML

FREE jQuery Book
Link: http://jqfundamentals.com

Documentation & Key Site
Link: http://www.jquery.com

Widgets, Animations & Cool
Link: http://www.jqueryui.com

Benchmark Learning jQuery Courses
Link: http://www.benchmarklearning.com/Courses/CrsSearchResults.aspx?ST=Q&S=false&T=jquery

ASP.NET MVC 3

Presentation Files

Link: EventManager_MVC3

Creating accessible webpages

How to meet the WCAG 2.0
Link: http://www.w3.org/WAI/WCAG20/quickref/

Use Expression Web > Tools > Accessibility Validator or
Use Visual Studio > Right click project > Check Accessibility

Internet Explorer > Tools > Developer Tools > Validate

As a developer we always need to run some of the basic checks for Section 508 compliance and also the WCAG 2.0. Most organizations will also have their own custom guidelines to follow for comformance.

[P.S] Thank you to the person who showed me I mispelled the word Sneak/Sneek :-)

 

What’s the deal with this jQuery thingy?

Posted: 22nd November 2011 by admin in Uncategorized
Comments Off

For a living, I teach. I’m frequently approached by students and prospective students asking questions around jQuery and why it’s so popular. Let me give you my run down.

First of all, jQuery is an abstraction layer that sits on top of JavaScript. Yes we can definitely do all of the animation, selecting and manipulating HTML elements and other “cool” things jQuery can do, all within JavaScript. Wait, I can do all the activities in JavaScript that jQuery does? What’s the point? Well jQuery offers consistent callable code and has prebuilt functions that leverage CSS selectors to manipulate HTML elements. “In english please, Mr Foreign Person”… basically, write less code to accomplish the same thing.

jQuery Javascript Layers

Remember that the entire idea of using jQuery is to make it easier, write less code, to manipulate your webpage. Manipulation can be animation, changing color to an HTML element etc.

jQuery uses CSS selectors to select elements on a page. Most of the time the resulting object gathered by a jQuery selector will be a collection/array of element objects. There are specialized jQuery functions that can find an individual element such as .first however the most generic selector to grab one element is selecting by id. For example, if I have a div with id=footer then my jQuery selector would be $(“#footer”) . So what does that actually give me? It give me a jQuery “groomed” object of that element. That means you can grab the HTML within that element with .html() instead of using .innerHtml in javascript.  That meansn you can grab the text or value using .text() or .va() instead of calling document.getElementById(‘elementname’).value. It becomes very easy to implement basic functionality.

Your generic selectors are:

  • Select by ID using #footer
  • Select by Class using .footer
  • Select by HTML element using div (or footer in HTML5)

Beyond the basic selectors we can use advanced selectors with rules. w3 schools has a good reference document here: http://www.w3schools.com/cssref/css_selectors.asp and a sample of this is here:

CSS Selectors

In CSS, selectors are patterns used to select the element(s) you want to style.

The “CSS” column indicates in which CSS version the property is defined (CSS1, CSS2, or CSS3).

Selector Example Example description CSS
.class .intro Selects all elements with 1
#id #firstname Selects the element with id=”firstname” 1
* * Selects all elements 2
element p Selects all <p> elements 1
element,element div,p Selects all <div> elements and all <p> elements 1
element element div p Selects all <p> elements inside <div> elements 1

 

Consuming web services with ASP.NET in VS 2010

Posted: 14th October 2011 by admin in Uber Micro
Comments Off

Web services have been an extremely important aspect of integrated systems. Microsoft has now moved to a more robust service oriented architecture called Windows Communication Foundation. Although this video presents web services developed in Visual Studio 2010 most steps and concepts here can be applied to the request response style communications of WCF.

Consuming a weather service in an ASP.NET Web Application from Brian Lockwood on Vimeo.

Possible Next Steps in your Career

Posted: 8th October 2011 by admin in Career Development

Technologies/Skills to consider:

  • jQuery
    • Benefit: jQuery is definitely one of the most powerful javascript libraries in use today. It is one of the top client side languages required for most jobs in todays market. jQuery is unobtrusive javascript that can manipulate, select and work with the HTML DOM in powerful ways.
    • Possible Resources:
      • Mastering jQuery – Benchmark Learning (August 2011)
      • TekPub – Video series http://www.tekpub.com
      • jQuery Seminar – Free Benchmark Learning Seminar (June 2011)
  • AJAX ASP.NET
  • Windows Communication Foundation
    • Benefit: WCF allows you to expose some of your valuable data for consumption by other applications. WCF can be configured in a RESTful way, or SOAP.  WCF can be configured similarly to Web Services but is more secure, and can operate over many protocols.
    • Possible Resources:
  • Silverlight
  • ASP.NET MVC
    • Benefit:The ability to leverage the model view control design pattern in ASP.NET. Allows for test driven development and separation of concerns. Full control of the rendered markup.
    • Possible Resources:
  • Entity Framework
  • LINQ
  • HTML
  • CSS
    • Benefit: HTML is a structural language that doesn’t have great design capability. CSS is essential to web development to get the look, feel and interaction you need.
    • Possible Resources:
  • Javascript
    • Benefit: Web pages and styles are not functional enough for dynamic sites. Javascript is one of the only ways to add true dynamic content to your pages. An ASP.NET developer may find more value in looking at a jQuery course then just a javascript course.
    • Possible Resources: