Thursday, December 31, 2020

farewell to flash

Sorry that Flash is going away. I never programmed much in it but there was a whole indie game making culture in it. Flash Game History is a bit of an homage.

The archivists are at work, though, with new options to run Flash stuff...

Wednesday, December 30, 2020

html ul/li unordered lists with plus or minus icons via CSS

My main blog turned 20 today! Semi-related I published a list of highs and lows from my academic years. 

I wanted to display those as unordered lists but replacing the bullets with pluses or minuses. There's a CSS pseudoselector that works well for that, using the emoji for big plus/big minus:

.plusminus li.plus::marker {
    content: "➕";
}
.plusminus li.minus::marker {
    content: '➖';
}
.plusminus li.plusminus::marker {
    content: '➕➖';
}
.plusminus li.plusplus::marker {
    content: '➕➕';
}
.plusminus li.minusminus::marker {
    content: '➖➖';
}

I guess to do a proper job of it you should throw in an aria-label...


UPDATE: this does not work on Safari! It supports ::marker but not the content property I guess? So I switched back to this earlier idea:

ul.plusminus  {
    list-style:none;
    position: relative;
}
ul.plusminus li::before {
    position: absolute;
    left:0;
}
ul.plusminus li.plus::before {
    content: "➕";
}
ul.plusminus li.minus::before {
    content: '➖';
}
ul.plusminus li.plusminus::before {
    content: '➕➖';
}
ul.plusminus li.plusplus::before {
    content: '➕➕';
}
.plusminus li.minusminus::before {
    content: '➖➖';
}


saints row iv freezing bug on nintendo switch

Played through Saints Row IV on Switch, kind of a comfort food game for me. I played it years ago on Xbox 360, and while I mostly play my Switch on my TV (that's otherwise that's a small screen for middle-aged eyes) it's amazing to have that little open world microcosm right in your hands. And this game captures superpowers like Flash-like running and soaring like no other.

There was a frustrating bug - near the end there was a mission called "Hello Teacup"/"The Girl Who Hates the 50s", but the Switch would freeze/lockup after its completion- the first time after the rewards screen for it, and then after that on the loading screen right after warping out. 

Googling for suggestions, I tried stuff like moving the game to system memory (vs SD card) and airplane mode and what not but what worked was going back and redoing one of the DLC missions... after that I could restart the Rescue Kenzie mission, complete it, and get on with the game. 

Just mentioning it here in case Google picks up on it and maybe it helps someone. 

Tuesday, December 29, 2020

20 macs for 2020

Six Colors finished its run of 20 Macs for 2020.

I'm a relatively new convert to Mac, like 2012 or so - gradually it has become the standard for web devs around Boston (I think we're all wanna be Designers, plus its Unix core is really nice) - but was always fascinated by the line, and the history of it was cool to think about.

the other dark web

Admittedly this is kind of a link to a link, but Daring Fireball's musings on Facebook’s Unknowable Megascale got me thinking - Gruber points out how Facebook is just unknowable in a way traditional media or blogs or message boards (even reprehensible 'chans) aren't. 

There's something fundamentally subjective, then, about Facebook, which makes the algorithm's engagement-maximizing manipulation that much harder to get a handle on, and to estimate the damage of. At first, I thought the same subjectivity applied to other custom-"wall"-based sites, such as Twitter and Tumblr - it's a different experience for each person - but those streams aren't nearly as heavy handed in the algorithmic manipulation as FB, and Twitter is fundamentally public by default. (My experience with Twitter might be idiosyncratic, though - I know people long for "just tweets of people I follow, in chronological order" which I actually get putting everyone I follow (and actually want to read, not just a courtesy follow) on a "list", and only reading that.) 

Like I wrote in The Stream vs The Froth (and later, the chrono, the wall, the stream, the froth) I am bummed out that my main blog - 20 years old this week - lost its message board audience, and that if I have any hope for conversation on what I write, I have to crosspost to FB, or sometimes one of the private Slack or WhatsApp groups I enjoy.) But FB has gotten to be so bad at that. FB worked its way into our hearts in part because it was based on people you know in real life, but now to keep pulling so many people it's just the most random group doomscrolling-bait stuff... like, I like the content in the Atari group, but I certainly don't value its random content more than stuff from people I know! 

Monday, December 21, 2020

better than codepen?

 I haven't used it much but jsitor looks like a great little code sandbox...

nagbot 3000

At an old job, we had a nice kind of team culture going for the developers. 

Our manager Scott asked us to do weekly status reports at end of day on Thursdays. I thought it would be easy to forget that, so I set an iPhone alarm to remind me, and then figuring the rest of the team was in the same boat, I decided to get in the habit of nudging people. To do so, I invented a persona for our group Skype chatroom called "Nagbot 3000". In theory I could have made up an automated script to do the reminder, but A. that would be work and B. It was kind of fun trying to think of variants to keep things lively.

Nagbot 3000 was generally appreciated by my coworkers. Here are some excerpts I saved at some point...

[Aug 2 2007 16:31:21] NAGBOT 3000 SEZ: status reports for sbruce.

[Aug 16 2007 16:30:20] NAGBOT 3000 SEZ: status tonight!

[Aug 23 2007 16:30:31] NAGBOT 3000 SEZ: STATUS

[Aug 30 2007 16:54:51] NAGBOT 3000 SEZ: STATUS

[Sep 6 2007 17:12:06] NAGBOT SEZ; geez, i guess there's status though everyone seems hipdeep in demo prep...

[Sep 20 2007 16:30:31] NagBot sez: DO YER STATUS
[Sep 20 2007 16:30:48] NagBot sez: *beep*

[Sep 27 2007 15:02:45] NAGBOT 3000 SEZ: status

[Oct 4 2007 16:31:28] NAGBOT 300 SEZ: DO STATUS

[Oct 11 2007 16:17:57] NAGBOT SEZ: STATUS

[Oct 18 2007 16:52:39] NAGBOT 3000 SEZ: DO STATUS

[Oct 25 2007 16:31:02] NAGBOT 3500 (now with politeness module) SEZ: DO YOUR STATUS REPORT PLEASE

[Nov 1 2007 16:30:25] NAGBOT 3000 [NOW WITH POLITENESS MODULE] SEZ: KINDLY DO YOUR STATUS REPORT, THANK YOU

[Nov 8 2007 16:30:48] NAGBOT 3000 (W/ POLITENESS MODULE UPGRADE) SEZ: IF YOU WOULD BE SO KIND, PLEASE DO YOUR STATUS.

[Nov 15 2007 16:47:22] NAGBOT 3000 SEZ: DO STATUS

[Nov 29 2007 16:33:46] *************NAGBOT 3000 SEZ: DO STATUS**************************

[Dec 6 2007 16:30:31] NAGBOT 3000 SEZ: DO STATUS. PLZ.

[Dec 20 2007 16:30:14] NAGBOT SEZ DO STATUS

[Jan 3 2008 16:31:47] NAGBOT 3000 W/ NEW "X-TRA SASS" CIRCUIT SEZ: try to scrape together some kind of decent status report for this weird, holiday-stricken no-man's-land limbo of a week

[Jan 10 2008 16:37:17] NAGBOT 3000 (Freeware Basic Edition) SEZ: do sta.

[Jan 17 2008 16:32:11] NAGBOT 3000 (with music upgrade) SEZ (to the tune of Howdy Doody theme):
IT'S DO YOUR STATUS TIME,
IT'S DO YOUR STATUS TIME,
SCOTT WANTS TO KNOW WHAT YOU DID DO,
SO TELL HIM AND BE TRUE

[Jan 24 2008 16:40:47] NAGBOT 3000 SEZ: IT IS ABOUT TIME TO DO YOUR STATUS REPORT.

[Jan 31 2008 16:31:11] NAGBOT 3000 SEZ: SEND IN YOUR STATUS PLEASE.

[Feb 7 2008 16:30:34] NAGBOT 3000 SEZ: STATUS STATUS RAH RAH RAH

[Feb 14 2008 16:44:56] NAGBOT SEZ: DO STATUS, CHA CHA CHA

[Feb 21 2008 16:35:07] NAGBOT 3000 (RHYMING UPDATE) SEZ:
The Time Has Come
The Walrus Said
To Write Things Done and Not:
Plus Obstacles, And Take All That Stuff
And Send It O'er Scott

[Feb 28 2008 16:31:22] NAGBOT 3000 (NOW WITH NEW BELLIGERENCE MODULE) SEZ: HEY YOU YA I'M TALKIN' TO YOU YOU GONNA GET YOUR DUMB STATUS INTO SBRUCE OR WHAT

[Mar 6 2008 16:36:01] NAGBOT 3000 (NOW W/ POWERPOINT MODULE) SEZ:
----------------------------
Status Reports
* Due Thursday E.o.D.
* Send to Scott
* Report 3 things:
-what you did this past week
-what you plan to do next week
-obstacles in your way
----------------------------

[Mar 13 2008 16:31:05] NAGBOT 3000 (JAPANESE EDITION) SEZ: 自分のステータスレポートをご覧ください。

[Apr 10 2008 16:30:56] NAGBOT 3000 (Mr. T Special Edition) SEZ: I PITY TH'FOOL WHO DON'T CUT OUT ALL THAT JIBBAJABBA AND DO A STATUS REPORT!

[Apr 17 2008 16:45:20] NAGBOT 3000 (with a little help from NagNAGBOTBot) SEZ: DO YOUR STATUS REPORT

[Apr 24 2008 16:28:01] NAGBOT 3000 (late 80s hiphop edition) SEZ: LOOKIN' AT MY GUCCI IT'S ABOUT THAT TIME

[May 1 2008 17:00:51] SLIGHTLY DELAYED NAGBOT 3000 SEZ: do your status!

[May 8 2008 16:30:30] NAGBOT 3000 (special Matrix Bullet-Time FX Edition) SEZ: dddddddddooooooooooooooooooo yyyyoooooooooooooooooouuuuurrrrrrrrrr sssssssttaaaaattuuuuuuuuuuuusssssssssssss rrreeeeeeeeepppooooooooooooooorrrrrrttt

[May 15 2008 17:23:45] NAGBOT 3000 SEZ (SUPER SECRET ENCRYPTION MODULE ENGAGED): qb lbhe fgnghf naq pbatenghyngvbaf ba xabjvat ebg-guvegrra!

[May 22 2008 16:33:20] NAGBOT 3000 (limerick edition) SEZ:
there once was a guy from rockport
whose career was nearly cut short
his work went unheeded
cause all that he needed
was to do his status report!

Wednesday, December 16, 2020

regexcellent

 I've mentioned it before but I do love my tool regexcellent - parts of my current project are making good use of my old school regex skills to scrape some html by hand. (relevant info from some thing like

SOMEKEY    <a href="SOMEURL"><img src="SOMEIMGURL" width="XX" height="YY" ></a>

with some other stuff.

The match was 

^(.*)\t\<a href\=\"(.*?)\"(.*)src\=\"(.*?)\"(.*)width\=\"(.*?)\" height\=\"(.*?)\"(.*?)$

and the replace was 

'$1':{ url:'$2', src:'$4', width:'$6', height:'$7'  },

Which produces something close enough to JSON that I can wrap it and pop it in JS and then do more formal manipulation...

I think way back when I used do this as macros in editors, lots of ctrl-arrow jumping around. And that was pretty quick! But I've lost track of what editors do that well, so this tool comes in handy.

Wednesday, December 9, 2020

the forager brain

Quote from Joshua Quittner, I think from Time Magazine circa 1998:

I am nuts for information-- as are we all, I suspect, most real men and women.  I can't get enough of the stuff.  When I'm clicking through the hundreds of E-mail messages that await me each morning, sometimes I imagine I'm a mighty information whale, sifting through thousands of tiny (but nutritious!) krill bits.  Yum!  Whether it's reading the cereal box or scanning the advertisement slide show some genius thought to project on the big screen at the movie theater, my appetite for information is unquenchable. 

This metaphor is kind of formalized as Information Foraging Theory. The claim is humans forage for information the way other animals forage for food - and that can be usefully applied to analyze "doom scrolling" and kneejerk email checking  and similar behaviors, where we swing back to the hunting grounds, and then stick/scroll around for periods of time based on the likelihood of something good showing up.

I was thinking about how I also stockpile information, and I use a motley collection of apps and websites to do so:

Simplenote App:

  • Projects Done
  • "Wisest" quotes
  • "Factoids and Intermittently Useful Information"
  • Medical events / things to discuss with my doctor
Google Docs:
  • Shared shopping list with my partner
  • Shared mailing list and zoom info for my science and spirituality reading group
  • Shared idea for future top list
Tot App:

  • Music to Get
  • Videos/Shows to Watch
  • Work Items to Do
Homebrew Online Database:
  • Passwords + Account Info
  • Media Journal
  • Random Useful Websites
For a bit it seemed weird that I don't have trouble remember what's recorded where... but now that I think about it, it makes sense that my brain is pretty well geared at remembering where any given "information hoard" is stored.

I think similarly, I've never been a fan of "RSS style readers" that take pure information content and put it into a generic template... the information loses that extraneous sensory data that helps me intuitively identify and recall the source/hunting ground..

Sunday, December 6, 2020

so random

 Nice piece on js coding with randomness. I need to get to making more artsy stuff myself!

preact and wmr - possible substitute for create-react-app

I am legit astonished at how much create-react-app - the de facto default - pulls. 250 Mb for just a Hello World! I really really really don't understand why the default brings so much... I'm tempted to make a package called "kitchen-sink" and lobby to get it included as part of the default.

JQuery (and modern CSS) really enhanced my homebrew programming, but Angular and React re-establishec the coding for work/coding for fun divide, in part because of this overhead... even though early React was more clearly meant to be part of an existing page, not presuming the "Single Webpage App" paradigm. I've done a few for fun projects in reat, but it never feels great, and since I don't usually use node on the backend, I get that "PHP for the JSON on the server" hubrid feel

I've had some better luck with Parcel. Another option might be wmr... it uses Preact which I haven't explored much, but might be more in tune with  my feeling of "I want to use basic React and JSX in a minimalist" way

on the naming of things (by other programmers)

A paraphrased quote I've gotten a lot of use (and some laughs) at possibly over the years:

It is a near universal belief among programmers that their peers can't name anything properly. Not variables nor subroutines... definitely not servers. Possibly not even their own children.

I decided to look up the original quote... looks like I grabbed it in September 2000 as 

How to tell you're becoming an technology prima donna:
You become convinced that none of your coworkers can name anything properly, whether it's machines, files, or their children. [...]

Alas, I failed to cite it properly and my sites are all Google knows about the original wording.

Thursday, December 3, 2020

php/js hack script to merge json files, keying on file name

 I know I "should" be using node for this, but:

Here is a php page that reads a bunch of files (in this case the files are "raw/_KEY_.json") and then prints out a single json object:

<pre><script>const raw = <?
$path = "raw";
$files = array_values(array_diff(scandir($path), array('.', '..')));
$tree = array();
foreach($files as $file){   
    list($key,$rest) = explode(".",$file);
    $tree[$key] = json_decode(file_get_contents("$path/$file"));
}
print json_encode($tree);
?>;
document.write(JSON.stringify(raw,null,' '));</script></pre>
For some reason the PHP version I had didn't seem to have JSON_PRETTY_PRINT defined (or I was doing it wrong) so I duck into js to do the pretty printing of the result... kind of an ObHack, that :-D

Tuesday, December 1, 2020

walk a json object, display paths of all parent nodes

One of the interesting things about styled components is that they can handle objects full of CSS stylings, not just strings.

So we have these json objects represented nested stylings, and I wanted to see all the keys (with their full paths) that had children (i.e. ignore any { "color" : "red" } simple properties) 

So a pretty good Comp Sci 101 exercise... 

const json = {
  "header":{
      "large":{
        "companyname":{
            color:"red"
        }
      },
    "small":{
        "companyname":{
            color:"green"
      }
    }
  }
}
let buffer = '';
showFullKeysOfParents(json,'');
console.log(buffer);

function showFullKeysOfParents(json,path){
  const keys = Object.keys(json);
  for(key of keys){
    if(typeof json[key] === 'object'){
      const newpath = `${path}${path===''?'':'.'}${key}`;
      buffer += `${newpath}\n`;
      showFullKeysOfParents(json[key],newpath);
    }
  }
  
}

I decided to just punt and use a global variable rather than waste more time fretting about return values and what not. 

The result of that is:

header
header.large
header.large.companyname
header.small
header.small.companyname

I made a code pen for it. Sidenote: I had to turn off "Match Brackets/Tags". I really don't understand why that kind of auto-complete is the default preference, and why coders like it... the "convenience" of saving a key or two comes no where near outweighing the unpredictability, and if you, say, go back to change the quote situation in a string, you can end up in a nightmare of appearing and disappearing quotes and single quotes.