Sunday, May 26, 2024

Build2024 keynote


Microsoft just completed its three-day Build developer conference on Tuesday, May 21st with keynote led by CEO Satya Nadella, followed by developer sessions.

Build is Microsoft’s developer conference where the company provides in-depth sessions for developers and professionals.  As expected, it had a plenty of new AI announcements and sessions.

Build2024 covers end-to-end (infra to app) framework for AI era, as marked. In my view, top-5 takeaways are:

1. Microsoft made a huge splash in the PC world on Monday announcing new arm-powered “Copilot Plus PCs”  Microsoft Copilot Studio is to help developers build their copilots.


2. Microsoft is expanding AI Partnerships with LLM-Hugging Face, GPU Chip-Nvidia, Open AI-GPT4o, AI teaching-Khan academy, etc.


3. Microsoft announced Phi-3-vision, a new small language models (SLMs) with audio and vision capabilities. 


4. Real-Time Intelligence on Microsoft Fabric is an AI-powered analytics platform to offer in-the-moment decision-making for organizations


5. Microsoft is partnering with the Khan Academy for AI-powered tutoring tools that will be free for all US educators.


I'm excited to explore next Gen AIs beyond the current developer experiences of Visual Studio Copilot

Full keynote of Satya Nadella at Microsoft Build 2024 https://www.youtube.com/watch?v=8OviTSFqucI

Wednesday, May 22, 2024

Build Action appsettings


In .NET projects, the appsettings.json file is used to store configuration data. The "Build Action" property of files in a .NET project determines how the file is treated by the build process. 

This ensures that the file is included in the output directory of the build and can be read at runtime for configuration purposes.

To set the "Build Action" to "Content" for appsettings.json (or any file) in Visual Studio:

  1. Right-click on the appsettings.json file in the Solution Explorer.
  2. Select "Properties" from the context menu.
  3. In the Properties window, find the "Build Action" property.
  4. Set the "Build Action" to "Content".

When set to "Content", the file is copied to the output directory (e.g., bin\Debug\netcoreapp3.1\) during the build if the "Copy to Output Directory" property is also set appropriately. The "Copy to Output Directory" property has a few options:

  1. Do not copy: The file is not copied to the output directory automatically.
  2. Copy always: The file is always copied to the output directory, overwriting any existing file with the same name.
  3. Copy if newer: The file is only copied if it has been modified since the last build that resulted in a copy operation.

If the application setting is set as 'Do not copy', dotnet run will throw the below error

System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional. 

Sunday, May 19, 2024

InvalidOperationException - Sequence

What?

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.InvalidOperationException: Sequence contains no elements
         at System.Linq.ThrowHelper.ThrowNoElementsException()
         at System.Linq.Enumerable.Average[TSource,TSelector,TAccumulator,TResult](IEnumerable`1 source, Func`2 selector)
         at CloudWeather.Report.BusinessLogic.WeatherReportAggregator.GetWeatherReportsAsync(String zip, Int32 days) in c:\dev\micro\micorservices-weather\CloudWeather.Report\BusinessLogic\WeatherReportAggregator.cs:line 43
         at Program.<>c.<<<Main>$>b__0_1>d.MoveNext() in c:\dev\micro\micorservices-weather\CloudWeather.Report\Program.cs:line 31
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Http.RequestDelegateFactory.ExecuteTaskResult[T](Task`1 task, HttpContext httpContext)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Why?

The error System.InvalidOperationException: Sequence contains no elements in a .NET application typically occurs when you're using methods like First(), Last(), Single(), or SingleOrDefault() on an empty collection or sequence. 

These methods expect the sequence to have at least one element (except for SingleOrDefault(), which allows zero or one element but throws if there are more), and when the expectation is not met, the mentioned exception is thrown.

How?

To handle this error, we need to check if the sequence is empty before calling these methods: Use Any() to check if there are any elements in the sequence. If Any() returns true, it's safe to proceed.

var result = tempData.Any() ? tempData.Average(t => t.field1) : 0;



Tuesday, May 7, 2024

IoC - DI


Inversion of Control (IoC) design is achieved using service locator, factory pattern or Dependency Injection (DI).  DI is the recent framework to build in the modern application framework.

As depicted in the diagram, DI has 4 core elements

  1. Client - dependent role
  2. Server - functionality provider 
  3. Injector - creates server instances to client
  4. Interface - communication contract between client and server

DI decouples objects from their dependencies by receiving from an external source - not with direct implementations.

Multiple ways of dependency injection implementations are available in github https://github.com/gsenthilvel/InversionOfControl 

Top-3 advantages

  1. Loosely coupled
  2. Unit testability
  3. Scalability

Top-3 disadvantages

  1. Complexity to develop
  2. Reduced transparency
  3. Overhead to troubleshoot/debug


Sunday, May 5, 2024

TLS-1.2 Architecture


The architecture of TLS (Transport Layer Security) 1.2, is defined in RFC 5246. As defined in the given diagram, TLS 1.2 has 4 phases of execution.

1. Record TCP check

It serves as the underlying transport mechanism for TLS, which is responsible for encapsulation of higher-level protocols

2. Certificate Exchange

In mutual authentication scenarios, client and server exchanges and verifies certificates to generates shared keys.

3. Key Exchange

The communication is based on the chosen cipher suite. The client and server then generate a pre-master secret and exchange it securely.

4. Final Data Transmission

Both the client and server connect with encrypted derived keys, to confirm that the handshake. It enables to continue the client request and server response in secured way.

Source code is demonstrated using C# in github repo at gsenthilvel/tls-demo (github.com)

Saturday, May 4, 2024

SSL TLS End of Life


In the world of secured HTTP protocol (HTTPS), Secure Socket Layer (SSL) and Transport Layer Security (TLS) plays a vital role in the network industry.

SSL is a cryptographic protocol, which extends HTTP to authenticate internet connections and enable encryption and SSL decryption for data communication over a network. 

SSL 1.0

  • Release: SSL 1.0 was never publicly released due to serious security flaws.

SSL 2.0

  • Release in 1995
  • End of Life: The Internet Engineering Task Force (IETF) officially deprecated in 2011 through RFC 6176.

SSL 3.0

  • Release in 1996
  • End of Life: June 2015 through RFC 7568.


TLS is a direct evolution of SSL and introduced to address security vulnerabilities in the earlier protocol.

TLS 1.0

  • Release in January 1999
  • End of Life: IETF recommended deprecating TLS 1.0 in 2018. Major browsers like Google Chrome, Mozilla Firefox, Microsoft Edge, and Safari officially ended support in 2020.

TLS 1.1

  • Release in April 2006
  • End of Life: IETF in 2018, with major browsers in 2020.

TLS 1.2

  • Release in August 2008
  • End of Life: Now, it is widely supported; but recommended to TLS 1.3 for which adoption increases.

TLS 1.3

  • Release in August 2018
  • End of Life: Not applicable as it is current standards


Friday, May 3, 2024

Ubuntu 24.04 LTS


Yday Canonical announced the availability of Landscape’s first LTS release. 

Today, it was required to upgrade/replace the end-of-life version Ubuntu 16.04.2 LTS at my work.  As sync, it's a great opportunity to explore the latest and greatest version Ubuntu 24.04 LTS

Landscape 24.04 LTS features a new versioned API, a new web portal with accessibility and performance in mind, and intuitive controls for software distribution. It comprises Landscape Server and Landscape Client. 

With a modernized backend and web portal in place, engineering teams can work efficiently, focusing on patches and new features.

Fact sheet is available at https://pages.ubuntu.com/rs/066-EOV-335/images/Landscape%20DS%20v3%205.4.2024.pdf?version=0&_gl=1*ux7hxq*_gcl_au*NDc5NjcxODM3LjE3MTQ3OTAwMDk.&_ga=2.140511158.548493742.1714790009-980279757.1714790009

This new version is not just faster, but also a fortress system.  Welcome to Noble Numbat!