Archived articles - March 2015
Archive for March 2015 (12)
30
Mar
2015
Recognize links in text content with jQuery
JavaScript31 titlesFind 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
22
Mar
2015
Enabling CORS only for specific domains in ASP.NET
.NET229 titlesEnable cross origin resquests only for certain domains in ASP.NET
0
Cross-origin resource sharing (CORS) means that page from other domain can make request to some resource which is on other domain. For example, if you try to invoke some WEB API method which is running on different domain you will get exception in the script.
By default CORS are disabled in ASP.NET bot you can easily enable them just by modifying web.config for IIS7 and newer versions pf IIS.
...read more
19
Mar
2015
Styles and images in app_offline.htm file
.NET229 titlesDisplay elegant maintenance page while you are upgrading your website
0
From time to time we all need to do some maintenance to our websites. ASP.NET has nice integrated feature to put your website online while you are updating files and libraries...read more
17
Mar
2015
Zip whole folder on the fly in ASP.NET MVC application
.NET229 titlesGenerate folder archive and send zip file in a response in ASP.NET MVC
0
Generating Zip archives has always been a great thing if you need to generate different content for the request depending on some parameters. In case you need to return multiple files this is one approach to go with...read more
15
Mar
2015
Detect when file download request is finished with jQuery
JavaScript31 titlesFiguring out when file download request completes with jQuery
0
Recently I started a small free service app for extracting icons from application files .exe and .dll. It is called IconExtract and it is hosted at http://iconextract.dejanstojanovic.net/
It basically takes application file you submit, extracts icons and returns them zipped, so beside long running upload there is some processing on the back-end when file is uploaded as well.
...read more
12
Mar
2015
Image thumbnail Html helper with image caching for the perforance
.NET229 titlesCreating image thumbnail with caching in MVC
0
Creating image thumbnail on the fly is pretty easy in ASP.NET whether you are still using WebForms or MVC. There is even a methods introduced in .NET 4.5 framework for generating thumbnail image from a Bitmap class instance.
You can easily create and action in a controller and generate and return thumbnail image on the fly...read more
12
Mar
2015
Reducing the number of Stored Procedures for the Application
SQL/T-SQL10 titlesApproach to reduce number of stored procedure for the application
0
Nowadays, in the years of ORM, barely anyone thinks about stored procedures, but they are still there and accessing and reading data with ADO and SqlDataReader ist still the fastest way.
Stored procedures are validated, parsed and compiled in SQL server, so these steps are not required to be performed versus plaint text query (which is what entity framework generates for accessing data).
...read more
03
Mar
2015
The ways of loading JavaScript files onto your page
JavaScript31 titlesVarios ways to load the script on the page and boos performances
0
Recently I was working on speeding up my website. As a reference I user Google PageSpeed Insights.
There were few things, but among them was one that was that really poked my eyes...read more
03
Mar
2015
Enabling GZip and Deflate compression from ASP.NET code
.NET229 titlesCompress your response on hosts where IIS compression is not supported
0
HTTP compression is a simple way to improve site performance and decrease bandwidth, with no configuration required on the client side. If you test your website through Google PageSpeed Insights, HTTP compression will be one of the points recommended to be used to increase website performance.
Luckily for .NET developers IIS supports it out of the box...read more
02
Mar
2015
Accessing UmbracoHelper in HttpHandler request
Umbraco CMS25 titlesWorking with UmbracoHelper and IPublishedContent in HttpHandler
0
If you were planning to create sitemap.xml in Umbraco, you most probably were doing it with HttpHandler. This was fine until Umbraco version 6.2.2.
If your website was running in lower version, most probably after update your HttpHandler were crashing since UmbracoContext.Current returns null.
...read more
02
Mar
2015
Easier manipulation with IEnumerable objects
.NET229 titlesUseful extension methods for working with lists, arrays, dictionaries...
0
Working with any collection which implements IEnumerable is pretty easy in C#, plus if you are using LINQ you can easily manipulate with collection data. Recently I was doing some filtering with some in-memory collections and I had to check whether one collection contains same elements as some other collection with elements of the same type...read more
01
Mar
2015
Super lightweight Data Access Layer returning models from ADO
.NET229 titlesReturn strongly typed objects directly from stored procedure calls
0
Entity framework is an awesome tool for working with database in .net, but sometime you have to get back to old fashion ADO for the performances. The bad thing is that as soon as you get back to ADO, you have to deal with SqlDataReader, DataTable and DataSet classes...read more
.NET
5
Jun
2022
Using dotnet nuget package vulnerability scan in Azure DevOps build
Listing nuget vulnerabilities and controlling build in Azure DevOps
5
May
2022
Protecting static files in ASP.NET Core using custom middleware
Restricting access to specific static content with middleware in ASP.NET Core
20
Dec
2021
Supporting multiple authentication schemes in asp.net core webapi
Using more than one authentication schemes in webapi projects
12
Dec
2021
Controlling the flow of migrations in EF Core
Altering EF Core migrations execution order
28
Nov
2021
Unit of work pattern with Dapper
Implementing unit of work pattern with Dapper in .NET 5
21
Sep
2021
Adding display name to Enum values
Implementing additional values for Enum items in C#
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
22
Feb
2022
Select column names with values from SQL Server database
Fetching column names with its value in T-SQL using built in JSON methods
23
May
2020
Identifying opened connections for the specific application in SQL Server
Connection listing queries in SQL Server
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
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