Posts

Showing posts from February, 2014

Log4Net with WCF hosted in a Windows Service

Let's see how to get logging working with a WCF service hosted in a windows service.

When I tried it at first, It didn't work on the service, but it worked perfectly fine on the web application (MVC4).

Instead of using Log4Net directly, I have used Commons.Logging. I'm just gonna quote how awesome it is here. And I will highlight why I think it's awesome.

When writing a library it is very useful to log information. However there are many logging implementations out there, and a library cannot impose the use of a particular one on the overall application that the library is a part of.

The Logging package is an ultra-thin bridge between different logging implementations. A library that uses the commons-logging API can be used with any logging implementation at runtime. Commons-logging comes with support for a number of popular logging implementations, and writing adapters for others is a reasonably simple task.

Applications (rather than libraries) may also choose to use com…

Pagination with Knockout & JQuery

Image
Oftern times, when we need to render large data sets on a web page, we must use pagination or something similar (think of twitter or facebook - load when scrolled down). Today, I'm going to show you how to create pagination with JQuery, Knockout.JS and a pretty cool jquery plugin, "Simple Pagination".

download the "Simple Pagination" JQuery plugin here. http://th3silverlining.com/2010/04/15/pajination-a-jquery-pagination-plugin/

Assume you have an API which return data something like this (orders in my case)

{"Items":[{"ID":12,"Description":"New pair of shoes","InvoiceDate":"2012-08-16T00:00:00"},{"ID":13,"Description":"One bottle of Juise","InvoiceDate":"2012-09-16T00:00:00"},[Upto10Items]],"TotalCount":38,