The content of this blog is my personal opinion only. Although I am an employee - currently of Nvidia, in the past of other companies such as Iagination Technologies, MIPS, Intellectual Ventures, Intel, AMD, Motorola, and Gould - I reveal this only so that the reader may account for any possible bias I may have towards my employer's products. The statements I make here in no way represent my employer's position, nor am I authorized to speak on behalf of my employer. In fact, this posting may not even represent my personal opinion, since occasionally I play devil's advocate.

See http://docs.google.com/View?id=dcxddbtr_23cg5thdfj for photo credits.

Thursday, December 21, 2017

WISH: Exception Coalescing Operator/Expressions, like Null Coalescing


I might like exception coalescing expressions and operators, e.g.

result := expression1 ?if-exception expression2 ?if-exception expression3 ... 
result := expression1 ?if-exception(EXCEPTION_TYPE x) x 
along the lines of null-coalescing operators like Perl // or C# ??


I very much like the null coalescing operators, like Perl's //

$a = $b // 'value if b is null/undef';
I suspect that I would also like the Elvis operator ?: if I could get away with using it (i.e. if I felt that my coworkers would not crucify me for using non-standard C), and various safe-traversal operators like ?. ?[] etc.

Today, writing some unit test code, I wanted to do simple exception handling, and I think that I realized that I might like to have an exception coalescing operator, or, more generally, try-catch style exception handling as an expression rather than a statement.

I wanted to do 

result := f(input) or "error" if an exception was thrown
which usually looks like

try {
     result := f(input);
     assert( result == expected );
} catch( ... ) {
     assert( 'according to whether exception is expected or not' );
possibly testing for particular exceptions.

Of course, I (or the test framework) usually have functions like

test_assert_equals( f(input), expected_value )

test_expect_exception( f(input), expected_exception )

f := if_not_exception( f(input), 'exception_value' ).
but that can be quite clumsy.  And, in non-test cases, you may want to chain

f := if(_not_exception( g( if_not_exception( f(input), 'exception_value' )), "exception2")
In general function(args) can be clumsy compared to prefix_fn(args).suffix_fn.suffix_fn2.

In this particular case, I think that I would like an exception coalescing operator

result := expression1 ?if-exception expression2
equivalent to

declare result
try {
     result := expression1;
} catch( ... ) {
     result := expression2;
return result
and chainable

result := expression1 ?if-exception expression2 ?if-exception expression3 ...
If we wanted to specify exactly what exception is caught

result := expression1 ?if-exception(EXCEPTION_TYPE x) x 
(although this raises the possibility of multifix vs infix binary)

Q: what should the operator be?   While I could live with ?if-exception - especially if in my oft-desired XML-based-programming-language-syntax - many folks would prefer something expressible as ASCII.  I would suggest ??, except that C# already uses that for null coalescing equivalent to Perl //.


But if we can't have a nice set of hard to remember symbols, how about traditional try/catch as an expression?

result := try{ expression1 } catch(...)  {expression2 }
This happens a lot - similarity between expressions and statements.  In LISP everything is an expression. Python gets much of its readability by having a stricter boundary between expressions and statements. And debuggability - accidentally making something into an expression when it should be a statement can be hard to find.

Perhaps there should be expressions corresponding to all statements - bit with a minor syntactic indication.

'via Blog this'

Sunday, December 17, 2017

Veggies for Breakfast - Henry’s PDX

VfB score: 90% (Veggies for Breakfast)

Many vegetable omelets have a lot of egg and not so much vegetable.

Not here!

This vegetable omelet has a hearty egg wrapper wrapped around a healthy serving if vegetables - a large amount of green and other sweet peppers, plus some onion and spinach.

Tasty even without hot sauce.


VfB - Vegetables for Breakfast - my search for healthy food, protein and vegetables - for the most of important meal of the day.

Friday, December 01, 2017

2FA watch app please! not phone

Duo Mobile: Duo Security:

'via Blog this'

My new employer uses Duo's push two factor authentication.  This is good...

But oh my gosh do I wish that this 2FA app was a watch app and not a phone app!  I am coming to hate having to go find my phone...  For some reason I need to do this much more often than in my personal 2FA usage - probably because I spend more time at work on my PC than banking, etc.  And Gmail and LastPass 2FA persists across (some) reboots.

If my employer's 2FA was time based, I suppose that I could clone the TOTP to run on both my phone and my watch. Although I never trusted the TOTP implementation for my Pebble SmartWatch - I never trusted that the Pebble had good enough security, both inside the watch, and in the synched-ed to phone app.

MORAL: SmartWatches need good security.

I would hope that the Apple Watch has good security.  That's a large part of the reason I switched from Android to iPhone.  Now if only the Apple Watch had decent battery life, I would gladly switch.  Being able to use my watch as 2FA would almost be enough to justify paying for cell phone connectivity for the watch independent without going through the phone.

In my dreams, the smart watch would carry the SIM card, and
temporarily delegate it to whatever more battery endowed device it was close
to. Like phone, or tablet, or laptop.  The smart watch could/should be the
most secure device – more physically secure, or at least less likely to be left
behind. Passwords by clicking buttons or tapping. Potentially endowed with
biometrics like fingerprint, and heartrate continuous monitoring – redo slow
authentication when taken off.

Will NNs
for pleasant authentication – fingerprint, face, voice – fit in the SmartWatch
form factor and battery profile?  I am willing to relegate training to a
synched to SmartPhone app; I would prefer NOT to let biometric authentication
live in the cloud, although it is probably too late.  All of our faces are
belong to Google, and Facebook, and ….

Amusing idea;  passwords as a sequence of silly facial
expressions.  NNs to recognize you tapping your favorite song on the
phone.  Conscious control of heartrate or body temperature or galvanic
skin response for authentication. Perhaps this will be the route to direct neural interfaces, the incremental step that provides partial value.


My Apple watch owning friends are happy to rub it in that they have a watch app for Duo 2FA..

As are some of my Android Wear friends - except they say that too many clicks are required on the watch app, so they often pick up the phone.

For the Record, I am currently wearing a FitBit Blaze not-really-smart watch.  Mainly as a Fitness Tracker, and that mainly because of FitBit's social fitness challenges with my friends. I was very disappointed to realize that the Blaze provides transient calendar notifications, but does not actually store my calendar on the watch.   Although FitBit bought Pebble, it doesn't yet support Pebble-style watch apps.