Thursday, July 23, 2020

The Declaration of Independence, not the US Constitution, is our National Foundational Document

We're often told that the USA is not a Christian nation. However, Abraham Lincoln, in his Gettysburg Address, justified the Civil War, and by implication his Emancipation Proclamation (freeing the slaves in the Confederate States), by appealing to the Declaration of Independence as our foundational document, even more foundational than the US Constitution. That Declaration serves as the very core piece of why we were justified in seceding from Great Britain and in forming a new nation, and why the Civil War was fought.

That Declaration states quite clearly that "all men are created equal", and "that they are endowed with certain unalienable rights", and that "governments are instituted among men" to secure these rights.

That document further states that the signers are "appealing to the Supreme Judge of the world" for the rightness of their declaration, and did so "with a firm reliance on the protection of Divine Providence".

So when Lincoln delivered his Gettysburg Address, he referred back to this document as the justification for the US, and for the subsequent Civil War, so that we, "one nation, under God", might resolve to be dedicated to the unfinished work of the signers of the Declaration, and so that our nation "shall have a new birth of freedom -- and that government of the people, by the people, and for the people, shall not perish from the earth".

I say all this to say this: the US Constitution, while being our supreme law regulating our government, is not the supreme law (or even supreme document - the Declaration is) that regulates our nation. A US President who reminds the people of this is a president who could turn the country back to its Creator, and to our unalienable rights, and to freedom.

Wednesday, July 15, 2020

The US Civil War: About Independence, or about Slavery?

If Utah wants to allow polygamy, and the Federal Government says, "No", then Utah would be within its right to secede, provided polygamy was voluntary and not mandated to its citizens.

If Utah wants to force polygyny (multiple wives), and the Federal Government says, "No", and any of the women in Utah object to being in a polygynous marriage, then Utah's attempt to secede must be allowed only if the objectors, and future objectors, are, and will be, allowed to leave Utah.

If the Confederate States of America want to force servitude on Blacks, and the Federal Government says, "No", and any of the Blacks in the CSA object to being enslaved, then the CSA's attempt to secede must be allowed only if the objectors, and future objectors, are, and will be, allowed to leave the CSA.

The War Between the States was not about "Independence"; it was about the issue of "Slavery". And if it were about the philosophical ideal of "Independence", the advocates were inconsistent with their ideal, and they were hypocritical, demanding independence for themselves while denying it to the people they enslaved.
 
The Confederate Flag evokes among many a pride in "Us" of the Southern States, when "we" were an independent nation. But that flag is flown from a pole of, not independence, but slavery. As fond as I am of the independence associated with the rebel flag, I have to acknowledge that this association has been only in my mind, and not in reality. The US Civil War was about slavery, not independence.

Thursday, July 02, 2020

How We Can Make Every American Citizen Wealthy in One Generation

The average Social Security monthly check is about $1400. That's $16,800 per year. Let's round it down to 16K.

Rather than focus on government pay-outs of $16,000 a year at the end of someone's life, maybe for five, ten, or thirty years, let's put that money to work at the start of someone's life.

For every baby born to legal American citizens (or a mother legitimately in process of becoming a citizen), we give $30,000 to the baby.

This money is broken up into three individual tax-deferred savings accounts.

One account is a normal IRA, and can't be touched (without hefty penalties) until the person reaches age 60.

The second account is an Education Payment Plan (EPP). The funds are untouchable until age 18, and if a degree is not earned from an accredited institution by age 28, 3/4s of the fund is returned to the government, and the remaining quarter can be rolled over into either of the other two accounts. If a two-year degree is earned, the government return is only half. If the person dies prior to 28, all the funds return to the government.

And the third is a Health Savings Plan (HSP). The funds are untouchable prior to age 24 (the child is hopefully on the parents' insurance until then), at which time the funds can be used to pay insurance premiums or qualified medical expenses. In the case of death prior to age 60, half the funds are accessible to the surviving family, and half are returned to the government. After 60, one-quarter goes to the government, and the survivors keep 75%.

Withdrawals after maturation dates are subject to normal taxation.

Assuming an average rate of interest on each account of 6% with no additional contributions being made, the EPP would have about $25,500 in the account. Maybe not enough to pay completely for college, but it'd help a lot.

Same situation with the HSP, the person would have about $40,500. Again, not much considering how expensive medicine and insurance premiums are, but a help.

And the same conditions with the IRA nets the retiree nearly $330,000. Not a huge nest egg, but for doing nothing, it ain't bad.

Now, let's take those same accounts, and have the person add $10 to each account every month (that's $30 a month). The EPP jumps to $32,000; the HSP goes to $46,500; and the IRA goes to $394,000.

But let's look at six other scenarios.

1 - An interest rate of 8% instead of 6%.

EPP = $40,000
HSP = $63,500
IRA = $1,000,000 (that's one million!)

2 - An interest rate of 6% and $100/month contributions

EPP = $65,500
HSP = $101,500
IRA = $970,000

3 - An interest rate of 8% and $100/month contributions

EPP = $85,000
HSP = $143,500
IRA = $2,500,000

4 - An initial investment of $60,000 instead of $30K, with 6% and $10/month

EPP = 61,000
HSP = $87,000
IRA = $724,000

5 - $60K, 6%, $100/month contributions

EPP = $94,000
HSP = $142,000
IRA = $1,300,000

6 - $60K, 8%, $100/month

EPP = $125,000
HSP = $207,000
IRA = $3,500,000

All this, for the cost of two (or four years in the case of #s 4, 5, and 6) of an average Social Security payout. The go-getters would be more aggressive with their monthly contributions (for example, I'm paying quite a bit more to my monthly IRA - this plan would have saved me a lot!), but even the laziest do-nothings would still wind up with a nice little retirement package ($330K would pay out $2000 a month for almost 14 years (taxed, so maybe back down to $1400/month take-home), even without the continued growth of the fund as it was paid out - so even longer considering that growth). Plus, much of the initial investment by the government would be recouped by the early deaths and non-college grads.

This would not replace all the social services needed, but it'd make a huge dent, and perhaps more importantly, reduce the governmental Nanny state.

Maybe I'm missing something, but it seems to me that the numbers work.

Friday, June 26, 2020

Draw Boxes, etc, on Debian GNU/Linux Terminal Window With Go Lang & tcell

     A cleaner version of this document is here.
Draw Boxes, etc, on Debian GNU/Linux
Terminal Window With
Go Lang
&
tcell

Have a functioning Debian system.

Install go

# apt install go

Make sure go works:

Create a workspace directory and cd into it; something like:

$ mkdir ~/PROGRAMMING/GO/HELLOWORLD
$ cd ~/PROGRAMMING/GO/HELLOWORLD

Create a test “helloworld.go” file with the following:

package main

import (
    "fmt"
)

func main() {
    fmt.Println("Hi")
}

Compile it:

$ go build helloworld.go

Be aware that if you copy and paste from this document into a text editor, the quote marks might paste as “smartquotes”, causing your program to generate errors during compilation. In such a case, just manually delete and retype the quote marks.

Run it, to test:

$ ./helloworld

Do a basic app to draw a character on the “graphical” screen

Create a new workspace for our box-drawing program: and cd into it:

     $ mkdir ~/PROGRAMMING/GO/BOXES
    $ cd ~/PROGRAMMING/GO/BOXES

Create a new program file, “boxes.go”, and put the following code into it:

package main
/*
 This code draws a single character (or 'rune', or 'glyph') at a single
 location on a terminal window in Debian GNU/Linux.
*/

import (
     "fmt"
"os"
"time"
     "github.com/gdamore/tcell"
) // end of import

func main() {
// Create a "canvas" (a window, frame) on which to draw
// ‘s’ is the name of the screen/canvas on which we’ll draw
// ‘e’ is some error information the NewScreen() method insists on generating
// (NewScreen() returns both values, so we have to deal with both)
s, e := tcell.NewScreen()

// Deal with the ‘e’ value by checking for some error situations; exit if need be
// (Requires "os" package in "import" section at top.)
if e != nil {
        fmt.Fprintf(os.Stderr, "%v\n", e)
        os.Exit(1)
}
if e = s.Init(); e != nil {
         fmt.Fprintf(os.Stderr, "%v\n", e)
         os.Exit(1)
     }

// Set the 's' canvas’s default bg & fg colors from tcell’s list of colors
s.SetStyle(tcell.StyleDefault.
    Foreground(tcell.ColorWhite).
    Background(tcell.ColorBlack))

// Clear the "canvas"
s.Clear()

// Create a “glyph” using the “rune” (character) we want to draw
glyph := rune('W')

// Create and set the coordinates for where we'll draw our character ('glyph', 'rune')
x := 10
y := 20

// Create and set variables for foreground and background colors
fg := tcell.ColorYellow
bg := tcell.ColorBlue

// We need to send an entire “clump” of tcell info to the 
// SetCell() command below, so we’ll create a copy of the
// default tcell “clump” named ‘st’, and then modify the
// bg & fg colors to what we set above, for just this copy,
// which will be what we draw the cell with.
st := tcell.StyleDefault
st = st.Background(bg)
st = st.Foreground(fg)

// Place the cell at the desired location, with our copy of the tcell “clump”,
// and the glyph we want to draw.  All the cells of the ‘s’ screen/canvas
// except this one will get the default settings, such as the black background.
s.SetCell(x, y, st, glyph)

// Nothing has actually been drawn on screen yet; so unveil the "canvas"
s.Show()

// Pause X seconds before resetting "graphics" screen to normal
// time.Second is the unit (a second); time.Duration is how many units
// (Requires “time” package in the “import” section at top.)
secondsToSleep := time.Duration(3) * time.Second
time.Sleep(secondsToSleep)

//Reset screen to normal
s.Fini()
} // end of main()

Compile it:

$ go build boxes.go

If you get an error like ‘cannot find package "github.com/gdamore/tcell"’,

    $ go get github.com/gdamore/tcell

Run it, to test:

$ ./boxes

You should see the terminal window turn black, and then a yellow “W” printed on a blue background at 10 characters in from the left of the terminal window and 20 lines down from the top of the terminal window.

Feel free to tinker with the settings in this program and recompile/re-run until you feel comfortable with what the program is doing.

Move the Actual Drawing Part into a function

Modify your program so it looks like the one below. Note that the bulk of the program listing has been replaced here with an ellipses (“...”), but you won’t do that in your program listing. I’m only doing so here to make this document less cumbersome. Note also that functions do not have to be below the main() function; they can be above if that’s your preference.

package main
/*
 This code draws a single character (or 'rune', or 'glyph') at a single
 location on a terminal window in Debian GNU/Linux.
*/

import (
...
) // end of import

func main() {
...
} // end of main()

func drawChar(s tcell.Screen, x, y int, fg, bg tcell.Color, glyph rune) int {
    // We need to send an entire “clump” of tcell info to the
    // SetCell() command below, so we’ll create a copy of the
    // default tcell “clump” named ‘st’, and then modify the
    // bg & fg colors to what we set above, for just this copy,
    // which will be what we draw the cell with.
    st := tcell.StyleDefault
    st = st.Background(bg)
    st = st.Foreground(fg)

// Place the cell at the desired location, with our copy of the tcell “clump”,
// and the glyph we want to draw. All the cells of the 's' screen/canvas
// except this one will get the default settings, such as the black background.
s.SetCell(x, y, st, glyph)
return 0
} // end of drawChar()

You’ll notice that the four lines (one line of code, and three lines of comment) were copied from the main() func into the drawChar() func.
Now, of those four lines in main(), leave the three comment lines for now, and replace just the one line of:

s.SetCell(x, y, st, glyph)

with the single line of:

drawChar(s tcell.Screen,, x, y, fg, bg, glyph)

Note also that a new line of “return 0” was added to the bottom of the drawChar() function. I think it’s a good practice to provide a return value from functions. The last “int” of the top line of the function specifies that the return value will be an integer; since we’re assuming everything will work without error, we’re returning a return value of zero, which is usually interpreted to mean “no errors occurred while running this function”. We’re not actually doing anything with this return value, but we could do something like:
   
retVal := drawChar(s tcell.Screen, x, y, fg, bg, glyph)
    If retVatl != 0 (print some error information to the screen or to a log file, etc)

If you compile and run this new code, you should see the same result on the screen.

It may seem like you’ve added some unneeded complexity to your program (which I’ll explain about a bit in a bit), but you’ve just made it easier to draw new characters on the screen. For example, just before the existing lines that say:

// Nothing has actually been drawn on screen yet; so unveil the "canvas"
s.Show()

add these lines:

x = 30
y = 10
fg = tcell.ColorRed
bg = tcell.ColorGreen
glyph = rune(‘?’)
drawChar(s, x, y, fg, bg, glyph)

Now compile and run your program. In addition to the “W” you saw earlier, you should now see a red “Y” on a green background 30 columns in and 10 rows down.

Now for Some Explanation

The function drawChar() expects some information from the main program (aka, the main() function). These pieces of information are sent to the function by the line that calls the function:

drawChar(s, x, y, fg, bg, glyph)

And the function’s top line defines what it expects as incoming information to the function:

func drawChar(s tcell.Screen, x, y int, fg, bg tcell.Color, glyph rune) int {

The number and types of arguments (or parameters) sent to the function must match the number and types of arguments (parameters) expected by the function.

In this case, I used the same names for the outgoing information as for the incoming information, but it’s important to know that (in this case, at least) the incoming information is only a copy of the outgoing information; the variables have the same names, and a copy of the same values, but they are completely different variables in the function than in the main program. Just as Paul Simon the musician and Paul the Apostle from the Bible have the same name “Paul”, they are completely different people, and the “fg” variable in the main program and which is being sent to the function is a completely different variable than the “fg” variable used in the function, even though ti has the same name and an identical copy of the variable’s value.

If we wanted to do so, we could have used different names in the function, like this:

func drawChar(screenOnWhichToDraw tcell.Screen, x_coordinate, y_coordinate int, foreground_color, background_color tcell.Color, charToDisplay rune) int {

The types of the arguments specify what type of information is in the variable.

For example, the ‘s’ (or ‘screenOnWhichToDraw’) variable holds a “clump” of data that is predefined in the tcell package, named “Screen” (thus, it’s referenced as “tcell.Screen”).

The ‘x’ and ‘y’ variables are integers (referenced as “int”), which means they’re just normal “counting numbers”, not fractions or weird imaginary numbers or having decimal points, etc, just -2 or 6 or 248, etc.

The ‘fg’ and ‘bg’ variable are also a pre-defined type from the tcell package, named “Color” (referenced as “tcell.Color”).

And the “glyph” variable is a type named “rune”. A “rune” is a special case of 32-bit integer used with Unicode characters. Just think of them as any character you might find on a computer keyboard, even in far-off places that use weird symbols instead of English alphabetic characters. For example, the letter “W” is a rune; so is ‘w’, and so are ‘╔’ and ‘&’, although “under the hood” the computer really sees them as 32-bit integers. If you remember your ASCII studies from your high-school Computer Literacy Class, ASCII chars are runes.

So the main program sets up a “screen” with a default white lettering on a black background, and sends a copy of that to the drawChar() function as ‘s’ (or ‘screenOnWhichToDraw’). It sends a copy of the X and Y coordinates, and a copy of the foreground and background colors to use for drawing the one cell that will change in the function, and a copy of the rune that we’ll draw in that one cell.

When the function gets all these copies, it creates a new copy of the “clump” of information containing all the style defaults provided by the tcell package, named “st”, and then modifies two of those styles, the foreground and background colors, and then sends that “clump” of information, along with the x and y coordinates and the glyph rune, to the screen’s “SetCell” function, which sets one cell on the screen according to all that information.

Now, Let’s Draw a Box

Let’s create a brand-new function. Leave the old drawChar() function in place; even if we decided to remove the calls for that function from the main program, and never use that function again, it doesn’t hurt us to have it in our program listing file just sitting there doing nothing.

After the last line of the drawChar() function, create this code:

...
} // end of drawChar()


func drawBox(s tcell.Screen, leftEdge, topEdge, width, height int, fg, bg tcell.Color) int {
    // Calculate bottom-right corner of box
    rightEdge := leftEdge + width
    bottomEdge := topEdge + height
    glyph := ' '        // Create a rune variable

    glyph = ‘╔’
    drawChar(s, leftEdge, topEdge, fg, bg, glyph)

glyph = ‘╗’
    drawChar(s, rightEdge, topEdge, fg, bg, glyph)

glyph = ‘╚’
    drawChar(s, leftEdge, bottomEdge, fg, bg, glyph)

glyph = ‘╝’
    drawChar(s, rightEdge, bottomEdge, fg, bg, glyph)

    s.Show()

    return 0
}

Depending on your operating system, there are different ways of entering in these characters. On my Debian GNU/Linux box, I enter such a rune by pressing Ctrl-Shift-U, which will create an underlined ‘u’, then typing in the Unicode number for the character I want. I find the easiest way to find these codes is to web-search for “Unicode character set box-drawing” and using the first Wikipedia hit I get.

To create ‘╚’, I press Ctrl-Shift-U, then 255a, then ENTER.

Next, create the drawbox() calling line (and it’s comment, “Draw a box”, and a blank line above that, leaving the rest of the contextual lines around it alone):

    ...
glyph = rune('?')
drawChar(s, x, y, fg, bg, glyph)

// Draw a box
drawBox(s, x, y, 20, 4, tcell.ColorWhite, tcell.ColorBlack)

// Nothing has actually been drawn on screen yet; so unveil the "canvas"
s.Show()
    ...

When you compile and run this, you should have the four corners of a box.

Note that since we left the starting x & w the same as when we drew the ‘?’, the top-left rune of the box overwrote that ‘?’.

Also notice that I used “magic numbers” in this line; six months from now, when you go to look at this code, you won’t remember what the “20” and “4” represent, or what the colors color. It’s a bad habit to use “magic numbers”, so let’s replace those with more meaningful identifiers:

    ...
glyph = rune('?')
drawChar(s, x, y, fg, bg, glyph)
boxWidth := 20
boxHeight := 4
boxForeGroundColor := tcell.ColorWhite
boxBackGroundColor := tcell.ColorBlack
drawBox(s, x, y, boxWidth, boxHeight, boxForeGroundColor, boxBackGroundColor)

// Nothing has actually been drawn on screen yet; so unveil the "canvas"
s.Show()
   

Now we need to finish drawing the perimeter lines of the box.

If we try to draw the perimeter line after we’ve drawn the corners, we’ll have to make exceptions for the corners, and that can get messy. So instead, let’s draw the entire box, then re-draw the corners with the correct runes. To start, let’s draw the first and last lines with ‘═’ (Ctrl-Shift-U, 2550, Enter), from leftEdge to rightEdge, then the left and right edges, and then finally the four corners, like so:

func drawBox(s tcell.Screen, leftEdge, topEdge, width, height int, fg, bg tcell.Color) int {
    // Calculate bottom-right corner of box
    rightEdge := leftEdge + width
    bottomEdge := topEdge + height
    glyph := ' '        // Create a rune variable

    // Draw the top and bottom lines of box
    glyph = '═'
    for x := leftEdge; x <= rightEdge; x++ {
        drawChar(s, x, topEdge, fg, bg, glyph)
        drawChar(s, x, bottomEdge, fg, bg, glyph)
    }
    
    // Draw the sides of box
    glyph = '║'
    for y := topEdge + 1; y <= bottomEdge; y++ {
        drawChar(s, leftEdge, y, fg, bg, glyph)   
        drawChar(s, rightEdge, y, fg, bg, glyph)   
    }
    
    // Draw the four corners of box
    glyph = '╔'
    drawChar(s, leftEdge, topEdge, fg, bg, glyph)
    glyph = '╗'
    drawChar(s, rightEdge, topEdge, fg, bg, glyph)
    glyph = '╚'
    drawChar(s, leftEdge, bottomEdge, fg, bg, glyph)
    glyph = '╝'
    drawChar(s, rightEdge, bottomEdge, fg, bg, glyph)

    // Display the screen
    s.Show()
    
    return 0
}

Now you can draw more boxes just by adding more drawBox() lines in main(), like so:

...
// Draw a box
boxWidth := 20
boxHeight := 4
boxForeGroundColor := tcell.ColorWhite
boxBackGroundColor := tcell.ColorBlack
drawBox(s, x, y, boxWidth, boxHeight, boxForeGroundColor, boxBackGroundColor)

// Draw box #2
x = 40
y = 8
boxWidth = 10
boxHeight = 6
boxForeGroundColor = tcell.ColorYellow
boxBackGroundColor = tcell.ColorBlack
drawBox(s, x, y, boxWidth, boxHeight, boxForeGroundColor, boxBackGroundColor)

// Draw box #3
x = 3
y = 2
boxWidth = 5
boxHeight = 14
boxForeGroundColor = tcell.ColorRed
boxBackGroundColor = tcell.ColorYellow
drawBox(s, x, y, boxWidth, boxHeight, boxForeGroundColor, boxBackGroundColor)

We can even add a fill option. Add a boolean (true/false) variable, “fill”, to the drawBox() header line, like this:

func drawBox(s tcell.Screen, leftEdge, topEdge, width, height int, fg, bg tcell.Color, fill bool) int {

and change the function itself to this:

    ...
glyph := ' '        // Create a rune variable
    
    // If fill, fill in the entire box
    if fill {
    for y := topEdge; y <= bottomEdge; y++ {
                for x := leftEdge; x <= rightEdge; x++ {
                        drawChar(s, x, y, fg, bg, glyph)
                }
            }
    }

    // Draw the top and bottom lines of box
     ...

Then add a fill variable to the calling lines, like so:

fill := true    // or ‘false’
drawBox(s, x, y, boxWidth, boxHeight, boxForeGroundColor, boxBackGroundColor, fill)

(Remember the colon only on the first, declaration, of a new variable; otherwise leave the colon off.)