Tag: .NET

Upload Image and Create Thumbnail

In this post, I will show an implementation of uploading image to server and creating a thumbnail version of the uploaded image. Creating a thumbnail is useful as it reduces image size and dimensions and improves application’s performance. In your ASP.NET Controller’s HttpPost Action, you can get the uploaded image file as HttpPostedFileBase as: HttpPostedFileBase […]

Read More

Implementing Inbox Messaging System in ASP.NET

In this post, I would like to write about creating a simple Messaging System for your application. Almost all user based applications require some form of messaging system. Mainly the messaging system is needed so that users within the application can send messages to one another and also, it is needed to show any form […]

Read More

Get Random Date From A Date Range

This is a quick trick to generate a random date between two date ranges. First, create a function that generates a random number between two given values: private static int RandomNumBetween(int smallNum, int bigNum) { Random rnd = new Random(); int randomValue = rnd.Next(smallNum, bigNum + 1); return randomValue; } Now, use this function to […]

Read More

C# : Write DataTable To CSV

Here’s a quick code to write data from database to a CSV format file in C# .NET. I find this function really useful as I frequently come across this scenario where I have to create a report for the client. Once our data is loaded into a DataTable, this function can be used. public static […]

Read More

Visual Studio: Converting a Class Library to Portable Class Library

Before you even start asking GOOGLE about how to convert a Class Library Project to Portable Class Library (PCL) in Visual Studio, why don’t you try to do it by yourself? In fact that is the best approach for this scenario because if you try to google for the solution, you will realize that none […]

Read More

Reducing Cyclomatic Complexity Using Delegates

In the previous post we looked at what Cyclomatic Complexity is and why it is important to write programs with low Cyclomatic Complexity. Here I would like to show an example of reducing Cyclomatic Complexity with the use of Delegates. This post is going to be extremely code intensive so buckle up guys! Let’s start. […]

Read More

Cyclomatic Complexity

Cyclomatic Complexity is a software metric used to calculate the complexity of a program. It is a measure of number of possible use case flows for a given program’s source code and is directly dependent upon the number of control flow statements (if/else statements and switch cases) within the code. For example, a method with […]

Read More

Notes on Spring.NET DAO Code Configuration

In this short article, we will look at how Dependency Injection for Data Access Objects can be implemented using Spring.NET. “Data Access support in Spring is aimed at making it easy to work with data access technologies like ADO.NET and Nhibernate in a standardized way.”- Spring.NET First an interface that exposes the methods that can […]

Read More

Uploading Unknown Format Excel File To A SQL Database

Introduction Usually it is expected from client side to upload only structured Excel sheets (sheet with defined Column Names and data types for Rows) to load to server. But sometimes you might also require to dump whatever is in the Excel directly to your database. While there is a tool that is provided by SQL […]

Read More

Post on ASP.NET Web API

Here are links to my two other posts which were published on TutsPlus. Introduction to ASP.NET Web API Securing the Web API You can find the full code in my git repo. Thanks!        

Read More