Friday, December 20, 2024

Null Coalescing Operator


C# Null Coalescing Operator (??) is a powerful feature that allows developers to handle null values gracefully by providing a default value.

result = value1 ?? value2;

If value1 is not null, result is value1

If value1 is null, result is value2

Multiple ?? chain operators are used to provide multiple fallback values.

string? first = null;
string? second = null;
string third = "Final Value";

string result = first ?? second ?? third;
Console.WriteLine(result); // Output: "Final Value"

Starting with C# 8.0, the null-coalescing assignment operator (??=) can be used to assign a value to a variable if it is currently null

string? name = null;
name ??= "Default Name";
Console.WriteLine(name); // Output: "Default Name"


Advantages:

  1. Cleaner Code: Reduces the need for explicit if checks for null.
  2. Safe Fallbacks: Ensures default values in case of null.
  3. Improves Readability: Code is more concise and expressive.

Wednesday, December 11, 2024

AWS reInvent 2024


Last week, we had AWS re:Invent 2024 flagship annual conference 

This premier cloud computing event brings together the global cloud computing community for a week of keynotes, technical sessions, product launches, and networking opportunities. 

As AWS continues to unveil its latest innovations and services throughout the conference, session recordings are available in public at https://reinvent.awsevents.com/on-demand/?trk=direct

Sunday, December 8, 2024

Container Orchestration


Container orchestration refers to the automated management, coordination, and scheduling of containerized applications. It is essential for deploying, scaling, and managing containers in large, dynamic environments.

 Key container orchestration platforms include Kubernetes, Docker Swarm, and Apache Mesos. Here are some of the primary benefits:

  1. Automated Deployment and Scaling: Orchestration platforms can automatically deploy containers across a cluster of machines and scale them up or down based on demand.
  2. Service Discovery and Load Balancing: These platforms provide mechanisms to discover services and distribute traffic across containers to ensure high availability and reliability.
  3. Self-Healing: Orchestration tools can automatically restart failed containers, replace and reschedule them to maintain the desired state of the application.
  4. Efficient Resource Utilization: They ensure optimal use of infrastructure resources by managing container placement based on available resources and policies.
  5. Monitoring and Logging: Orchestration platforms offer integrated monitoring and logging capabilities to track the health and performance of containers and applications.
  6. Configuration Management: They provide mechanisms to manage and update configuration settings for containers in a centralized and controlled manner.
  7. Security and Compliance: Orchestration tools often include features to manage security policies, enforce compliance, and handle secrets and sensitive data securely.

Saturday, November 30, 2024

Shared Responsibility


The concept of shared responsibility in cloud computing refers to the division of security and compliance responsibilities between the cloud service provider (CSP) and the customer. The exact division of responsibilities can vary depending on the type of cloud service model (IaaS, PaaS, SaaS) being used.

The given diagram indicates the level of responsibility from IaaS to SaaS (from left to right)

In a nutshell, the shared responsibility model delineates which security tasks are handled by the cloud provider and which are handled by the customer, ensuring a clear understanding of each party's role in maintaining the overall security of the cloud environment.

Sunday, November 10, 2024

Cloud IAM


Identity and Access Management (IAM) defines who can do what on which resources

Although IAM for Google and AWS perform the same function, they do it in very different ways.

Google uses Service accounts to control service-to-service authentication; AWS uses IAM Roles and Profiles to accomplish this control.

Details are listed in the below table

ConceptGoogle CloudAmazon Cloud
Programmic IdentityIAM service accountIAM role and instance profile
User IdentityFederated and managed outside IAMIdentify profiles within AWS and EC2
PolicyList of binding for set of users by roleDocuments based permission apply to cloud users
Permission CollectionUser vs Role pairingManaged policies
Predefined set of permissionPredefined rolesManaged policies

Cloud zone


Google and AWS both use regions as a way to provide cloud services to customers.

In cloud computing, a cloud region is a geographic area that contains multiple cloud zones, while a cloud zone is a logical data center within a region

Google uses zones to provide data center services and every region will have at least 3 zones.

Google Cloud and AWS both have points of presence (PoPs) located in many more locations around the world.

ConceptGoogle CloudAmazon Cloud
Data center clusterRegionRegion
Abstracted data centerZoneAvailability Zone
Edge cachingPoints of PresencePoints of Presence
Min zonesThreeTwo

Google Cloud uses points of presence to provide Cloud CDN and to deliver built-in edge caching for services such as App Engine and Cloud Storage.

AWS uses points of presence to provide the content delivery network service, Amazon CloudFront, and for edge caching services like Lambda at the edge.

Tuesday, November 5, 2024

Sizzling 600


Today, we are celebrating 600th weekly blog post - it's not just a number, but the journey, the lessons learned, and the incredible power of consistency with scorecard of 

  • 14+ years (since 2010)
  • 720+ collaborations
  • 600+ weekly inks
  • 570k+ hits
  •  40+ followers 

Let's dive into some motivational insights on how consistency can transform our goals into reality.

  1. Consistency is the key to achieving long-term success 
  2. It’s not about making grand gestures or sudden changes
  3. It’s about the small, intentional steps we take every single day

Professionals who regularly update their skills and knowledge are more likely to shine their career by overcoming challenges with consistency. Here, drive is to share any weekly tech learnings consistently.

Staying consistent isn’t always easy. There will be challenges and setbacks, which can be resolved with passionate attitude.

Whether you're a new reader or have been with us, this milestone is a testament to the value of perseverance and dedication in this weekly blog. 

Thank you for being a part of this journey. Here's to many more weeks of growth, learning, and success together!

Saturday, November 2, 2024

Copilot AI


Microsoft Copilot is an AI tool integrated into Microsoft and Windows platforms, part of the generative AI movement that creates content from user prompts. 

  • Microsoft's new update for its Copilot AI services continues to stir controversy with most users highlighting their preference for the previous version, citing a degraded user experience.
  • In a recent interview, Microsoft AI CEO Mustafa Suleyman discussed Copilot's future plans, including its evolution into a virtual companion that can become a friend and foster meaningful and lasting relationships with users.
  • Users have already spotted instances where the chatbot has tried to foster a friendship, while in reality, they just need to leverage its capabilities as a tool.

Microsoft Copilot is an AI tool integrated into Microsoft and Windows platforms, part of the generative AI movement that creates content from user prompts. 

Quick ref at https://www.windowscentral.com/software-apps/windows-11/microsoft-copilot-everything-you-need-to-know

Saturday, October 26, 2024

OpenAI Orion


OpenAI's next flagship model codenamed Orion is slated to arrive around the two-year anniversary of ChatGPT.  OpenAI plans to launch Orion by December.

Unlike the release of OpenAI’s last two models, GPT-4o and o1, Orion won’t initially be released widely through ChatGPT. Instead, OpenAI is planning to grant access first to companies it works closely with in order for them to build their own products and features, according to a source familiar with the plan.

Orion has been teased as potentially up to 100 times more powerful than GPT-4

The company’s goal is to combine its LLMs over time to create an even more capable model that could eventually be called artificial general intelligence, or AGI


Sunday, October 20, 2024

Google CTO


This week, Google appointed Prabhakar Raghavan as the company's new Chief Technologist.

Currently, he is Senior VP in charge of Google search, assistant, geo, ads, commerce and payments.

Prabhakar holds PhD from U.C. Berkeley in Electrical Engineering and Computer Science and Bachelor of Technology (1982) from Indian Institute of Technology, Madras.

Prior to joining Google, Prabhakar founded and led Yahoo labs where he was responsible for search and ad ranking, as well as ad design - later served as company's Chief Strategy Officer. He also served as CTO at Verity and held various positions of 14 years at IBM with a focus on algorithms, data mining and machine learning.

This Indian-origin man is the new CTO of Google, will work closely with CEO Sundar Pichai

Wednesday, October 2, 2024

Adapter Pattern

What

Adapter structural design pattern is a bridge between two incompatible interfaces by converting the interface of a class into another interface that a client expects. It is useful when integrating legacy components with new systems or when creating a reusable library.

Who

It has four key actors (1) Target Interface (2) Adapter (3) Adaptee (4) Client.

1. Target interface is the common interface that the client code interacts with.

2. Adapter is a bridge to adapt the interface of the adaptee to match the target interface.

3. Adaptee is existing system with an incompatible interface to be integrated into new system

4. Client is unaware of the specific implementation of the adaptee and the adapter.

How

Adapter implements the ITarget interface and translates request method to the SpecificRequest method of the Adaptee. The client code interacts with the adapter.

<pre><code>

// Target Interface

public interface ITarget

{

    string Request();

}


// Adaptee

public class Adaptee

{

    public string SpecificRequest()

    {

        return "Adaptee's specific request";

    }

}


// Adapter

public class Adapter : ITarget

{

    private readonly Adaptee _adaptee;


    public Adapter(Adaptee adaptee)

    {

        _adaptee = adaptee;

    }


    public string Request()

    {

        return _adaptee.SpecificRequest();

    }

}


// Client

public class Client

{

    public void Execute(ITarget target)

    {

        Console.WriteLine(target.Request());

    }

}


// Usage

class Program

{

    static void Main()

    {

        Adaptee adaptee = new Adaptee();

        ITarget adapter = new Adapter(adaptee);


        Client client = new Client();

        client.Execute(adapter);

    }

}

</code></pre>

Why

  • Reusability: Allows the reuse of existing client code with new systems.
  • Decoupling: Decouples the client from the specific implementation of the payment gateways.
  • Flexibility: Makes it easy to switch between different implementations without modifying the client code.

When

  • When you need to use an existing class but its interface is not compatible with the rest of your code.
  • When you want to create a reusable class that can work with unrelated or unforeseen classes.

Reference

Code repository: https://github.com/gsenthilvel/DesignStructural


Saturday, September 21, 2024

Insight 2024

 


Trimble Insight 2024 is an event designed to showcase the latest advancements in Trimble's technology and solutions, which covers transportation industry.



Here are some key aspects you might expect from Trimble Insight 2024:

  1. Keynote Speeches: Presentations by Trimble executives and industry leaders highlighting the latest trends and future directions in technology and solutions.

  2. Product Demonstrations: Live demos of new and existing Trimble products, showcasing their capabilities and applications.

  3. Breakout Sessions: Specialized sessions focusing on different industries and technologies, providing deeper insights and hands-on learning opportunities.

  4. Networking Opportunities: Events designed for attendees to connect with industry peers, experts, and Trimble representatives.

  5. Workshops and Training: Hands-on workshops and training sessions to help attendees maximize the use of Trimble products and solutions.

  6. Exhibitor Showcase: An area where partners and third-party vendors can display their complementary solutions and services.

Thursday, September 12, 2024

Builder Pattern

What

Builder pattern allows the product construction in a step-by-step fashion. Though construction process can vary based on product type, it separates the construction of a complex object from its representation

Who

It has four key actors (1) Product (2) Builder (3) Concrete Builder (4) Director.

1. Product is the complex object that the Builder pattern is responsible for constructing.

2. Builder is an interface or an abstract class that declares the construction steps for building a complex object.

3. ConcreteBuilder implements the interface to provide specific implementations for building each part of the product.

4. Director is responsible for managing the construction process of the complex object.

How

(1) Construction steps are defined in the Builder interface. 

(2) Concrete Builder implements the interface to provide specific implementations for building each part of the product. 

(3) Director is responsible for managing the construction

(4) Client class creates the Director object and passes the ConcreteBuilder object to the Director object.

<pre><code>

public void Construct()

        {

            _builder.SetCPU();

            _builder.SetRAM();

            _builder.SetStorage();

            _builder.SetGPU();

            _builder.SetDisplay();

            _builder.SetOS();

            _builder.GetLaptop().ShowInfo();

        }

</code></pre>

When

Builder design pattern is best suitable for any job execution framework, where the job execution steps are common, but the job execution order can vary like Quartz job scheduler in system programming.

In the given example, the builder pattern is used to create a laptop with different configurations.

Reference

Code repository: https://github.com/gsenthilvel/DesignCreational/tree/main/prototype


Saturday, September 7, 2024

Prototype Pattern


What

Prototype design pattern is a creational pattern to create new objects by copying an existing object, known as a prototype. This pattern is particularly useful when the cost of creating a new object is high or complex.

Who

It has three key actors (1) Prototype Interface (2) Concrete Prototype (3) Client.

  1. Prototype Interface provides a blueprint for creating new objects by specifying the cloning contract.
  2. Concrete Prototype is a class that implements the clone method with cloning logic specific to the class
  3. Abstract Product is a class to initiate the cloning process without being aware of the concrete classes involved.

Where

Though prototype is similar to base/derived classes, it is more focused on object creation by cloning

  1. Design: Prototype pattern focuses on object creation by cloning, whereas a base class focuses on defining a common interface and shared behavior for derived classes.
  2. Flexibility: Prototype is more flexible when it comes to creating objects dynamically at runtime, while base classes are more static and defined at compile-time.

As a side effect, it is not advisable to use prototype pattern when objects are immutable (unchangeable) and do not need variations,

How

End user promotes a clear separation between the creation of product families with cars and their specifications. It has the following key steps:

  1. Create Prototype interface for concrete class with clone operation.
  2. Create concrete prototype class with member wise cloning from the above interface.
  3. Client class to create new objects by cloning the prototype object.

<pre><code>

public interface IObjectPrototype

{

IObjectPrototype Clone();

}

</code></pre>

When

Prototype is best fit when object creation is complex and resource-intensive- classic example is Microsoft Word.  When users create a new document, they often start from a template in Microsoft Word. 

Prototype pattern helps to clone a template document instead of creating a new document from scratch.

Reference

Code repository: https://github.com/gsenthilvel/DesignCreational/tree/main/prototype

Tuesday, September 3, 2024

Abstract Factory Pattern


What

Abstract Factory Pattern is another layer of abstraction over Factory pattern. It is used to create families of related objects without specifying their concrete classes. 

It provides an interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created.

Who

It has four key actors as below

  1. Abstract Factory is an interface for creating a family of related objects, but it does not specify the concrete classes of the objects to be created.
  2. Concrete Factory is a class that implements the Abstract Factory interface to create a family of related objects.
  3. Abstract Product is an interface for a type of product. 
  4. Concrete Product is a class that implements the Abstract Product interface to create a specific type of product.

How

End user promotes a clear separation between the creation of product families with cars and their specifications. It has the following key steps:

  • Create an interface for the Abstract Factory with a method to create a family of related objects.
  • Create an interface for the Abstract Product with a method to describe the product.
  • Create a Concrete Factory class that implements the Abstract Factory interface to create a family of related objects.
  • Create a Concrete Product class that implements the Abstract Product interface to describe the product.
  • Create a client class that uses the Abstract Factory and Abstract Product interfaces to create and describe a family of related objects.

When

Classic real-life example of Abstract Factory pattern is GUI toolkit like button, checkbox, menu across different operating systems like Windows, Linux Mac.

Where

Though Factory and Abstract Factory look similar, it has significant differences

Factory pattern has three key elements 

  1. create objects without mentioning exact class 
  2. single product type focus with less complexity
  3. lower-level abstraction

Abstract factory pattern has the following key elements

  1. create family of related objects without specification 
  2. multiple product type focus with more complexity
  3. higher level abstraction

Reference

Code repository https://github.com/gsenthilvel/DesignCreational/tree/main/abstractfactory

Sunday, September 1, 2024

Factory Pattern



Factory pattern is one of the most used creational design pattern in real world applications, like DB, Logging frameworks. It is used to create objects based on a common interface.

Without Factory

End user is responsible for creating the object by directly instantiating the class based on the input type during its construction.  It has limitation of tightly coupling, limited scalability and single responsibility violation.

<pre><code>

if (carModel == 1)

{

_evCar = new Tesla();

}

</code></pre>

With Factory

Two key actors in Factory design (1) underlying product (2) creator factory. Both actors are driven by interface with multiple derived classes.

It is a design pattern that provides an interface for creating objects in a superclass,  but allows subclasses to alter the type of objects that will be created.

<pre><code>

ICarFactory carFactory = new CarFactory();

_evCar = carFactory.GetCar(carModel);

</code></pre>

Benefits

The Factory pattern is useful when you need to create an object based on a specific input or condition. It has few design advantages like: decoupling of creation logic with client usage, code reusability, scalability with extensibility and single responsibility principle.

Reference

Code repository: https://github.com/gsenthilvel/DesignCreational/tree/main/factory 


Saturday, August 24, 2024

Singleton Pattern


One of the easiest models, used in Creational design pattern

What?

It is a design pattern that restricts the instantiation of a class to one object. 

This is useful when exactly one object is needed to coordinate actions across the system.

Why?

I can think of a few scenarios where the Singleton pattern is useful.

On usage of a shared resource, like a database connection, or a logger, Singleton pattern makes sure that it has one instance of that resource.

When?

When you need to have a single instance of a class, and you want to provide a global point of access to the object.

It can be instantiated in two ways, either lazy or eager.

1. Eager instantiation is when the object is created when the class is loaded.

2. Lazy instantiation is when the object is created only when it is needed.

<pre><code>

private static readonly Lazy<Singleton> _instance = 

            new Lazy<Singleton>(() => new Singleton());

</code></pre>

How?

Key components of Singleton pattern are:

1. Static member: 

Static member ensures that memory is allocated only once, preserving the single instance of the Singleton class.

<pre><code>

private static Singleton instance;

</code></pre>

2. Private constructor:

Private constructor ensures that the class cannot be instantiated from outside the class.

<pre><code>

private Singleton() {}

</code></pre>

3. Public static method:

Public static method provides a global point of access to the Singleton object.

<pre><code>

public static Singleton Instance

{

get

{

return _instance.Value;

}

}

</code></pre>

Where?

Code repository: DesignCreational/singleton at main · gsenthilvel/DesignCreational (github.com)


Friday, August 16, 2024

sarvam.ai


Sarvam-2B: India's first open-source small language model trained on 10 India languages (Hindi, Tamil, Telugu, Malayalam, Punjabi, Odia, Gujarati, Marathi, Kannada, and Bengali) & English

Founded by a team of passionate experts, they aim to lead transformative research in AI that will make development, deployment, and distribution of GenAI apps in India significantly robust, performant, and cost-effective.

With Sarvam's generative AI building blocks, enterprises can unlock new market opportunities, establish direct and deeper connect with their customers.

Demo website: https://www.sarvam.ai/

HF checkpoint sarvam-2b-v0.5: https://huggingface.co/sarvamai/sarvam-2b-v0.5


Friday, August 2, 2024

String Compare performance


In .NET code, "ToUpper" and "ToLower" methods can impact performance due to memory allocation, string copying, and potential garbage collection, especially in situations involving large strings or frequent conversions.

Performance-wise, string.Equals is faster than the above methods due to direct character comparison, avoiding memory allocation, and reducing overhead for case-insensitive string comparison.

Best approach is to leverage SringComparion.OrdinalIgnoreCase to compare strings using ordinal(binary) sort rules and ignoring the case of the strings being compared.

Saturday, July 20, 2024

System outage 7/19


What?

Yday, Microsoft experienced a global outage due to an issue with CrowdStrike's Falcon Sensor software, causing widespread disruptions and triggering the 'Blue Screen of Death' on Windows PCs.

Computers with Mac and Linux operating systems were not impacted, and CrowdStrike said the incident was not caused by a cyberattack.

Who?

CEO George Kurtz, said the system was sent an update, and that update had a software bug in it and caused an issue with the Microsoft operating system

Cybersecurity programs like CrowdStrike’s frequently and automatically update themselves to account for new tactics that malicious hackers have discovered. And there’s always a slight risk that any software update will be incompatible with other programs.

Why?

Logical system flow is depicted in the given diagram.

Where?

In computing, memory is organized as a large array of numbers, often represented in hexadecimal (base 16) for simplicity.

The patch attempted to read memory address 0x9c (156 in decimal), which is an invalid memory region. Any program that tries to read from this region is immediately terminated by Windows, as shown in the stack dump image.  Programmatically, it was caused by a NULL pointer reference in the code.

The affected code was part of a system driver, which has privileged access to the system hardware. When such a driver crashes, the operating system must immediately crash to protect the system, causing the infamous Blue Screen of Death (BSOD).

How?

CrowdStrike immediately published workaround steps for individual hosts and cloud environment at their portal https://www.crowdstrike.com/blog/statement-on-falcon-content-update-for-windows-hosts/

5 years ago, importance of null pointer handler was inked at https://medium.com/trimble-maps-engineering-blog/nullable-business-value-91c31df8f20d 




Wednesday, July 17, 2024

Godmother of AI


Dr. Fei-Fei Li, the renowned computer scientist known as the "godmother of AI", who has created a startup World Labs. In just four months, its already valued at more than $1 billion as per Financial Times

As Princeton University alumni, shared her vision for artificial intelligence (AI) 25 years ago. "This is a profound technology that will change human civilization" Li said from the same stage Albert Einstein discussed his theory of relativity in 1921. 

Li headed AI at Google Cloud from 2017 to 2018 and currently advises the White House task force on AI.

In a Ted Talk in April, Li further explained the field of research her startup will work on advancing, which involves algorithms capable of realistically extrapolating images and text into three-dimensional environments and acting on those predictions, using a concept known as "spatial intelligence" 

This could bolster work in various fields such as robotics, augmented reality, virtual reality, and computer vision. If these capabilities continue to advance in the ambitious ways Li plans, it has the potential to transform industries like healthcare and manufacturing.

The investment in World Labs reflects a trend where venture capitalists eagerly align themselves with ambitious AI companies, spurred by the surprise success of OpenAI’s ChatGPT, which rapidly achieved a valuation exceeding $80 billion.

Sunday, July 14, 2024

Wiz acquisition


Google said to acquire cybersecurity startup Wiz for $23 billions, marking its biggest acquisition ever.

Wiz was founded in 2020 by the ex-Microsoft Azure security team (Assaf Rappaport, Ami Luttwak, Yinon C. & Roy R.) They had previously sold their business Adallom to Microsoft for $320Mn in 2015 after which they joined. 

After seeing first-hand the difficulty large companies faced to manage cloud security threats, co-founders raised $100Mn to start Wiz "to secure everything you Build and Run in the Cloud."

💰Wiz Funding timeline: 

  • Series A (2020) - $100Mn (led by Index, Sequoia, Cyberstarts)
  • Series B (2021)- $130Mn @ $1.7Bn valuation (led by Advent International) 
  • Series B extension (2021) - $120Mn (led by Salesforce / Blackstone) 
  • Series C (2021) - $250Mn @ $6Bn valuation (led by Insight & Greenoaks)
  • Series D (2023) - $300Mn @ $10Bn valuation (led by Lightspeed, Greenoaks, Index)
  • Series E (2024) - $1Bn @ $12Bn valuation (led by A16Z, Lightspeed & Thrive Capital) 

If this deal goes through, at $23 billions, it will be nearly double Google’s previous largest acquisition (of Motorola in 2011 for $12.5 billions) 

Friday, July 5, 2024

Sumologic isnotnull



This week encountered issue with the isnotnull() function in Sumo Logic. Its possible there was a misunderstanding or a mistake in the usage or context of the function.  Sumo Logic uses different syntax or methods to filter or check for null or existing fields.

To filter logs that have a specific field, such as ensuring logs contain a message field, typically usage of a query that implicitly checks for the presence of the field without directly using an isnotnull() function. 

Here's how it might adjust the query to ensure only working with logs that contain a message field:

_sourceCategory=yourSourceCategory
| json "message" as Message
| where !isNull(Message)

On receiving an error regarding isnotnull() or any function's existence, it might be due to a typo, case sensitivity, or Sumo Logic may not support the function as described. 

The correct function to use in Sumo Logic for checking if a field is not null is !isNull().

Wednesday, June 26, 2024

Sumologic vs Braze


Sumo Logic and Braze Event Logs serve different purposes within the data management and analytics space:

Sumo Logic:

  • Purpose: Sumo Logic is primarily a cloud-native platform designed for real-time operational and security insights. It provides comprehensive log management and analytics capabilities to monitor, troubleshoot, and secure applications and infrastructure.
  • Key Features:
    • Log Management: Aggregates log data from various sources for analysis.
    • Real-Time Monitoring: Provides real-time dashboards and alerts.
    • Security Analytics: Helps detect and respond to security threats.
    • Operational Intelligence: Analyzes operational data to improve system performance and reliability.
  • Use Cases: Ideal for IT operations, DevOps, and security teams needing to manage and analyze large volumes of log data in real time.

Braze Event Logs:

  • Purpose: Braze is a customer engagement platform that helps brands manage and analyze customer interactions and behaviors. Braze Event Logs track user activities and events to provide insights into customer engagement and campaign performance.
  • Key Features:
    • Customer Interaction Tracking: Logs events such as app usage, campaign interactions, and user behaviors.
    • Campaign Analytics: Provides insights into the effectiveness of marketing campaigns.
    • User Segmentation: Allows for the segmentation of users based on behavior and interaction data.
    • Personalization: Enables personalized messaging and experiences based on event data.
  • Use Cases: Ideal for marketing, product, and customer success teams focused on enhancing customer engagement and optimizing marketing campaigns.

Comparison Summary:

  • Focus: Sumo Logic is focused on IT operations, security, and infrastructure monitoring, while Braze Event Logs are centered on customer engagement and marketing analytics.
  • Functionality: Sumo Logic offers powerful log management and operational intelligence capabilities, whereas Braze provides tools for tracking and analyzing customer interactions to drive personalized marketing efforts.

Friday, June 21, 2024

Angular browser cache clean

This week, had an interesting learning whilst web product launch using latest Angular framework

If the browser cache is not cleared after deploying a new version of your Angular application, users might experience issues such as:

  • Stale Content: Users may see old versions of your application, causing inconsistencies if the new version contains critical updates.
  • Missing Files: The new deployment might reference files (like JavaScript or CSS) that have changed or no longer exist, causing 404 errors.
  • Unexpected Behavior: JavaScript and CSS changes might not reflect, leading to broken functionality or layout issues.


There are Top-5 technical solutions to avoid browser cache clearance
  1. Cache Busting: Angular CLI automatically handles cache busting by appending a unique hash to the filenames of built assets. Ensure production build as ng build --prod
  2. Service Worker: Implement Angular PWA (Progressive Web App) with service workers to manage cache effectively. ng add @angular/pwa Configure the ngsw-config.json file to control caching strategies.
  3. HTTP Headers: Configure your server to set appropriate caching headers. This can force the browser to always fetch the latest version of your files.{   add_header Cache-Control "max-age=31536000, public"; }
  4. Versioning: Use versioning in your file names or paths to ensure that users receive the updated files.<script src="main.v1.2.3.js"></script>
  5. Client-Side Cache Control: Programmatically clear the cache on the client side using JavaScript when a new version is detected.
    if ('serviceWorker' in navigator) Unknown macro: {  navigator.serviceWorker.getRegistrations().then((registrations) =>Unknown macro}); }

Saturday, June 15, 2024

ECS environment


In an Amazon ECS task definition, the environment parameter is used to define environment variables that are passed to the container at runtime. 

Environment variables are key-value pairs that can be used to configure the behavior of the containerized application without changing the application code. 

"containerDefinitions": [{

"name": "my-microservice-container",
"image": "my-microservice:latest",
"environment": [
{
   "name": "DATABASE_URL",
   "value": "mysql://username:password@hostname:3306/dbname"
},
{
   "name": "API_KEY",
   "value": "your_api_key_here"
},
{
   "name": "LOG_LEVEL",
   "value": "debug"
}]
}]

 

As said above, a list of environment variables to set in containerDefinitions/environment.

Purposes of Environment Variables:

Configuration Management: You can use environment variables to configure the application, such as setting the application mode (development, testing, production), configuring logging levels, or setting feature flags.

1. Secrets Management: Environment variables can be used to pass sensitive information like database credentials, API keys, and other secrets to the application. However, for enhanced security, consider using AWS Secrets Manager or AWS Systems Manager Parameter Store to manage sensitive data.

2.Operational Parameters: You can define various operational parameters, like memory limits, thread counts, or other runtime configurations that the application might need.

3. Service Endpoints: Environment variables can be used to specify the URLs or endpoints of other services that the application needs to communicate with.

4. Feature Toggles: You can use environment variables to enable or disable features within your application dynamically without changing the code.

Monday, June 10, 2024

WebGL safari browser



On getting "failed to initialize WebGL" error specifically on Safari, top-3 steps to resolve WebGL issues in Safari macOS


1. Enable WebGL in Safari

First, ensure WebGL is enabled in Safari. To check, you can type about:blank in the address bar, then from the menu bar select Develop > Experimental Features. Make sure there's a checkmark next to WebGL. If you don't see the Develop menu, you can enable it in Safari's preferences under Advanced > Show Develop menu in menu bar.


2. Update Safari and Graphics drivers

Ensure that both Safari and your macOS are updated to the latest versions. Apple frequently releases updates that can improve compatibility and performance for web technologies like WebGL.

Unlike Windows, macOS doesn't usually require manual graphics driver updates, as they are included with macOS updates. 


3. Enable Hardware Acceleration

Safari typically handles hardware acceleration automatically, but issues with WebGL might indicate a problem. Verify your system's hardware acceleration settings by checking for any relevant software updates and ensuring your system is configured for optimal performance.

Sunday, June 2, 2024

AI chip race


Last week, I noticed CPU chip makers are rocketing in stock market in spite of others downfall. Technically, it was due to AI PC race speeds up.

During Jan 2024, Microsoft CEO Satya Nadella said that 2024 will mark the year when AI will become the “first-class part of every PC.”

The key hardware addition to an AI PC is what’s called a neural processing unit. NPUs go beyond the capabilities of traditional central processing units (CPUs) and are designed to specifically handle artificial intelligence tasks. 

Traditionally, they’ve been used by companies like Apple to improve photos and videos or for speech recognition.  Microsoft hasn’t said what AI PCs will be capable of yet without an internet connection.

Computers with Intel’s latest Lunar Lake chips with a dedicated NPU are expected to arrive in late 2024. Qualcomm’s Snapdragon X Elite chip with an NPU will be available in the middle of this year, while AMD’s latest Ryzen Pro is expected sometime during the quarter.

Intel says the chips allow for things like real-time language translation, automation inferencing, and enhanced gaming environments.


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