Browse Source

accumulate some changes from the last couple of weeks

Brennen Bearnes 1 year ago
parent
commit
69708411dd

archives/2004/12/10 → archives/2004/12/10/index View File

@@ -1,4 +1,3 @@
1
-
2 1
 <h1>Friday, December 10</h1>
3 2
 
4 3
 <p>What follows is unfinished and not remotely cohesive.</p>

+ 0
- 0
archives/2004/12/10/tag-writing.prop View File


+ 4
- 4
archives/2006/1/14/index View File

@@ -51,8 +51,8 @@ of a tragic past</freeverse>
51 51
 
52 52
 <p>Even without nested alternatives, conditionals, or any kind of branching,
53 53
 this is surprisingly flexible. You can take a <a
54
-href="/archives/2006/1/14">look at the source</a>, if you like, or reload
55
-this entry to get a new variation.</p>
54
+href="/archives/2006/1/14">look at the source</a>, if you like, or reload this
55
+entry to get a new variation.</p>
56 56
 
57
-<p><b>May 10, 2016 edit:</b> Since this site is now generated statically,
58
-the poem above will only change when it's republished.</p>
57
+<p><b>May 10, 2016 edit:</b> Since this site is now generated statically, the
58
+poem above will only change when it's republished.</p>

+ 1
- 1
archives/2008/10/10/index View File

@@ -9,7 +9,7 @@ a wrapper around <kbd>diff(1)</kbd> which produces simple "these words
9 9
 added, these words deleted" output.</p>
10 10
 
11 11
 <p>For example, let us imagine that I have two text files, <kbd>one</kbd> and
12
-<kbd>two</kdb>:</p>
12
+<kbd>two</kbd>:</p>
13 13
 
14 14
 <table class="side-by-side">
15 15
   <tr><th>one</th> <th>two</th></tr>

archives/2010/8/25 → archives/2010/8/25/index View File


+ 0
- 0
archives/2010/8/25/tag-facebook.prop View File


archives/2011/5/17 → archives/2011/5/17/index View File


+ 0
- 0
archives/2011/5/17/tag-facebook.prop View File


+ 0
- 0
archives/2014/5/21/tag-facebook.prop View File


+ 0
- 0
archives/2016/2/17/tag-facebook.prop View File


+ 1
- 1
archives/2017/1/7/index View File

@@ -111,7 +111,7 @@ Once I had a running operating system, I needed to be able to read things
111 111
 and use the keyboard.
112 112
 
113 113
 By default, you have to chord <kbd>Fn</kbd> and a function key to get
114
-traditional <kbd>F1</kbd> - <kdb>F12</kbd> input. Since I bind a bunch of stuff
114
+traditional <kbd>F1</kbd> - <kbd>F12</kbd> input. Since I bind a bunch of stuff
115 115
 to function keys in my editor, and only change the volume or toggle the
116 116
 keyboard backlight occasionally, this feels backwards.  I eventually found a
117 117
 forum post that mentioned the BIOS settings for this are now hidden in POST

+ 0
- 0
archives/2018/3/27/tag-facebook.prop View File


+ 138
- 0
archives/2018/5/28/index View File

@@ -0,0 +1,138 @@
1
+
2
+<h1>Monday, May 28</h1>
3
+
4
+<h2>XML::Atom::SimpleFeed and utf-8 text</h2>
5
+
6
+<markdown>
7
+**tl;dr**: If you've got character weirdness with UTF-8 content and the
8
+XML::Atom::SimpleFeed module in Perl, make sure you're doing something
9
+like:
10
+
11
+    my $feed = XML::Atom::SimpleFeed->new(
12
+      -encoding => 'UTF-8',
13
+      # ...
14
+    );
15
+
16
+    my $utf8_content = decode('UTF-8', $content, Encode::FB_CROAK);
17
+
18
+    $feed->add_entry(
19
+      content   => $utf8_content,
20
+      # ...
21
+    );
22
+
23
+A fuller explanation follows.
24
+
25
+<p class="centerpiece"> ☙ </p>
26
+
27
+There's long been a bug with [the Atom feed I generate for this site][feed]
28
+with [wrt][wrt], where characters outside of the ASCII set (like ✿ ✢ ☆) were
29
+showing up mangled in the feed.
30
+
31
+I noticed this once in a while, but never investigated too deeply.  Since
32
+things usually seemed to display correctly in feedreaders (or at least in
33
+[NewsBlur][newsblur]), I always wrote it off as some sort of vaguely
34
+intractable encoding glitch and forgot about it.
35
+
36
+Back in April, though, I [made some changes][wrt-430] to how the feed
37
+generation worked, and [checking it with feedvalidator.org][feedvalidator] made
38
+it obvious that something was legitimately broken.  Sure enough, in the Firefox
39
+feed view, decorative glyphs like `✺` were rendering instead as multiple
40
+characters (see addendum below) while the first line of the generated Atom XML
41
+looked like so:
42
+
43
+    <?xml version="1.0" encoding="us-ascii"?>
44
+
45
+I'm using a CPAN library called XML::Atom::SimpleFeed for this.  Digging around
46
+[in the docs][interface], I found this bit:
47
+
48
+    -encoding (omissible, default us-ascii)
49
+
50
+So I changed the constructor in my code to look like this:
51
+
52
+    my $feed = XML::Atom::SimpleFeed->new(
53
+      -encoding => 'UTF-8',
54
+      title     => $self->{title_prefix} . '::' . $self->{title},
55
+      link      => $self->{url_root},
56
+      link      => { rel => 'self', href => $feed_url, },
57
+      icon      => $self->{favicon_url},
58
+      author    => $self->{author},
59
+      id        => $self->{url_root},
60
+      generator => 'App::WRT.pm / XML::Atom::SimpleFeed',
61
+      updated   => App::WRT::Date::iso_date(App::WRT::Date::get_mtime($first_entry_file)),
62
+    );
63
+
64
+That took care of the declared encoding, but I was still getting mangled
65
+characters.  In order to fix that, I had to add something like:
66
+
67
+    use Encode qw(decode encode);
68
+
69
+    my $utf8_content = decode('UTF-8', $content, Encode::FB_CROAK);
70
+    $feed->add_entry(
71
+      title     => $title,
72
+      link      => $entry_url,
73
+      id        => $entry_url,
74
+      content   => $utf8_content,
75
+      updated   => $iso_date,
76
+    );
77
+
78
+...where I add individual entries to the feed.
79
+
80
+As I understand it, when you read a UTF-8-encoded text file into a Perl string,
81
+the string's contents will correspond to the _bytes_ in the file --- all well
82
+and good, for many purposes, but unless you explicitly use
83
+`Encode::decode('UTF-8', $string)` to map multi-byte characters in UTF-8 to the
84
+correct Unicode code points in Perl's internal string representation, weirdness
85
+will result when somebody calls `Encode::encode($character_set, $string)` to
86
+explicitly turn those bytes back into correctly-encoded _output_, which
87
+XML::Atom::SimpleFeed does.
88
+
89
+I may well be mangling that explanation somewhat.  I've never really had my
90
+head around this class of problems in general, which at this late date should
91
+probably be kind of embarrassing for a working programmer, but I also suspect
92
+that character encoding remains a confusing topic for almost everyone.
93
+
94
+See also:
95
+
96
+* [perlunicode](http://perldoc.perl.org/perlunicode.html),
97
+  [perlunitut](http://perldoc.perl.org/perlunitut.html) (official docs)
98
+* [Allow XML encodings other than us-ascii](https://github.com/ap/XML-Atom-SimpleFeed/issues/2) (GitHub issue)
99
+* [libxml-atom-simplefeed-perl: Encoding hardcoded to us-ascii](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793069)
100
+* [Bug #19722 for XML-Atom-SimpleFeed: Can't make it to work with international charsets](https://rt.cpan.org/Public/Bug/Display.html?id=19722)
101
+* [CPAN Ratings XML-Atom-SimpleFeed reviews](https://cpanratings.perl.org/dist/XML-Atom-SimpleFeed)
102
+
103
+A comment in the review by Darren Kulp (from 2008, no less) pretty much
104
+contains the solution I landed on, but of course I skimmed over it on the first
105
+reading and spent a bunch more time getting there.
106
+
107
+<p class="centerpiece"> ✩ </p>
108
+
109
+**Addendum:** I mentioned that `✺` was rendering as multiple characters.
110
+Specifically, it was turning into what vim displays as `â<9c>º`.  You can use
111
+`xxd` to get a hexdump of this:
112
+
113
+    $ cat original
114
+    ✺
115
+
116
+    $ cat re_encoded
117
+    âº
118
+
119
+    $ xxd original
120
+    00000000: e29c ba                                  ...
121
+
122
+    $ xxd re_encoded
123
+    00000000: c3a2 c29c c2ba                           ......
124
+
125
+So without running `Encode::decode()` on this input, each of those initial 3
126
+bytes (`e2 9c ba`) becomes a character in Perl's internal string
127
+representation, and then `Encode::encode()` says "ok, let's represent these
128
+three characters as UTF-8", from which you obviously get nonsense (though it's
129
+nonsense in which some of the original _bytes_ are preserved).
130
+
131
+[ascii]: https://en.wikipedia.org/wiki/Ascii
132
+[feed]: /feed
133
+[feedvalidator]: https://www.feedvalidator.org/check.cgi?url=https%3A%2F%2Fp1k3.com%2Ffeed
134
+[interface]: https://metacpan.org/pod/XML::Atom::SimpleFeed#INTERFACE
135
+[newsblur]: https://www.newsblur.com/
136
+[wrt]: /topics/wrt
137
+[wrt-430]: /2018/4/9/
138
+</markdown>

+ 0
- 0
archives/2018/5/28/tag-perl.prop View File


+ 0
- 0
archives/2018/5/28/tag-technical.prop View File


+ 0
- 0
archives/2018/5/28/tag-unicode.prop View File


+ 0
- 0
archives/2018/5/28/tag-wrt.prop View File


+ 0
- 0
archives/2018/5/28/tag-xml.prop View File


+ 12
- 12
archives/linkdump View File

@@ -1,3 +1,15 @@
1
+<p><a href="http://vim.wikia.com/wiki/Showing_the_ASCII_value_of_the_current_character">Showing the ASCII value of the current character | Vim Tips Wiki</a> &mdash; Press ga with the cursor on a character. I always forget this one; super useful.</p>
2
+<p><a href="https://blog.plover.com/Unix/stdio-buffering-2.html">The Universe of Discourse : More about disabling standard I/O buffering</a></p>
3
+<p><a href="http://www.perkin.org.uk/posts/how-to-fix-stdio-buffering.html">How to fix stdio buffering</a></p>
4
+<p><a href="https://nevalalee.wordpress.com/2018/05/28/the-constant-gardner/">The Constant Gardner</a></p>
5
+<p><a href="https://en.wikipedia.org/wiki/List_of_cats">List of cats - Wikipedia</a></p>
6
+<p><a href="https://blogs.msdn.microsoft.com/devops/2018/05/29/announcing-the-may-2018-git-security-vulnerability/">Announcing the May 2018 Git Security Vulnerability &ndash; Microsoft DevOps Blog</a></p>
7
+<p><a href="https://nomasters.io/posts/nonparticipation/">nonparticipation - nomasters</a></p>
8
+<p><a href="https://nevalalee.wordpress.com/2018/05/25/a-season-of-disenchantment/">A season of disenchantment</a></p>
9
+<p><a href="http://solarconflict.com/w2nSEmTj-YI.video">&#x1F4FA; Self Balancing Robot by Michael Tasellari</a> &mdash; This is amazing.</p>
10
+<p><a href="https://synocommunity.com/#easy-install">SynoCommunity</a> &mdash; &quot;SynoCommunity provides packages for Synology-branded NAS devices.&quot;</p>
11
+<p><a href="https://drewdevault.com/2018/05/27/Why-rewrite-wlc.html">Why did we replace wlc?</a></p>
12
+<p><a href="http://raganwald.com/2018/05/20/we-dont-need-no-stinking-recursion.html">Recursion? We don&#39;t need no stinking recursion!</a></p>
1 13
 <p><a href="https://unix.stackexchange.com/questions/87908/how-do-you-empty-the-buffers-and-cache-on-a-linux-system">kernel - How do you empty the buffers and cache on a Linux system? - Unix &amp; Linux Stack Exchange</a></p>
2 14
 <p><a href="https://krebsonsecurity.com/2018/05/mobile-giants-please-dont-share-the-where/">Mobile Giants: Please Don&rsquo;t Share the Where &mdash; Krebs on Security</a></p>
3 15
 <p><a href="https://blog.plover.com/Unix/stdio-buffering-2.html">More about disabling standard I/O buffering</a></p>
@@ -7,15 +19,3 @@
7 19
 <p><a href="https://www.bloomberg.com/news/articles/2018-05-14/inside-google-a-debate-rages-should-it-sell-artificial-intelligence-to-the-military">Inside Google, a Debate Rages: Should It Sell Artificial Intelligence to the Military? - Bloomberg</a> &mdash; don&#39;t be evil lol</p>
8 20
 <p><a href="https://nevalalee.wordpress.com/2018/05/15/the-bedtime-story/">The bedtime story</a></p>
9 21
 <p><a href="http://blog.khinsen.net/posts/2017/11/16/a-plea-for-stability-in-the-scipy-ecosystem/">A plea for stability in the SciPy ecosystem</a></p>
10
-<p><a href="https://www.frequencycheck.com/compatibility/EaDXIlv/planet-computers-gemini-pda-lte/united-states">Planet Computers Gemini PDA LTE Compatibility in United States</a></p>
11
-<p><a href="https://www.calebthompson.io/talks/dont-get-distracted/">Don&#39;t Get Distracted</a> &mdash; &quot;I&rsquo;m going to tell you about how I took a job building software to kill people.&quot;</p>
12
-<p><a href="https://github.com/cowlicks/privacypossum">cowlicks/privacypossum: Privacy Possum makes tracking you less profitable</a> &mdash; An anti-tracking-oriented plugin from a one-time Privacy Badger dev. Probably worth a look.</p>
13
-<p><a href="https://tedium.co/2018/05/10/sound-blaster-history/">Sound Blaster: How Sound Cards Took Over Computing</a> &mdash; &quot;Sound cards like the Creative Sound Blaster were the missing element that computers needed to take on multimedia. Then, they faded from view. Here&#39;s why.&quot;</p>
14
-<p><a href="https://claro2.wordpress.com/2016/11/07/the-healthy-will-of-the-people-a-lesson-from-history/">&ldquo;The healthy will of the people&rdquo; &ndash; a lesson from history &ndash; James Christie&#39;s personal blog</a></p>
15
-<p><a href="https://nicholas.carlini.com/code/audio_adversarial_examples/">Audio Adversarial Examples</a> &mdash; &laquo;We have constructed targeted audio adversarial examples on speech-to-text transcription neural networks: given an arbitrary waveform, we can make a small perturbation that when added to the original waveform causes it to transcribe as any phrase we choose.&raquo;</p>
16
-<p><a href="https://tracking.feedpress.it/link/15204/9120124">Make Some Noise</a></p>
17
-<p><a href="http://www.mondo2000.com/2018/05/10/why-did-some-countercultural-types-vote-for-trump/">Why Did Some Countercultural Types Vote For Trump? - Mondo 2000</a> &mdash; These seem like fairly accurate observations, as far as they go. (Could probably use a side of &quot;lots of people are just racist as hell&quot;.)</p>
18
-<p><a href="https://ai.googleblog.com/2018/05/duplex-ai-system-for-natural-conversation.html">Google AI Blog: Google Duplex: An AI System for Accomplishing Real-World Tasks Over the Phone</a></p>
19
-<p><a href="https://nevalalee.wordpress.com/2018/05/09/the-ghost-story/">The ghost story</a></p>
20
-<p><a href="https://www.theatlantic.com/entertainment/archive/2018/05/the-world-still-spins-around-male-genius/559925/">Karr, Wallace, Schneiderman, &amp; the Tyranny of Genius - The Atlantic</a></p>
21
-<p><a href="https://www.youtube.com/watch?v=7rqvRwfZHF4">Building a Kubernetes on Bare-Metal Cluster to Serve Wikipedia - Alexandros Kosiaris - YouTube</a></p>

+ 30
- 0
archives/topics/facebook View File

@@ -2,8 +2,38 @@
2 2
 <table class="tags">
3 3
   <tr>
4 4
     <th>
5
+      <a href="/2018/3/27">2018/3/27</a>
6
+    </th>
7
+    <td>some guesses</td>
8
+  </tr>
9
+  <tr>
10
+    <th>
11
+      <a href="/2016/2/17">2016/2/17</a>
12
+    </th>
13
+    <td>process management with pm2</td>
14
+  </tr>
15
+  <tr>
16
+    <th>
17
+      <a href="/2014/5/21">2014/5/21</a>
18
+    </th>
19
+    <td>Ta-Nehisi Coates, </td>
20
+  </tr>
21
+  <tr>
22
+    <th>
5 23
       <a href="/2011/7/5">2011/7/5</a>
6 24
     </th>
7 25
     <td>channels</td>
8 26
   </tr>
27
+  <tr>
28
+    <th>
29
+      <a href="/2011/5/17">2011/5/17</a>
30
+    </th>
31
+    <td> on Facebook:</td>
32
+  </tr>
33
+  <tr>
34
+    <th>
35
+      <a href="/2010/8/25">2010/8/25</a>
36
+    </th>
37
+    <td>pitchforks &amp; torches, people</td>
38
+  </tr>
9 39
 </table>

+ 6
- 0
archives/topics/perl View File

@@ -2,6 +2,12 @@
2 2
 <table class="tags">
3 3
   <tr>
4 4
     <th>
5
+      <a href="/2018/5/28">2018/5/28</a>
6
+    </th>
7
+    <td>XML::Atom::SimpleFeed and utf-8 text</td>
8
+  </tr>
9
+  <tr>
10
+    <th>
5 11
       <a href="/2018/4/9">2018/4/9</a>
6 12
     </th>
7 13
     <td>App::WRT v4.3.0: schwartzian transforms, long-term projects</td>

+ 6
- 0
archives/topics/technical View File

@@ -19,6 +19,12 @@ I wrote an (unfinished) introduction to the command-line called
19 19
 <table class="tags">
20 20
   <tr>
21 21
     <th>
22
+      <a href="/2018/5/28">2018/5/28</a>
23
+    </th>
24
+    <td>XML::Atom::SimpleFeed and utf-8 text</td>
25
+  </tr>
26
+  <tr>
27
+    <th>
22 28
       <a href="/2018/5/1">2018/5/1</a>
23 29
     </th>
24 30
     <td>wtfm</td>

+ 9
- 0
archives/topics/unicode View File

@@ -0,0 +1,9 @@
1
+<h1>entries by topic: <a href="/topics/unicode/">unicode</a></h1>
2
+<table class="tags">
3
+  <tr>
4
+    <th>
5
+      <a href="/2018/5/28">2018/5/28</a>
6
+    </th>
7
+    <td>XML::Atom::SimpleFeed and utf-8 text</td>
8
+  </tr>
9
+</table>

+ 6
- 0
archives/topics/writing View File

@@ -15,6 +15,12 @@
15 15
   </tr>
16 16
   <tr>
17 17
     <th>
18
+      <a href="/2004/12/10">2004/12/10</a>
19
+    </th>
20
+    <td>What follows is unfinished and not remotely cohesive.</td>
21
+  </tr>
22
+  <tr>
23
+    <th>
18 24
       <a href="/2004/2/19">2004/2/19</a>
19 25
     </th>
20 26
     <td>Armand over at </td>

+ 6
- 0
archives/topics/wrt View File

@@ -35,6 +35,12 @@ $ cpan -i App::WRT
35 35
 <table class="tags">
36 36
   <tr>
37 37
     <th>
38
+      <a href="/2018/5/28">2018/5/28</a>
39
+    </th>
40
+    <td>XML::Atom::SimpleFeed and utf-8 text</td>
41
+  </tr>
42
+  <tr>
43
+    <th>
38 44
       <a href="/2018/4/19">2018/4/19</a>
39 45
     </th>
40 46
     <td>a git log with both tags and dates</td>

+ 9
- 0
archives/topics/xml View File

@@ -0,0 +1,9 @@
1
+<h1>entries by topic: <a href="/topics/xml/">xml</a></h1>
2
+<table class="tags">
3
+  <tr>
4
+    <th>
5
+      <a href="/2018/5/28">2018/5/28</a>
6
+    </th>
7
+    <td>XML::Atom::SimpleFeed and utf-8 text</td>
8
+  </tr>
9
+</table>

+ 0
- 1
wrt-lynx-preview.json View File

@@ -1,5 +1,4 @@
1 1
 {
2
-   "feed_url": "https://p1k3.com/feed",
3 2
    "entry_dir": "./archives",
4 3
    "publish_dir": "./public_lynx",
5 4
    "title_prefix": "p1k3",

+ 0
- 1
wrt.json View File

@@ -1,5 +1,4 @@
1 1
 {
2
-   "feed_url": "https://p1k3.com/feed",
3 2
    "feed_length": 100,
4 3
    "entry_dir": "./archives",
5 4
    "title_prefix": "p1k3",

Loading…
Cancel
Save