Friday
Nov162018

Rust's rand::distributions

Rust's rand crate, a external library for generated randomness, moved from 0.5.5 to 0.6.0 and wow... what new goodies!  There are now ways to generate random distributions that follow a number of probability distributions.  Wow... so many non-uniform probability distributions (Normal, binomial, bernoulli, LogNormal, Poisson, Exp, Gamma, ChiSquared, StudentT, FisherF) are available hinting at genius and insanity obsession at once.  I love it!

Yes, actually love it.  Conceptually at least... still playing with it.  The big book of random (https://rust-random.github.io/book/intro.html) contends rand 0.6.0 isn't crypto grade, but I'll contend it is certainly aiming for full featured.  Slight worries about compile times and new version bloat... Historically rust doesn't seem to be great about take only what you need.  Then again, Rust's cargo library version manager makes my point mostly moot, opt in to an earlier version as you wish.  Almost pure goodness!

 

 

 

Saturday
Nov102018

Rust on Arduino

This fall I got a fun little Hallowing from Adafruit and thought I'd try to cross compile something in Rust Lang (https://www.rust-lang.org/) for it.  Wow that board is has 48Mhz speed demon with 32 Kb of RAM and and 256k flash rom program memory plus a !8MB! SPI flash drive loads and saves... and a 8192 color 128x128 dot TFT display with 4bit blues and reds and amazing 5bits for vibrant greens.  Easily twice the computational power of your average 1976 mars lander!   

The sorry state of the Rust programming language on Arduino right now is "I am not smart enuff to make it work".   I blindly hope that's changing... perhaps I am merely not patient enough.     I really thought rust+arduino might be a happy couple soon, not all that long ago, and the last AVR Rust language fork was released almost simultaniously with this post so perhaps they are yet destined to be together. (https://github.com/avr-rust).  

I'm a fan of Arduino C, and a fan of Rust.  Rust would be a strong choice for hack hardened electronics - the language is designed to be resistant to memory attacks and undefined states - weaknesses frequently exploited in compiled C.  Executable rust programs run nearly as speedy as C or faster if you can leverage low bar multithreading.)   If your next router was running rust, a good number of security vulunerabilities might just not exist in the way they do now.  

My present barriers to entry:

(1) RUST executable sizes are larger than ARDUINO C.  With effort not double, but still harrowing for a hallowing 32kb system.  

(2)  I don't presently have projects that really needs Rust's security or parallelism even if I would prefer to write in Rust.  If I take up programmed robotic painting again, a Raspberry Pi with multiple coresc and configured with 4mb of (slow) virtual memory should work for the build on device.  

(3) No Rustified Arduino cross compile IDE exists so far as I can tell, at least nothing like the sweet sweet https://www.arduino.cc/en/Main/Software.  Long arcane configurations and rustc command lines should not deter me, but do, especially when I follow examples and still get "That probably worked a few versions ago type" errors.

(4). Did I mention the "that probably worked a few versions ago with a specific unstable AVR fork off the main rust nightly branch " type errors?  Good news, there's a better way and I just don't seem to be up to speed yet.  Yea.  And I'm reaching for that single thread slow ass Ardino C IDE to do a library search again (The cross platform Arduino C IDE really is execellent in so many ways... super kudos to the Arduino team of Massimo Banzi, David Cuartielles, Tom Igoe and David A. Mellis.  If only they each loved rust... soft wet weeping sound ensues along with the the unformed thought "if only Claude Monet had painted entwined lovers atop just one of his usual pastoral haystacks in contented shades of iron oxide and colbalt turquoise.")

I do want to see Rust come to Ardino, and since it barely, almost, sort of, sputterlingly, has- maybe I should add "and BE EASY!"   I really think Arduino+Rust would make the world better.    I like C, but how much of the worlds computational security woes come from that code base?  Perfectly tallented C programmers write wonderful things that compile and run and still have hidden hordes of gremlins inside.   I really do hope the state of Rust on the Arduino platform changes soon... I'm not quite ready to jump in and swim yet.

Friday
Oct192018

Ugh. CNN Reports Spin News.

Link: index.html "Police officers in the US were charged with more than 400 rapes over a 9-year period"

This really sounds bad, even a police rape epidemic.  Far too many traffic stops resulting in victimization.  But how do police compare in this regard to the remainder of the population? 

CNN reports 405 rapes over 9 years by law enforcement officers.  Given a estimated US population of 327,445,198 (Google) people, and an estimated police force of 422,869 officers (Statistia US employment records) by my estimation there were total 153809 successfully prosecuted rapes in the last rolling calendar year in the United States.  This is a dismally low portion of the total number of rapes, but please accept that the number can not reasonably be argued to be even lower than the values that follow.

If police were committing this crime at national rates, roughly 1892 events would be recorded in the 9 year period.  So I conclude law enforcement is not offending at a rate higher than the general population in this regard.   Even if the police force is taken to be the 120,000 full time officers they offend at rates similar to the general population - which is actually still better than average men given strong male bias toward both the crime and the law enforcement career choice.

By in large, the police mostly suck because their job sucks.   My last happy interaction with one was "help find a likely teen suicide in a large park but if alive report to the professionals and do not engage" and I did and despite a long blood trail, it was not completely terrible until the teen's father showed up, and in random dark moments that father still haunts my memory more than his child.  I can't constrain what I saw into words, and won't judge.  Praise the Lord that isn't my day to day.  Police suck because far too many people suck.  But police don't suck because they commit rape at a rate higher than the general population.  

Saturday
Oct062018

The Nice and Accurate Prophecies of Agnes Nutter

Very nice book, full of good omens.  Highly recommended.  In an effort to chanel Agnes, I got this:
 
Kavanaugh, in victory dress, moves the court toward self enscribed rectitude.
Phyrric need named the crime and the deed, truth or lies are nobody's guess. 
Justice will take blindfold and weights, and hand down many a rule.
Remember her name, the rage and the shame, a burden for many more years.  
  
Hmm... I didn't explode... so maybe I didn't actually chanel Agnes.   I clearly channel the Nutter not, for my words are  those of this century and not 1672.  Still don't know why she let the town folk burn her as a witch when she had the foresight to pack her peticoat with gunpowder...   
Tuesday
Oct022018

Where in I Harp About Evolution Algorithms 

Reading comments posted to a unnamed websitemade me think most americans don't understand evolution.

Here's my TLDR on evolution:

(1) Evolution isn't about you.  Or even the fittest individual.  Its about the the fitness and diversity of the entire population that share genes as it faces many unpredictable* like challenges over many generations. 

(2) Sexual evolution is a problem solving algorithm powered by lives.  In a large diverse population almost nothing is left to chance.  In small homogeneous population, much more is left to long odds.  

(3)  Not knowing how evolution did something should not automatically be better than knowing it was done by design with Crispr or similar technologies.   

* unpredictable:  Besides just cranking out babies, try evolution's expansion pack featuring live play with 5 Million Trillion Trillion other indiviuals on levels like famine, disease, war, hunting, hunted, times of plenty, invasion, supernova radiance, parasites, habitat change, city sanitation, sinking islands, volcanic winters, plant biotoxins, animal venoms, rare energy sources, and of course meteor impacts.