Archived articles - August 2014
Archive for August 2014 (9)
30
Aug
2014
Optimizing LINQ expressions with anonymous types and methods
.NET200 titlesAdvanced LINQ techniques
0
When LINQ was announced in .NET framework 3.5 I was a bit skeptic because it look a bit odd to me on the first look. Writing queries in C#, just did not look right to me.
Anyway, not all the things introduced in .NET had long life...read more
27
Aug
2014
Fastest way to return JSON result from a controller
Umbraco CMS25 titlesResturn JSON in MVC controller action
0
Recently I had to develop a form on a page which loads secondary dropdown list items based on selection in a primary dropdown list.
Because secondary list items are basically children elements of the one selected in primary I just had to run through all children and just return text-value pair object to JavaScript to populate secondary dropdown list.
...read more
25
Aug
2014
Nesting Dictionary items to create lists
Umbraco CMS25 titlesStoring and reading nested Dictionary items as lists in Umbraco using API
0
Recently I wrote an article about workaround for storing lists in Umbraco. I did some googling and Umbraco API exploring since then I found another solution for lists in Umbraco.
This solution is relying to Umbraco Dictionary...read more
22
Aug
2014
Faking browser client in HttpWebRequest
.NET200 titlesIntroduce your request to server as a browser request
0
Using HttpWebRequest to fetch some data in your code from web is the easiest way to do it. However some web locations have restrictions to all only requests which come from browsers.
Performing a normal HttpWebRequest will return 403 status code (HTTP 403 - Wikipedia) which means forbidden access...read more
16
Aug
2014
Dictionary lists in Umbraco
Umbraco CMS25 titlesOut of the box solution for Dictionary lists in Umbraco
0
Umbraco implementation of localized values is based on Dictionary which is in settings section of Umbraco back-end. This works pretty fine in case you need to display only string values but does not work localized lists.
For example you might want to have country list for your contact form on your website...read more
14
Aug
2014
Using GoogleMaps Directions API to get accurate distance
.NET200 titlesExample of using GoogleMaps Directions API for calculating the distance
0
In situations where distance between two geo coordinates needs to be found most of the people are using mathematical function to do this. However there is a major disadvantage in using this method.
...read more
11
Aug
2014
Restrict Access to an MVC Action or Controller based on IP address
.NET200 titlesIP Address Filtering in MVC Controller
0
When you are developing a back-end web application, you might want to restrict access only to people who are working in the company which is maintaining the content or any other operations in the back-end and allowing public access only for the public, usually read-only content.
This means you still have to leave some parts of your application public and for some you need to restrict access for the people outside of a network (certain IP range).
...read more
07
Aug
2014
Best practice tips for large scale Umbraco websites
Umbraco CMS25 titlesExperience based tips for building large and complex websites in Umbraco
0
Umbraco is a great CMS, it simple, easily extendible and most important it is free.
However, it is not build for large scale websites, since presentation and back-end are on the same machine and all published content is stored in AppData/umbraco.config file. This is good because it can be easily cached and database read is reduced...read more
04
Aug
2014
Automatic property population when node created
Umbraco CMS25 titlesPre-populate properties right after node is created
0
For pretty much every website I built in Umbraco, there is some sort of title property for page document type. Either it is a title for navigation in breadcrumbs or menu or main h1 page title.
Usually some of these properties need to be mandatory and in most cases they are the same as the name of the node in content, but still, you have to keep ability to override the value with these properties.
...read more
.NET
28
Nov
2019
Using options pattern in MVC5 legacy applications with web.config
Simple implementation of options pattern in .NET Framework 4.x legacy applications
26
Oct
2019
Ignoring properties from controller action model in Swagger using JsonIgnore
Excluding properties from Swagger in controller action input model using Newtonsoft.Json package
15
Oct
2019
Increase service resilience using Polly and retry pattern in ASP.NET Core
Retry pattern in ASP.NET Core with Polly
1
Oct
2019
Strongly typed configuration sections with options pattern in ASP.NET Core
Loading configuration values directly to classes and use them in the runtime
10
Sep
2019
Unit testing repositories in ASP.NET Core with xUnit and Moq
Mocking UserManager RoleManager and DbContext in unit tests in .NET Core
4
Sep
2019
Mixed model binding in ASP.NET Core using custom model binders
IModelBinder interface implementations usage for multiple source model binding
JavaScript
28
Oct
2018
HTML5 localStorage with expiry with vanilla JavaScript
Using HTML5 localStorage with expiry
8
May
2018
Monitoring DOM changes with JavaScript
Handling DOM changes with plain JavaScript
9
May
2017
Non blocking CSS load on the page
Load external CSS files in an async manner
16
Mar
2017
Serialize html form to JSON without using JQuery
Transform user input from HTML form fields to JSON
17
Jan
2016
Copy text value to clipboard using jQuery
Simple sample of using jQuery to copy value to clipboard
11
Jan
2016
Resize image on the client side with JQuery
Reducing the upload sie by resizing image on the client side
SQL/T-SQL
3
May
2018
Reading JSON data in T-SQL on SQL Server
Extracting values from JSON string on SQL Server using T-SQL
28
Apr
2016
Create XML/HTML with T-SQL
Generating XML/HTML output in SQL Server
24
Nov
2015
IP address to octets split in TSQL
Split IP addresse into octets in SQL Server
20
Jul
2015
Getting first and last second of the current year, month and day
Using minimum and maximum date time in SQL query
13
Apr
2015
Dealing with duplicate rows in SQL Server
Finding and cleaning up duplicate rows in SQL Server tables
12
Mar
2015
Reducing the number of Stored Procedures for the Application
Approach to reduce number of stored procedure for the application
Umbraco CMS
2
Mar
2018
Minify HTML output of your pages
Minification of HTML output using ASP.NET IHttpModule
18
Apr
2015
Generate sitemap.xml on the fly in Umbraco CMS
Simple sitemap.xml Umbraco handler
2
Mar
2015
Accessing UmbracoHelper in HttpHandler request
Working with UmbracoHelper and IPublishedContent in HttpHandler
14
Sep
2014
Same page language switching in Umbraco
Land on the same page in different language in Umbraco using Relations
4
Sep
2014
Getting cropped image the smart way
The way to get cropped image URL with option to load original image too
27
Aug
2014
Fastest way to return JSON result from a controller
Resturn JSON in MVC controller action