Wednesday, December 26, 2018

DotPeek Tool: A .NET Decompiler

The dotPeek decompiler tool was initially introduced by Microsoft. It's a free-of-charge, standalone tool-based decompiler for any .NET assemblies. It converts .NET assemblies into equivalent C# code and optionally shows the underlying IL code. A dotPeek application can decompile different kinds of assembly files, such as Libraries (.dll), Executable files (.exe), Windows 8 metadata files (.winmd), Archives (.zip), NuGet packages (.nupkg), and Microsoft Visual Studio Extensions packages (.vsix).

Creating Different Types of Charts in ASP.NET MVC

Creating charts and displaying them in a Web page is a common requirement. As a developer, you might think "What is chart? And, how do I create charts in an ASP.NET application?"
One of the popular chart libraries is canvas.js. The canvas.js library is a simple and robust JavaScript API for the HTML5 element. This library could be used to generate interactive 2D graphs in a Web browser, by using lines, shapes, paths, images, and text. In this article, we will see how to use canvas.js to create various charts, such as Line, Column, Area, and Pie for ASP.NET MVC applications.

List Down Your Google Drive Files Using .NET

The Google Drive platform provides a list of APIs, along with client libraries, language-specific examples, and documentation for developers to integrate Drive functionalities with Web and Mobile applications. Core functionalities of Google Drive are to download and upload. However, the Drive also provides searching, sharing and collaboration, file listing, and exporting functions.

Integrating ASP.NET MVC with GitHub

Git is the most popular open-source, Cloud-based version control system. Git was started by Linus Trovalds (Founder of Linux) of in 2005; recently, Microsoft has acquired it. Git is the preferred version control system of most developers and enterprises because it stores file changes more efficiently and better ensures better file integrity. Git also allows developers to easily collaborate; they can download a new version of the software, make changes, and upload the newest revision. In this article, I will demonstrate how to integrate Git with Visual Studio so that you can create local branch and push changes, and also pull requests.

Connecting to an Azure SQL Database and Query Data from VS Code

Azure Service provides SQL relational database-as-a-service with high performance, reliability, and security. Developers can write C# code to connect to an Azure SQL database by using the .NET code framework from Visual Studio or Visual Studio Code editor. As a prerequisite, you need to install the latest version of Visual Studio or Visual Studio Code and you should have created the server level firewall rule in Azure to access the database from your development environment.

Encryption and Decryption in C Sharp Using TripleDES

The Triple Data Encryption Standard (DES) is a symmetric key encryption algorithm for computerized cryptography. As per the algorithm, the same key is used for encryption and decryption. Also, the same block cipher algorithms are applied three times to each data block. To implement TripleDES, .NET provides a TripleDES class present in the System.Security.Cryptography namespace. The TripleDES class represents the base class for .NET Triple Data Encryption Standard algorithms, from which all TripleDES implementations are derived.

Tuesday, September 25, 2018

Working with Microsoft Cognitive Text Analytics

Microsoft Cognitive Text Analytics API is a Cloud-based machine learning service that provides advanced natural language processing. The Text Analytics service provides sentiment analysis, key phrase extraction, and language detection. This API supports a total of 120 languages. The Text Analysis API returns the detected language details and a numeric score between 0 and 1; if the score is close to 1, that indicates 100% certainty that the identified language is true.

Compressing and Decompressing Files With C#

To reduce the time needed for files to be transmitted over a network, Compression and Decompression techniques are very useful. Developers prefer to write code to compress files before sending them out to the network for a file upload process. Web applications get the most benefit out of it. The .NET Framework provides the System.IO.Compression namespace, which contains the compressing and decompressing libraries and streams. Developers can use these types to read and modify the contents of a compressed file.

Creating Captcha Images for Security with an ASP.NET Application

CAPTCHA (Completely Automated Public Turing test to Tell Computers and Humans Apart) is a security check to distinguish between humans and computers. Computers or bots are not capable of solving a Captcha problem. Captcha is automatically generated with a random string. Generally, Captcha is generated by using an image with text/numbers or combination of both. A human has to enter the correct Captcha code to pass through the security check. Captcha technology is used mostly to block spammers who try to sign up and hack information from Web sites, blogs, or forums.

Getting Started with LiteDB in .NET

LiteDB is a simple, serverless, fast and lightweight, embedded .NET document database written in .NET C# managed code. It's completely open source and free to use, even for commercial use. It's compatible with .NET 3.5, 4.x, and NET Standard 1.3 and 2.0. LiteDB was developed by Mauricio David; he was inspired by the MongoDB database and its APIs. LiteDB supports Document ACID transaction, storing files and stream data, and provides LINQ support. A developer simply can add a reference of the LiteDB.dll file in the project. Also, LiteDB can be installed via the NuGet Package Manager in Visual Studio or by typing the following command in the NuGet Package Manager command line tool:.

Deciding When to Use Weak References in .NET

The .NET WeakReference Class represents a weak reference, which references an object while still allowing that object to be reclaimed by garbage collection. Now, let's see an example. Create a console application from Visual Studio and name it MyWeakReference.
Create a WeakReference object and pass an object reference to the constructor call. In the following example, I have used the StringBuilder object.

Tuesday, August 07, 2018

Validating JSON with JSON Schema in C#

JSON Schema is a specification for validating structure-based, JSON-formatted data. JSON Schema is very similar to a grammar of some languages; it defines what data are permitted and which are not permitted. It's a vocabulary that allows developers to annotate and validate JSON documents. It ensures the quality of submitted JSON data by a client. JSON Schema also describes existing data formats in human and machine readable documentation. The JSON Schema project is currently in draft 7.0 version and will be adopted by an IETF working group.

Using SQLite in a C# Application

SQLite is a small, fast, and embeddable open source file system-based SQL database. It doesn't have a separate server component like traditional databases. Rather, it reads and writes data directly in disk files. A SQLite database is integrated with the application that accesses the database. The SQLite database file format is cross-platform and can be copied between 32-bit and 64-bit file systems. Due to the serverless architecture, developers don't need to install SQLite before using it. All SQLite transactions are fully ACID compliant; that means all queries and changes are Atomic, Consistent, Isolated, and Durable. The SQLite source code is public and is free for use for any purpose, commercial or private.

Working with MongoDB in .NET

A NoSQL database is a document-oriented database system that stores data in a JSON-like format. MongoDB is classified as a Document NoSQL databases. It's one of the most popular and leading representatives of a Document databases system widely used in the industry. MongoDB gives users the ease of use and flexibility of JSON documents with the richness of a lightweight binary format. MongoDB represents JSON documents in a binary-encoded format called BSON. Its implementation is lightweight, fast, and highly traversable.
MongoDB provides drivers that allow you to connect with MongoDB from different programming languages. In this article, I'll demonstrate MongoDB installation, how to work with MongoDB from your .NET applications (C# code), and demonstrate the CRUD functions available from the .NET driver.

Dynamically Generating QR Codes In C#

QR stands for Quick Response; it's a type of two-dimensional barcode that is used to store small amounts of text or data. It was created by the Japanese corporation Denso-Wave and aims to decode contents at high speed. Nowadays, QR Codes are used in mobile phones that can use the contents of QR Codes as a URL to open in the phone's Web browser. By using QR Codes, a developer can encode content into a QR Code image that can be saved in JPEG, GIF, PNG, or Bitmap formats. Also, by using the reverse technique, the QR decoder can decode a QR Code image. To scan a QR Code, you need to have a scanner app on your smartphone that can scan QR code.

Caching Implementation with C# Using Redis Cache

Caching is a technique for performance enhancements, especially when user interface interaction, with application speed, needs to be increased. It's also a state management strategy that helps you reduce the consumption of resources. There are several caching frameworks available, but in this article I will share information about Redis Cache, a noSQL caching technique and its integration with .NET applications. Redis keeps information as a key-value NoSQL pair.

Best Exception Handling Techniques In .NET

During application development, we have to adopt a manageable strategy for handling errors to keep the user's experience pleasant and consistent. Microsoft .NET provides a list of best practices and guidelines to follow for writing less lines of code and effectively manage error and exception handling with more a logical approach of coding and designing the code modules. In this article, we will discuss best practices of exception handling, and guide you through few effective error handling strategies that you can use in your projects.

Download SVN Code Automatically Using C#

During the development phase, developers check out and check in source code every day. Sometimes, the source code checkout task to a local repository could be automatically executed by a job. Automation of these activities will help to automate code setup in the developer's machine or the build process of an application. In this article, I will demonstrate an automated SVN checkout process from a C# console application. The Tortoise SVN command line tool uses svn.exe. This tool is helpful to pull code from an SVN server.

Playing a YouTube Video in an ASP.NET Application

Embedding Video Players using pure HTML5 video technology can enhance Web page aesthetics and overall user experience. YouTube is the most popular video sharing websites in the world. That's why, as with many popular Google services, YouTube also has a Data API. The YouTube API allows developers to interact with this service. By using this API, developers can query videos, search videos, and upload videos on YouTube.
In this article, I will demonstrates the coding technique for playing a YouTube video using an embed link. I will also demonstrate an example to consume the YouTube API to get a list of videos from a channel.

Creating a JSON File in C#

JSON (JavaScript Object Notation) is a lightweight data interchanging format. It's based on a subset of the JavaScript language. JSON is a text format and it is completely language independent. JSON is easy for humans to read and write, and it's easy for code to parse and generate. It's an alternative to XML, natively supporting basic data types. The syntax that is used in JavaScript and JSON itself stands for "JavaScript Object Notation."
JSON is built on two structures:
  • A collection of name/value pairs. In different languages, this is realized as an object, record, structure, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, JSON is realized as an array, vector, list, or sequence.

Tuesday, July 10, 2018

Consuming a Google URL Shortener API from C#

Many of us have faced issues while sharing a URL with others because it's too long to be shared in its original form. Such long URLs affect the readability and flow of your message. URL shortening is a technique by which a Uniform Resource Locator (URL) is made substantially shorter in length, which is easily shareable and it redirects the user to the required page.

Creating an HTML Helper in ASP.NET MVC

HTML Helper is just a method that returns the HTML content in a view. Developers can use HTML helpers to render standard HTML tags such as HTML ,

Best Practices for Improving Web Application Performance

Improving Web application performance is critical. Users wants a more lightweight application which runs quicker and gives a better response time. In this article, I will suggest a few tips to improve the performance of an ASP.NET Web application by taking advantage of the following components.

Friday, May 25, 2018

Passing Data in an MVC Application (ViewBag, ViewData, and TempData)

Maintaining the state of a Web application is very important when passing the data between multiple requests. In an ASP.NET application, we use different techniques or ways to pass the data from one page to other. ASP.NET provides Session, ViewState, QueryString, Cross Page Posting, and so forth. Most of the time, developers find difficulties understanding and using ViewData, ViewBag, and TempData in an ASP.NET MVC application. In this article, I will explain ViewData, ViewBag, and TempData with examples, and show you how to pass data in an MVC application in different scenarios.

Understanding Action Filters in ASP.NET MVC

To understand MVC Action Filters, we have to know how ASP.NET MVC routing works. When a user types an ASP.NET MVC application URL in the browser, it lands at the UrlRoutingModule. The routing module parses the requested URL and then invokes the corresponding controller and action. Finally, the controller renders the appropriate view and the response is sent to the user. Now assume, a developer wants to inject some additional processing logic which could be reused across multiple controllers and actions in the request response life cycle. MVC custom filters allow developers to inject additional processing logic in the request-response life cycle.

Team Project Using Visual Studio Team Services

Microsoft Visual Studio Team Services (VSTS) is a Cloud-based platform that provides an integrated, collaborative environment that supports Git, Team Foundation Version Control (TFVC), Agile Tools, Continuous Integration, Tools for Java, Reporting, Release Management, Package Management, DevOps, Testing Tools, and many more. Because VSTS services are available on the Cloud, that easily can be used by teams that are distributed across different geographical locations.

Tuesday, April 17, 2018

Comparing Two Complex Objects in C#


Often, developers encounter a common problem of comparing two complex objects or classes created in code. Most of the time, developers prefer to use the IEquatable approach to actually create an IComparer so that he can define what determines that two of your objects are equal.

But, it's difficult to compare objects that contain nested elements. An objects comparer NuGet package will solve such kinds of complex object comparison problems. By using the NuGet framework, a developer can perform an object-to-object comparer that allows us to compare objects recursively, member by member. An objects comparer can be considered a ready-to-use framework or as a starting point for similar solutions.

More

Thursday, April 12, 2018

Linking an External App Setting Config File to web.config

During software development, the Testing and deployment process in the configuration files continuously undergoes changes in terms of application settings, database connection strings, membership, role, and profile provider information. Changing the web.config file each time is tedious and error prone. Fortunately, ASP.NET provides a configuration system by which a developer can keep application configuration flexible at runtime. Also, the config file is dynamic; a developer can change the value in the config file without compiling and deploying the .NET app.

More

Monday, April 09, 2018

Handling Transactions in .NET Using TransactionScope

The responsibility of the TransactionScope class is to manage local as well as distributed transactions of our .NET Framework code block. The System.Transactions.TransactionScope namespace provides an implicit programming model by which transactions are automatically managed. It provides a simple mechanism for developers to specify a code block to be added in a transaction. TransactionScope is simple, straightforward, reliable, and easy to use. TransactionScope reduces the complexity of the code that needs to use transactions. Without using TransactionScope, a developer has to manage the transaction himself by writing additional code.

Create SQL Server Database Unit Tests Using Visual Studio

Writing database unit test cases are complimentary to the software development life cycle created by software developers. A developer can write unit tests cases to evaluate the success or failure of database design changes and check the results of stored procedures and functions. Unit test cases can ensure any changes applied on the database are as expected and do not introduce new errors. Unit tests, in addition, serve as documentation for users of the methods under test. Developers quickly can review unit tests to determine exactly how a particular database object should be consumed. By developing database unit tests, developers can create a collection of tests and run them during development to make sure all features work as expected.

Wednesday, March 21, 2018

Top Five Most Popular Front-end Frameworks

JavaScript is the most trending and popular language among developers as a front-end framework. JavaScript-based, client-side frameworks are usually used to design interactive Web sites because they help programmers design behavior of the Web sites. During the initial days of Web development, JavaScript was used to design beautiful interfaces, add functionalities to Web apps, and to modify Web pages in real time. Now, JavaScript is used on the server side, Web server, and database functionalities as well. Client-side JavaScript frameworks are used to submit data to the server, apply animation effects to page elements, validate user inputs, transmit user behavior on the Web site, and create interactive contents.

Considerations for Setting Up an Enterprise Architecture

The Enterprise Architecture Repository (EAR) is a TOGAF specification term intended to provide a single place for the storage and retrieval of solution architecture artifacts. EAR provides the capability to link architectural assets to components of the Detailed Design, Deployment, and Service Management Repositories. Artifacts belonging to this repository are created by using tools, and some are custom developed. The important part of the EA repository is the architecture landscape that represent assets in use or planned by the enterprise at particular points in time.

The Top Five JavaScript Linting Tools

Linting is the process of checking the source code for programmatic and stylistic errors. A Linter is an automated tool that runs on static code to find formatting discrepancy, non-adherence to coding standards and conventions, and find logical errors in your program. Running a Linter (static code analyzer) over your source code improves code quality, helps to ensure that source code is legible, readable, less polluted and easier to maintain. Linters are also useful for code formatting and adhering to language-specific best practices.

Sunday, February 25, 2018

Introduction to Domain-driven Design

Domain-driven design (DDD) focuses more on the business needs compared to technology. It's all about understanding the customer's real business needs. Domain-driven design consists of a set of patterns for building enterprise applications from the domain model out. During software development, a DDD approach is used to solve complex implementations problems. DDD puts the emphasis squarely on the domain model; the main focus is creating a conceptual model that forms a common language for both the users and programmers.

Wednesday, February 14, 2018

Using Selenium WebDriver with Visual Studio

Selenium WebDriver is a tool used for automating Web application testing. WebDriver is the successor to Selenium RC, which accepts commands and sends them to a browser. WebDriver includes a collection of open source APIs that support browsers like Firefox, Chrome, IE, and Safari. Selenium WebDriver APIs are platform independent and support different programming languages such as C#, Java, Perl, PHP, and Ruby.

Working with Visio UML Model Diagrams in Visual Studio

Microsoft Visual Studio offers architecture and modeling tools to design and model your application. These tools are available in the Enterprise edition. By using these tools, architects can make sure the application meets the specified architectural requirements. Modeling tools help you understand existing program code more easily by visualizing the code's structure, behavior, and relationships. Developers can create models at different levels of detail throughout the application lifecycle as part of the development process. Architecture and modeling also help developers understand the dependencies over the modules while coding.

Best Code Review Tips for Effective Reviews

Code review is a process to ensure that code is readable and maintainable; it meets the functional requirements, ensures that the team knows the code base, catches bugs, enables developers to adopt the best coding practices, and finally, improves the software quality. A code reviewer will review the source code of an application and report the findings to the developer. During the code review session, a reviewer will focus on general unit testing, comment and coding conventions followed, error handling code written, memory leaks, use of threads, control structures, code performance, functionality implemented, and securities.

SOLID Design Principles with Implementation in C#

In Object Oriented Programming (OOP) concepts, we should have low coupling, high cohesion, and strong encapsulation. The SOLID principles of OOPS help developers to achieve scalability by applying these principles together, so that we are able to write better quality and more robust code. The system created by following this principle becomes easy to maintain, reusable, and easily extendable over time. SOLID principles were introduced by Michael Feathers for five principles.

Understanding Onion Architecture

Most of the traditional architectures raise fundamental issues of tight coupling and separation of concerns. Onion Architecture was introduced by Jeffrey Palermo to provide a better way to build applications in perspective of better testability, maintainability, and dependability. Onion Architecture addresses the challenges faced with 3-tier and n-tier architectures, and to provide a solution for common problems. Onion architecture layers interact to each other by using the Interfaces.

Tuesday, January 23, 2018

Visual Studio Architecture and Design Tools

Microsoft Visual Studio offers architecture and modeling tools to design and model your application. These tools are available in the Enterprise edition. By using these tools, architects can make sure the application meets the specified architectural requirements. Modeling tools help you understand existing program code more easily by visualizing the code's structure, behavior, and relationships. Developers can create models at different levels of detail throughout the application lifecycle as part of the development process. Architecture and modeling also help developers understand the dependencies over the modules while coding.

Monday, January 15, 2018

How Bundling and Minification Work in an MVC Application

Bundling and Minifying in ASP.NET are two powerful features by which you can improve request load time. ASP.NET MVC provides bundling and minification of CSS and JavaScript, which reduces the number of HTTP Requests and payload size, resulting in faster and better performing ASP.NET MVC Web sites. The System.Web.Optimization namespace offers the bundling and minification techniques that exist in the Microsoft.Web.Optimization assembly. To apply bundling and minification, you have to add this DLL as a reference in your project.

More

Differences Among MVC, MVP, and MVVM Design Patterns

During software development, we build solutions those addresses needs of customers and solve problems of users and businesses. To achieve this, different technologies and architecture patterns—such as Model-View-Controller (MVC), Model-View-ViewModel (MVVM), and Model-View-Presenter (MVP)—are used. All these design patterns help when developing applications that are loosely combined, easy to test and maintain, and formalized best practices that facilitate reusable object-oriented development and easier to maintain and change than an application's architecture.

More

Visual Studio 2017 Productivity Tools

Visual Studio keeps enhancing its features and easy development process for developers with every release. Visual Studio 2017 Productivity Power Tools are a set of extensions to Visual Studio which improves developer productivity. These productivity tools help during the development process and make a developer's life more comfortable and easy. Recently released Microsoft Productivity Power Tools are broken into separate extensions and developers now can download as many extensions as they need.

More

Calling Web APIs from jQuery and JavaScript

In this article, I will demonstrate how to create a Web API using the ASP.NET MVC framework and consume it from a client application. Web API is new version of Microsoft's service-oriented application built on top of MVC architecture. Web API is a great framework for exposing your data and service. It can be consumed by a broad range of clients, including browsers, mobiles, iPhone, and tablets. Web API supports conventional CRUD actions. It also supports MVC features such as routing, controllers, action results, filter, model binders, IOC container, and dependency injection; that makes it more simple and robust.

More

Dot NET Dependency Injection Frameworks

When designing a software application, a major concern is that the design must be loosely coupled because loose coupling offers greater reusability, maintainability, and testability. Dependency Injection (DI) reduces the coupling between classes and moves the binding of abstraction and concrete implementation out of the dependent class. Dependency Injection enables developers to better manage future code changes and complexity in our software, thus helping us to make our code maintainable. Dependency Injection could be achieved by Construction Injection, Setter Injection, and Interface-based Injection techniques.

More

Creating Excel Charts in C#


Microsoft Office Excel Object Library, commonly known as Microsoft Office Interop Object, can help developers generating and exporting report from Microsoft Excel. In this tutorial, I will explain with code snippets how to plot a graph from the data in Excel sheet, and export a chart from Excel sheet through C# and save it locally. This tutorial will be very useful for developers working on Desktop and Web applications using Visual Studio .NET where we need to do lot of report generation from Microsoft Excel.

More

Mocking API Responses in Azure API Management Portal

A mock API imitates a real API call by providing a realistic JSON or XML response to the requester. Mock APIs can be designed on a developer...