Wednesday, October 10, 2018

photo albums, macros, perl regex, browser regex, terminal clipboard, and photo galleries

Middle School was not kind to me.
A long time ago I scanned the photo album I assembled shortly after college and put the photos online. (For a weird time in the late 90s too many websearches for old friends just pointed back to that dang site) The thing is I scanned things at too low of a resolution, so I decided to redo the effort at 600 dpi and post them on my blog.

Over the year I've hacked up my blog system to be pretty friendly to post photos, especially with resizing images for web display, but keeping the fullsize images there as a link (since I finally realized it really was my canonical personal data warehouse.)

(I'm still enamored of my CSS hacky photo gallery system, which easily makes a nice compact display of the album with a minimum of setup)

Anyway, I reused all the file names from my original scans, which include a lot of metadata about people and places in the photos, so I wanted to go from the html my blog system generates for me, for example
<a href="/m/2018/10/10/049.c.mrs mclaughlin at prom toasting camera.jpg"><img src="/m/2018/10/10/049_560.c.mrs mclaughlin at prom toasting camera.jpg" border="0" width="560" height="441"></a>
<br><br>
and copy the filename as the caption underneath, ala:
<a href="/m/2018/10/10/049.c.mrs mclaughlin at prom toasting camera.jpg"><img src="/m/2018/10/10/049_560.c.mrs mclaughlin at prom toasting camera.jpg" border="0" width="560" height="441"></a> mrs mclaughlin at prom toasting camera<br> 
<br><br>

Once upon a time, I would have done this in a macro in a text editor - I feel like I used to care A LOT about how well an editor supported macros (it can get tricky, especially how you record a macro that uses a dynamic "find") but now it doesn't come up so much.

So my fallback plan was writing a perl script:
while($line = <STDIN>){
    chomp $line;
    print "$line\n";
    if($line =~ /^.*?\.\w\.(.*?)\.jpg/){
        print "$1<br>\n";
    }
}

The trick was being a bit lazy about putting things in temporary files - one thing that helped was the pbcopy command in MacOS Terminal, which can pipe stuff into clipboard.

So that would have got the job done, but then I remembered I had made a tool to help me do that in the browser: regexcellent which I write about here. In this case, the matcher was
^(.*?\.\w\.)(.*?)(\.jpg.*)$
and the output was
$1$2$3 $2<br> 
(the one thing I couldn't figure out was putting in \n's for line breaks, but not such a big loss)

Anyway, I'll be posting the results starting tomorrow.

Hope any of this was useful to someone! If only as notes to my future self...

Friday, October 5, 2018

es6 re-review

Decent re-review of ES6 new(ish) hotness(also ish).

Its notes from the Wes Bos lectures- currently I'm taking his video React intro course. A lot of it is review but there's a lot that hasn't yet cemented for me with my intermittent use of it.

I admit I'm not in love with all the new concise syntax - it used to be much easier to take a guess at what a { meant in javascript code, now everything is heavily overloaded.

Saturday, September 29, 2018

fb wants your group page to have the last word


While I can applaud FB encouraging page maintainers to respond promptly to folks contacting the page, this alert - coming after a successful dialogue (my band will likely march with the 15th anniversary JP Canine Costume Parade) worries me that they will clumsily ding the page's response rate because I let Brad have the last word ("great")

The subtle encouragement to have the page runner post the last reply seems like damaging bad UX. When I wrote a post kvetching about this on FB, a friend said that's why he tends to end with the thumbs up, as a kind of punctuation. Good idea, if a bit of a hack.

Friday, September 28, 2018

on the iphone x and ios 12 gestures

I upgraded to an iPhone Xs, mostly seduced by tales of the superior lowlight camera.

Seeing people adapt pretty easily to "no home button" over the previous year had allayed my fears about the transition and learning the new gestures - I'd always been a fan of physical home buttons; to quote Gruber writing skeptically about removal of the home button (admittedly it was 2011)
The physical Home button is impossible to miss. That it is the one and only button on the faces of these devices is a big part of why normal people are able to pick them up, start playing with them, and figure out how to get around with no help.
The PalmPilot had a prominent silkscreen button for "home", and I've always thought it was similar to the convention that clicking on a website's name at the top right will bring you back to the top of the site.

In practice, the iPhone X's Face ID has a simplifying effect - since unlocking is passive and automatic, there is now one gesture predominant, the upward swipe. This movement is identical when opening the phone from the lock screen or from any app - not quite the case with Touch ID, where the "rest and wait for fingerprint" felt a bit different from clicking from with an app.

UPDATE: my sweetie Melissa points out I'm missing a crucial gesture - swiping right or left on the "Home indicator" bar - this is a fast task switcher, a way of getting to apps you've recently been using without going to the whole card-app carousel. From a UX perspective, it's an interesting choice: always returning to the homepage, then letting muscle memory telling you where to go for the app you have in mind, vs keeping in mind what apps you've recently been using (and/or rolling the dice that the app you want is recent- an interesting attention span challenge)

Conceptually, I still miss the home button a bit - there was something nice about how it was "out of band" from every app-interaction  - it was kind of reassuring that to know you were communicating directly with the device, and unlike a gesture it was tough to do accidentally. Also, the home button was always trivial to locate, no matter how you were holding the phone - if an app has switched into landscape mode, even though there's that marker line, the direction to swipe might not be instantly clear.

One additional improvement: the lock screen quick camera access is now a virtual button (See the screenshot below for an example) - it requires a "hard press" but is MUCH more reliable than the "swipe to the side" gesture. (That gesture is still supported on iPhones with Face ID - and the swipe seems to be the only option for iPhones with home buttons, for some reason.)

Anyway.

Over the years I've become rather vain about making my own cases via Zazzle - I figure the silver lining to phones becoming so thin, even at the cost of durability and battery life, is that you can kind of think of the case as a form of customization rather than mere external protection.

I think illustration is a much better bet than photography, and so I go to the work of my artist friend James Harvey (who did the illustrations for my self-help-about-mortality comic So, You're Going to Die) -

In retrospect, I think the wood cases were a mistake - they had a nice warmth (and I could knock wood no matter where I was) but lacked durability.

Also I think my James Harvey lock screen also rocks:

Sunday, September 23, 2018

hand wavey gestures

I use HyperDock on Mac, my favorite feature is using option-cmd-arrow to toss around windows, make them either full-screen or half-screen, an easy way to neaten up the workspace plus I realize it feels a bit like a keyboard based version of all those hand-wavey gestures Tom Cruise uses in Minority Report or Tony Stark in Iron Man movies.

(That said I don't think I'd like actual hand wavey gestures all that much. It's easy enough to make mistakes and get startling behavior just with plain old touchpad gestures.)

My friend Ari recommends SizeUp - I like it because HyperDock didn't really have an option for "bottom half of the screen" (which was unfortunate since I run one of my monitors in "portrait mode". I kind of preferred HyperDock's method of toggling between the moved state and the previous position, but still SizeUp is not bad for $12, and I like how it had a little transparent indicator in the center of the screen telling you what just happened.

Friday, September 14, 2018

using cgi for good

Fantastic use of greenscreen to warn people about why storm surges are not to be trifled with, and behind the scenes....

jawdropper - every id'd DOM element is a variable?



I had no idea, or had utterly forgotten, that every DOM element with an id attribute is available as a variable, seemingly plucked from global space and I guess rendering document.getElementById() almost useless- here's the jsbin link from that tweet.

I forget just how "scripty" Javascript is sometimes, and understand its detractors a bit more (though I am not one of them)