Tuesday, March 31, 2020

lovely little UI details

My company relies on Slack, and while Zoom still seems to be the favorite for Work from Home standup meetings, its "Call" feature is great for quick conversations.

Slack of course has a "share screen" button, and even gives participants the ability to "draw" on the shared screen, with a highlighter like pen. One detail I liked is that the marker fades out on its own after like ten seconds... given that  screen display is often changing, it neatly sidesteps that usual problem of the markup not matching what's beneath. I like it as a subtle solution to a UX problem other people might overlook as an issue, much like Basalmiqs Big Blue Arrow...

Sunday, March 22, 2020

some light reading for these dark days

You could read JavaScript: The First 20 Years:
How a sidekick scripting language for Java, created at Netscape in a ten-day hack, ships first as a de facto Web standard and eventually becomes the world’s most widely used programming language. This paper tells the story of the creation, design, evolution, and standardization of the JavaScript language over the period of 1995–2015. But the story is not only about the technical details of the language. It is also the story of how people and organizations competed and collaborated to shape the JavaScript language which dominates the Web of 2020.
The actual paper is like 190 pages though.

A brisker read is How I made a 3D game in only 2KB of JavaScript... personally I am more interested in faking the 3D effect than the compression stuff.

Wednesday, March 18, 2020

two (or three) fixes for the mac touch bar

Like I said the other day, I am not a fan of the Macbook Pro Touch Bar. It's flashy for the sake of flashy: having a dynamic, context-sensitive set of options at a place where the user is rarely looking is a rather odd choice, and there's nothing it does well that you couldn't do with the touchpad and the screen. Making it worse, they didn't put in the same "touch vs tap" logic that the touchpad has, a finger accidentally resting from typing and brushing the surface is enough to hit whatever key happens to be there.

One easy option turns the every shifting bar into something like the old function keys (screen brightness, multimedia controls, volume up/down): go to
System Preferences | Keyboard | Keyboard
and say "Touch Bar shows" "Expanded Control Strip".

It does raise the question, do you lose much doing this? In my opinion tapping a volume up or down button is as good or better than a sliding volume control, but YMMV.

But still, I find when I hold my hands over the keyboard, it's too easy to tap a virtual key accidentally - either Esc or more mre amusingly, I was wondering why my laptop screen was going all the way dark, as if just the bottom screen was going to sleep... turns out I had a finger JUST pressing screen brightness down... also it seems so odd that pressing a physical volume button on my Macbook Air gives that nice little pong sound, but the virtual volume button (already lacking in feedback) was silent...

UPDATE 1: Actually, even going to "Expanded Control Strip" you can still customize it. Since I seem to have much more problem with my resting left hand drifting up to the touch bar than my right (I think I tend to keep my right hand lower so my pinky can hit the return key, but my left hand is higher so my middle finger can hit the "e" key) I removed everything but the screen brightness and volume controls, and put a spacer shoving stuff to the right. (I also included a lock screen button, which does seem at least a little useful.) It's unfortunate that there's a "show all open windows" and a "show all installed apps button" but not a "show all open windows of the current app" button. But I use three finger swipes up and down for both of the show windows actions, so it's not a big loss.)

I found an app that seems promising to help: Haptic Touch Bar gives a little buzz on each tap, and can even do a sound effect. Free to try out, $5 if you like it.

Why Apple doesn't have that tactile feedback built in is beyond me- I'd say it's an embarrassment, along with having no "accidental touch" protection...

UPDATE 2: A coworker recently lived a version of this story - Apple has this wacky oversite where the touch bar / keyboard balance is at whatever it was when shutdown. The fact that this is a feature of "Pro" models is ironic considering what amateur hour problems it sports, even 3 or 4 years after its release.

UPDATE 3: Bar None is a way of making it so you have to hit the fn key before the touch bar is active. I might try this later but haven't yet.

Thursday, March 12, 2020

apple's touch bar can't tell an accidental brush from a click

In some ways even stupider than sacrificing reliability for slimness of their keboards,  I find Apple's touch bar infuriating - they somehow forgot to put in any haptic sensors that could an accidental brush (like when your hands are held above it, not typing but ready to go) from a purposeful click. When I hit the Esc key, I have to press down, just a bit, and there's feedback. When I click a button on a screen I have to use a pointer, and on my phone my attention is about where I'm trying click. Losing information because a resting finger drifted north of the keys, and hit "Esc" or, worse for like Chrome, "back", is just awful. Given how hardly anyone is looking down at the Touch Bar to see what mode it has reconfigured it self to, it hardly seems like a timesaver in anyway.

Well, Bob on the Lost in Mobile WhatsApp group warns me Apple seems at risk for doubling down on their bad understanding of human ergonomics: Mac laptops with Touch Bars may one day be able to detect touchless gestures.
As far as I know, not much came of Samsung messing with the same ideas in 2013 on their phones...

As usual in these cases I turn back to Douglas Adams in Hitchhiker's Guide to the Galaxy, from literally about 40 years ago:
A loud clatter of gunk music flooded through the Heart of Gold cabin as Zaphod searched the sub-etha radio wavebands for news of himself. The machine was rather difficult to operate. For years radios had been operated by means of pressing buttons and turning dials; then as the technology became more sophisticated the controls were made touch-sensitive - you merely had to brush the panels with your fingers; now all you had to do was wave your hand in the general direction of the components and hope. It saved a lot of muscular expenditure of course, but meant that you had to sit infuriatingly still if you wanted to keep listening to the same programme.

Sunday, March 8, 2020

notes to self: building a slide down nav bar thingy

I wonder if I'm kicking against the sticks, generally still shunning using prefab CSS stuff, like the descendents of boostrap, and handcoding HTML and CSS. Definitely it makes mobile not a lot of fun.

So I was trying to make a site with a navbar roughly modeled after porchfestquincy.org.

One challenge for both href-# as well as javascript Element.scrollIntoView() solutions is the navbar itself will block the top of the content-
css-tricks.com/hash-tag-links-padding/ has a pseudo-element work around for that...

dev.to/changoman/showhide-element-on-scroll-w-vanilla-js-3odm showed me the basic of javascript scroll listeners (with debounce) - I don't quite get why it thinks different behavior for scrolling up vs scrolling down is good, but it showed me what I needed for a simple "if scrolling more than X distance from top of page, show the navbar" - of course I could have just made it fixed in place if I didn't mind it always there, or there's that cool display: sticky; setting if I had nav that looked good in the middle of the page as well.

Finally, I was noticing console warnings until I used passive:true on the scroll addEventListener (and of course my scrollIntoView had behavior:smooth because I am such a smooth guy.)

Man. That's kind of a lot!

Saturday, March 7, 2020

tim o'reilly not quite predicting the iphone

(Grabbing some stuff I wrote a few months ago on the Lost in Mobile Whats App Group:)

Finally this thing I wrote in 2002
Saw Tim O'Reilly (of everygeek's favorite computer book company) give a rambling talk on "Emerging Tech Trends" last night at local computer bookstore Softpro. Some thought provoking stuff. He mentioned that the Apple iPod is being used (or could be?) to carry around the information for people's Macintosh desktops...so you could go take your iPod to your buddy's Mac, and suddenly it looks like your computer. It made me think how far we are from the ultimate PDA/laptop combo...what if you had something that looked and acted like a typical PDA, but it had plugs for a monitor, keyboard, mouse, power, etc, so you could use it on the go, or as a reasonable desktop. It would have the standard dayplanner software, but you could still get to the desktop programs in PDA mode....it's an intriguing idea, and I suppose I'd have to admit Microsoft PocketPC's are closer than Palm to realizing that dream at this point, though they're still pretty far off.
So, two things that missed out on:

  1. that comes from a time when laptops felt more like a luxury than a default, so having a pluggable portable component to carry your "desktop" experience would be great
  2. it didn't quite foresee the cloud - when I do need to transfer or share information, it's generally simplest to synch or bounce it off the network. (this was just a tad before ubiquitous wifi and cellular data as well...)

Also, in searching my site for "ipod" using my semi-clumsy search engine I realize there used to be an awful lot of great sites on tripod... (and you can't spell tripod without the ipod 😀 ) and that of course reflects the weakening of the DIY web - homepages being replaced with twitter bios and facebook profiles. Sharing in your group is increased... but at what costs.

Thursday, March 5, 2020

Laziness, Impatience and Hubris

According to Larry Wall(1), the original author of the Perl programming language, there are three great virtues of a programmer; Laziness, Impatience and Hubris

  1. Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it.
  2. Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to.
  3. Hubris: The quality that makes you write (and maintain) programs that other people won't want to say bad things about.
(stolen from threevirtues.com)

Monday, March 2, 2020

js conditionally include or exclude an element in a static array declaration

via this stackoverflow, you can use the spread operator and the ternary operator to conditionally include or exclude something in an array declaration ala:

const myArray = [
  'always this thing',
  ...(testFuntion() ? ['sometimes this thing'] : []),
  'and always this thing',

js sort function for a fixed set of values

At work I found some code that I refactored as follows:

const ORDINAL_BY_NAME = ['5', '4', '3', '2', '1', 'No Rating'].reduce(
    (acc, name, index) => ({ ...acc, [name]: index }),

const sortFn = (a, b) => ORDINAL_BY_NAME[a.name] - ORDINAL_BY_NAME[b.name];

It seems a pretty ok syntax for applying an arbitrary sort order to an enum type set - like you model the desired sort by example. Probably could wrap these two lines as a function...