Sunday, December 11, 2022

.NET 7 features

.NET 7 is so versatile that you can build any app on any platform.

Let’s highlight some scenarios that you can achieve with .NET starting today:

What’s new in .NET 7

.NET 7 releases in conjunction with several other products, libraries, and platforms that include:

In this blog post, we’ll highlight the major themes the .NET Teams focused on delivering:

  • Unified
    • One BCL
    • New TFMs
    • Native support for ARM64
    • Enhanced .NET support on Linux
  • Modern
    • Continued performance improvements
    • Developer productivity enhancements, like container-first workflows
    • Build cross-platform mobile and desktop apps from same codebase
  • .NET is for cloud-native apps
    • Easy to build and deploy distributed cloud native apps
  • Simple
    • Simplify and write less code with C# 11
    • HTTP/3 and minimal APIs improvements for cloud native apps
  • Performance
    • Numerous perf improvements

.NET 7 is Available!!

Download .NET 7 today!

.NET 7 brings your apps increased performance and new features for C# 11/F# 7, .NET MAUI, ASP.NET Core/Blazor, Web APIs, WinForms, WPF and more. With .NET 7, you can also easily containerize your .NET 7 projects, set up CI/CD workflows in GitHub actions, and achieve cloud-native observability.

Thanks to the open-source .NET community for your numerous contributions that helped shape this .NET 7 release. 28k contributions made by over 8900 contributors throughout the .NET 7 release!

.NET remains one of the fastest, most loved, and trusted platforms with an expansive .NET package ecosystem that includes over 330,000 packages.

Download and Upgrade

You can download the free .NET 7 release today for Windows, macOS, and Linux.

.NET 7 provides a straightforward upgrade if you’re on a .NET Core version and several compelling reasons to migrate if you’re currently maintaining a .NET Framework version.

Visual Studio 2022 17.4 is also available today. Developing .NET 7 in Visual Studio 2022 gives developers best-in-class productivity tooling. To find out what’s new in Visual Studio 2022, check out the Visual Studio 2022 blogs.

Thursday, December 01, 2022

How to check active transactions in SQL Server

A transaction is a single unit of work. If a transaction is successful, all of the data modifications made during the transaction are committed and become a permanent part of the database.

Some times, if there are any issues we will get into this deadlock stage and we don't get any responses from database. In those cases, if you want know what are active connections going on at that point of time, will help identifying issue.

if you want to know more details about active sessions like session ID, Host Name, Login Name, Transaction ID, Transaction Name, Transaction Begin Time,Database ID,Database Name etc.

Use the below query for details,

trans.session_id AS [SESSION ID],
execSession.host_name AS [HOST NAME],login_name AS [Login NAME],
trans.transaction_id AS [TRANSACTION ID], AS [TRANSACTION NAME],tas.transaction_begin_time AS [TRANSACTION 
tds.database_id AS [DATABASE ID], AS [DATABASE NAME]
FROM sys.dm_tran_active_transactions tas
JOIN sys.dm_tran_session_transactions trans
ON (trans.transaction_id=tas.transaction_id)
LEFT OUTER JOIN sys.dm_tran_database_transactions tds
ON (tas.transaction_id = tds.transaction_id )
LEFT OUTER JOIN sys.databases AS DBs
ON tds.database_id = DBs.database_id
LEFT OUTER JOIN sys.dm_exec_sessions AS execSession
ON trans.session_id = execSession.session_id
WHERE execSession.session_id IS NOT NULL

Saturday, November 19, 2022

How to Delete “BIN and OBJ” folders via Batch file

We had issues deleting bin and obj folders when we check in code or share code with in teams.

Here is simple batch file that we can use to delete Bin and Obj folders.

1. Create an empty file and name it DeleteBinObjFolders.bat

2. Copy-paste the below code into the DeleteBinObjFolders.bat

@echo off
@echo Deleting all BIN and OBJ folders...
for /d /r . %%d in (bin obj) do @if exist "%%d" rd /s/q "%%d"
@echo BIN and OBJ folders successfully deleted.
pause > nul

3. copy this file to your solution (*.sln) location.

4. Go to your project folder via command prompt and run this file DeleteBinObjFolders.bat file which is in the same folder with your solution (*.sln) file.

Hope this helps!

Wednesday, November 16, 2022

What is the Query to display the failed SQL Jobs

We can get this information by the standard reports available in SQL Server, right click on SQL server agent> Standard reports and select the desired report to see Job History

It can be frustrating to find recently failed jobs in the job history in SQL Server Management Studio. A quicker way to do it is to just run a query to see what jobs have failed recently.

Below Query will give you list of failed jobs, you can also filter by name.

FROM msdb.dbo.sysjobs AS j
INNER JOIN msdb.dbo.sysjobsteps AS js
   ON js.job_id = j.job_id
INNER JOIN msdb.dbo.sysjobhistory AS jh
   ON jh.job_id = j.job_id AND jh.step_id = js.step_id
WHERE jh.run_status = 0
--and name = 'jobName'
order by run_date desc

If you want to check results based on data range, you can use below query to find desired results.

-- Variable Declarations 
SET @FinalDate = CONVERT(int
    , CONVERT(varchar(10), DATEADD(DAY, -2, GETDATE()), 112)
    ) -- last two days date as Integer in YYYYMMDD format

-- Final Logic 

SELECT  j.[name],  
FROM    msdb.dbo.sysjobhistory h  
        INNER JOIN msdb.dbo.sysjobs j  
            ON h.job_id = j.job_id  
        INNER JOIN msdb.dbo.sysjobsteps s  
            ON j.job_id = s.job_id 
                AND h.step_id = s.step_id  
WHERE    h.run_status = 0 -- Failure  
         AND h.run_date > @FinalDate  
ORDER BY h.instance_id DESC;

Hope this helps!

How to Get the Last Day of the Month in T-SQL

We’ll use the function EOMONTH() to find the last day of the month.


SET @fromdate = '11/01/2022'

SET @EOMMonthdate = EOMONTH(@fromdate,0) -- for current month

SELECT @EOMMonthdate as lastdayOfthemonth

If you want to return the last day of the second, third, etc. month from a given date, use EOMONTH()’s optional second argument: the number of months to add. Look at the examples for last day of next month or last day of the previous month.


SET @fromdate = '11/01/2022'

SET @EOMMonthdate = EOMONTH(@fromdate,1) -- for next month last day

SELECT @EOMMonthdate as nextMonthLastDayOfthemonth

SET @EOMMonthdate = EOMONTH(@fromdate,-1) -- for previous month last day

SELECT @EOMMonthdate as previousMonthLastday

Hope this helps!!

Visual Studio Debugging Windows: Watch, Locals, Autos, Immediate, Call Stack and Threads

The Watch Window

The Watch Window allows you to see value of variables and expressions while debugging. It’s kind of like the DataTip you get when hovering over a variable, except that you can write any expression you want. It’s available from Debug | Windows | Watch | Watch 1 or Ctrl + Alt + W + 1.

There are 4 watch windows in Visual Studio, which you can use in different contexts (Watch 1, Watch 2, etc.).

Any expression can be entered into the watch window. The same rules apply to expressions as to code. So if you write an illegal expression, you’ll see the same compiler error.

To add items to watch do any of the following:

  • Write them manually in a new row of the Watch window
  • Right-click on a variable choose “Add Watch” in the context menu
  • Right-click on a variable in the DataTip and choose “Add Watch”
  • “Add Watch” button from QuickWatch

When to Use the Watch Window:

While the DataTip and QuickWatch are more popular, the watch window is very useful when you need to re-evaluate the same variables and expressions multiple times. This happens if you hit the same breakpoint over and over again, or different breakpoints in the same class. The most common scenario is with a breakpoint inside a loop

The Immediate Window

The immediate window is available in the menu from Debug | Windows | Immediate or Ctrl + Alt + i. You can type in any expression and the immediate window will evaluate. It’s kind of like the Watch window, but it acts more like a command line window in Windows or Linux.

For me, the immediate window was always more convenient than the Watch or QuickWatch windows.

  • Like in command line interfaces, you can use the Up/Down arrow keys to paste previous expressions.
  • To clear the window, right-click on it and select “Clear All”.

Locals and Autos Windows

VS offers 2 automatic-watch tool windows: The Locals and Autos windows.

The Locals will show local variables of the current scope. It usually starts with this, which represents the current class.

The Autos window will show all variables used in the current line and in the previous line. These could be local variables, class members or static variables. The Autos also shows values returned from methods, which is useful at times

  • In both Locals and Autos, you can double click on any Value field and change the variable’s value. This will actually its value, causing a possibly unwanted side effect.
  • Search works same as in the Watch window.

Call Stack Window

One of the most useful tool windows is the Call Stack Window. It shows the chain of methods that called one another, up to the the currently debugged method

Threads Window

The Threads Window is the final tool window in what I call the Truly Vital Debugging Windows group. This window shows all the currently active threads, and allow to switch between them.


Sunday, October 09, 2022

Some facts about Vedic Mathematics

Vedic Mathematics makes Mathematics Magical. The subject is unique in itself.

Vedic Mathematics helps to solve mathematical calculations easy and fast.

With Vedic Mathematics we can perform calculations mentally or in s single or minimum steps.

Some unique facts are:

1. In addition, we don't need multiple carry overs.

2. In subtraction, there is no concept of borrow.

3. 16 sutras and 16 sub sutras form the base which can be put to use in almost any branch of mathematics.

4. Composed in maximum 120 Sanskrit words.

5. These sutras can be applied to various operations too.

6. Totally Indian system

7. Use of decimal system well defined.

8. Use of zero originated and used by the system.

9. The system of mathematics is popularized as Vedic mathematics.

10. Sharpens memory as propagates think without ink.

11. Uses the intricacies of formulate derived and put to use which is not so prevalent in Western mathematics.

12. The concept of Vinculum numbers helps to convert bigger number to smaller and thus makes calculations easy and fast.

13. The concept of Digital Root or Navashesh or Digital Sum helps to verify our answers in seconds.

Friday, October 07, 2022

How to increase file upload size limit in ASP.NET Core

ASP.NET Core 2.0 or 2.1 enforces 30MB (~28.6 MiB) max request body size limit, be it Kestrel and HttpSys. Under normal circumstances, there is no need to increase the size of the HTTP request. But when you are trying to upload large files (> 30MB), there is a need to increase the default allowed limit.

Kestrel is a cross-platform web server for ASP.NET Core and that’s included by default in ASP.NET Core project templates. Kestrel can be used as a standalone server or with a reverse proxy server, such as IIS, Nginx, or Apache

Hosted on IIS

Remember in the ASP.NET, we used to set maxRequestLength in web.config file to increase the default limit of 4MB. Like,

<?xml version="1.0" encoding="UTF-8"?>
        <requestLimits maxAllowedContentLength="4294967295"  />

Similarly, for ASP.NET Core application, we can increase the default limit of 30MB by setting maxAllowedContentLength property in the web.config file. The default ASP.NET Core application template doesn’t create the web.config file. It is created when you publish the application. However, you can also add it manually (if not present) to the root of the application with the following code.

<?xml version="1.0" encoding="utf-8"?>
    <authentication mode="Windows" />
    <httpRuntime enableVersionHeader="false" />
  <!-- To customize the core module uncomment and edit the following section. 
  For more info see -->
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
      <remove name="aspNetCore" />
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    <!-- processPath="dotnet" arguments=".\Mobility.Core.Web.API.dll"  update with these values on stage or prod servers-->
    <aspNetCore requestTimeout="00:20:00" processPath="dotnet" arguments=".\myCoreWeb.Core.Web.API.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
      <environmentVariables />	 
          <!-- This will handle requests up to 50MB -->
          <requestLimits maxAllowedContentLength="52428800" />
<!--ProjectGuid: 82a05c43-b244-4222-a1ff-ebe99b445a14-->

Hope this helps!

Open Live Writer–Google Blogger login issues

When it comes to blogging I am big fan of Open Live Writer aka OLW. Recently I had issues with google connections. May be some of you might have same problems connecting to blogger.

The Volunteers at Microsoft has released a new version of OLW that has fixed the connection issue. OLW now works fine with Google Blogger v3. I have included below the direct link to the team's frequently updated setup copy called "Nightly" which contains several unreleased features that you can try out. Download the latest version from the link below.

I have found this information at GitHub forums related to OLW

Download OLW (Build - Nightly

Wednesday, October 05, 2022

Path of revolution of moon

The moon travels around the Earth in an elliptical orbit, a slightly stretched-out circle. When the moon is closest to Earth, its rotation is slower than its journey through space, allowing observers to see an additional 8 degrees on the eastern side. When the moon is farthest, the rotation is faster, so an additional 8 degrees are visible on the western side.

The rotational period of the moon wasn't always equal to its orbit around the planet. Just like the gravity of the moon affects ocean tides on the Earth, gravity from Earth affects the moon. But because the moon lacks an ocean, Earth pulls on its crust, creating a tidal bulge at the line that points toward Earth.

Does the Moon Orbit the Sun or the Earth? | WIRED

Gravity from Earth pulls on the closest tidal bulge, trying to keep it aligned. This creates tidal friction that slows the moon's rotation. Over time, the rotation was slowed enough that the moon's orbit and rotation matched, and the same face became tidally locked, forever pointed toward Earth.

The moon is not the only satellite to suffer friction with its parent planet. Many other large moons in the solar system are tidally locked with their partner. Of the larger moons, only Saturn's moon Hyperion, which tumbles chaotically and interacts with other moons, is not tidally synchronized.

The lunar rotation determined whether the infamous Man in the Moon, a face-like pattern of dark maria on the Earth-facing side, wound up pointing toward our planet. Gravity created an Earth-side bulge in the moon, slowing down its rotation in the past to create the synchronous rotation and keeping the longer lunar axis toward our world.

The moon takes almost 27 days to revolve around the earth. But between two full moons, there are 29.5 days. This is because the earth also travels a distance through space during that time around the sun. It has to cover an extra distance (which takes 2 more days) if it has to be exactly behind the earth and sun again.

Tuesday, October 04, 2022

What is Connective Tissue?

Connective tissues, as the name implies, support and connect different tissues and organs of the body. They are widely distributed in every part of the body. They originate from the mesoderm (the middle germinal layer of the embryo).

Connective tissue is made up of a few cells present in the intercellular framework of protein fibres secreted by the cells, known as collagen or elastin. The cells also secrete a thin gel of polysaccharides, which together with fibres make matrix or ground substance.

Connective tissues contain three types of fibres: collagen, elastic and reticular

Collagen fibres are the most widespread and made up of fibrous protein, collagen. Collagen fibres are flexible and have high tensile strength (comparable to steel).

Elastic fibres form a network and can be stretched like a rubber band. They are made up of protein elastin. They retain their original shape and size once the force is removed.

Reticulate fibres consist of collagen and glycoproteins. They are thin and form a delicate network. They join connective tissues to neighbouring tissues.

There are various kinds of cells present in different types of connective tissues. They secrete different types of fibres and matrices. Fibroblasts or adipose cells are stationary and macrophages, mast cells, monocytes, lymphocytes are migrating cells.

Fibroblasts are found in developing tissues and play an important part in wound-healing. They are spindle-shaped and present between collagen fibres. They secrete tropocollagen and other substances found in the matrix.

Macrophages are also known as scavenger cells. They wander through connective tissues, clean up debris and remove bacteria and other antigens by phagocytosis.

Sunday, June 05, 2022

How to build using command line from Visual Studio?

Here is how we can build using command line or terminal for Visual Studio using msbuild tool

1. Open Terminal from Visual Studio

2. On the terminal type msbuild to build current project 

msbuild /t:build

3. To clean here is the syntax

msbuild /t:clean

4. To Rebuild 

msbuild /t:rebuild

More examples


MSBuild MyApp.sln -t:Rebuild -p:Configuration=Release

MSBuild MyApp.csproj -t:Clean


For more detailed information, see