Are mandatory #AmberAlert messages less than useless?

October 2, 2019 Incoherent ramblings , , ,

I received two supremely annoying Amber alerts on my phone yesterday.  They appear to be specifically designed to maximize intrusiveness, which is quite counterproductive, as the natural response is to shut down the incessant pinging as quick as you can. I’ll elaborate on why I consider that these alerts have no value (actually negative value) below.

The thought and action process to deal with the alert is modeled by the following internal dialogue: “Gaghg … what the hell is that noise!?   Grab, swipe, clear.  Thank god I wasn’t wearing my headphones!”  I got a passing glance at the message in the process, enough to see that it was an Amber alert, but no more.

This was pretty much the same process as dealing with an accidental press of that stupid red panic button on a car key fob — you know the one, it’s always triggered because you are trying to hold your keys, phone, and two dribbling travel mugs in one hand, and a backpack, garbage from the car, and a bag of groceries in the other.  Like the Amber alert, the panic button just triggers more city noise that is ignored by everybody.  It’s been 30 years since car alarms have had any value, but for some reason, instead of just getting rid of them, the manufacturers have supplied an easy way to trigger then accidentally — but I digress.

When yesterday’s second Amber alert triggered, I knew the drill and was able to silence it quickly without even having to look at it.  It was time to turn to google and see if there was a way to avoid these.  It appears there’s a way to do that on an android, but for the ancient discarded iPhone-6s that I bought for $50 USD (and probably even newer models), I appear to be out of luck.  There’s a CRTC ruling that mandates these messages, and phone providers are not allowed to provide a mechanism to disable it. They are also sent with a priority so high that their intrusiveness is off the charts.

Ironically, making the message so intrusive, means that the rush to shut it off means that you loose any chance to actually look at the message.  This is a classic example of a government policy backfire, as the policy has the exact opposite effect than the intention.

Later in the day, having struck out with google, I noticed a an #AmberAlert hash tag beside my twitter stream.  My thought was, “Perfect, there’s got to be people who know how to deal with this there”, and I posted

There were a couple helpful responses, and the rest basically conformed to expectations that one has for the worst Jon-Ronson “So You’ve Been Publically Shamed” style twitter responses:

Reading those reactions, you’d think that I’m an advocate for kidnapping and abduction, perhaps child sex trafficking, and pedophilia too.  How could I be such a piece of shit heartless fucking bastard?  Why would I want to avoid a tiny inconvenience when kids lives are at stake? Sigh.

It is striking to observe first hand how easily people are willing to take up arms to shame somebody for a cause, despite not knowing anything about their thought process, or any possible nuances that underlie the perceived offense. It’s truly thoughtless mob mentality.

Understanding that so many people are unfortunate victims of media stranger-danger fear-porn, the vitriolic reactions of the people above make some sense.  Like useless car alarms, we’ve had 30+ years of the media pumping it’s danger is everywhere story.  Fear sells exceptionally.  However, all the worry that’s been drummed into us about the black van at the school taking off with the kids has been shown again and again to be unsubstantiated.  Most kidnappings are by family members, largely related to custody issues.  Kidnapping is the conflict resolution strategy for desperate white trash trailer park inhabitants who aren’t smart nor sober enough to realize that a split second decision of that nature will only backfire and result in no access to your kids, plus considerable jail time.

Unlike car alarms, media stranger danger carping is not just an annoyance, but has massive social consequences.  I’ve now lived in three Markham subdivisions in the last 20 years, where walking the streets would make you think that you are living in a retirement community.  There are no kids playing.  The parks and the streets are empty on weekends and after school.  Kids are kept corralled in their houses, or only let out for carefully supervised play.  This fear has also become institutionalized.  I know one mother who was afraid to let her 10 year old son out to play at the park alone or try to recruit friends for unsupervised park play, because she was worried that she would be vulnerable to a child protective services induced confiscation of her son.

I know that the media and fear of CPS aren’t the only factors that are keeping kids from outdoor play.  Video games, TV, and phones now also compound the problem.  We have a couple generations of effectively lost kids, who are all experts on the characters in the 10 Netflix or YouTube series that they’ve binge watched, in countless video games, or other useless knowledge sets.  They aren’t kids who know how to  play with each other, start conversations, get into fights and make up, or even look each other in the eyes.

The AmberAlert, in my eyes, is just another conduit for media related fear porn.  It is also useless.  I’ll never know anybody who’s name flashes by in an AmberAlert, not on my phone, on media, or one one of those highway signs.  I’ll never know anybody who knows somebody related to an AmberAlert.  The chances of one of these messages being relevant is effectively zero.  I probably have a better chance of winning the lottery.  If I look at 50 Amber alerts, there will be a 50x times more chance that it is relevant: 50 x 0.00000000001 = 0 — just like buying 50 lottery tickets.

You can find plenty of Amber alert advocates that claim they are effective, but it’s not hard to find research that shows the opposite.  One such example is this “After 20 years of AMBER Alerts… Are They Worth It?” research gate interview with Timothy Griffin, Associate Professor of Criminal Justice at the University of Nevada, Reno.

Asked about the success rate of the program, he states: “However, in my reading of the data, the number of children whose lives have been saved by AMBER Alert ranges from zero to something very close to zero.”, and as expected “These cases do not appear to typically involve apparently life-threatening abductors. Rather, they are far more often deployed in familial/custodial disputes and other cases not suggestive of life-threatening peril to the abducted child(ren).” I defer to that interview for other interesting facts, none of which were surprising to me.

The truth of the effectiveness of Amber alerts probably lies in between the glowing stats of the Amber alert advocates, and the more data driven conclusions of Prof. Griffin — but I’d guess the facts are much more strongly skewed towards the conclusions of Prof. Griffin.

Regardless of the effectiveness of the program, not allowing an opt out mechanism for these messages, nor any way to regulate priority, is a strategic mistake by the CRTC, who appears to be pushing the value of this program. Setting inappropriate priorities gets you ignored. In a corporate environment, think of the pencil pusher who sends all his ISO-9001 process conformance emails with urgent priority.  You set up a rule in short order to put all emails from that person directly in the trash.

Even if you believed that these alerts were helpful, Amber alerts depend upon an “everybody sees it” strategy that is actually crippled by making these messages mandatory and in your face. The end result is that people will delete without reading, just to silence the offending noise. The probability of even the limited possible success of the alert program is thus sabotaged. The small subset of people who will actually read the Amber alert text, and feel that it is important to do so, is made even smaller by the CRTC policy that enforces “can’t be ignored” and “can’t be prioritized”.

4800 pages of basic physics notes for $88 USD

September 29, 2019 math and physics play , , , , , , , , , , , , , , , , , , , , , , , , , ,

Over the last 8 years I took most of the interesting 4th year undergraduate physics courses, and some graduate physics and engineering courses.

Well, my notes for much of that work are now available on amazon.com (or .ca), or for free as PDF.  For the bargain price of $88, leveraging the time and money that I spent, you can get very comprehensive paperback notes for these subjects.  These notes aren’t textbook quality, but generally contain detailed expositions of the subjects and many worked problems.

Here’s what’s available:

Title Professor Year of study Format Price (USD) Pages
Quantum Mechanics I: Notes and problems for UofT PHY356 2010 Prof. Vatche Deyirmenjian Fall 2010 PDF $0.00 263
Quantum Mechanics II: Notes and problems for UofT PHY456 2011 Prof. John E. Sipe Fall 2011 PDF $0.00 320
Relativistic Electrodynamics: Notes and problems from 2011 PHY450H1S Prof. Erich Poppitz Winter  2011 Black and white $11.00 387
Classical Mechanics Prof. Erich Poppitz, + self-study Winter 2012 PDF $0.00 475
Advanced Classical Optics: Notes and problems from UofT PHY485H1F 2012 Prof. Joseph H. Thywissen Fall 2012 Black and white $11.00 382
Continuum Mechanics: Notes and problems from UofT PHY454H1S 2012 Prof. Kausik S. Das Winter 2012 Black and white $10.00 358
Basic Statistical Mechanics: Notes and problems from 2013 UofT PHY452H1S Prof. Arun Paramekanti Winter 2013 Black and white $11.00 399
Condensed Matter Physics: Notes and problems from UofT PHY487H1F 2013 Prof. Stephen Julian Fall 2013 Black and white $10.00 329
Modelling of Multiphysics Systems.  Notes and problems for UofT ECE1254 Prof. Piero Triverio Fall 2014 PDF $0.00 300
Graduate Quantum Mechanics: Notes and problems from 2015 UofT PHY1520H Prof. Arun Paramekanti Winter 2015 Black and white $12.00 435
Antenna Theory: Notes and problems for UofT ECE1229 Prof G. V. Eleftheriades Winter 2015 PDF $0.00 207
Electromagnetic Theory: Notes and problems for UofT ECE1228 Prof. M. Mojahedi Fall 2016 PDF $0.00 256
Geometric Algebra for Electrical Engineers: Multivector electromagnetism self-study 2016,2017 Colour $40.00 280
Geometric Algebra for Electrical Engineers: Multivector electromagnetism self-study 2016,2017 Black and white $12.00 280
Quantum Field Theory I: Notes and problems from UofT PHY2403 2018 Prof. Erich Poppitz Fall 2018 Black and white $11.00 423

 

That’s 4814 pages of notes for 0-$USD 88, depending on whether you want a PDF or paper copy (if available).  My cost per page is about $4.7 CAD, factoring in total tuition costs of ~$23000 CAD (most of which was for my M.Eng), but does not factor in the opportunity cost associated with the 20% paycut (w/ a switch to 80% hours) that I also took to find the time to fit in the study.

If you compare my cost of $4.7/page for these notes to FREE – $0.024/page, then I think you would agree that my offering is a pretty good deal!  While I have built in a $1 (+/- $0.50) royalty for the book formats, the chances of me recovering my costs are infinitesimal.

A few of the courses and/or collections of notes are not worth the effort of making print ready copies, and those notes are available only in PDF form.  An exception are my notes for Multiphyiscs Modelling, which was an excellent course, and I have excellent notes for, but I’ve been asked not to make those notes available for purchase in any form (even w/ $0 royalty.)

 

Continuum mechanics notes now in book format at amazon.com

September 26, 2019 math and physics play , , , , , ,

My notes from the 2012 UofT session of phy454, Continuum mechanics (aka fluid mechanics), are now available in book form on amazon.com for $10 (black and white, softcover, 6×9″ format, 358 pages), as well as in PDF and latex formats as before.

I took that course as a non-degree student.  It was taught by Prof. Kausik S. Das, and had the official course description:

The theory of continuous matter, including solid and fluid mechanics. Topics include the continuum approximation, dimensional analysis, stress, strain, the Euler and Navier-Stokes equations, vorticity, waves, instabilities, convection and turbulence.

It was really only about fluid dynamics. Anything related to solids was really just to introduce the stress and strain tensors as lead up to expressing the Navier-Stokes equation. There was nothing in this course about beam deformation, Euler stability, or similar topics that one might have expected from the course description.

If you download the free PDF, compile the latex version, or buy a paper copy and feel undercharged, feel free to send some bitcoin my way.

Ugg, COBOL is so horrible.

September 23, 2019 Mainframe , , ,

If you don’t know COBOL (and I clearly don’t know it well enough), you probably won’t spot that there’s a syntax error here:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. BLAH.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       LINKAGE SECTION.

       PROCEDURE DIVISION.

           DISPLAY 'BLAH.' UPON CONSOLE.

           STOP-RUN.

The C equivalent to this program is:

#include <stdio.h>
int main(){
  printf("BLAH.\n");
}

but it is meant to have an exit(0), so we want:

#include <stdio.h>
int main(){
  printf("BLAH.\n");
  return 0;
}

Translating that back into COBOL, we need the STOP-RUN statement to say STOP RUN (no dash).  With the -, this gets interpreted as a paragraph label (i.e. STOP-RUN delimits a new function) with no statements in it. What I did was something akin to:

#include <stdio.h>
void STOPRUN(){
}
int main(){
  printf("BLAH.\n");
  STOPRUN();
}

The final program doesn’t have the required ‘return 0’ or ‘exit(0)’ and blows up with a “No stop run nor go back” error condition.  Logically, what I really wanted was:

 

       IDENTIFICATION DIVISION.
       PROGRAM-ID. BLAH.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       LINKAGE SECTION.

       PROCEDURE DIVISION.

           DISPLAY 'BLAH.' UPON CONSOLE

           STOP RUN

           .

 

This time I’ve left off the period that I had after CONSOLE (which was superfluous and should really only be used at the end of the paragraph (end of “function”)), and also fixes the STOP-RUN -> STOP RUN typo.

This is not the first time I’ve gotten mixed up on when to use DASHES or not.  For example, even above, I’d not expect a programmer to know or remember that you need to know to use dashes for WORKING-STORAGE and PROGRAM-ID but not for PROCEDURE DIVISION, nor some of the other space delimited fields.

My eyes are burning, and I left my COBOL programmer safety gear at home.

An example of Linux/glibc symbol versioning.

September 20, 2019 C/C++ development and debugging. , , , , , , ,

Here’s a little introduction to Linux/glibc symbol versioning.  The sources, linker version scripts, and makefile from this post can be found here in github.

The definitive reference for this topic is Ulrich Drepper’s dsohowto document.

Linux symbol versioning is a very logical way to construct a definitive API for your product.  If you are careful, you can have a single version of your shared library that is binary compatible with all previous versions of code that have linked it, and additionally hide all symbols that you don’t want your API consumer to be able to use (as if all non-exported symbols have a “static” like scope within the library itself).

That visibility hiding can be done in other ways (such as using static, or special compiler options), but utilizing a symbol version linker script to do so also has all the additional binary compatibility related benefits.

Suppose that we have a “v1.1” API with the following implementation:

#include <stdio.h>

void internal_function_is_not_visible()
{
   printf( "You can't call me directly.\n" );
}

void foo( int x )
{
   internal_function_is_not_visible();

   printf( "foo@@V1: %d\n", x );
}

and we build this into a shared library like so:

$ make libfoo.1.so
rm -f libfoo.1.so
cc foo.c -g -Wl,--version-script=symver.map -fpic -o libfoo.1.so -Wl,-soname,libfoo.so -shared
rm -f libfoo.so
ln -s libfoo.1.so libfoo.so

Everything here is standard for building a shared library except for the –version-script option that is passed into the linker with -Wl,. That version script file has the following contents:

$ cat symver.map
MYSTUFF_1.1 {
	  global:
foo;
	  local: *;
	};

This defines a “V1.1” API where all the symbols that are exported with a symbol version @@MYSTUFF_1.1. Note that internal_function_is_not_visible is not in that list. It’s covered in the local: catch-all portion of the symbol version file. Code that calls foo does not look out of the ordinary:

void foo(int);

int main()
{
   foo(1);

   return 0;
}

Compiling and linking that code is also business as usual:

$ make caller1
cc caller.c -g -Wl,-rpath,`pwd` -o caller1 -lfoo -L.

However, look at the foo symbol reference that we have for this program:

$ nm caller1 | grep foo
                 U foo@@MYSTUFF_1.1

If we run this, we get:

$ ./caller1
You can't call me directly.
foo@@V1: 1

If you add in a call to internal_function_is_not_visible() you’ll see that compilation fails:

void foo(int);
void internal_function_is_not_visible();

int main()
{
   foo(1);
   internal_function_is_not_visible();

   return 0;
}

$ make caller1
cc caller.c -g -Wl,-rpath,`pwd` -o caller1 -lfoo -L.
/run/user/1002/ccqEPYcu.o: In function `main':
/home/pjoot/symbolversioning/caller.c:7: undefined reference to `internal_function_is_not_visible'
collect2: error: ld returned 1 exit status
make: *** [caller1] Error 1

This is because internal_function_is_not_visible is not a visible symbol. Cool. We now have versioned symbols and symbol hiding. Suppose that we now want to introduce a new binary incompatible change too our foo API, but want all existing binaries to still work unchanged. We can do so by introducing a symbol alias, and implementations for both the new and the OLD API.

#include <stdio.h>

void internal_function_is_not_visible()
{
   printf( "You can't call me directly.\n" );
}

void foo2( int x, int y )
{
   if ( y < 2 )
   {
      internal_function_is_not_visible();
   }
   printf( "foo@@V2: %d %d\n", x, y );
}

void foo1( int x )
{
   internal_function_is_not_visible();
   printf( "foo@@V1: %d\n", x );
}

This is all standard C up to this point, but we now add in a little bit of platform specific assembler directives (using gcc specific compiler sneaks) :

#define V_1_2 "MYSTUFF_1.2"
#define V_1_1 "MYSTUFF_1.1"

#define SYMVER( s ) \
    __asm__(".symver " s )

SYMVER( "foo1,foo@" V_1_1 );
SYMVER( "foo2,foo@@" V_1_2 );

We’ve added a symbol versioning alias for foo@@MYSTUFF_1.2 and foo@MYSTUFF_1.1. The @@ one means that it applies to new code, whereas the @MYSTUFF_1.1 is a load only function, and no new code can use that symbol. In the symbol version script we now introduce a new version stanza:

$ cat symver.2.map
MYSTUFF_1.2 {
	  global:
foo;
};
MYSTUFF_1.1 {
	  global:
foo;
	  local: *;
};

$ make libfoo.2.so
rm -f libfoo.2.so
cc foo.2.c -g -Wl,--version-script=symver.2.map -fpic -o libfoo.2.so -Wl,-soname,libfoo.so -shared
rm -f libfoo.so
ln -s libfoo.2.so libfoo.so

If we call the new V1.2 API program, like so:

void foo(int, int);
int main()
{
   foo(1, 2);
   return 0;
}

our output is now:

$ ./caller2
foo@@V2: 1 2

Our “binary incompatible changes” are two fold. We don’t call internal_function_is_not_visible if our new parameter is >= 2, and we print a different message.

If you look at the symbols that are referenced by the new binary, you’ll see that it now explicitly has a v1.2 dependency:

$ nm caller2 | grep foo
                 U foo@@MYSTUFF_1.2