Popular Posts

Saturday, December 27, 2014

Fiscal / Financial year table with constraints

Example of a table with full constraints for data validity:

drop table fiscalyeartable1

CREATE TABLE FiscalYearTable1
(fiscal_year INTEGER NOT NULL,
 start_date DATE NOT NULL,
 end_date DATE NOT NULL
 Constraint PK__fiscal_year__start_date__end_date primary key (fiscal_year, start_date, end_date),
 Constraint Chk__start_date__YearMinusOne check (year(start_date) = fiscal_year -1),
 Constraint Chk__start_date__SmallerThanEnddate check (start_date < end_date),
 Constraint Chk__start_date__MonthIs1stJuly check (month(start_date) = 7), check(day(start_date)=1),
 Constraint Chk__end_date__Year check (year(end_date) = fiscal_year),
 Constraint Chk__end_date__GreaterThanStartdate check (end_date > start_date),
 Constraint Chk__end_date__MonthIs30thJune check (month(end_date) = 6), check(day(end_date)=30)
 );


Tuesday, December 23, 2014

Tuesday, December 9, 2014

Mvvm validatio

http://www.codeproject.com/Articles/851631/IDataErrorInfo-with-Fluent-Validation

Monday, November 17, 2014

Garbage collection

http://www.dotnet-tricks.com/Tutorial/netframework/0L3P131012-.Net-Garbage-Collection-in-depth.html

Thursday, November 6, 2014

Monday, November 3, 2014

Sacrificial architecture martin fowler

http://www.infoq.com/news/2014/11/sacrificial-architecture?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=Architecture

Sunday, November 2, 2014

Thursday, October 23, 2014

Javascript callback utility function

http://www.codeproject.com/Tips/831376/Decouple-javascript-function-call-to-multiple-call

Monday, October 20, 2014

Mvc tempdata keep and peek

http://www.codeproject.com/Articles/818493/MVC-Tempdata-Peek-and-Keep-confusion

Googlemap and mvc good example

http://www.codeproject.com/Articles/829292/jQuery-Based-Ajax-ASP-NET-MVC-Google-Maps-Web-App

Windows phone validation framework

http://www.sullinger.us/blog/2014/7/4/custom-object-validation-in-winrt

Thursday, October 9, 2014

Basic windows phone mvvm example

http://www.geekchamp.com/articles/windows-phone-mango-getting-started-with-mvvm-in-10-minutes

Wednesday, October 1, 2014

Bootstrap mandatory

http://www.codeproject.com/Tips/824784/Few-Mandatory-Things-to-Know-for-Using-Bootstrap

Saturday, September 27, 2014

Bootstrap table with sorting paging

http://www.codeproject.com/Tips/823490/Bootstrap-Table-With-Sorting-Searching-and-Paging

Tuesday, September 9, 2014

Monday, September 8, 2014

Pdf word free dlls

http://www.codeproject.com/Articles/811833/Free-powerful-API-to-process-Word-and-PDF-file-Spi

Automapper tips

http://www.codeproject.com/Articles/814869/AutoMapper-tips-and-tricks

Thursday, September 4, 2014

Universal application

http://msdn.microsoft.com/magazine/0c980894-ea5e-4e46-a038-c35c20c8af86

Saturday, August 16, 2014

Logging signalr events

http://www.asp.net/signalr/overview/signalr-20/troubleshooting-and-debugging/enabling-signalr-tracing

Monday, August 11, 2014

Thursday, August 7, 2014

Desktop signalr example

http://www.codeproject.com/Articles/804770/Implementing-SignalR-in-Desktop-Applications

Saturday, August 2, 2014

Trsting private methods - private object inboker

http://www.codeproject.com/Tips/801060/Safely-expose-your-methods-for-Unit-Testing

Web api cachecow

http://bitoftech.net/2014/02/08/asp-net-web-api-resource-caching-etag-cachecow/

Web api performance improvement

http://dotnet.dzone.com/articles/8-ways-improve-aspnet-web-api

Log beautifully

http://feeds.hanselman.com/~/70554708/0/scotthanselman~NuGet-Package-of-the-Week-MarkdownLog-makes-log-files-much-prettier.aspx

Friday, August 1, 2014

Web api 2.1 creating http response in new way

http://www.bizcoder.com/composing-api-responses-for-maximum-reuse

Fiddlercore capture http requests

http://weblog.west-wind.com/posts/2014/Jul/29/Using-FiddlerCore-to-capture-HTTP-Requests-with-NET

Generate office dovuments using openxml

http://odetocode.com/blogs/scott/archive/2014/07/30/easily-generate-microsoft-office-files-from-c.aspx

Thursday, July 31, 2014

Saturday, July 26, 2014

RavenDb related links


http://ravendb.net/docs/client-api/basic-operations/saving-new-document

http://blog.mariusschulz.com/2013/05/06/using-integer-document-ids-in-ravendb-indexes

Advanced Entity Framework 6 Scenarios for an MVC 5 Web Application (12 of 12) | The ASP.NET Site

Advanced Entity Framework 6 Scenarios for an MVC 5 Web Application (12 of 12) | The ASP.NET Site:



'via Blog this'

Introduction to Windows Azure Worker Roles (Part 2) | Windows Azure Cloud Services | Channel 9

Azure cloud services with service bus



Introduction to Windows Azure Worker Roles (Part 2) | Windows Azure Cloud Services | Channel 9:



'via Blog this'

Windows Azure Cloud Services Concepts (Part 1) | Windows Azure Cloud Services | Channel 9

Azure cloud service and load balancer and role



Windows Azure Cloud Services Concepts (Part 1) | Windows Azure Cloud Services | Channel 9:



'via Blog this'

The World's Greatest Azure Demo

Great windows azure video - scalebility etc



The World's Greatest Azure Demo:



'via Blog this'

Thursday, July 24, 2014

Enabling cors on asp.net web api

http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

Sunday, July 13, 2014

Easy, eager and explicit loading entity framework

http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/part-4

Friday, July 11, 2014

Connecting to sql server express instance using web config connection string and entity framework


This connection string does NOT work:

  <connectionStrings>
    <!--<add name="TodosConnection" providerName="System.Data.SqlClient"
          connectionString="Server=.\SqlExprss;Initial Catalog=Todos;Integrated Security=True;"/>-->

This connection string works:

    <add name="TodosConnection"
     connectionString="data source=.\SQLEXPRESS;Integrated Security=True; database=Todos;"
     providerName="System.Data.SqlClient" />
    
  </connectionStrings>


And in the code this how to use it:

namespace Todo.Api.Data
{
    public class TodosContext : DbContext
    {

        public TodosContext()
            : base("name=TodosConnection")
        {
            Debug.Write(Database.Connection.ConnectionString);
        }

        public DbSet<Todo> Todos { get; set; }
    }
}

Tuesday, June 17, 2014

Angularjs form dirty reset

http://odetocode.com/blogs/scott/archive/2014/06/10/model-options-and-pristine-forms-in-angularjs.aspx

Log to console with colour

http://www.codeproject.com/Articles/786304/Logging-How-to-Growl-with-NLog-or

Wcf creating proxies

http://www.codeproject.com/Articles/786601/Ways-to-generate-proxy-for-WCF-Service

Saturday, May 31, 2014

introduction.js



Jasmine testing function with callbacks ..







describe("Testing function callback", function () {



    it("calls the callback", function () {

        var callbackObject = new CallBackTest();

       

        // NB: a dummy object with function success so can be used to check callback was called

        var observer = {

            success: function() {}

        };



        // spies always need an object and a method

        spyOn(observer, "success");

       

        callbackObject.doIt(observer.success);



        expect(observer.success).toHaveBeenCalled();



    });



});



function CallBackTest() {



    this.doIt = function (success) {

        return success();

    };

}





'via Blog this'

Richardson Maturity Model

Richardson Maturity Model:



Web API RMM or Maturity Model ... steps to get the api to its glory



'via Blog this'

Tuesday, May 27, 2014

Logging client side errors angularjs

http://www.bennadel.com/blog/2542-logging-client-side-errors-with-angularjs-and-stacktrace-js.htm

Thursday, May 22, 2014

Com. Net visibility issues

http://www.codeproject.com/Articles/769028/How-I-Came-to-Love-COM-Interoperability

Wednesday, April 9, 2014

Tuesday, April 8, 2014

Generic ado.net database agnostic provider attempt??

http://www.codeproject.com/Articles/753789/Simplified-Database-Access-via-ADO-NET-Interfaces

Wednesday, March 26, 2014

Deep copy of classes that are not marked seroalizable

http://stackoverflow.com/questions/129389/how-do-you-do-a-deep-copy-an-object-in-net-c-specifically

Tuesday, March 18, 2014

Multiple submit buttons mvc nice

http://www.codeproject.com/Tips/745887/Multiple-Actions-from-a-Single-VIEW-Page-in-MVC

Monday, March 17, 2014

Generic chain of responsibility

http://www.codeproject.com/Articles/743783/Reusable-Chain-of-responsibility-in-Csharp

Saturday, March 15, 2014

c# - ArgumentNullException - how to simplify? - Stack Overflow

c# - ArgumentNullException - how to simplify? - Stack Overflow:



Generic guard function to check for null parameters ...



'via Blog this'

Inbox (3) - rahman.mahmoodi@gmail.com - Gmail



Kendo UI related links found during the research:



Post data http://www.codeproject.com/Articles/606682/Kendo-Grid-In-Action



http://stackoverflow.com/questions/13534414/kendoui-grid-summary-values-in-footer



http://www.kendoui.com/forums/kendo-ui-web/grid/can-the-groupfootertemplate-contain-the-sum-of-another-column's-values-.aspx







Display Image in Kendo UI:



http://stackoverflow.com/questions/16338238/displaying-dynamic-images-in-kendo-grid




Thursday, March 13, 2014

Testing wcf proxies

http://www.codeproject.com/Tips/743246/How-to-Mock-Visual-Studio-Generated-Web-Services-U

Sunday, March 9, 2014

Friday, February 28, 2014

Tuesday, February 25, 2014

Regular expressions

http://www.codeproject.com/Articles/206330/Learning-REGEX-regular-expression-in-the-most-ea-2

Ienumerable vs iquerryable

http://www.codeproject.com/Articles/732425/IEnumerable-Vs-IQueryable

Tuesday, February 11, 2014

Less - enables to use variable and more inside css

http://www.codeproject.com/Articles/724246/Introduction-to-LESS-an-easier-way-to-create-CSS-s

Disable browser caching from code

http://www.codeproject.com/Articles/724302/Prevent-browser-caching-of-css-and-javascript-file

Mocking session using mock

http://www.codeproject.com/Articles/724300/Mocking-Session-State-in-an-ASP-NET-MVC4-Unit-Test

Monday, February 10, 2014

Serving html from desktop using katana

http://odetocode.com/blogs/scott/archive/2014/02/10/building-a-simple-file-server-with-owin-and-katana.aspx

Custom Excel Toolbars

http://msdn.microsoft.com/en-us/library/office/ee767705(v=office.14).aspx




Friday, February 7, 2014

ASP.NET MVC TempData Extension Methods - DONN FELKER

ASP.NET MVC TempData Extension Methods - DONN FELKER: "public static class TempDataExtensions
{
    public static void Put(this TempDataDictionary tempData, T value) where T : class
    {
        tempData[typeof(T).FullName] = value;
    }
 
    public static void Put(this TempDataDictionary tempData, string key, T value) where T : class
    {
        tempData[typeof(T).FullName + key] = value;
    }
 
    public static T Get(this TempDataDictionary tempData) where T : class
    {
        object o;
        tempData.TryGetValue(typeof(T).FullName, out o);
        return o == null ? null : (T)o;
    }
 
    public static T Get(this TempDataDictionary tempData, string key) where T : class
    {
        object o;
        tempData.TryGetValue(typeof(T).FullName + key, out o);
        return o == null ? null : (T)o;
    }
}"



'via Blog this'

MvcPaging let the partialview updates its own content using ajax

<script>
 
    $(function () {
        $('#Pager a').click(function () {
            $.ajax({
                url: this.href,
                type: 'GET',
                cache: false,
                success: function (result) {
                    $('#grid-list').html(result);
                }
            });
            return false;
        });
    });
 
</script>
 

Selenium the best test web application testing tool

Downloads:



enables to test the web application by mocking the browsers -> mock or ???



'via Blog this'

SQL CLR Research

Good one -> http://technet.microsoft.com/en-us/library/ms131103.aspx



http://www.codeproject.com/Articles/37298/CLR-Stored-Procedure-and-Creating-It-Step-by-Step



This is not for the web reference -> http://nielsb.wordpress.com/sqlclrwcf/






Using paging in partial view, asp.net mvc - Stack Overflow

Using paging in partial view, asp.net mvc - Stack Overflow:



https://github.com/martijnboland/MvcPaging

paging using Ajax -> http://demo.taiga.nl/MvcPaging/Paging/IndexAjax



issue with paging and custom ajax

http://stackoverflow.com/questions/18822352/using-paging-in-partial-view-asp-net-mvc



'via Blog this'

Wednesday, February 5, 2014

Tuesday, January 28, 2014

Wednesday, January 22, 2014

Truthy and falsy jsvascript

http://www.codeproject.com/Articles/713894/Truthy-Vs-Falsy-Values-in-JavaScript

Mustache jquery plug in

http://www.jonnyreeves.co.uk/2012/using-external-templates-with-mustache-js-and-jquery/

Tuesday, January 21, 2014

Custom message based wcf

http://www.codeproject.com/Articles/598157/Building-SOAP-Message-Based-Web-Services-with-WCF

Monday, January 20, 2014

Signalr client code

https://github.com/SignalR/SignalR/tree/master/src/Microsoft.AspNet.SignalR.Client.JS

Saturday, January 11, 2014

Friday, January 3, 2014

Bashing my head to the wall for the last few days as Kendo UI Grid was populating properly but when clicking Delete Or Update button it was always passing NULL to the Controller parameter.

The solution was to build the javascript result manaully before posting so MVC default model binder nows how to deserialise it.

The trick is that the MVC controller parameter should be called as products too:

result["products[" + i + "]." + member]


<script>
        $(document).ready(function () {
            dataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            url: "ShoppingCartDetailsRead",
                            dataType: "json"
                        },
                        update: {
                            url: "ShoppingCartDetailsUpdate",
                            dataType: "json",
                            contentType: "application/json",
                            type: "POST"
                        },
                        destroy: {
                            url: "ShoppingCartDetailsDelete",
                            dataType: "json",
                            type: "POST"
                        },
                        parameterMap: function (data, type) {
                            if (type != "read") {
                                
                // post the products so the ASP.NET DefaultModelBinder will understand them:
                                var result = {};
 
                                for (var i = 0; i < data.models.length; i++) {
                                    var product = data.models[i];
 
                                    for (var member in product) {
                                        result["products[" + i + "]." + member] = product[member]; //NB: controller parameter should be products
                                    }
                                }
                                return result;
                                
                            } else {
                                return JSON.stringify(data);
                            }
                        }
                    },
                    batch: true,
                    pageSize: 20,
                    schema: {
                        model: {
                            id: "ShoppingCartItemID",
                            fields: {
                                ShoppingCartItemID :  { editable: falsedefault:1},
                                ShoppingCartID: { editable: false},
                                ProductID: { editable: false},
                                ProductName: { validation: { required: true } },
                                ListPrice: { type: "number"},
                                Quantity: { type: "number"}
                            }
                        }
                    }
                });
 
            $("#grid").kendoGrid({
                dataSource: dataSource,
                navigatable: true,
                sortable: true,
                pageable: true,
                toolbar: ["save""cancel"],
                columns: [
                    { field: "ShoppingCartItemID", title: "Cart Id", width: 30 },
                    { field: "ShoppingCartID", title: "User Id", width: 110 },
                   { field: "ProductName", title: "Item", width: 110 },
                    { field: "ProductId", title: "Item Id", width: 110 },
                    { field: "ListPrice", title: "List Price", format: "{0:c}", width: 110 },
                    { field: "Quantity", title: "Quantity", width: 110 },
                    { command: "destroy", title: "&nbsp;", width: 90 }],
                editable: true
            });
        });
    </script>

Wednesday, January 1, 2014

Ioc vs di plus videos

http://www.codeproject.com/Articles/592372/Dependency-Injection-DI-vs-Inversion-of-Control-IO

Design patterns interview questions

http://www.codeproject.com/Articles/592372/Dependency-Injection-DI-vs-Inversion-of-Control-IO

Uni offering free courses

http://www.codeproject.com/Articles/704567/Learning-Opportunities-online