QZ qz thoughts
a blog from Eli the Bearded
Page 2 of 146

A Protein Alphabet


Mark Howarth, having looked at a lot of protien visualizations, realized that there is enough diversity to easily create an alphabet of protein shapes.

This is all the more impressive since the proteins are all three dimensional shapes, and only look like letters from certain angles.

I used the 3-D visualizer at the protein database he links to create my own images of the Q (3SZV, Pseudomonas aeruginosa OccK3) and Z (4BTA, Peptide(pro-pro-gly)3 bound complex of N- terminal domain and peptide substrate binding domain of prolyl-4 hydroxylase (residues 1-244) type I) letters.

QZ protein images

And then made a QZ logo for the blog out of them. First new logo in a while, and currently the largest one in the collection (by file size). Very, very, few of more than one thousand QZ images in the logo collection are color, which makes having them small much easier.

Matched Pairs


In vi (and vim), there's a "motion" command, % that moves you to an enclosing symbol. In the previous sentence, with the cursor on the "v" of vim, using % will move the cursor to the "(", which is the start of the enclosed sequence. On that "(", the % motion moves to the matching ")".

Out of the box, vi knows the pairs "()", "[]", and "{}". You can change the pairs with the configuration variable matchpairs and people frequently do to add "<>" for XML or HTML work:

set matchpairs=(:),[:],{:},<,>

But there are a lot more, like quoting angles "«»" and smart quotes. And vim happily accepts UTF-8 characters for each half of a pair. So I could think up some Unicode pairs and stick them in there. Or I could look for all pairs that exist in Unicode.

Here's a stab at doing just that.

First off, we need the list of characters in Unicode. This is surprisingly easy to get. Unicode themselves provide an easy to parse list of characters in plain ASCII(!).

$ curl -sO http://www.unicode.org/Public/UNIDATA/UnicodeData.txt

The list is not fixed, new stuff gets added with each version of Unicode. Releases happen every 12 to 18 months. Refreshing that file is the major change needed to update my Unicode Toys for a new version.

So how about a quick script to find "LEFT" characters that have a matching "RIGHT" version?

#!/usr/bin/perl
# Read the UnicodeData.txt file to create a vim 
# matchpair list.
#
# May 2022 "Eli the Bearded"
use strict;
use warnings;

my $in = 'UnicodeData.txt';
my %found;
my %pool;
my %check;
my $id;
my $pid;
my $name;
my $count = 1; # first pair is the hardcoded one

# Tag characters are an obsolete invisible set of
# ASCII for hidden metadata. Modifiers and Combining
# should not be used on their own. Arabic are not
# left-to-right text, so I decided I don't need them.
# You may decide otherwise. The others, by inspection,
# don't have anything I'd want as a pair. (Some
# are part of of larger sets, like up/down/left/right
# quads, or parts of multicharacter pictures.) This
# still leaves some unlikely pairs including box drawing
# stuff. It's a quick list.
#
# These are checked with word boundaries, so CIRCLE
# will not skip CIRCLED.
my @skip = qw[ TAG MODIFIER COMBINING ARABIC IDEOGRAPH
	       ARROWHEAD ARROW
	       AFFIX CIRCLE HALF
	       UP UPWARDS
	       DOWN DOWNWARDS
	     ];
my $skip = join('|', @skip);
my $skip_re = qr/\b(?:$skip)\b/; # \b for boundary

# no boundary check, allow "leftfacing" and the like
my $keep_re = qr/(?:LEFT|RIGHT)/;

binmode(STDOUT, ':utf8');
open(STDIN, '<', $in) or die;

while(<>) {
  # keep code point and name only
  /^([^;]+);([^;]+);/ or next;
  $id = $1;
  $name = $2;

  # Stop checking if on skip list
  next if /$skip_re/;

  # if left or right, keep, but separately
  if (/$keep_re/) {
    if (/RIGHT/) {
      $check{$name} = $id;
    } else {
      $pool{$name} = $id;
    }
  }
}
close STDIN;

for $name (keys %check) {
  my $pair = $name;
  # %check has RIGHTs, see if there is a matching left
  $pair =~ s/RIGHT/LEFT/g;
  if (length( $pid = $pool{$pair} )) {
     $id = $check{$name};
     $found{$pid} = $id;

     # In .exrc or .vimrc " is used to begin a comment.
     # These three printf()s just document the pairs.
     printf(qq{" U+%s\t%c\t%s\n}, $pid, hex($pid), $pair);
     printf(qq{" U+%s\t%c\t%s\n}, $id, hex($id), $name);
     printf "\"\n";
     $count ++;
  }
}
print STDERR "Found $count pairs\n";

# Unfortunately < and > are not named with LEFT and RIGHT
# so hardcode that.
printf "set matchpairs=<:>";
for $id (sort { $a cmp $b } (keys %found)) {
  $pid = $found{$id};
  printf ",%c:%c", hex($id), hex($pid);
}
printf "\n";
__END__

Saved as matchmaker, with the Unicode data file in same directory, let's try it.

$ perl matchmaker >> .vimrc
Found 186 pairs
$ tail -1 .vimrc
set matchpairs=<:>,(:),[:],{:},«:»,֎:֍,܆:܇,࿖:࿕,࿘:࿗,𐡷:𐡸,𝄆:𝄇,𝅊:𝅌,𝅋:𝅍,👈:👉,🔍:🔎,🕃:🕄,🕻:🕽,🖉:✎,🖘:🖙,🖚:🖛,🖜:🖝,🗦:🗧,🗨:🗩,🗬:🗭,🗮:🗯,🙬:🙮,🤛:🤜,🫲:🫱,🭪:🭨,🭬:🭮,🭼:🭿,🭽:🭾,🮜:🮝,🮟:🮞,🮠:🮡,🮢:🮣,🮤:🮥,🯇:🯈,‘:’,“:”,‹:›,⁅:⁆,⁌:⁍,⁽:⁾,₍:₎,⇇:⇉,⊣:⊢,⋉:⋊,⋋:⋌,⌈:⌉,⌊:⌋,⌍:⌌,⌏:⌎,⌜:⌝,⌞:⌟,〈:〉,⌫:⌦,⍅:⍆,⎛:⎞,⎜:⎟,⎝:⎠,⎡:⎤,⎢:⎥,⎣:⎦,⎧:⎫,⎨:⎬,⎩:⎭,⎸:⎹,⏋:⎾,⏌:⎿,⏪:⏩,⏮:⏭,⏴:⏵,┤:├,┥:┝,┨:┠,┫:┣,╡:╞,╢:╟,╣:╠,╴:╶,╸:╺,▉:🮋,▊:🮊,▋:🮉,▍:🮈,▎:🮇,▏:▕,▖:▗,▘:▝,◀:▶,◁:▷,◂:▸,◃:▹,◄:►,◅:▻,◜:◝,◟:◞,◣:◢,◤:◥,◰:◳,◱:◲,◸:◹,◺:◿,☚:☛,☜:☞,⚟:⚞,⛦:⛥,❨:❩,❪:❫,❬:❭,❮:❯,❰:❱,❲:❳,❴:❵,⟅:⟆,⟕:⟖,⟞:⟝,⟢
 :⟣,⟤:⟥,⟦:⟧,⟨:⟩,⟪:⟫,⟬:⟭,⟮:⟯,⥼:⥽,⦃:⦄,⦅:⦆,⦇:⦈,⦉:⦊,⦋:⦌,⦍:⦐,⦏:⦎,⦑:⦒,⦗:⦘,⧘:⧙,⧚:⧛,⧼:⧽,⫍:⫎,⫥:⊫,⬱:⇶,⮄:⮆,⮐:⮑,⮒:⮓,⯇:⯈,⸂:⸃,⸄:⸅,⸉:⸊,⸌:⸍,⸜:⸝,⸠:⸡,⸦:⸧,⸨:⸩,⸶:⸷,⹑:⹐,⹕:⹖,⹗:⹘,⿸:⿹,〈:〉,《:》,「:」,『:』,【:】,〔:〕,〖:〗,〘:〙,〚:〛,꧁:꧂,﴾:﴿,︵:︶,︷:︸,︹:︺,︻:︼,︽:︾,︿:﹀,﹁:﹂,﹃:﹄,﹇:﹈,﹙:﹚,﹛:﹜,﹝:﹞,(:),[:],{:},⦅:⦆,「:」
$

There are a lot of good pairs in that. But some pairs might need to be switched for taste. (Looking at those hands.)

A "Tail" of Two Scanners


Earlier this year, I had a need to scan a stack of documents about an inch thick to share them with a lawyer. I considered busting out my flatbed scanner, an Epson Perfection 4490 which is somewhere around thirteen years old. It was the first scanner I owned which didn't use SCSI. To judge from Amazon, you can still buy them new, but the "high speed USB 2.0" doesn't sound as attractive these days. I selected it for quality reflective (ie typical scanning) and transparency (ie, slides and negatives) work and Linux compatibility.

It still works, but it never was fun to use. It slow to warm up, slow to scan. Every time I use it I seem to need to do the first scan at least twice while I get positioning and cropping right. And closing the lid so often causes a small gust that blows documnents slightly out of position.

So I found a circa $100 scanner, also Epson, a EM-50 "travel" scanner. The Perfection 4490 is about five inches thick and has a a sheet of glass around nine by twelve (for A4 sized scanning) with hefty "bezel" around the glass. I have to clear desk space every time I pull it off the shelf. The EM-50 is about twice the size (and half the weight) of the just the power brick that the 4490 uses. I don't know if it is USB 2 or USB 3, just that I need a converter for my USB-C computer and again Linux compatible.

After scanning my legal documents, which was a breeze and so very much faster than it would have been on the flatbed, I started to look for other things to scan in the EM-50. It's a narrow feed-through design with a stated maximum size of 8.5" x 72", with the target use case there being receipt scanning for expense reports.

It can also take things that are much thicker than sheets of paper, although still limited to thin. Fun. The apparent use is scanning credit cards, photo IDs, and the like. But I fed a DVD through easily enough. Also a flattened coffee cup sleeve. And a metal ruler.

Flattened coffee cup sleeve with raised hexagon pattern

I saved this coffee cup sleeve because it has an interesting texture.

The EM-50 is far from perfect. It has already developed a defect, a line runs down scans about six inches from left. This may well have been related to my feeding "interesting" things through it. The device feels kinda flimsy. It has a roller to feed material through, but only one, and on the far left, so some things twist as they go through resulting in distortion progressively more extreme to the right edge.

But it was inspiring. So I started to think about a newer device for scanning slides and negatives. And then I got "thank you" gift from work and could spend some "money" at a special capitve portal. I looked around and found a Kodak Scanza. $150 at major e-taliers, and $210 at the portal (but not my money, and shipping, taxes, etc included in that price). Seems to be a four year old product.

Epson EM-50 next to Kodak Scanza

Here's the EM-50 with a dog photo in it next to the Scanza with some Minox negatives.

The Scanza is small, a bit larger than a large coffee mug, and easy to use. That's about all I can say in favor of it. There are few adjustments you can make (and I wanted to adjust brightness). It can only be powered by a USB cord, but doesn't need a computer and came with a janky power adapter. You must provide an SD card to scan to. It doesn't come with even a tiny capacity one (not to mention microSD cards are where it's at these days).

But the biggest sin is the crappy quality of the scan. I expect a "resolution 7200" scan size to give me output that has pretty good fine detail. That's about 280 dots per milimeter, so 8mm x 11mm Minox negatives should be around 2264 x 3113, 7 megapixels.

Scanza scan of my old dog Bo

This is a scan of a Minox negative of my dog Bo. The Scanza does not have a Minox setting, I used a 110 setting (13mm x 17mm) and cropped this to 1917 x 2646 (5.1 megapixels). But it looks like a 1 megapixel image that has been upscaled and blurred. There are mottled blotches of color and indistinct edges.

For comparison, here is an Epson EM-50 scan at 600 dpi of a print of the same photo.

EM-50 scan of my old dog Bo

At 600dpi, this is a 2.6 megapixel image (1342 x 1940) but it's much crisper looking. The focus is off, because I'm not great with rangefinders, but you can see the dog has whiskers (at least one of them) and clearly see the wood grain of the floor.

As a matter of fact, I opened the EM-50 scan up in Gimp, downsized it to 1 megapixel, then scaled it back up to 5 megapixels applied a blur and an unsharp mask, and the image still looked better than the Scanza output.

Bo, again, not much worse for wear

This was scaled down to about 1000 pixels wide, then scaled up to 2700 wide. After that I applied a blur and a sharpen.

The Epson EM-50 was more fun than I expected for something so mundane as a scanner. The Scanza was such a disappointment for even a freebie.


Painting Ads

There's a painting company in San Francisco that tapes up terribly designed, but mostly memorable, flyers on poles all over the city. I've been trying to find all of the variations.

Adverting flyer for room painting

One of the original designs, a multiple font mess evoking a ransom note in consistency.

Adverting flyer for room painting

"DEER CROSSING Tis The Season To Save Some Bucks On Interior House Painting"

Adverting flyer for room painting

"Do This" (ie, Evel Knievel stunts) instead of painting yourself.

Adverting flyer for room painting

"One less Bell to answer,
One less Egg to fry,
One less Mess to pick
Up after?"
With a Valentine's Day picture.

Adverting flyer for room painting

"Are There Little Green Men In Your Head?"

Adverting flyer for room painting

"On Your Path To Interior Appearance Inner Peace"

Adverting flyer for room painting

"Having A Wedding? A Party? An Affaire?" Another with a Valentine's stock photo

Adverting flyer for room painting

"THE RACE IS ON" with roadster versus steam locomotive

Adverting flyer for room painting

Wall of text ending with "Ricky Don't Lose The Number"

Adverting flyer for room painting

"IN SEARCH OF SANITY?"

The next few are much rarer versions.

Adverting flyer for room painting

"Looking?" Looking like a personal ad, the rare clean design.

Adverting flyer for room painting

Room painting as easy as ordering a burrito. Lengua con frijoles refritos, por favor.

Adverting flyer for room painting

Spock says of getting your painting done now: "Correct, it's the logical choice captain"

Adverting flyer for room painting

"Do Something nice For your Landlord!" Because it's welll known that renters like to help landlords out.