Tuesday, February 13, 2024

 This is a summary of the book titled “Leading Beyond Change -  A practical guide to evolving business agility” written by Michael K. Sahota and Audree Tara Sahota and published by Berrett-Koehler in 2021. As productivity consultants they propose “Shift314 Evolutionary Leadership framework (SELF)”  that advocates learning what happens in your organization by listening “to the voice of the system”. It’s the next step in your personal leadership journey and for your company.  They link effective change to awareness and accountability.

Most changes are ineffective but by encompassing results, organizational change, organizational culture, people, use of power, leadership, and understanding reality. Evolutionary leaders lead beyond change. They must be constantly realistic and open to new ideas. They are empathetic as human beings and are accountable for their choices. It is crucial to focus on achieving "organizational evolution" instead of routine change programs. This requires a shared transition into higher consciousness and evolutionary leadership. Traditional change efforts often fail because leaders mistakenly view their organizations as easy to understand. The "Shift314 Evolutionary Leadership Framework" (SELF) is a strategic approach to seek evolutionary change. The SELF program consists of four aspects: maps, principles, models, and tools. Maps help leaders visualize patterns and understand the difference between traditional and evolutionary change patterns. Principles guide personal evolution and inspire change in others. Models provide a better understanding of the organization through data collection and analysis. Tools allow leaders to enhance personal and organizational results. Evolutionary leaders prioritize employees' safety and interests, even prioritizing their safety and interests over shareholder interests.

Evolutionary leadership focuses on system improvement and higher consciousness, leading "beyond change." It involves two dimensions: "Being" and "Doing," where leaders commit to individual improvement that inspires people and leads to team and systemic improvement. Responsibility is the key factor for successful self-organization and self-management. Organizations with high-energy employees and superior performance are ideally equipped to manage evolutionary change. Companies need leaders who develop and evolve their own leadership styles to move beyond conventional business operations.
Leaders must be realistic and accept reality, as their brains tend to generalize, distort, or delete information when overloaded with sensory data. Companies need leaders who accept reality and its consequences to deal with challenges effectively. Open-minded and humble leaders accept that their thoughts may not accurately reflect reality, and are tough-minded enough to question their own models.
Achieving this mindset requires faith in oneself and the process of growth. To learn, keep the mind open to new ideas and avoid believing you know it all. A famous Zen koan teaches that believing in one's own knowledge can hinder clear thinking and openness to new ideas.

The best leaders evolve as aware human beings, embracing self-awareness, emotional awareness, and enlightened wisdom. Self-evolution is crucial for leaders, as it allows them to discover reality, unlearning, understand that external challenges are linked to internal ones, serve purpose, let go of control, increase freedom, exhibit responsibility, provide psychological safety, and have an equal voice. Leaders must be accountable for their choices that define their leadership, as everything in their sphere at work reflects on their personal leadership. They must be aware of the consequences of their actions, including how they grow as a leader, the organization's processes, corporate changes, employee treatment, and the leaders they appoint and mentor. This journey requires courage and motivation to accept the challenging process of evolving.

Monday, February 12, 2024

 

Sequences from usage

Introduction: Neural networks democratize dimensions, but the pattern of queries served by the neural network inform more about some of them rather than others over lengthy periods of time. These are like sequences used in transformers except that sequence is not given between successive queries and instead must be learned over time and curated as idiosyncratic to the user sending the queries. Applications of such learners are significant in spaces such as personal assistant where the accumulation of queries and the determination of these sequences offer insights into interests of the user. The idea behind the capture of sequences over large batches of queries is that  they are representational not actual and get stored as state rather than as dimensions. There is a need to differentiate the anticipation, prediction, and recommendation of the next query to determine the user traits from usage over time. The latter does not play any role in immediate query responses but adjusts the understanding whether a response will be with high precision and recall for the user. In an extension of this distinguishing curation of user traits, this approach is different from running a latent semantic classifier on all incoming requests because that would be short-term and helping with the next query or response but not assist with the inference of the user’s traits.

If the neurons in a large language model were to light up for the query and responses, there would be many flashes across millions of them. While classifiers help with the salience of these flashes for an understanding of the emphasis in the next query and response, it's the capture off repetitive flash sequences over a long enough time span in the same space that indicate recurring themes and a certain way of thinking for the end-users. Such repetitions have their origins in the way a person draws upon personal styles, way of thinking and vocational habits to form their queries. When subjects brought up the user are disparate, her way of going about exploring them might still draw upon their beliefs, habits and way of thinking leading to sequences that at the very least, is representative of themselves.

Curation and storage of these sequences is like the state stored by transformers in that must be encoded and decoded. Since these encoded states are independent of the forms in which the input appears, it eschews the vector representation and consequent regression and classification, focusing instead on the capture and possible replay of the sequences, which are more along the lines of sequence databases use of which is well-known in the industry and provides opportunities for interpretation not limited to machine learning.

Continuous state aggregation for analysis might also be possible but not part of this discussion. Natural language processing relies on encoding-decoding to capture and replay state from text.  This state is discrete and changes from one set of tokenized input texts to another. As the text is transformed into vectors of predefined feature length, it becomes available to undergo regression and classification. The state representation remains immutable and decoded to generate new text. Instead, if the encoded state could be accumulated with the subsequent text, it is likely that it will bring out the topic of the text if the state accumulation is progressive. A progress indicator could be the mutual information value of the resulting state. If there is information gained, the state can continue to aggregate, and this can be stored in memory. Otherwise, the pairing state can be discarded. This results in a final state aggregation that continues to be more inclusive of the topic in the text.

NLP has algorithms like BERT to set the precedence for state encoding and decodings but they act on every input and are required to be contiguous in their processing of the imputs. A secondary pass for selectivity and storing of the states is suggested in this document. Reference: https://booksonsoftware.com/text

Sunday, February 11, 2024

 


Storing secrets in app_settings versus key vault for Azure App Service has some trade-offs. Here are some of the advantages and disadvantages of each option:

In summary, app settings are a good choice for storing non-sensitive application settings, such as endpoint locations, sizing, flags, etc4. Key vault is a better choice for storing sensitive information, such as encryption keys, certificates, passwords, etc4. You can also use both options together, by creating app settings that reference secrets stored in key vault1. This way, you can maintain secrets apart from your app’s configuration, and access them like any other app setting or connection string in your code1.

 

1.       https://learn.microsoft.com/en-us/azure/app-service/app-service-key-vault-references

2.       https://stackoverflow.com/questions/67722160/what-is-the-point-of-using-azure-key-vault-instead-of-only-app-configuration

3.       https://learn.microsoft.com/en-us/azure/azure-app-configuration/faq

4.       https://learn.microsoft.com/en-us/azure/key-vault/secrets/secrets-best-practices

### Code sample for reading app settings

 

```python:

import logging

import os

import azure.functions as func

 

app = func.FunctionApp()

 

@app.function_name(name="HttpTrigger1")

@app.route(route="req")

def main(req: func.HttpRequest) -> func.HttpResponse:

    # Get the setting named 'myAppSetting'

    my_app_setting_value = os.environ["myAppSetting"]

    logging.info(f'My app setting value: {my_app_setting_value}')

    # Your other function logic goes here

    return func.HttpResponse("Function executed successfully!")

 

```

 

<a id="item-two"></a>

### Code sample for reading key vault secrets

 

```python:

# Import necessary libraries

import logging

import azure.functions as func

from azure.identity import DefaultAzureCredential

from azure.keyvault.secrets import SecretClient

 

def main(req: func.HttpRequest) -> func.HttpResponse:

    logging.info('Python HTTP trigger function processed a request.')

 

    # Initialize Azure credentials

    credentials = DefaultAzureCredential()

 

    # Create a SecretClient to interact with the Key Vault

    vault_url = "https://your-key-vault.vault.azure.net"  # Replace with your Key Vault URL

    secret_client = SecretClient(vault_url=vault_url, credential=credentials)

 

    # Retrieve the secret by name

    secret_name = 'your-secret-name'  # Replace with your secret name

    secret = secret_client.get_secret(name=secret_name)

 

    # Access the secret value

    secret_value = secret.value

 

    # You can now use the secret value in your function logic

    # For example, return it as an HTTP response

    return func.HttpResponse(f"Secret value: {secret_value}")

 

```

Make sure to replace the placeholders (your-key-vault.vault.azure.net and your-secret-name) with your actual Key Vault URL and secret name. Additionally, ensure that your Azure Function App has the necessary permissions to access the Key Vault (e.g., Reader role assignment).

Remember to include the required libraries (azure-functions, azure-keyvault-secrets, and azure-identity) in your requirements.txt file for deployment.

 

Previous articles: IaCResolutionsPart73.docx

Saturday, February 10, 2024

 

Given a wire grid of size N * N with N-1 horizontal edges and N-1 vertical edges along the X and Y axis respectively, and a wire burning out every instant as per the given order using three matrices A, B, C such that the wire that burns is

(A[T], B[T] + 1), if C[T] = 0 or
(A[T] + 1, B[T]), if C[T] = 1

Determine the instant after which the circuit is broken

     public static boolean checkConnections(int[] h, int[] v, int N) {

        boolean[][] visited = new boolean[N][N];

        dfs(h, v, visited,0,0);

        return visited[N-1][N-1];

    }

    public static void dfs(int[]h, int[]v, boolean[][] visited, int i, int j) {

        int N = visited.length;

        if (i < N && j < N && i>= 0 && j >= 0 && !visited[i][j]) {

            visited[i][j] = true;

            if (v[i * (N-1) + j] == 1) {

                dfs(h, v, visited, i, j+1);

            }

            if (h[i * (N-1) + j] == 1) {

                dfs(h, v, visited, i+1, j);

            }

            if (i > 0 && h[(i-1)*(N-1) + j] == 1) {

                dfs(h,v, visited, i-1, j);

            }

            if (j > 0 && h[(i * (N-1) + (j-1))] == 1) {

                dfs(h,v, visited, i, j-1);

            }

        }

    }

    public static int burnout(int N, int[] A, int[] B, int[] C) {

        int[] h = new int[N*N];

        int[] v = new int[N*N];

        for (int i = 0; i < N*N; i++) { h[i] = 1; v[i] = 1; }

        for (int i = 0; i < N; i++) {

            h[(i * (N)) + N - 1] = 0;

            v[(N-1) * (N) + i] = 0;

        }

        System.out.println(printArray(h));

        System.out.println(printArray(v));

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

            if (C[i] == 0) {

                v[A[i] * (N-1) + B[i]] = 0;

            } else {

                h[A[i] * (N-1) + B[i]] = 0;

            }

            if (!checkConnections(h,v, N)) {

                return i+1;

            }

        }

        return -1;

    }

        int[] A = new int[9];

        int[] B = new int[9];

        int[] C = new int[9];

        A[0] = 0;    B [0] = 0;    C[0] = 0;

        A[1] = 1;    B [1] = 1;    C[1] = 1;

        A[2] = 1;    B [2] = 1;    C[2] = 0;

        A[3] = 2;    B [3] = 1;    C[3] = 0;

        A[4] = 3;    B [4] = 2;    C[4] = 0;

        A[5] = 2;    B [5] = 2;    C[5] = 1;

        A[6] = 1;    B [6] = 3;    C[6] = 1;

        A[7] = 0;    B [7] = 1;    C[7] = 0;

        A[8] = 0;    B [8] = 0;    C[8] = 1;

        System.out.println(burnout(9, A, B, C));

1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

8
Alternatively,

    public static boolean burnWiresAtT(int N, int[] A, int[] B, int[] C, int t) {

        int[] h = new int[N*N];

        int[] v = new int[N*N];

        for (int i = 0; i < N*N; i++) { h[i] = 1; v[i] = 1; }

        for (int i = 0; i < N; i++) {

            h[(i * (N)) + N - 1] = 0;

            v[(N-1) * (N) + i] = 0;

        }

        System.out.println(printArray(h));

        System.out.println(printArray(v));

        for (int i = 0; i < t; i++) {

            if (C[i] == 0) {

                v[A[i] * (N-1) + B[i]] = 0;

            } else {

                h[A[i] * (N-1) + B[i]] = 0;

            }

        }

        return checkConnections(h, v, N);

    }

    public static int binarySearch(int N, int[] A, int[] B, int[] C, int start, int end) {

        if (start == end) {

            if (!burnWiresAtT(N, A, B, C, end)){

                return end;

            }

            return  -1;

        } else {

            int mid = (start + end)/2;

            if (burnWiresAtT(N, A, B, C, mid)) {

                return binarySearch(N, A, B, C, mid + 1, end);

            } else {

                return binarySearch(N, A, B, C, start, mid);

            }

        }

    }

1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

8

 

Friday, February 9, 2024

 

This is a summary of the book titled “Life Force – how new breakthroughs in precision medicine can transform the quality of your life and those you love” written by Tony Robbins and Peter Diamandis and published by Simon and Schuster, 2022. They offer anecdotes, research case studies and stories on how precision medicine changing people’s lives. New breakthroughs can not only be preventive, rejuvenative and supplemental but also defeat chronic illnesses. Together with a positive mindset, these hold the promise of increased longevity.

New technologies in rejuvenative medicine are revolutionizing healthcare by fighting disease and potentially reversing aging through the power of stem cells. Stem cells divide and renew themselves without limits, providing incredible healing powers. Clinical trials are ongoing to treat diseases like Parkinson's, Alzheimer's, diabetes, and heart and liver problems. Aging is a disease that can be curable through lifestyle changes and supplements. New medical technologies can create organs, edit genes, and make the body functionally younger. For example, Dr. Anthony Atala has been "printing" 3D human bladders for almost two decades, and genetically altered pig lungs to replace and outperform human lungs. CAR T-cell therapy stimulates the immune system, while Insightec is working on focused ultrasound therapy for Parkinson's disease. Gene therapy, such as CRISPR, can eliminate disease and cure it completely. Biosplice has made advances against eight common diseases, restoring the Wnt pathway to its youthful baseline through small-molecule medicines.

Evolving supplements and treatments can help individuals look and feel younger by increasing vitality and lengthening their health span. Peptides, metformin, hormone optimization therapy, NAD+ supplements, and nutraceutricals can help maintain youthfulness and health. Hair loss often accompanies aging, but companies like Harklinikken and TissUse are developing natural hair products to combat this issue. Stem-cell-based hair transplant treatments and cryofacials can also improve skin.

Diet, exercise, sleep, and lifestyle can also contribute to healthier living. A plant-based diet is optimal for health, while intermittent fasting helps avoid disease and stay youthful. Consistency in exercise and regular exercise can lead to significant results. Sleep is the foundation of health, and if adults get less than eight hours of sleep, the risk of serious medical problems increases. To improve sleep, evaluate sleep quality, stick to regular sleep and wake times, and limit alcohol and caffeine in the evening. If sleep-deprived, consult a doctor.

Precision medicine aims to combat various diseases such as heart disease, strokes, cancer, autoimmune diseases, diabetes, and Alzheimer's. Heart disease is the most common and fatal disease, and new treatments include stem cell-based therapies like Caladrius Biosciences' CD 34+ and Elevian's GDF11. Strokes are a significant cause of death, and companies are developing gloves, VR equipment, and magnetic stimulators to help patients recover.

Cancerous diseases, such as cancer, require early diagnosis and early detection. The GRAIL liquid biopsy blood test can screen for over 50 types of cancer, and scientists are working on treatments that stimulate the immune system to fight cancer.

Autoimmune diseases, such as Crohn's, multiple sclerosis, psoriasis, and rheumatoid arthritis, can be treated with electric stimulation of the vagus nerve and stem cell infusions. Anti-inflammatory diets and weight loss can also help manage these conditions.

Nutritional intervention is currently the best treatment for obesity, with weight loss potentially reversing Type 2 diabetes by regenerating beta cells.

Alzheimer's affects 50 million people worldwide and is a significant challenge for scientists. Innovative treatments include blood tests, drugs, plasma transfusions, an Alzheimer's vaccine, and psychedelic mushrooms like Lion's Mane. Natural measures like sleep, stress management, social interaction, exercise, a healthy diet, and continuous learning improve brain health. A positive mindset can extend the human life span beyond 120 years, and a positive attitude towards aging leads to longer lives and better health recoveries.

Previous book summaries: BookSummary49.docx

Summarizing Software: SummarizerCodeSnippets.docx.  

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

 

Thursday, February 8, 2024

Subarray Sum equals K

Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals tok. 

A subarray is a contiguous non-empty sequence of elements within an array. 

Example 1: 

Input: nums = [1,1,1], k = 2 

Output: 2 

Example 2: 

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

Output: 2 

Constraints: 

·        1 <= nums.length <= 2 * 104 

·        -1000 <= nums[i] <= 1000 

·        -107 <= k <= 107 

 

class Solution { 

    public int subarraySum(int[] nums, int k) { 

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

        int[] sums = new int[nums.length];    

        int sum = 0; 

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

            sum += nums[i]; 

            sums[i] = sum; 

        } 

        int count = 0; 

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

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

                int current = nums[i] + (sums[j] - sums[i]); 

                if (current == k){ 

                    count += 1; 

                } 

            } 

        } 

        return count; 

    } 

} 

 

[1,3], k=1 => 1 

[1,3], k=3 => 1 

[1,3], k=4 => 1 

[2,2], k=4 => 1 

[2,2], k=2 => 2 

[2,0,2], k=2 => 4 

[0,0,1], k=1=> 3 

[0,1,0], k=1=> 2 

[0,1,1], k=1=> 3 

[1,0,0], k=1=> 3 

[1,0,1], k=1=> 4 

[1,1,0], k=1=> 2 

[1,1,1], k=1=> 3 

[-1,0,1], k=0 => 2 

[-1,1,0], k=0 => 3 

[1,0,-1], k=0 => 2 

[1,-1,0], k=0 => 3 

[0,-1,1], k=0 => 3 

[0,1,-1], k=0 => 3