How to revise for MCTS 70-515 Web Applications with .NET 4.0

Updated: I’ve re-uploaded my flash cards to WordPress. When you download the file, rename it to .anki (see the Anki application below). I wrote them for my personal use, so some might not make perfect sense, however I’m certain you will find them useful.

To prepare for sitting my MCTS the first thing I did was to ask as many of my colleagues (who have all taken many certification exams) about their approach to passing. The feedback was unanimous in that practise tests are the key to passing. This would be the backbone to my studying.

I bought the 70-515 Microsoft Self Paced training kit as a study guide and starting point. I would recommend the training kit as it was concise and covered 95% of the information that you need to know. Buy the book and read it cover to cover a few times.

After I was about half way through the book I asked around again as to which practise test provider I should use. My feedback was that Transcender was good quality and as it happened at the time had a 40% off deal through Microsoft Partners. I bought the practise tests and got to work running over and over them to get up to close to 100% correct. What I like about the Transcender package is that it comes with Flash cards which make you dig a bit deeper into your knowledge.

The actual MCTS 70-515 test is multiple choice, however with flash cards, you will be given a question and no options. Therefore you have to think. This thinking really strengthens those neural pathways and solidifies your memory.

I started off the process taking detailed, hand written notes. I soon found that was slowing me down and that It was slow to go back on them. With the knowledge that writing stuff down further helps your memory retention, and knowing that Flash cards were beneficial I found Anki which is a free piece of software that allows you to create flash cards. Instead of writing hand written notes I converted to writing them into Anki. I wrote my notes as meaningful questions, so that I could replay the flashcards and test my knowledge. Anki also will shuffle the ones that you get constantly correct to the back of the pack and the ones you get wrong more frequently to the front. /Win

I soon found that the book plus the test exams were not enough to pass. Reading MSDN proved to be very helpful as well as various blog posts. In particular the following post is an awesome listing of a huge swathe of items that you could be tested upon.

Part 1
Part 2
Part 3
Part 4
Part 5
Part 6

Make sure you do timed tests so that you have a feeling for how fast you should go. My test was 51 questions and I had 140 minutes to complete the test with the questionnaire and evaluation. It will take you around 10 mins to fill out the questionnaire and evaluation. Also worth noting, you can go forward and backward in the exam, whilst marking questions you want to come back to later. My approach was to go through all the ones I easily knew, marking down the ones I didn’t know or was unsure about. This meant I didn’t get anxious that I was spending too long on a hard question. I came back at the end to tackle all the odds and sods.

I found a decent approach to answering the multiple choice questions is that they usually give you 4 or 5 options. 2 of them will be blatantly wrong and the remaining possibilities will have subtle syntactical differences.

Each question in the exam is weighted differently and some of the questions aren’t even used in your score! The pass mark for the 70-515 was 700 out of 1000.

I hope this helps some one pass!
Good luck!

Advertisements

Difference between ASP.NET Data Controls

Totally lame post, but I’m studying for my MCTS and thought this might help some one. Keep in mind the values in the matrices below are for out of the box ASP.NET – it doesn’t mean you can’t achieve certain functionality, by extending them.

Single Item Display

FormView

Property Value
Multiple Items No
Templated Yes
Create Yes
Read Yes
Update Yes
Delete Yes
Sorting No. It is a single item view, so there is no need.
Pagination Yes, but it’s only one page at a time. Use the AllowPaging=”true” attribute to turn it on. Use the PagerSettings-Mode attribute to state the type (NextPrevious, NextPreviousFirstLast, Numeric, NumericFirstLast). Use the PagerSettings element within the FormView to specify paging options such as the text for the previous and next buttons.

References:
http://msdn.microsoft.com/en-us/library/ms227992.aspx

DetailsView

Property Value
Multiple Items No
Templated No
Create Yes
Read Yes
Update Yes
Delete Yes
Sorting No. It is a single item view, so there is no need.
Pagination Yes, but it’s only one page at a time. Use the AllowPaging=”true” attribute to turn it on. Use the PagerSettings-Mode attribute to state the type (NextPrevious, NextPreviousFirstLast, Numeric, NumericFirstLast). Use the PagerSettings element within the FormView to specify paging options such as the text for the previous and next buttons.

References:
http://msdn.microsoft.com/en-us/library/s3w1w7t4.aspx

Multiple Item Display

Repeater

Property Value
Multiple Items Yes
Templated Yes
Create No
Read Yes
Update No
Delete No
Sorting No
Pagination No

References:
http://msdn.microsoft.com/en-us/library/x8f2zez5.aspx

ListView

Property Value
Multiple Items Yes
Templated Yes
Create Yes
Read Yes
Update Yes
Delete Yes
Sorting Yes. You add a LayoutTemplate and set the button’s command name to “Sort”. Set the CommandArgument to the direction that you want sorting.
Pagination Yes, use the DataPager control

References:
http://msdn.microsoft.com/en-us/library/bb398790.aspx

DataList

Property Value
Multiple Items Yes
Templated Yes, but it does wrap the output in a table.
Create No
Read Yes
Update Yes
Delete Yes
Sorting Yes, but you have to take care of this manually in your code behind.
Pagination Yes, but you have to take care of this manually in your code behind.

References:
http://msdn.microsoft.com/en-us/library/es4e4e0e.aspx

References:
http://msdn.microsoft.com/en-us/library/bb398790.aspx

GridView

Property Value
Multiple Items Yes
Templated No
Create Yes
Read Yes
Update Yes
Delete Yes
Sorting Yes
Pagination Yes

References:
http://msdn.microsoft.com/en-us/library/2s019wc0.aspx

Netduino Transistor Switch

A transistor switch allows you to use a smaller flow of electrons to control a much larger flow of electrons. In this case, we are using the Netduino’s 3.3V output to control turning on and off a 9v supply.

It took me a while to figure out how this should be wired up, but after a lot of looking around I found some arduino examples. This one in particular was very helpful

My take away is that you should have your circuit set up like this. Effectively your transistor is blocking the current from going to ground until some input to the base is given from the Netduino.

Some notes on the switch: There is a formula for figuring out the value of the resistor going to base is, however it is outside the scope of this tutorial. I’ve just used 1k and it works fine. Also be sure to connect both the ground from your power, and the ground from your Netduino. For the longest time I didn’t have my Netduino grounded like in the images above and could not figure out why it was not working!

Netduino Pull up and Pull down Resistor

The idea of a pull up and pull down resistor initially confused me. After reading around the web a bit I found a description that helped me. Pull up and pull down resistors are used when you have something on your board that is not connected between the Vcc and ground (this is also known as an open circuit). Say for example when we wire up a motion sensor to our circuit, there will be a period of time when it is an open circuit or open collector. Whilst something is not connected directly between Vcc and ground it is susceptible to external electrical noise – which means you might get random erratic readings. For this reason – we use the pull up or pull down resistor.

Pull Up Resistor Example on the Netduino

The pull up resistor will make the input read as high/Vcc and when triggered go low to 0/ground.

Pull Up – Not Connected

Here we have the input port d0 being pulled up to Vcc by the 10k resistor. If we didn’t have the resistor you might get the event handler being randomly fired by electric fluctuations in the circuit.

Pull Up – Connected

Now when we complete the circuit by connecting to ground, we will fire the event handler. Our pin was being held at Vcc (3.3v) and now will be pulled to ground (0v). So our second parameter in the event handler will read as a low of 0.

Pull Up – Source Code

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

namespace _3_Digital_Input
{
    public class Program
    {
        public static void Main()
        {
            InterruptPort input = new InterruptPort(Pins.GPIO_PIN_D0, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
            input.OnInterrupt += new NativeEventHandler(input_OnInterrupt);

            Thread.Sleep(Timeout.Infinite);
        }

        static void input_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            string s = "";
        }
    }
}

Pull Down Resistor Example on the Netduino

The pull down resistor will make the input read as 0. When it is triggered it will go high to Vcc (3.3v).

Pull Down – Not Connected

Here we now are connected via the 10k ohm resistor to ground, bringing the pin to 0v.

Pull Down – Connected

When I complete the circuit the event handler fires. The pin was being held at 0v and now has been pulled high to 3.3v. If you breakpoint on the event handler and inspect the second parameter (data2) you should see the value come in as 1.

Pull Down – Source Code

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

namespace _3_Digital_Input
{
    public class Program
    {
        public static void Main()
        {
            InterruptPort input = new InterruptPort(Pins.GPIO_PIN_D0, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh);
            input.OnInterrupt += new NativeEventHandler(input_OnInterrupt);

            Thread.Sleep(Timeout.Infinite);
        }

        static void input_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            string s = "";
        }
    }
}

Side note: The Netduino does also have an inbuilt Pull up resistor that you can turn on and off by the software. This is an enumeration that you can see as one of the parameters when creating the interrupt port. I didn’t include it on this example, as I wanted to show mirror symmetry between the pull up and pull down circuits.

The Netduino does not have an inbuilt Pull down resistor. So you will always have to wire it like the example above.

Building a DIY Home Alarm Part 2 (Netduino Plus WebServer)

For this second part in the series I wanted to prototype the network connectivity of the Netduino. Why? Because I want the alarm to message me some how if some one breaks in AND I want to be able to interact with it from my phone.

Prototype Features

  • Run a threaded web server, capable of returning 200 OK with the HTTP body of “Hello World”
  • Flash the onboard LED whenever the webserver services an inbound request
  • Trigger a sound (I’ll cover this sound in more detail later in my posts). I was using a transistor switch to trigger a 555 timer which makes a 3khz sound to the speaker

Approach

I started off using any old network cable to connect to the Netduino. After some thought and discussion on the NetDuino chat I realized I should be using a Crossover cable. Luckily I had one to hand. (Good thing I hoard my electronics stuff :P). I made sure the network cable was connected before I turned the NetDuino on. I think I read somewhere that with certain versions of the flashed software, it can be troublesome connecting the network cable afterwards.

I discovered that the Netduino’s network configuration can be configured programatically or through the tool that comes with the microframework MFDeploy.exe (I found it in C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools). Through a lot of experimentation I figured the easiest way of me connecting the pc and the netduino would be to manually assign ip addresses on the same subnet mask. My laptop was initially setup for DHCP assigned ip on the physical network connection and the netduino was pre-wired with an ip. I set the pc to be a manually assigned IP of 10.5.0.1 and the netduino to 10.5.0.2 and both on a subnet mask of 255.0.0.0.

Using Fiddler I sent HTTP Get Requests to the web server and received 200 OK messages back with the content “Hello World”.

Demo

Source Code

Note: I used the .Net Micro Framework Networking Toolkit to run the web server.
PS: Make sure you use the assembles found in the folders prefixed with “Micro” as they are compiled for the micro framework.
PPS: I used port 8080 as my machine is running IIS on port 80.

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using MFToolkit.Net.Web;
using Microsoft.SPOT.Net.NetworkInformation;

namespace WebServer
{
    public class Program
    {
        public static void Main()
        {
            HttpServer httpServer = new HttpServer(8080, new MyHttpHandler());
            httpServer.Start();
        }
    }

    public class MyHttpHandler : IHttpHandler
    {
        private OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
        private OutputPort sound = new OutputPort(Pins.GPIO_PIN_D5, false);
        private bool playSound = false;

        public void ProcessRequest(HttpContext context)
        {
            led.Write(true);
            BuildHttpResponse(context.Response);
            led.Write(false);

            if (playSound == false)
            {
                playSound = true;
            }
            else
            {
                playSound = false;
            }

            sound.Write(playSound);
        }

        public void BuildHttpResponse(HttpResponse httpResponse)
        {
            httpResponse.HttpStatus = HttpStatusCode.OK;
            httpResponse.WriteLine("Hello World");
        }
    }
}

Building a DIY Home Alarm Part 1 (Learning electronics)

Background

After listening to Scott Hanselman’s podcast on the NetDuino I was really interested in the idea of building my own hobby projects and learning electronics. I’ve got two projects that I want to build, both of them rather ambitious 😛

The first idea was to build a Snowbot (snow blowing robot) and the other idea was to build a home alarm system. I’m starting with the home alarm system as it in theory should be easier to build.

This is what I would ideally have in a home alarm system:

  • Networked, so that I can arm/disarm and check the status over the web
  • Email alerts
  • Sensors on all the doors and windows
  • 2x Motion sensors (main floor and basement)
  • Bloody loud alarm system

Starting Point

So looking at the best places to start learning how to do all of this I decided it would be best to start learning electronics. The best resources I have found so far are:

I tried using software to model circuits but found them really confusing. I tried Tina-TI, while it is really good for certain learning, I have found that actual hands on with components is easier to learn from.

I decided to buy some basic electronics components. Looking through the Make electronics book and searching on the web i found this product, a starter electronics kit for the first few chapters of the MAKE: Electronics book. I noted down what i thought were the key components and went to the local electronics shop and bought them for around $150 including digital multimeter.

The main components I bought were the multimeter, a $15 dollar pack of assorted resistors (definitely worth the money), various capacitors, some NPN transistors, breadboard and 9v supply, assorted LEDs and wires.

After reading up on DC theory at allaboutcircuits.com I started building some really simple circuits, with the home alarm system in mind.

I tried to visualize what components the alarm would need to have to make this alarm system. At its simplest it would need the following:

  • Blinking LED
  • Siren
  • Circuit that would break when a window/door was opened
  • Some sort of keypad interface (ideally touchscreen)
  • Netduino as the microcontroller

The next post in this series will cover the alarm’s blinking LED.

Copying project dependencies using Visual Studio

I used to only use NAnt to copy dependencies around a project, due to me being familiar with it as well as Nant having many other useful features. However I wondered the other day whether there was anything more simple and quicker to set up than going the whole hog and using Nant. Reason being – I’ve found that I do a lot of smaller projects that don’t have the need for the lengthy Nant installation and setup.

I guess up until this point, I had never really looked in Visual Studio for this functionality. Any way, cutting to the chase:

Right click your main project that you want copying from, select properties. Then select the Build Events Tab. In the Pre-build event command line throw in something like below to get your copy going.

copy "$(ProjectDir)Web.config" "$(SolutionDir)Move.Tests\bin\Debug\Move.Tests.dll.config"

If you are unsure as to your options, click the Edit Pre-build button and hit the macro button. It will show you the tokenized values for common build properties such as $(ProjectDir).