Mecurial / Tortoisehg: Setting up a Source Control Repository on HTTP

Hi,

Install the following

http://tortoisehg.bitbucket.org/download/index.html

One this is installed we will:

  • Create a Repository where our source code will sit.
  • Create a clone where our working location is
    STEP 1: Create the Repository

So, the first step is to allocate a folder for the repository:

My repository folder is called:

PhotoRARepository

We will then right click the folder and select Create Repository:

image

We just confirm the destination as the same place:

image

Cool, now we need to publish the repository to the web.

Right click the folder and go to repository explorer.

image

Then in the explorer go to Tools->Settings and configure HTTP/HTTPS and port number to listen on:

image

Once this is done, click the Server Button!

image

You will see a window open that is listening on this new port:

image

That’s it we done.

We can also updated the .hgignore file to ignore checking in these files:

image

# Ignore file for Visual Studio 2008

# use glob syntax
syntax: glob

# Ignore Visual Studio 2008 files
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml

 

Next, you need to activate the files in the repository, by adding them, if you got existing files already in the folder!

image

 

Once this is done, you COMMIT them to the repository:

image

Confirm all the files and we done on the Master repository side:)

image

Double check all files have a nice green tick:

image

If you go back to the repository explorer the history should now be there after the commit.

image

    STEP 1: Clone the Repository from a developer machine

 

Note: if you have the master repository, you still need to clone it and use the clone, never use the repository directly!)

To use the repository, you need to create another folder on ALL users machines that will use the source control. To do this, they will CLONE the repository.

So if you are the only user of the project, you will STILL need to clone it, that means if your computer is the repository and you want to use the source control, you must also clone it.

So i created a new folder called PhotoRA, which will be my clone. I right click the folder and select Clone:

image

Then specify the web URL.

image

Once done, it will automatically fill the folder and you can now use Visual Studio and start coding.

image

We can test this, by opening the solution editing the file and committing it to the repository.

I went an updated the web.config file in my clone repository using Visual Studio. Now I right click the clone folder and commit.

image

Next I right click my clone folder and select repository explorer and I see the history, I can now PUSH it up to the main repository.

image

You can see all the chit chat in the HTTP Server Log:

image

Never edit files directly in the MAIN repository!

 

Repeat STEP 2 for ALL developers using your repository 🙂

That’s it 🙂

MVC 3 Cleaner Views

Hi,

Lets compare MVC 2 to a MVC 3 view, a basic one:

MVC 2:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PhotoRA.Web.ViewModels.StoreBrowseByEventViewModel>" %> 

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> 
</asp:Content> 

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
    <h2>Browse Photo's</h2> 
    <ul>
    <%foreach (var photo in Model.Photos) {%>
    <li><a href="<%: Url.Action("Details","Store", new {photoId = photo.PhotoId} )  %>"> <img src="<%:photo.Photo_Url %>" /> </a></li>
    <%}%>   
    </ul>


</asp:Content>

MVC3:

@model PhotoRA.Web.ViewModels.StoreBrowseByEventViewModel
    <h2>Browse Photo's</h2>
  <ul>
    @foreach (var photo in Model.Photos) {
      <li><a href="@Url.Action("Details", "Store", new {photoId = photo.PhotoId})"><img src="@photo.Photo_Url" /></a></li>
    }
  </ul>

 

Pretty Clean….

There is also a @helper for HTML helpers and loads of other stuff such as layout defaults and better IoC/DI support.

Windows Azure AppFabric – Part 1: The Big Picture with Pub/Sub

Hi,

I am currently working on some AppFabric projects for a company I am thrilled to have recently joined called Readify. So, why not share the love and discuss AppFabric.

Part 1: I am hoping to complete a series of blogs on Windows Azure AppFabric. This blog will be part where we look at the basics for getting started and the bigger picture and some infrastructure configuration for IIS AutoStart, I love WAS J We must use it.

Part 2: Will show a Asynchronous message pattern via Windows Azure Appfabric and we will use WPF clients to publish and subscribe messages using the EventRelayBinding. The WPF application will be using the Event Aggregation framework from the Composite Application Library (Prism), which you can download here: http://msdn.microsoft.com/en-us/library/ff648465.aspx

We also use a WPF phone client, that subscribes to events, it is VERY SIMILAR to a real windows 7 Phone implementation where calls back to the phone occur from the Windows 7 Phone cloud that pushes Tile and Toast notifications. Perhaps in a separate blog I will post a sample Windows 7 App, however, I have to chat with my colleague Miguel Maderoas he is doing allot of work on it in regards to IoC (Ninject) and Silverlight stuff.

Part 3: We will look at integration with Azure Worker/Web Roles and Azure Queues

Part 4: We will look at BizTalk 2010 integration scenarios J

What this allows is a single client to subscribe to the AppFabric Service Bus and then it can distribute it to internal subscribers; this is a nice way to receive messages when Message Queues are out of the question. So in Part two the high level solution will be:

I have omitted the client in this diagram that published to AppFabric.

clip_image002

Service Bus Benefits

· Expose apps and services through problematic network boundaries

· Exposing services easily, supporting multiple connection options and publish and subscribe for multicasting. 

· Lightweight developer friendly programming model

· Shields your services from intrusions and denial-of-service attacks

Service Bus Features

· Services discovered through URL, irrespective of location

· One-way messaging between sender and listener supports unicast and multicast datagram distribution

· Full-duplex connection-oriented sessions

· Full-duplex, connection-oriented peer-to-peer sessions

· Multiple publishers and multiple subscribers can simultaneously use the service’s topic management and event distribution system

· Support of REST and HTTP Access from non-.NET platforms

· Global hierarchical namespaces that are DNS- and transport- independent

· Anonymous access to services is supported

Community Technology Preview

To get started with AppFabric, there is a free CTP portal where you can register a service, below is a Service Bus, hosted on the CTP labs cloud, which is free of charge.

clip_image004

Windows Azure AppFabric Getting Started

Once the CTP portal is running you can then setup the development environment to work with the Labs Portal and the SDK.

Labs

http://www.microsoft.com/downloads/details.aspx?FamilyID=d89640fc-c552-446e-aead-b1e0d940f31b&displaylang=en

You can rename the Servicebus.config.txt file to Servicebus.config and ensure to have a Servicebus.config in the .Net Framework configuration folder, depending on the framework version you using e.g. c:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\servicebus.config

The default content for the Lab config file is:

servicebus.appfabriclabs.com

accesscontrol.appfabriclabs.com

accesscontrol.appfabriclabs.com

Ensure to read the Release Notes.mht

Note:The above config file is for Development only, production will be pointing to: servicebus.windows.net

clip_image006

Service Bus SDK

· http://www.microsoft.com/downloads/details.aspx?FamilyID=39856a03-1490-4283-908f-c8bf0bfad8a5&displaylang=en

Run this command to customize the location of the SDK:

msiexec /I WindowsAzureAppFabricSDK.msi APPLICATIONFOLDER=c:\WindowsAzureAppFabricSDK /qn

Service Bus Known Issues

1. Current users would need to update their issuer keys for their existing applicationss to work with the new services – you can get this key from the ServiceBus section on the portal.

2. When uploading CrossDomain.XML to the Service Bus root, please leave out the schema declaration.

3. Silverlight clients convert every Service Bus operation error to a generic HTTP NotFound error.

4. Service Bus Multicast with Message Buffers features, which have been available in LABS since March 2010, has been temporarily removed from the LABS environment. The team is working on an alternative approaches to these features.

Access Control SDK

The access control samples can be downloaded from:

http://acs.codeplex.com/wikipage?title=Samples

Access Control

Shared key

The default mechanism to authenticate is Shared Key, therefore ensure in AppFabric Labs Portal, you find the Issuer Name and Issuer Secret:

Default Issuer Name is: Owner

You can find the details in the ACS links for Service Identities. So to keep things simple, we will not use any federated services and claim tokens such as SimpleWebToken.

Below is a screenshot, where you can find this information, the production version has links to the Issuer Name from the Service NameSpace Management page, but not in the Labs Portal!

clip_image008

Then when creating a connection from a client endpoint, the code will resemble the following for Shared Key authentication.

TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();

relayCredentials.CredentialType = TransportClientCredentialType.SharedSecret;

relayCredentials.Credentials.SharedSecret.IssuerName = issuerName;

relayCredentials.Credentials.SharedSecret.IssuerSecret = issuerSecret;

Uri serviceAddress = ServiceBusEnvironment.CreateServiceUri(“sb”, serviceNamespace,

String.Format(CultureInfo.InvariantCulture, “{0}/MulticastService/”, session));

ServiceHost host = new ServiceHost(typeof(MulticastService), serviceAddress);

host.Description.Endpoints[0].Behaviors.Add(relayCredentials);

host.Open();

This can be testing using the simple SDK samples for Azure AppFabric, particularly the sample application: WindowsAzureAppFabricSDKSamples_V1.0-CS\ServiceBus\GettingStarted\Echo. Note run RelayConfigurationInstaller.exe if you convert the sample to .Net 4.0

Here is output from the console to test the connection, remember the servicebus.config file MUST be in the config folder in the .NetFramework as mentioned before, or you can add it to the local app.config for each sample you want to use, if you do not want to add it, else it will try to connect to the Production AppFabric Portal and the host.Open() method will fail as it is resolving the service name to servicebus.windows.net instead of servicebus.appfabriclabs.com

clip_image010

Windows Azure AppFabric Platform Training Kit

You can download the following kit to assist in learning various scenarios with App-Fabric Service Bus:

http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&displaylang=en


Hosting a Service with relay bindings Preparation

What we want to do is ensure that Publisher can always publish messages, so let’s host the service in IIS AppFabric, then configure the service to relay the message to a Brodcaster, this means two things:

1. The service accepts messages from a publisher, hence a IContract

2. The service resends the message to a new service endpoint in AppFabric that Clients connect to; we call this the BookingFeedBroadCast endpoint!

Here is a diagram showing what we building in the future parts:

clip_image012

Note, you can have multiple Publishers and multiple Subscribers.

You probably first wrote the service that has a channel listening to AppFabric as a Console App, this can be hosted in IIS with some small changes and some hotfixes!

Since relay bindings OPENS a channel with Host.open(), IIS cannot activate such a service, so if you want to host a service with relay bindings, then you need to use IIS Autostart

Check List

· Always run Visual Studio 2010 in Administrator’s Mode

· Have IIS 6.0 Metabase Compatibility installed.

· IIS 7.5

· AppFabric Server Install
clip_image014

· Two patches to allow AppFabric XML settings to be recognised by IIS and the other for autostart features.

o http://support.microsoft.com/kb/980423– transportClientEndpointBehavior and serviceRegistrySettings in C:\Windows\System32\inetsrv\config\schema

o http://support.microsoft.com/kb/983484/en-us

· Run the RelayConfigurationInstaller.exe which is part of the Azure AppFabric SDK

· Create a new project (Empty ASP.NET Application) and just add linked references to the console version (I like the console version for testing, very rare scenario where I have a console app for testing, since it connects to the service bus it makes sense to have it here, I guess you can make some integration tests too).
clip_image016

· Configure hosting in IIS on the project properties web page.
clip_image018

· Add links to the original services in the console, or if you prefer to just have this, then create the service etc, the contracts are in a different assembly, so you will not see them here:
clip_image020

o Notice above that I have it linked, since I use it for testing in a console app as well, but I always prefer IIS auto Start, then I always know the latest service for publishing is always up and running!

clip_image022

Notice that System.Runtim.Serialization is .Net 3.0 assembly!

· Now we just configure the web.config for it. This is slightly different to the console application config. Here is my config, notice I am using NetEventRelayBinding, for a multicast scenario, or commonly called PUB/SUB messaging pattern.

In future parts, I will explain these settings, they for a Pub/Sub model! I have the credentials twice one for IIS to use and the other for the service to call the broadcaster endpoint. You can always just have one location if need me, I just find it easier to have them in both places as I use System.Configuration.

Notice the service here is also a client! It is a client to a Subscribers endpoint to broadcast the message for pub/sub J

We can now publish the application to IIS, notice we actually do not have an SVC file, since we really do not need one, as the EventRelayBinding will open a channel when IIS instantiates it. So in IIS we configure the AutoStart without a SVC file!
Notice the relative address in the web.config is:

<add relativeAddress="ExternalBookingsReportService.svc"

You can make yours whatever you like.

· In IIS we will configure the WCF properties with AutoStart Set to custom:
clip_image024

clip_image026

· Then at the AppFabric Service level we will set auostart (if you do not do the step above, this will be greyed out!) Also in production use a dedicate application pool for AuoStart!
clip_image028

clip_image030

clip_image032

That it is, now the service will automatically start up, no requests from users are needed, now when it autostarts, it can create a channel with the AppFabric Service Bus!

We can check that the endpoints are configured from the config file correctly in IIS AppFabric:

clip_image034

To test the endpoint with ap fabric is easy, just browse the to the default virtual directory for the app and add the relative address e.g.

http://localhost/AAFabricServiceBus.Bookings.CorpServicesIIS/externalbookingsreportservice.svc

This is in the ServiceActivation element in the web.config:

clip_image036

I have not created a Mex EndPoint, and why should I when building a PUB/Sub system, it is totally transparent from subscribers J

Now, I do not want to get into too much detail here, the idea is to have some inkling of configuration settings that you will get into, however, if I now publish a message the Bus, I can debug the service hosted in IIS:

clip_image038

Now when I use a client who connects to AppFabric:

clip_image040

I should be able to step in:

clip_image042

Cool right! A client submitted a message asynchronously and we can debug it remotely J

Let the system go with F5 and indeed a subscriber got the message via AppFabric and IIS Autostart:

clip_image044

Pricing

I understand pricing is big issue for allot of people, the best advice is to get an excel sheet and try calculate the costs, you will be amazed at how cheap hosting services are, however depending on how you design your architecture; you can keep the costs down!

The following prices are in US Dollars

Access Control

Access Control transactions = $1.99/100K

Service Bus connections

$3.99 per connection on a “pay-as-you-go” basis

$9.95 for a pack of 5 connections

$49.75 for a pack of 25 connections

$199 for a pack of 100 connections

$995 for a pack of 500 connections

Data transfers

Data transfers = $0.10 in / $0.15 out / GB – ($0.30 in / $0.45 out / GB in Asia)

Measuring AppFabric Consumption

AppFabric Service Bus connections can be provisioned individually on a “pay-as-you-go” basis or in a pack of 5, 25, 100 or 500 connections. For individually provisioned connections, you will be charged based on the maximum number of connections you use for each day. For connection packs, you will be charged daily for a pro rata amount of the connections in that pack (i.e., the number of connections in the pack divided by the number of days in the month). You can only update the connections you provision as a pack once every seven days. You can modify the number of connections you provision individually at any time.

For AppFabric Access Control transactions, customers will be charged the actual number of transactions utilized for the billing period (i.e., not in discrete blocks of 100,000 transactions), plus data transfers in or out.

Community Technology Preview (CTP)

Community Technology Preview (CTP) participants that have not yet upgraded to a commercial subscription of the Windows Azure platform will continue to be subject to the following limits:

· Total compute usage: 2,000 compute hours

· Cloud storage capacity: 50GB

· Total storage data transfers: 20GB/day

Conclusion

In part 2 we will go into a deep dive and check out how to build these composite applications. I hope this gives you some ideas on AppFabric. Also, we could make this a reliable message pattern by introducing queues, but I need to do some thinking around that to make it as reliable as NserviceBus, which will be a challenge in AppFabric/Azure hosting, but should be possible.

Windows 7 Phone Development and Hyper-V/Server 2008

Hi,

For those of you that want to develop Windows Phone apps on Hyper-V or Windows Server 2008, think again!!! You have been warned:

 

1. Intel I7 VPRO processor with Hyper Threading enabled causes blue screens with Hyper-V

a. Solution: Disable Hyper Hyper Threading

2. Windows 7 Phone Development Tool kit and Hyper-V will not work, the emulator will crash the VM, once it starts

a. Solution: Throw a Tantrum, kick, swear, run around and throw your clothes off and then install it on a non VM OS, oh wait another problem!!!

3. Windows 7 Phone tools do not work on Windows Server 2008

a. You need a host operating system like Windows 7/Vista

Boot VHD Drive in Windows Server 2008 R2

Hi,

 

You can configure the Windows Boot Loader using BCDEDIT to boot off a VHD drive from the boot menu:

 

C:\Windows\system32>bcdedit /copy {current} /d "Windows 7 VHD"

Copy the output of the GUID and use it here:

my example is: db994f45-acc9-11df-a9e1-e4856d34cfae

 

Do not use my GUID!

C:\Windows\system32>bcdedit /set {db994f45-acc9-11df-a9e1-e4856d34cfae} device v
hd=”[H:]\Windows 7 Development\Windows 7 Development.vhd”
The operation completed successfully.

C:\Windows\system32>bcdedit /set {db994f45-acc9-11df-a9e1-e4856d34cfae} osdevice vhd=”[H:]\Windows 7 Development\Windows 7 Development.vhd”
The operation completed successfully.

C:\Windows\system32>bcdedit /set {db994f45-acc9-11df-a9e1-e4856d34cfae} detecthal on
The operation completed successfully.

Then double check config:

 

C:\Windows\system32>bcdedit

Windows Boot Manager
——————–
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {db994f41-acc9-11df-a9e1-e4856d34cfae}
displayorder            {current}
                        {db994f45-acc9-11df-a9e1-e4856d34cfae}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
——————-
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows Server 2008 R2
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {db994f43-acc9-11df-a9e1-e4856d34cfae}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {db994f41-acc9-11df-a9e1-e4856d34cfae}
nx                      OptOut
hypervisorlaunchtype    Auto

Windows Boot Loader
——————-
identifier              {db994f45-acc9-11df-a9e1-e4856d34cfae}
device                  vhd=[H:]\Windows 7 Development\Windows 7 Development.vhd

path                    \Windows\system32\winload.exe
description             Windows 7 VHD
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {db994f43-acc9-11df-a9e1-e4856d34cfae}
recoveryenabled         Yes
osdevice                vhd=[H:]\Windows 7 Development\Windows 7 Development.vhd

systemroot              \Windows
resumeobject            {db994f41-acc9-11df-a9e1-e4856d34cfae}
nx                      OptOut
hypervisorlaunchtype    Auto
detecthal               Yes

Ninject, Primer – Contextual Binding

Hi,

I am currently learning how to use Ninject as a Inversion of Control and Dependency Injection tool.

I have created a very simple Console Application that is based on the tutorials at github. As I learn all the cool features of Ninject, I will then update my blog e.g. When I start learning about conventions and custom providers etc

My first Class File has custom attributes that I can use to apply contextual/conditional binding:

——————————CustomNinjectAttributes.cs————————–

using  System; 

namespace NinjectTutorial 
{ 
    public class RangeAttribute : Attribute{} 

    public class ThrowingAttribute : Attribute { } 

    public class MeleeBladeAttribute : Attribute { } 
}

—————————— END CustomNinjectAttributes.cs————————–

We will use the above vocabulary on selected properties of Player types in the game (e.g. Warrior, Ninja, Samurai)

Ok, so the next part is to define all the weapons available. Then , we will define the player types and then use Ninject to detect the players weapon based on the attributes.

Ok, so the weapons are:

—————————————–Weapons.cs——————————————–

using System;

namespace NinjectTutorial 
{ 

    public interface IWeapon 
    { 
        void Hit(string target); 
    } 

    public class Sword : IWeapon 
    { 
        public void Hit(string target) 
        { 
            System.Console.WriteLine("Chopped {0} clean in half", target); 

        } 
    } 

    public class Bow : IWeapon 
    { 
        public void Hit(string target) 
        { 
            System.Console.WriteLine("Arrow hit target in the Bulls eye!", target); 

        } 
    } 

    public class Shuriken : IWeapon 
    { 
        public void Hit(string target) 
        { 
            Console.WriteLine("Pierced {0}'s armor", target); 
        } 
    }  
}

—————————————–END Weapons.cs——————————————–

Now that we have the weapons defined, lets then use Property injection in combination with contextual binding based on decorating properties with custom attributes that we defined above!

—————————————–MarksMan.cs——————————————–

using System; 
using Ninject; 

namespace NinjectTutorial 
{ 
    public class MarksMan 
    { 
        [Inject, Range] 
        public IWeapon Weapon 
        { 
            get; 
            set; 
        } 

        public void Attack(string target) 
        { 
            Weapon.Hit(target); 
        } 
    } 
}

—————————————–END MarksMan.cs——————————————–

—————————————–Ninja.cs——————————————–

using System; 
using Ninject; 

namespace NinjectTutorial 
{ 
    public class Ninja 
    { 
        [Inject, Throwing] 
        public IWeapon Weapon 
        { 
            get; 
            set; 
        } 

        public void Attack(string target) 
        { 
            Weapon.Hit(target); 
        } 
    } 
}

—————————————–END Ninja.cs——————————————–

—————————————–Samurai.cs——————————————–

using System; 
using Ninject; 

namespace NinjectTutorial 
{ 
    public class Samurai 
    { 
        [Inject, MeleeBladeAttribute] 
        public IWeapon Weapon 
        { 
            get; 
            set; 
        } 

        public void Attack(string target) 
        { 
            Weapon.Hit(target); 
        } 
    } 
}

—————————————–END Samurai.cs——————————————–

Steps to notice

  • We use the Inject attribute in combination with the custom attribute
  • This means when we define bindings we can now have conditions based on custom attribute names which are strongly types
  • You do not need custom attributes you could use strings, but then you lose type safety.
    Excellent, now the last part of the setup is to create a custom Ninject module. Note that when you create a module, it will not be called directly, but Ninject will detect and load it for you, when you ask it to.
    ok, so lets create a module that does all the binding stuff for us, so we can keep our game code clean!

—————————————– AllFighterModule .cs——————————————–

using System;

using Ninject;

using Ninject.Modules;

namespace NinjectTutorial

{

    public class AllFighterModule : NinjectModule

    {

        public override void Load()

        {

            Bind<IWeapon>().To<Sword>().WhenTargetHas<MeleeBladeAttribute>();

            Bind<IWeapon>().To<Bow>().WhenTargetHas<RangeAttribute>();

            Bind<IWeapon>().To<Shuriken>().WhenTargetHas<ThrowingAttribute>();

            Bind<Samurai>().ToSelf();

        }

    }

}

—————————————–END  AllFighterModule .cs——————————————–

As we can see when use the WHEN keyword to detect the decorated custom attributes and then bind the appropriate concrete class.

Now to run the game, lets check out the console application

———————————————Program.cs———————————————-

using System;

using Ninject;

namespace NinjectTutorial

{

    class Program

    {

        public static void Main()

        {

            IKernel kernel = new StandardKernel();

            kernel.Load(AppDomain.CurrentDomain.GetAssemblies()); //Go Load Ninject Modules

            var samurai = kernel.Get<Samurai>();

            var marksMan = kernel.Get<MarksMan>();

            var ninja = kernel.Get<Ninja>();

            samurai.Attack("The Boss Mob!");

            marksMan.Attack("The Eagle!");

            ninja.Attack("The Robber!");

            System.Console.ReadKey();

        }

    }

}

———————————————End Program.cs———————————————-

Notice here, that we load the kernel and we also tell the kernel to find the modules! So

kernel.Load(AppDomain.CurrentDomain.GetAssemblies()); //Go Load Ninject Modules

will go and automatically load the AllFighterModule and get the bindings, this is done because the AllFigterModule extends the class : NinjectModule

The output of our cool little game is:

image

So our little warriors are working hard to keeping the peace with Ninject technology 🙂

I hope this helps you getting started with Ninject.

Welcome

Hi Folks,

I have just started out on a home project for XNA Development. The game is going to be a 2-D platformer, which will be a cross between Wonder Boy and Super Mario. It will also be utilizing the Farseer physics engine, which I hope will add an extra dimension of play to the game.

What is the game called? The title for now is The Dark Yogi. Players will need to embrace themselves for a fun filled adventure in a world of Fireballs, Magic Carpets and exotic worlds, some real, some in the world of consciousness or is it. All the levels will have their own unique set of rules that the Dark Yogi will need to traverse to conquer his self.

Helping seemingly innoccent people in the game could cause more harm than good in the world of The Dark Yogi! Stay Tuned.

Regards

Optimising SQL Server Disk subsystem – 64K

Hi Folks,

Nope this is not a job offer for 64K 🙂

Today I was having a chat with our SQL developer, as we are looking for a good DBA, once of the topics that came up was the B-Tree (Balanced Tree) structure for the SQL Storage engine. I was mentioning that the ideal DBA should at least understand how 64K extents , each containing 8 x 8k pages can cause some issues if your disk partitions are not aligned.

Anyway, we got into a heated debate of a DBA should know some of these principles. I thought to myself if I was going to win this discussion, I would need to pull something that everyone has heard of and apply my defence, and so I did!

If we use a DBCC ShowContig for a table, we will find the first two fields are the number of pages scanned and then the number of extents.

Now theoretically, for a system (Reporting system at that), the fill factor will be high, due to index references being appended to the B-Tree structure, so lets assume that we have such a reporting system that never gets a page split.

Then for a 100% fill factor index system, we should find that the (number of pages / 8 )  = number of extents.

This is of course the starting point to how SQL server detects logical fragmentation, whilst taking the fill factor into account.

Of course all DBA’s should know this, and so I applied it to disk partition alignment, and finally convinced my team mate 🙂 Since a good DBA will alter index fill factors for a reporting, OLAP, Transaction system respectively.

So, what about disk cluster alignments. Well it is important to optimise the disk for the way SQL stores day in 8K pages and 64k extents.

Microsoft discusses this in allot of detail on MSDN and any DBA wanting to optimise the Disk Subsystem, especially if you forked out allot of money for the disks such as a RAID 10 configuration.

So, what is the cluster size of a SQL optimised disk? it should of course be 64K!

Here is an example in which the F: drive is created on disk 3, aligned with an offset of 1,024 KB, and formatted with a file allocation unit (cluster) size of 64 KB.

However, aligning the partition will also be a crucial factor to disk usage. We must start the alignment and a place where we can ensure 64k extent FITS SNUGLY into a 64k cluster and not Overflow into another one.

Command Line Syntax

C:\>diskpart
Microsoft DiskPart version 6.0.6001
Copyright (C) 1999-2007 Microsoft Corporation.
On computer: DevMachine

DISKPART> select disk 3
Disk 3 is now the selected disk.
DISKPART> create partition primary align=1024
DiskPart succeeded in creating the specified partition.
DISKPART> assign letter=F
DiskPart successfully assigned the drive letter or mount point.
DISKPART> format fs=ntfs unit=64K label=”MyFastDisk” nowait


Want to know more?

The article can be read here.

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

I hope this will help any DBA’s out there when planning a SQL dedicated disk subsystem and put the companies money in well spent hardware into optimal use.