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, 10 but when completeness comes, what is in part disappears. 11 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. 12 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.

13 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

Android App Collection Widgets

Adding a “launcher” widget to your application can be a little convoluted even in recent 4.x AOSP releases. If you’re heading down this path, check out Google’s App Widget tutorial first. Take note that one of the more powerful concepts covered in the tutorial is “collections” or RemoteViews. I created the following UML static structure to help aid in designing your new collection widget.

appwidgetproviderwatermark

Creative Altruism

“Every man must decide whether he will walk in the light of creative altruism or in the darkness of destructive selfishness.”

Martin Luther King Jr.