Wednesday, October 9, 2024

 Resource Naming Convention

If you know of parents who named their children as Child-surname-boy-01 and Child-surname-girl-02, you know at least one of the parents is a public cloud infrastructure engineer. This form of naming convention is not limited to one public cloud and is even recommended by IaC providers who provide a unifying language over multiple clouds.

Organizing the resources when they number in tens or more demands a certain discipline as it would in library science. The public clouds suggest a naming convention that speaks to resource type, environment, workload, region, and instance so that there is no need to make an additional call to get the details the resource to tell them apart. Unique names are also necessary when resources get destroyed and re-created many times. When we freeze the instance, customers can expect to find the resource the way they saw it earlier. Consider a database server that was provisioned and used to save some data, but it got destroyed and recreated and now the data does not exist. Customers referring to that server by its name might find data at one point and find it missing later. To ensure that the instances have changed, it is better to increase the instance number whenever a resource is destroyed and recreated.

It is also important to know that the naming conventions help to sort and index just as any data in a database. These are two powerful techniques when we want to retrieve a subset of resources among hundreds and find it easier to discern them. Closely related names are especially helpful to indicate a similarity in origin or workload and being able to spot similarity and differences are probably one of the core duties of building out infrastructure in an organization.

Another habit of infrastructure engineers deserves special attention. When trying to use a name as a literal to input on an editor or search a set of resources, the veterans will never try to interpret the names to reconstitute it part-by-part at another location, because such steps are prone to mistakes and typos. Instead, they will treat the name as opaque between copying and pasting and taking care that the name was selected whole. Unfortunately, a significant source of errors during deployments of large-scale infrastructure occur because a resource or its component or associations were not referred to by the right name. It would help professionals deploying infrastructure-as-code to pay a lot of attention to names throughout the code just like they would if they were reading quantitative information from a resume.

Conventions can be strict or relaxed and allow grading to enforce order and structure and the inclusivity is up to the discretion of engineers as some may choose to combine or omit some components. Clear, consistent, and descriptive names will make resource management easier.

Another popular principle is the Copy-on-write where two entities sharing the same list of names will make a copy whenever one of the tries to modify it so that the other can continue to read the original. This principle applies even to resources that are currently being used so that the original set of resources are not destroyed until the traffic moves to the newly created resource set. Since creation and deletion can be repeated in an idempotent manner, this principle facilitates a safe, reliable and robust migration.

Previous articles: https://1drv.ms/w/s!Ashlm-Nw-wnWhPYQF4gznvaSS_8_bQ?e=cov7hG


Tuesday, October 8, 2024

 Solution Accelerator:

One of the recent infrastructure trends has been the use of solution accelerator. This is a collection of resources with a configuration that is best suited to a workload. These pre-configured, canned, and ready-to-go deployment templates are the equivalent of pre-fabricated items in any industry. They could range in size from small storage to large, range in purpose from supporting a dedicated to workload to all kinds of applications, and range in cost from least expensive to one with all bells and whistles. These solution accelerators can be published by home-grown teams as well as imported from other organizations and their repositories. In this section, we will cover only the case where a solution accelerator must be developed in-house.

One of the main characteristics of a solution accelerator is that it is intended to be paired with a workload. Understanding the workload and implementing the best practices into a deployment stamp so that its blueprint can be used many times, is a prerequisite. It is this reusability of the solution accelerators that drives it to take the form of T-Shirt sizes so that workloads of the same type both big and small can leverage the same solution accelerator.

Another characteristic of the solution accelerator is that it must be built like a product and the fewer and more suited to the demand the better. When we treat it like a product rather than a solution where one is more generic and the other more specific, we become more focused in our efforts. This does not compromise on the business purpose for which the solution accelerator is designed. It merely reduces waste in terms of unnecessary distractions, prototypes, and their iterations.

As such the following principles apply to a solution accelerator: 1. Know Your Customers: Understanding your customers' needs, behaviors, and pain points is crucial. This involves continuous user research and feedback collection.2. Outcome Over Output: Focus on the outcomes and impact of the whole proposal rather than just the features. This means prioritizing features that deliver the most value to users. 3. Prioritization: Effective prioritization is essential. Solution Accelerators developers must balance various factors such as customer needs, business goals, and technical feasibility.4.Data-Driven Decision Making: Leverage data and analytics to inform decisions. This helps in understanding user behavior, measuring success, and making informed adjustments. 5. Cross-Functional Collaboration: Work closely with engineering, design, marketing, and other teams. Effective communication and collaboration are key to aligning everyone towards common goals. 6. Agility and Adaptability: Be prepared to pivot and adapt based on new information, market changes, or feedback. Flexibility is crucial in the fast-paced tech industry. 7. Clear Vision and Roadmap: Develop a clear solution accelerator vision and roadmap. This helps in setting expectations, aligning the team, and guiding the development process. 8. Experimentation and Innovation: Encourage a culture of experimentation. Testing new ideas and iterating based on results can lead to innovative solutions. 9. Customer-Centric Mindset: Always keep the customer at the center of decision-making. This ensures that the solution accelerator remains relevant and valuable to its users. 10. Effective Communication: Ensure transparent and effective communication within the team and with stakeholders. This helps in managing expectations and keeping everyone informed.

These principles help solution accelerator developers navigate the complexities of the infrastructure and deliver a blueprint that meet the user needs and drive business success.

Monday, October 7, 2024

 One of the most routine encountered cases of software migration to the cloud is the migration of entire Kubernetes workload. As an ecosystem of its own supporting state reconciliation of resources for applications, workflows, orchestrations, and data store managers. As an instance of a resource type in the public cloud, it is a unit that lends itself to the management from the public cloud console. One of the management activities of this resource is its move from one location to another or one network to another. When switching just the network integration for outbound traffic for this network, it might be tempting to think of it as a property change of a resource that amounts to in-place update. But this is just the tip of the iceberg. Different methodologies and formulae for estimation although applicable to many scenarios do not apply to this case-study without further investigation.

In this case, the instance has a default node pool and many additional node pools that may still be referencing the old network even with directive to switch to new network. They also happen to refer to additional storage accounts for facilitating the creation of persistent volumes as key vaults for storing secrets. If these satellite resources are also restricting traffic to private planes, then networking and authentication must both be enabled from the new network.

The infrastructure changes for this might also not be straight forward single-pass and require iterative maneuvers to make incremental progress. This is specifically the case when the IaC compiler encounters multiple other resources and detect changes in them the path of minimal changes to the infrastructure will imply the lowest cost and this works very well if we can wipe clean and create with the same specifications as earlier but with the new network.

Thus, estimation of infrastructure is heavily dependent on what the resource needs, the changes being made to it and what the compiler detects as mandatory to perform before applying the change.


Sunday, October 6, 2024

 There are N points (numbered from 0 to N−1) on a plane. Each point is colored either red ('R') or green ('G'). The K-th point is located at coordinates (X[K], Y[K]) and its color is colors[K]. No point lies on coordinates (0, 0).

We want to draw a circle centered on coordinates (0, 0), such that the number of red points and green points inside the circle is equal. What is the maximum number of points that can lie inside such a circle? Note that it is always possible to draw a circle with no points inside.

Write a function that, given two arrays of integers X, Y and a string colors, returns an integer specifying the maximum number of points inside a circle containing an equal number of red points and green points.

Examples:

1. Given X = [4, 0, 2, −2], Y = [4, 1, 2, −3] and colors = "RGRR", your function should return 2. The circle contains points (0, 1) and (2, 2), but not points (−2, −3) and (4, 4).

class Solution {

    public int solution(int[] X, int[] Y, String colors) {

        // find the maximum

        double max = Double.MIN_VALUE;

        int count = 0;

        for (int i = 0; i < X.length; i++)

        {

            double dist = X[i] * X[i] + Y[i] * Y[i];

            if (dist > max)

            {

                max = dist;

            }

        }

        for (double i = Math.sqrt(max) + 1; i > 0; i -= 0.1)

        {

            int r = 0;

            int g = 0;

            for (int j = 0; j < colors.length(); j++)

            {

                if (Math.sqrt(X[j] * X[j] + Y[j] * Y[j]) > i)

                {

                    continue;

                }

                if (colors.substring(j, j+1).equals("R")) {

                    r++;

                }

                else {

                    g++;

                }

            }

            if ( r == g && r > 0) {

                int min = r * 2;

                if (min > count)

                {

                    count = min;

                }

            }

        }

        return count;

    }

}

Compilation successful.

Example test: ([4, 0, 2, -2], [4, 1, 2, -3], 'RGRR')

OK

Example test: ([1, 1, -1, -1], [1, -1, 1, -1], 'RGRG')

OK

Example test: ([1, 0, 0], [0, 1, -1], 'GGR')

OK

Example test: ([5, -5, 5], [1, -1, -3], 'GRG')

OK

Example test: ([3000, -3000, 4100, -4100, -3000], [5000, -5000, 4100, -4100, 5000], 'RRGRG')

OK


Saturday, October 5, 2024

 Number of Ways to Split Array

You are given a 0-indexed integer array nums of length n.

nums contains a valid split at index i if the following are true:

• The sum of the first i + 1 elements is greater than or equal to the sum of the last n - i - 1 elements.

• There is at least one element to the right of i. That is, 0 <= i < n - 1.

Return the number of valid splits in nums.

Example 1:

Input: nums = [10,4,-8,7]

Output: 2

Explanation:

There are three ways of splitting nums into two non-empty parts:

- Split nums at index 0. Then, the first part is [10], and its sum is 10. The second part is [4,-8,7], and its sum is 3. Since 10 >= 3, i = 0 is a valid split.

- Split nums at index 1. Then, the first part is [10,4], and its sum is 14. The second part is [-8,7], and its sum is -1. Since 14 >= -1, i = 1 is a valid split.

- Split nums at index 2. Then, the first part is [10,4,-8], and its sum is 6. The second part is [7], and its sum is 7. Since 6 < 7, i = 2 is not a valid split.

Thus, the number of valid splits in nums is 2.

Example 2:

Input: nums = [2,3,1,0]

Output: 2

Explanation:

There are two valid splits in nums:

- Split nums at index 1. Then, the first part is [2,3], and its sum is 5. The second part is [1,0], and its sum is 1. Since 5 >= 1, i = 1 is a valid split.

- Split nums at index 2. Then, the first part is [2,3,1], and its sum is 6. The second part is [0], and its sum is 0. Since 6 >= 0, i = 2 is a valid split.

Constraints:

• 2 <= nums.length <= 105

• -105 <= nums[i] <= 105

Solution:

class Solution {

    public int waysToSplitArray(int[] nums) {

        if (nums == null || nums.length <= 1 ) return 0;

        int sumSoFar = 0;

        int total = 0;

        int count = 0;

        for (int i = 0; i < nums.length; i++) {

            total += nums[i];

        }

        for (int i = 0; i < nums.length - 1; i++) {

            sumSoFar += nums[i];

            if (sumSoFar >= total-sumSoFar) {

                count += 1;

            }

        }

        return count;

    }

}

Test cases:

[0] => 0

[1] => 0

[0,1] => 0

[1,0] => 1

[0,0,1] => 0

[0,1,0] => 1

[0,1,1] => 1

[1,0,0] => 2

[1,0,1] => 2

[1,1,0] => 2

[1,1,1] => 1


Friday, October 4, 2024

 This is a summary of the book titled “The Psychological Safety Playbook” written by Minette Norman and Karolin Helbig and self-published in 2023. Psychological safety is as much relevant to workplace as it is to relationships, terms and culture. The authors highlight five skills leaders must harness to achieve this: communication, listening, emotional regulation, managing failure, and inclusion. Each of these five skills is accompanied by five ways to implement them. Everyone needs to feel psychologically safe to reach their full potential. When they communicate, they must be able to speak up, welcome diverse viewpoints, and not insist on their own. When we improve our listening skills, others feel understood. Our emotional reactions and kneejerk behavior must be regulated, so others find it easy to open up. They must be able to take risks and fail, learn and innovate. Inclusive rituals and gathering feedback improves participation. This book is easy to read and inspiring at the same time.

Psychological safety is crucial for a team's success, as it allows individuals to ask questions, express concerns, and admit mistakes without fear of humiliation or punishment. This creates an environment where people feel safe to contribute ideas, express dissent, and challenge leaders. Leaders should set the tone, ensure everyone feels valued, and create an environment where they can model behavior such as listening, humility, trust, and openness to criticism. Courageous communication involves welcoming diverse viewpoints and embracing dissent. Leaders should invite varied viewpoints, encourage dissent, and display feelings productively. They should avoid perfectionism, admit their own inadequacies, and be funny to build connection and trust. By fostering a culture of continuous learning, leaders can foster a culture of psychological safety and high-performing cultures. By embracing these practices, leaders can foster a more inclusive and innovative work environment.

Skilled listening involves understanding others' perspectives and understanding their emotions. It requires humility and mindfulness, allowing for acceptance of different viewpoints without agreeing. Participation is key, with a focus on the conversation partner, paraphrasing and summarizing what is heard. Emotions are crucial for decision-making, but often unstated. Identifying emotions through micro-expressions, gestures, and body language is essential. Show empathy without judgment and encourage curiosity by asking for clarification and allowing for silence. By demonstrating curiosity and allowing for further engagement, you can foster a more inclusive and effective conversation.

Emotional regulation is crucial in ensuring a productive response to challenges. It involves self-awareness, emotional control, and sincere appreciation for challengers. To respond non-defensively, observe defensive reactions and pause before responding. Label emotions with logical thinking and be objective. Deconstruct blind spots by seeking alternative perspectives and examining contradictory evidence. Express grace and gratitude towards challengers, recognizing and labeling emotional and physiological responses. Move towards confrontation rather than away from it, reminding yourself of shared values and goals. Learn from new ideas by building on them, not avoiding negative reactions and treating new proposals as valuable experiments.

Leaders should embrace risk and failure to foster a culture of learning and innovation. This doesn't mean lowering performance standards or letting accountability slide. Instead, leaders should welcome failure, frame it as part of the journey towards innovation, and share stories of high performers who have overcome setbacks. Befriending uncomfortable emotions, demonstrating learning behavior, and facilitating continual learning are also essential. By embracing failure and mistakes, leaders can help employees understand why a failure occurred and how to remedy it. Regular, blame-free postmortems and "premortems" can help employees understand the learning process and encourage continuous learning. Rewarding people who identify potential flaws in a plan can also contribute to a more positive work environment.

Inclusive rituals and feedback gathering are essential for creating a diverse team culture. Appoint an "inclusion booster" at meetings to ensure everyone has a chance to speak. Establish a no-interruption rule and encourage concise speaking. Set a rule that "no one speaks twice until everyone speaks once" to foster innovation. Use visual timers and collaboration tools to keep everyone concise. Assemble post-meeting feedback to promote accountability and measure progress. Express gratitude to workers for their work, challenging ideas, and celebrating hard work. Keep all responses confidential and encourage team members to collaborate effectively.

References:

1. PreviousBookSummary.docx

2. SummarizerCodeSnippets.docx

3. DroneInformationManagement.docx

4. https://coursera.org/share/89dd61377bad7e93402c5bb3440414af

5. https://coursera.org/share/b1e019fd7028b96f54a057db4d11ea85

#codingexercise : https://1drv.ms/w/s!Ashlm-Nw-wnWhNN5MYAncYz3czQKUw?e=JHwWUU?

Thursday, October 3, 2024

 This is a continuation of the articles on IaC shortcomings and resolutions. The previous articles talked about different data backup and migration strategies and provided steps to go over the variations for resource types. This article discusses what is needed for a specific case where the data transfer must span azure management hierarchy of tenants, subscriptions, resource-groups and resources. As before, we will assume that all resources have private networking enabled for security and performance reasons. In addition, each virtual network for private networking is isolated from one another. For example, the virtual network in one subscription might not have any peering with that in any other subscription. Both public and private IP connectivity is enabled for each resource that acts as source and destination for data transfer.

Given such a scenario, the traditional way to allow cross virtual network access for use of resources in the said networks has been the use of private connections by virtue of private endpoints. Consequently, any destination for data transfer can request a private endpoint to be added where the data is saved on the source virtual network. Each virtual network can safely assume that typical options of name resolution to private IP assigned to these private connections is enabled with the help of private domain name resolution service. When the destination can connect to the remote source via the private IP connectivity thus established, the destination will be able to pull the data from the source. This works well for paired servers of the same resource type with the help of continuous replication that is supported by the resource types such as Azure managed instances of MySQL flexible servers and Azure managed instances for Apache Cassandra. However, it does not work that easily for cases where a third resource type or automation is involved to perform the transfers by way of pulling from the source and pushing to the destination. The involvement of a resource type, such as a Database Migration Service or an automation requires networking to be available to both source and the destination, so more connections need to be established than earlier and from both source and destination. These connections are always on the private IP connectivity plane, but it is also possible to keep the traffic over the public if the size of the data transfers is small and the encryption for data in transit is supported. In such cases, IP addresses for the entity performing the data transfers must be supported between the source and the destination. Any firewall or firewall polices must also support the allow listing of IP addresses. If the entity is an Azure resource and receives a public IP address from Azure, then it is not necessary to add allowlists for Microsoft IP addresses because such resources can be allowed traffic with the “Bypass trusted Azure services” option that is available under the network settings of the source and the destination. With the help of this option, it is easy to keep the public IP access restrictions light and simple. All traffic between Azure resources with public IP addresses from Azure will in such a case, flow over the Azure networking backbone. This prevents the Azure services from going over the public internet and provides very low latency of less than ten milliseconds as opposed to a hundred to two hundred milliseconds. In addition, to networking, authentication must be setup for each of the entity performing the data transfers. This again is required only in the case where continuous replication is not involved. An application identity can be dedicated for data backup/migration purposes. A role that honors the principle of least privilege must be assigned to this identity at both the source and the destination.


#codingexercise

https://1drv.ms/w/s!Ashlm-Nw-wnWhNIeZZhspIpNfjqURg?e=pymL9w