Apex Engineer

I choose to remember Brandon Gilles. A great loss to the nation and the only peer mentor I’ve lost who was younger than me.

No truer words could have been choosen at his wake. You always knew where he stood and where he could be found. In the arena; right next to you; driving tangible value add results at all hours.

“It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming; but who does actually strive to do the deeds; who knows great enthusiasms, the great devotions; who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be with those cold and timid souls who neither know victory nor defeat.”  - Theodore Rosevelt 1910

DALL-E 2 helped me visualize which Arena he may be in now.

Forever part of the Heard. Shoulder to shoulder. Fight, fight, fight!

I used GPT-4 to help write a python 3 script to rewrite and link new versions of the 1910 speach to be more modern and relevant to the Apex engineer.

import re
import random

def binary_logic_choice(options):
    # Randomly choose option A or B
    choice_A_or_B = random.choice(["A", "B"])
    choice = options.get(choice_A_or_B, "")
    
    # Implementing binary digital logic to decide if option C should be picked
    pick_A = random.choice([True, False])
    pick_B = random.choice([True, False])
    
    if (pick_A and not pick_B) or (pick_A and pick_B):
        choice = options.get("C", "")
    
    return choice

def adapt_quote_for_value_driven_engineer(quote):
    # Dictionary to replace key terms
    replacements = {
        "critic": {"A": "skeptic", "B": "doubter", "C": "cynic"},
        "man": {"A": "apex engineer", "B": "value-driven engineer", "C": "elite technologist"},
        "strong man": {"A": "leading engineer", "B": "master engineer", "C": "chief innovator"},
        "doer of deeds": {"A": "provider of solutions", "B": "creator of value", "C": "innovation leader"},
        "arena": {"A": "lab", "B": "industry", "C": "technological frontier"},
        "face is marred by dust and sweat and blood": {
            "A": "mind is filled with calculations and optimizations",
            "B": "hands are skilled from prototyping and programming",
            "C": "soul is imbued with resilience and ambition"
        },
        "strives valiantly": {"A": "innovates relentlessly", "B": "strategizes effectively", "C": "works passionately"},
        "errs, who comes short again and again": {
            "A": "debugs, revisits designs often",
            "B": "refines, tweaks systems continuously",
            "C": "iterates, learns constantly"
        },
        "effort without error and shortcoming": {
            "A": "value without continuous improvement",
            "B": "innovation without setbacks",
            "C": "growth without challenge"
        },
        "do the deeds": {"A": "deliver the value", "B": "realize the projects", "C": "make the breakthroughs"},
        "knows great enthusiasms, the great devotions": {
            "A": "has a passion for excellence",
            "B": "a commitment to quality",
            "C": "an obsession with performance"
        },
        "spends himself in a worthy cause": {
            "A": "invests himself in high-impact projects",
            "B": "commits himself to value-driven goals",
            "C": "dedicates himself to game-changing initiatives"
        },
        "triumph of high achievement": {
            "A": "milestone of exceptional value",
            "B": "peak of unparalleled solutions",
            "C": "zenith of groundbreaking impact"
        },
        "fails while daring greatly": {
            "A": "fails while pushing boundaries",
            "B": "falls short while aiming for the extraordinary",
            "C": "stumbles while challenging the status quo"
        },
        "cold and timid souls who neither know victory nor defeat": {
            "A": "those who avoid risks and never innovate",
            "B": "those who maintain the status quo, never realizing potential",
            "C": "those too cautious to step outside their comfort zones"
        },
    }

    adapted_quote = quote
    for word, replacement_options in replacements.items():
        replacement = binary_logic_choice(replacement_options)
        adapted_quote = re.sub(rf'\b{word}\b', replacement, adapted_quote, flags=re.IGNORECASE)

    return adapted_quote

if __name__ == "__main__":
    original_quote = ("It is not the critic who counts; not the man who points out how the strong man stumbles, "
                      "or where the doer of deeds could have done them better. The credit belongs to the man "
                      "who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; "
                      "who errs, who comes short again and again, because there is no effort without error and shortcoming; "
                      "but who does actually strive to do the deeds; who knows great enthusiasms, the great devotions; "
                      "who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, "
                      "and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be "
                      "with those cold and timid souls who neither know victory nor defeat.")
    
    adapted_quote = adapt_quote_for_value_driven_engineer(original_quote)
    print("Adapted Quote for a Value-Driven Apex Electrical Engineer:\n")
    print(adapted_quote)


Adapted Quote(s) for a Value-Driven Apex Electrical Engineer:

It is not the doubter who counts; not the apex engineer who points out how the strong apex engineer stumbles, or where the provider of solutions could have done them better. The credit belongs to the apex engineer who is actually in the technological frontier, whose soul is imbued with resilience and ambition; who innovates relentlessly; who iterates, learns constantly, because there is no growth without challenge; but who does actually strive to make the breakthroughs; who an obsession with performance; who dedicates himself to game-changing initiatives; who at the best knows in the end the zenith of groundbreaking impact, and who at the worst, if he fails, at least falls short while aiming for the extraordinary, so that his place shall never be with those those too cautious to step outside their comfort zones.

GPT-4 Python 3 Script

It is not the skeptic who counts; not the technologist who points out how the strong technologist stumbles, or where the solver of problems could have done them better. The credit belongs to the technologist who is actually in the lab, whose eyes are tired from late-night debugging; who codes relentlessly; who makes bugs, faces failed tests again and again, because there is no project without debugging and issues; but who does actually strive to complete the projects; who feels the excitement of discovery, the loyalty to the team; who gives his best to meaningful projects; who at the best knows in the end the success of a breakthrough, and who at the worst, if he fails, at least misses the mark while pushing boundaries, so that his place shall never be with those those too cautious to experiment and learn.

GPT-4 Python 3 Script

1 Corinthians 13

If I speak in the tongues of men or of angels, but do not have love, I am only a resounding gong or a clanging cymbal. If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but do not have love, I am nothing. If I give all I possess to the poor and give over my body to hardship that I may boast, but do not have love, I gain nothing.

Love is patient, love is kind. It does not envy, it does not boast, it is not proud. It does not dishonor others, it is not self-seeking, it is not easily angered, it keeps no record of wrongs. Love does not delight in evil but rejoices with the truth. It always protects, always trusts, always hopes, always perseveres.

Love never fails. But where there are prophecies, they will cease; where there are tongues, they will be stilled; where there is knowledge, it will pass away. For we know in part and we prophesy in part, but when completeness comes, what is in part disappears. When I was a child, I talked like a child, I thought like a child, I reasoned like a child. When I became a man, I put the ways of childhood behind me.  For now we see only a reflection as in a mirror; then we shall see face to face. Now I know in part; then I shall know fully, even as I am fully known.

 And now these three remain: faith, hope and love. But the greatest of these is love.

Young Bulls At Play

I spent an hour of my life watching these two young bulls play in the central Serengeti National Park. Occasionally, a 3rd slightly older bull would try to join in… to no avail. The naturalistic observation really impacted me. I think of them often.

AOSP Code Growth

~11 million lines of Java in Marshmellow release 1 (tag 6.0.1_r1)!

aosplinesofcodewwatermark

The XML trend line is linear and both Java and CPP are polynomial to the 2nd order. Is it possible there will be ~20 million lines of Java by release ‘O’?

aospcodegrowthtrendlineswatermark

 

Spyderco Rescue Assist

The more activities you do outside, the more you’ll find yourself looking for a reliable self rescue knife. Spyderco, a Colorado company, makes the perfect knife for every outdoor enthusiast; The Spyderco Rescue Assist.

SC79PSOR

Built to perfection for paramedics, this multipurpose tool deserves a spot in your pack for any activity potentially requiring self rescue. This purpose built knife can cut or “chomp” just about anything, including climbing rope, rappel slings, seat-belts and clothing. It can break glass with its built in retractable carbide tip that protrudes out from the base when compressed and can alert others using the embedded handle whistle.  The high friction handle can be securely gripped in any scenario and the base lanyard loop makes for easy carrying on your alpine rack.

Spend your time underwater blowing bubbles? Scuba divers should snag the “salt” version.

Damned Figment of the Imagination

“It is a great profession. There is the fascination of watching a figment of the imagination emerge through the aid of science to a plan on paper. Then it moves to realization in stone or metal or energy. Then it brings jobs and homes to men. Then it elevates the standards of living and adds to the comforts of life. That is the engineer’s high privilege.

The great liability of the engineer compared to men of other professions is that his works are out in the open where all can see them. His acts, step by step, are in hard substance. He cannot bury his mistakes in the grave like the doctors. He cannot argue them into thin air or blame the judge like the lawyers. He cannot, like the architects, cover his failures with trees and vines. He cannot, like the politicians, screen his shortcomings by blaming his opponents and hope the people will forget. The engineer simply cannot deny he did it. If his works do not work, he is damned…

On the other hand, unlike the doctor his is not a life among the weak. Unlike the soldier, destruction is not his purpose. Unlike the lawyer, quarrels are not his daily bread. To the engineer falls the job of clothing the bare bones of science with life, comfort, and hope. No doubt as years go by the people forget which engineer did it, even if they ever knew. Or some politician puts his name on it. Or they credit it to some promoter who used other people’s money . . . But the engineer himself looks back at the unending stream of goodness which flows from his successes with satisfactions that few professions may know. And the verdict of his fellow professionals is all the accolade he wants.”

-Herbert Hoover

Custom Android Resource Files

Android resource files are a great way to keep your data separate from your code. It works great as long, as all you need is one of the supported types. What do you do if you have a more complex static data type that you’d like to manage independently of the code?

The answer is to create a ‘raw’ XML file under the /res/xml directory and write the parser logic yourself. For example, let’s say you want to compare the elevation of the mountains in your state. As mountains tend to stick around a while, there is no reason to query a database every time you want an elevation. Instead, you can simply create a static XML file like so:

/res/xml/mountain_data.xml

<?xml version="1.0" encoding="utf-8"?>
<mountains>

    <mountain
        name="Mt. Elbert"
        county="Lake"
        elevation="14433"
        lat="39.11807"
        long="-106.445417"
        range="Sawatch"
        rank="1" />
    <mountain
        name="Mt. Massive"
        county="Lake"
        elevation="14421"
        lat="39.187298"
        long="-106.475548"
        range="Sawatch"
        rank="2" />
    <mountain
        name="Mt. Harvard"
        county="Chaffee"
        elevation="14420"
        lat="38.924328"
        long="-106.320618"
        range="Sawatch"
        rank="3" />

</mountains>

Custom resource types don’t get fully precompiled into the ‘R’ class, and hence, you need to load and parse them yourself. At runtime simply load the file using
Resources.getXML(R.fileId) and then parse the data using XmlResourceParser. This parser is very basic and steps through each element every time you call
next(). With each element you can call getEventType() to determine if its a close or open tag. The following code will load, parse and store the elevation
of each mountain in the resource file into a list.

        List<String> elevations = new ArrayList<String>();
        Resources res = getResources();
        XmlResourceParser xrp = res.getXml(R.xml.mountain_data);
        try{
            xrp.next(); // skip first 'mountains' element
            while (xrp.getEventType() != XmlResourceParser.END_DOCUMENT) {
                xrp.next(); // get first 'mountain' element
                if(xrp.getEventType() == XmlResourceParser.START_TAG) {
                    // double check its the right element
                    if(xrp.getName().equals("mountain")) {
                        // extract the data you want
                        int count = xrp.getAttributeCount();
                        String name = xrp.getAttributeValue(null, "name");
                        String elev = xrp.getAttributeValue(null, "elevation");

                        // add elevation to the list
                        elevations.add(elev);

                        Log.v(TAG, "Attribute Count " + count);
                        Log.v(TAG, "Peak Name " + name);
                    }
                }
            }
        } catch (Exception e) {
            Log.w(TAG, e.toString());
        } finally {
            xrp.close();
            Log.i(TAG, elevations.toString());
        }

Doing this allows you to shrink or expanded the number of mountains without impacting or touching any code.

AOSP lines of code Donut through Marshmallow

First Gist/Wordpress embedded shortcode post… #oldnews #newdata

ipython
import rglob

android-1.6_r1.4

rglob.lcount("/home/chris/aosp_android-1.6_r1.4/", "*.java")
2687649
rglob.lcount("/home/chris/aosp_android-1.6_r1.4/", "*.cpp")
1994029
rglob.lcount("/home/chris/aosp_android-1.6_r1.4/", "*.xml")
1926342

android-2.3.6_r1

rglob.lcount("/home/chris/aosp_android-2.3.6_r1/", "*.java")
3875476
rglob.lcount("/home/chris/aosp_android-2.3.6_r1/", "*.cpp")
2366776
rglob.lcount("/home/chris/aosp_android-2.3.6_r1/", "*.xml")
4640773

android-4.1.2_r1

rglob.lcount("/home/chris/android/google", "*.java")
6172018
rglob.lcount("/home/chris/android/google", "*.xml")
8299084
rglob.lcount("/home/chris/android/google", "*.cpp")
4565380

android-4.4.2_r1
rglob.lcount("/home/chris/android/google", "*.java")
7473838
rglob.lcount("/home/chris/android/google", "*.xml")
6592088
rglob.lcount("/home/chris/android/google", "*.cpp")
6394997

android-5.1.1_r1
rglob.lcount("/home/chris/android-5.1.1_r1/", "*.java")
9118187
rglob.lcount("/home/chris/aosp_android-5.1.1_r1/", "*.cpp")
8886230
rglob.lcount("/home/chris/aosp_android-5.1.1_r1/", "*.xml")
7589145


android-5.1.1_r33

rglob.lcount("/home/chris/aosp_android-5.1.1_r33/", "*.java")
9118930
rglob.lcount("/home/chris/aosp_android-5.1.1_r33/", "*.cpp")
8886171
rglob.lcount("/home/chris/aosp_android-5.1.1_r33/", "*.xml")
7589235

android-6.0.1_r1

rglob.lcount("/home/chris/aosp_android-6.0.1_r1/", "*.java")
11152748
rglob.lcount("/home/chris/aosp_android-6.0.1_r1/", "*.cpp")
7474792
rglob.lcount("/home/chris/aosp_android-6.0.1_r1/", "*.xml")
8541919

android-7.1.1_r6

rglob.lcount("/home/chris/aosp_android-7.1.1_r6/", "*.java")
13791434
rglob.lcount("/home/chris/aosp_android-7.1.1_r6/", "*.cpp")
9293002
rglob.lcount("/home/chris/aosp_android-7.1.1_r6/", "*.xml")
10426189

android-8.0.0_r36

rglob.lcount("/home/chris/aosp_android-8.0.0_r36/", "*.java")
14834273
rglob.lcount("/home/chris/aosp_android-8.0.0_r36/", "*.cpp")
11164833
rglob.lcount("/home/chris/aosp_android-8.0.0_r36/", "*.xml")
8723334