Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Thursday, July 24, 2014

Looking in the Event Viewer, System, ever since I’ve had this PC I’ve been getting:

Windows Hardware Error Architecture

WHEA-Logger warnings:

A corrected hardware error has occurred.

Reported by component: Processor Core
Error Source: Corrected Machine Check
Error Type: Cache Hierarchy Error
Processor APIC ID: 2

The details view of this entry contains further information.

image

http://social.technet.microsoft.com/wiki/contents/articles/3567.event-id-18-microsoft-windows-whea-logger.aspx

update BIOS and drivers for motherboard

maybe bump up voltage. offset +0.100?

image

https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=19792

Tested okay

http://www.gigabyte.com/products/product-page.aspx?pid=4960#dl

BIOS is at latest version - F7

| | # 
# Tuesday, July 22, 2014

Getting the most out of your machine:

http://www.cpuid.com/softwares/cpu-z.html

image

CPU: 4790K

image

Have gone from BIOS F6 to F7

Motherboard: Z97X-UD3H

Intel Devil's Canyon Core i7-4790K CPU Cinebench results

http://www.theregister.co.uk/2014/06/30/review_intel_devils_canyon_cpu/

So possible 10% increase in perf going from 4.4 to 4.8

 

Look at BIOS update..

http://www.gigabyte.com/products/product-page.aspx?pid=4960#bios

latest is F7 – 19/06/2014.  Had to format a mem stick to Fat32, copy the files over, then reboot and run the flash update in the BIOS.

http://www.gigabyte.com/products/product-page.aspx?pid=4960#driver  - management?

 

image

Overclocked to 4.5GHz

http://www.overclock.net/t/1490835/the-gigabyte-z97x-overclocking-guide – Changed the Performance Upgrade switch in the BIOS

image

no overclock (4.4GHz.. or 4.0?)

image

4.5GHz

Also how to find drivers http://social.microsoft.com/Forums/en-US/9adcf4df-0dfd-47f0-a955-2dd1cb56e151/driver-question-pci-simple-communications-controller?forum=whssoftware

Installed :  Intel Management Engine Inerface.. got rid of 1 device not there.

And an INF update.. all good.

EasyTune.. need Gigabyte AppCenter utility

image
4.6GHz

| | # 
# Wednesday, July 16, 2014

image

Going for a minimal install, but with client tools.  Also put on mixed mode authentication.  Rest are defaults.

| | # 

Disabling outlook alerts (2013)

http://www.howtogeek.com/tips/how-to-disable-desktop-notifications-in-outlook-2013/

setup power saving (if using desktop) to performance

 

setting up mstsc (inbound) – proving to be hard as I’m on a VPN to a corp network, so it should just work.

| | # 

“DI is a way to enable loose coupling, and loose coupling is first and foremost an efficient way to deal with complexity”

image

“Anyone can draw a three-layer application diagram, and [this] proves that I can, too”!

Building a tightly coupled application

MVC, EF and MSSQL application.  E-commerce.

  • List of featured products
  • If user is a preferred customer, the price on all products should be discounted by 5%

Data Layer

image
Creates a table in SSMS

image
Uses EF to create an Entity Model (db first).  She has changed Featured to IsFeatured in the model

Domain Layer

How to know who is a preferred customer?

    public partial class ProductService {
        private readonly CommerceObjectContext objectContext;

        public ProductService() {
            this.objectContext = new CommerceObjectContext();
        }

        public IEnumerable<Product> GetFeaturedProducts(
            bool isCustomerPreferred) {
            var discount = isCustomerPreferred ? .95m : 1;
            var products = (from p in this.objectContext
                                .Products
                            where p.IsFeatured
                            select p).AsEnumerable();
            return from p in products
                   select new Product {
                       ProductId = p.ProductId,
                       Name = p.Name,
                       Description = p.Description,
                       IsFeatured = p.IsFeatured,
                       UnitPrice = p.UnitPrice * discount
                   };
        }
    }

She implements this in the domain layer.  However she needs a reference to the DAL as ObjectContext is defined there.

UI Layer

public ActionResult Index() {
    bool isPreferredCustomer = this.User.IsInRole("PreferredCustomer");

    var service = new ProductService();
    IEnumerable<Product> products = service.GetFeaturedProducts(isPreferredCustomer);
    this.ViewData["Products"] = products;

    return this.View();
}

Needs a reference to Domain layer, and DAL (as products are defined there). 

image
The answer as to why this was failing to compile on line 12 becomes clear when you use the type explicitly

image

Ahh, it is Product. Need a reference to System.Data.Entity (EF4) for EntityObject which Product inherits from.

MVC5

As I couldn’t get the project to compile easily (MVC3) in VS2013, I created a new MVC5 and fitted in the code.

@using Ploeh.Samples.Mary.ECommerce.Data.Sql

<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Featured Products</h2>
    <div>
        @foreach (var prod in (IEnumerable<Product>) ViewData["products"]){
            @prod.Name
            <br />
            @Html.Encode(prod.Name)
            <br />
            @prod.UnitPrice
            <br/>
            @Html.Encode(prod.UnitPrice.ToString("C"))
            <br/><br/>
        }
    </div>
</asp:Content>

and web.config

  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.1">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      </assemblies>
    </compilation>

to get a reference to System.Data.Entity.  Also had to make sure the connection string was pointing to .\SQLEXPRESS where I generated the database.

Evaluation

Did Mary succeed?  No.  It looks like the coveted layered application, but the code is tightly coupled

image
Dependency graph showing how the modules depend on each other.  The arrows point towards a module’s dependency

The UI is dependant on both the Domain and Data Access layers!  It seems the UI mayy bypass the Domain in certain cases.

| | # 
# Monday, July 14, 2014
( Resharper | Xunit )

Resharper Manage Extensions

image

| | # 
# Friday, July 04, 2014

Rohans talk

What book?

Dave Kerr.. knows about messaging

 

Framework for doing a distributed application

Separate machines eg Web -> create user -> Console app picks up message to save... -> raise an event that this has happened

Another ConsoleApp picks up that message and then sends an email

 

MSMQ, RabbitMQ, Tables(!) in a DB, Azure

  • Error queue
  • Auditing

 

Why have an Interface over an Attribute for NServiceBus eg ICommand (a marker interface)

Command is somehting want to happen

Event is something after it happens

Resilient... eg if emailler console app went down.

Starbucks Analogy

1person - take order

cup is the message (written on)

1 person - makes

 

Other Products

NServiceBus and MassTransit started using MSMQ

EasyNetQ is a light .NET wrapper around RabbitMQ (Erlang open source)

RabbitMQ is a much more feature rich queuing system.. than MSMQ... perf slightly better at 8k messages per sec compare to 5k

| | # 
# Thursday, June 12, 2014

After a very interesting discussion at the Brighton Alt.NET meeting, and some follow up blog posts, I thought I’d explore why to use DI, then use it in my personal project to see if it does help.

This is a follow up to an interesting discussion the other night at the Brighton Alt.NET group on: “when is a project big enough to warrant using DI”

http://flat9.wordpress.com/2014/06/04/when-should-i-use-dependency-injection/

http://www.artisancode.co.uk/2014/06/appropriate-dependency-injection/

http://blog.ploeh.dk/2014/06/03/compile-time-lifetime-matching/

Interesting quote from Mark Seeman who wrote the book on DI in .NET: http://www.manning.com/seemann/

“Since I wrote the article on when to use a DI Container, I've only strengthened my preference for Poor Man's DI. Unless I'm writing a very complex code base that could benefit from Convention over Configuration, I don't use a DI Container, but since I explicitly architect my systems to be non-complex these days, I haven't used a DI Container in production code for more than 1½ years.”

My initial concerns are:

  • Complexity
  • Harder to navigate through the code

What I’m hoping may happen is:

  • Less code
  • Greater testability
  • Less complex systems

What is Dependency Injection

“Dependency injection is a software design pattern that implements inversion of control and allows a program design to follow the dependency inversion principle” Wikipedia

“Dependency injection means giving an object its instance variables.” James Shore

Dependency Injection (DI) is the proper way to write loosely coupled code when using Object-Oriented Design.” Mark Seemann

Pluralsight – John Sonmez course

http://pluralsight.com/training/Courses/TableOfContents/inversion-of-control

  • Dependency Inversion Principle – (DIP)
  • Inversion of Control – a pattern
  • DI - Implementation of IoC to invert dependencies
  • IoC Container – a framework

3rd module.. a quick demo on DI.. using types before they are made to help drive out… like TDD.

google TDD IoC DI C#?

Rob Conery

http://tekpub.com/blogs/tekpub-free-bin/7964835-concepts-1-dependency-injection-and-inversion-of-control

“You’ve got to be kidding me!”

ie why should we use this

Pluralsight – Jeremy Clark

http://pluralsight.com/training/Courses/TableOfContents/dependency-injection-on-ramp

| | #