Posts

How to Setup Apache Ignite Cache in Windows Easily?

Image
Apache Ignite is a distributed in-memory computing platform that provides high-performance and scalable caching capabilities. It enables users to store large amounts of data in memory, reducing access latency and improving overall system performance. In this blog post, we will guide you through the process of setting up Apache Ignite cache on a Windows machine. Here we are going to see in a step by step manner how to Setup Apache Ignite in a Windows Machine. Setup Apache Ignite Install Java Runtime in the machine if it does not have one from the site  : Java . Once its installed Set the Environment variable JAVA_HOME in Edit Environment Variable Dialog as shown below: Download the latest version of Apache Ignite Binaries from the site : Apache Ignite . For this Demo we will download the version 2.13.0. Binaries will be downloaded in a compressed format. Extract the binaries and navigate to the path :  \apache-ignite-2.13.0-bin\bin. To launch the Apache Ignite Cluster run the...

How to Create/Generate Project File Programmatically in .Net?

Image
There are situations where the source files are generated dynamically either through templates or codeDOM, therefore we need a mechanism to package those source files in a project.   .Net allows to generate project files dynamically using the Microsoft.Build.Construction. Generating Project File Dynamically In this post lets see with an example how we can generate csproj file, add the source files and references dynamically into the csproj file. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 using Microsoft.Build.Construction ; namespace OnTheFlyCompilation { class Program { static void Main ( string [] args) { var root = ProjectRootElement.Create(); var group = root.AddPropertyGroup(); group .AddProperty( "Configuration" , "Release" ); group .AddProperty( "Platform" , "x64" ); // referen...

How to Compile Source Code in .Net Dynamically ? | Generate Assembly Dynamically

Image
  .Net Framework allows us to generate as well as compile our source code dynamically. We have already seen how we can generate the source code with the help of T4 Text Template in our previous post . Dynamic compilation is supported by .Net Framework with the help of CSharpCodeProvider class which is defined in the assembly System.CodeDom.dll. Dynamic Compilation Using CSharpCodeProvider In this post we will see how to use this class to compile our source code dynamically and generate an output assembly with an example. In our example we will create a Console Application in .Net Framework which uses CSharpCodeProvider to compile our source code using Compiler Parameters. Sample Code Defining source codes to be used for compilation:  Below code is used in our sample application as input source files which will be used for compilation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 ...

Understanding MVC with the Help of Design Patterns

Most of us are familiar with the architecture called MVC - Model-View-Controller and how to implement it, but how many of us know that MVC follows compound pattern when seen from a design pattern point of view. Understanding MVC with Design Patterns Here we are basically trying to understand MVC from the Design pattern point of view. MVC as the name suggests consists of three major components namely Model, View and Controller. Responsibilities of the classes are given below: Model : Holds the Application logic and the associated data. View : Responsible for Representing data contained in the Model. Controller : Responsible for taking actions based on User Interaction and calling necessary APIs in the Model. Controller is essentially sandwiched between the Model and the View and can interact with both. Let us try to understand based on the functionalities of each of these components the pattern they might be following. Model basically has the application logic and maintains the state of...

Why IEnumerable is required in C# ? All you need to know | Explained with Example

Image
  Use of IEnumerable in C# code is not new and We have already seen it being used in many places where we are dealing with Collection. Either it will be present as the return type and/or as parameter type.  What is IEnumerable in C#? IEnumerable is an Interface in C# which provides the capability to iterate over the Collection or in other words Enumerate over the collection which implements it. Why IEnumerable? Following are the reasons/should be the reasons for using IEnumerable  It allows the use of For-each loop over the collection which is kind of a range based for loop in C#. It abstracts the under lying data structure which holds the actual data. Modification of the collection data is prevented when collection is exposed as IEnumerable. Second point is the most important one for the use of IEnumerable, where it can act as a generic collection and the underlying data structure is not exposed outside. We can see these in action with the below example: Sample Code: ...

Creating RESTful Minimal WebAPI in .Net 6 in an Easy Manner! | FastEndpoints

Image
  We might have developed Web APIs using MVC Controllers where we used to give Route Path Attributes to the Controller and  to identify individual methods we used to provide Actions in the Route. With the Controller approach we need to write boiler plate code in separate files which deals with the Configuration of the Web Service. Those who have worked in Node js would be aware of how easy it is to create a Web API and expose different Endpoints without the need of so much boiler plate code. Here we are going to discuss of similar approach for creating a Web API in .Net6 using FastEndpoints. Under the hood it uses Minimal API concept which tries to reduce the dependencies required to achieve a particular task. This approach is more suitable in the case of Microservice Architecture where we want to keep the dependencies to minimum. Must Read : Fluent API and Data Annotations What are FastEndpoints? FastEndpoints is a Framework compatible with .Net 6 which allows to build a...

How To Push Specific Commit/Commits To Git Remote without commands? | All you need to know

Image
  Managing code using source control is an inevitable part of current Software development process. Most of us may be aware of how to push the local changes to remote repository in Git, but there may be situations where we have to choose specific Commits from an existing branch and push it to Git Remote. What is meant by Pushing Specific Commits To Git Remote? Let me take an example to explain "Pushing specific commits to Git Remote".  Above figure shows the history of a branch called "master". In this history you can see different commits out there. Out of those we want to maintain a separate branch in the remote with the commits highlighted in the above figure. Why do we need it? Simple reason why we need a separate branch in the remote with the specific commits may be that these commits are associated with a different feature that we are trying to develop and accidently it became part of the main branch. Therefore afterwards if we want to maintain or organize the...