Dejan's Web Log

Server-side, client-side, code snippets, scripts, automation, best practices, proven approaches, tips & tricks...

Auto realod application config in .NET

Reflect config file changes in application in a runtime
 
0
In .NET working with configuration is really easy and there are bunch of .NET classes that rely on config values so you do not have to specify values in their constructors. For me it a common practice to instantiate database connections of WCF client by only creating an instance with parameterless constructor while keeping values in config file. In case you have to use these kind of classes in a long running process, like windows service on which other processes are depending on ... read more

Easy and simple way to bind ADO object to POCO object

Simple one way binding of ADO database objects to POCO
 
0
This article is base don the article I wrote in September last year. Basically I wrote this piece of code because I needed something really lite for one way binding. There are a bunch of light ORMs and ORM-Like solution, but both of them provide two way binding, but for me insert/delete/update commands were already handled by stored procedures as it was an existing solution which needed some new features, so I needed something to make reading a lot easier ... read more

Working with GoogleMaps in jQuery style

jQuery plugin for GoogleMaps
0
I've used GoogleMaps on several web projects and it seemed to me that I'm repeating a lot of code used in the previous projects which lead me to write a common Javascript library to help me easily reuse the code by only copying the JavaScript library to a project or referencing it from CDN. I could not think of a better way to build this library than to use jQuery and build a pligin for this. ... read more

Benefits of binary serialization in C#

Manipulationg with object instances using binary serialization in C#
 
0
By default object instances in .NET are never "trully" clonned. Instead .NET is doing shallow copy of instances which means if you have one variable which is object instance and you assign that variable to other variable, both of them will point the same instance of that object. Basically you created two pointers of the same object instance. ... read more

Scraping website content using HtmlAgilityPack

Build you own website crawsler for extracting data from websites
 
0
HTML is a markup language same as XML, but still there are differences which make dealing with them a bit different. Basically HTML is a strict structure in terms of node sets and attribute sets, but in general more documents online are not exactly following the proper structure since browsers usually manage to deal with rendering out the document in UI. However, this makes it more difficult to read them in case you want to from website itself as you cannot apply all XML rules since structure is not strictly followed. ... read more

Microsoft IIS and ASP.NET MVC caching techniques

Ways to cache data and response to improve page performance
 
0
Of course, the best way to make you web application work fluent is to write the code properly and design the architecture of application to meet requirements and certain load depending of the type of application. But even though architecture is good, you can always improve performance by reducing processing in application code itself. Caching is the best way to boost web application performance and reduce load of both application (IIS) and data servers (SQL Server) ... read more

Block referrer spam request on ASP.NET application

Block unwanted spam traffic from your wesbite
0
Recently I was checking my Google Analytics for this website I spotted some referrer urls that were completely unknown to me. When I tried to visit the url of the referrers I got a lot of commercial and pop-ups after few redirects. It looked really suspicious, so I tried to find a little bit more about these. ... read more

Recognize links in text content with jQuery

Find and replace URLs with anchor tags inside the text
0
Very often when you are dealing with content from 3rd party like tweets from Twitter of Facebook posts and comments you might end up with some URL inside the content. On both Twitter or Facebook or any other social network, links inside text comments are replaces with anchor tags to those URLs. In order to keep the same user experience and make it more useful o your side where you are serving the content from the other party it is recommended that you do the same. ... read more

JavaScript

read more

Umbraco CMS

read more

.NET

read more

SQL/T-SQL

read more