31.xhtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. h t t :: / / t /
  4. h t t :: // // t //
  5. h ttttt ttttt ppppp sssss // // y y sssss ttttt //
  6. hhhh t t p p s // // y y s t //
  7. h hh t t ppppp sssss // // yyyyy sssss t //
  8. h h t t p s :: / / y .. s t .. /
  9. h h t t p sssss :: / / yyyyy .. sssss t .. /
  10. <https://y.st./>
  11. Copyright © 2016 Alex Yst <mailto:copyright@y.st>
  12. This program is free software: you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation, either version 3 of the License, or
  15. (at your option) any later version.
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. GNU General Public License for more details.
  20. You should have received a copy of the GNU General Public License
  21. along with this program. If not, see <https://www.gnu.org./licenses/>.
  22. -->
  23. <!DOCTYPE html>
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <base href="https://y.st./en/weblog/2016/10-October/31.xhtml" />
  27. <title>A temporary job &lt;https://y.st./en/weblog/2016/10-October/31.xhtml&gt;</title>
  28. <link rel="icon" type="image/png" href="/link/CC_BY-SA_4.0/y.st./icon.png" />
  29. <link rel="stylesheet" type="text/css" href="/link/basic.css" />
  30. <link rel="stylesheet" type="text/css" href="/link/site-specific.css" />
  31. <script type="text/javascript" src="/script/javascript.js" />
  32. <meta name="viewport" content="width=device-width" />
  33. </head>
  34. <body>
  35. <nav>
  36. <p>
  37. <a href="/en/">Home</a> |
  38. <a href="/en/a/about.xhtml">About</a> |
  39. <a href="/en/a/contact.xhtml">Contact</a> |
  40. <a href="/a/canary.txt">Canary</a> |
  41. <a href="/en/URI_research/"><abbr title="Uniform Resource Identifier">URI</abbr> research</a> |
  42. <a href="/en/opinion/">Opinions</a> |
  43. <a href="/en/coursework/">Coursework</a> |
  44. <a href="/en/law/">Law</a> |
  45. <a href="/en/a/links.xhtml">Links</a> |
  46. <a href="/en/weblog/2016/10-October/31.xhtml.asc">{this page}.asc</a>
  47. </p>
  48. <hr/>
  49. <p>
  50. Weblog index:
  51. <a href="/en/weblog/"><abbr title="American Standard Code for Information Interchange">ASCII</abbr> calendars</a> |
  52. <a href="/en/weblog/index_ol_ascending.xhtml">Ascending list</a> |
  53. <a href="/en/weblog/index_ol_descending.xhtml">Descending list</a>
  54. </p>
  55. <hr/>
  56. <p>
  57. Jump to entry:
  58. <a href="/en/weblog/2015/03-March/07.xhtml">&lt;&lt;First</a>
  59. <a rel="prev" href="/en/weblog/2016/10-October/30.xhtml">&lt;Previous</a>
  60. <a rel="next" href="/en/weblog/2016/11-November/01.xhtml">Next&gt;</a>
  61. <a href="/en/weblog/latest.xhtml">Latest&gt;&gt;</a>
  62. </p>
  63. <hr/>
  64. </nav>
  65. <header>
  66. <h1>A temporary job</h1>
  67. <p>Day 00604: Monday, 2016 October 31</p>
  68. </header>
  69. <img src="/img/CC_BY-SA_4.0/y.st./weblog/2016/10/31.jpg" alt="Mushrooms in the side yard" class="weblog-header-image" width="811" height="480" />
  70. <p>
  71. Current countdowns:
  72. </p>
  73. <ul>
  74. <li>249 scheme-specific <abbr title="Uniform Resource Identifier">URI</abbr>-parsing classes to write and add to <a href="https://git.vola7ileiax4ueow.onion/y.st./include.d/releases">include.d</a></li>
  75. <li>1 free elective left in my associate degree program</li>
  76. <li>4 free electives left in my bachelor degree program</li>
  77. </ul>
  78. <p>
  79. Topics for essays that I want to write outside of school:
  80. </p>
  81. <ul>
  82. <li>How the <abbr title="GNU &quot;Free&quot; Documentation License">GFDL</abbr> isn&apos;t a free license, and is effectively nonfree even when invariant sections aren&apos;t used</li>
  83. <li>How the telephone number system is screwy</li>
  84. <li>How postpaid mobile plans are bad for customers</li>
  85. <li>How connections using &quot;untrusted&quot; <abbr title="Transport Layer Security">TLS</abbr> certificates are more trustworthy than connections without any <abbr title="Transport Layer Security">TLS</abbr> certificate at all</li>
  86. <li>The importance of free software</li>
  87. <li>The importance of free media</li>
  88. </ul>
  89. <p>
  90. It seems that one of the managers from work called me by telephone yesterday and I didn&apos;t notice.
  91. I tried to call back, but I can&apos;t figure out how to place calls through Google Voice.
  92. One option that I found involves having Google Voice call you at another telephone number, then having Google Voice connect your call to the intended party.
  93. That requires having a voice line though, and thankfully, I don&apos;t have one.
  94. If using Google Voice required that I have a separate telephone line, what is even the point of having Google Voice service? The other option works through the Web, at least as far as I can tell, but that option requires the installation of a proprietary Web browser plugin.
  95. Obviously that&apos;s not an option either.
  96. I ended up using <abbr title="Short Message Service">SMS</abbr> to get back to them.
  97. Later in the day, the head manager wrote to me via email.
  98. I explained that I might not be able to stay beyond a month or two, but I got the job anyway! The head manager asked if there was a telephone number that I could be reached at, and I replied that my telephone number is on my resume, but apparently, the head manager already tried that number.
  99. For some reason, they couldn&apos;t get through.
  100. I don&apos;t know what Google did wrong that is preventing the call from getting through, but the head manager brushed it off and said that I should just keep an eye on my email inbox.
  101. Sweet! Last time that I worked there, the same head manager insisted that I not cancel my telephone service because email wasn&apos;t good enough for them.
  102. This will be a big improvement! On Thursday at 14:00, I&apos;m to bring by the documentation that says that I&apos;m legally allowed to work in this country, then on Friday and Saturday, I work shifts from 08:00 to 12:00 and 16:00 to 19:00, respectively.
  103. </p>
  104. <p>
  105. I started building <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> classes for parsing <abbr title="Uniform Resource Identifier">URI</abbr>-like strings with the <code>aaas:</code> and <code>aaa:</code> scheme as described by <a href="https://tools.ietf.org./html/rfc6733"><abbr title="Request for Comments">RFC</abbr> 6733</a>, but I ran into a bit of a design difficulty.
  106. My <abbr title="Uniform Resource Identifier">URI</abbr> parsers and <abbr title="Uniform Resource Identifier">URI</abbr>-like string parsers all extend a base class, <code>\st\y\uri\abstract_class\uri</code>.
  107. This base class is an abstract class that defines a couple of <code>final</code> and <code>abstract</code> methods.
  108. The whole point of this class is to allow <abbr title="Uniform Resource Identifier">URI</abbr>-like strings, which don&apos;t quite meet the definition of a <abbr title="Uniform Resource Identifier">URI</abbr> because they don&apos;t conform to <a href="https://tools.ietf.org./html/rfc3986"><abbr title="Request for Comments">RFC</abbr> 3986</a>, to still be mostly treated as <abbr title="Uniform Resource Identifier">URI</abbr>s.
  109. With that in mind, the <code>\st\y\uri\abstract_class\uri</code> class is defined as containing an <code>abstract</code> method that corresponds to every method present in the base <abbr title="Uniform Resource Identifier">URI</abbr> class, <code>\st\y\uri</code>.
  110. Any method that the base class has, the abstract class must also have.
  111. This is by design.
  112. One method defined in the base class, <code>\st\y\uri::normalize_percent()</code>, doesn&apos;t hold any relevance to <abbr title="Uniform Resource Identifier">URI</abbr>-like strings of the <code>aaas:</code> and <code>aaa:</code> schemes, yet for best compatibility, the abstract class <strong>*must*</strong> call for <code>\st\y\uri\abstract_class\uri::normalize_percent()</code> to be defined.
  113. In theory, I could move the method definition from the <code>\st\y\uri</code> class to the <code>\st\y\uri\abstract_class\uri</code> class, but that seems hacky.
  114. It&apos;s true that it&apos;s unlikely that the schemes of <abbr title="Uniform Resource Identifier">URI</abbr>-like strings will call for percent encodings to function differently than in real <abbr title="Uniform Resource Identifier">URI</abbr>s.
  115. However, it&apos;s also unlikely that a <abbr title="Uniform Resource Identifier">URI</abbr>-like string scheme would call for a host component to be present while also calling for the path component to begin with a non-slash character, but that&apos;s exactly what <abbr title="Request for Comments">RFC</abbr> 6733 does.
  116. Both actions are equally incorrect, and anything claiming to be a <abbr title="Uniform Resource Identifier">URI</abbr> scheme shouldn&apos;t be making such specifications.
  117. My other option is to define the method as just a dummy method in <code>\st\y\uri\abstract_class\aaas</code> (a class extended by <code>\st\y\uri\aaas</code> and <code>\st\y\uri\aaa</code>).
  118. That feels incorrect too though.
  119. Someone calling that method expects something very specific.
  120. If I made that method private, it would no longer be an issue, but I&apos;d be blocking access to that method for no valid reason.
  121. Because of the way that that method is called from within other methods in <code>\st\y\uri</code> (for example, <code>$path = \preg_replace_callback(self::REGEXP_PERCENT, &apos;self::normalize_percent&apos;, $path);</code>), it should be perfectly safe to move it to the abstract class.
  122. Specifically, the method doesn&apos;t have to be final, as it doesn&apos;t matter if child classes redefine it.
  123. The correct version will always be referenced by the <code>self</code> keyword.
  124. With that in mind, I moved the method to the abstract class, at least for now.
  125. I&apos;m not sure that it&apos;s the best option, but at least it keeps me from being stuck, unable to make progress.
  126. In a way, any decision as to what to do here is better than no decision.
  127. </p>
  128. <p>
  129. The next issue that I ran into was the port number validation.
  130. While <abbr title="Request for Comments">RFC</abbr> 6733 doesn&apos;t conform to <abbr title="Request for Comments">RFC</abbr> 3986, it does still call for port numbers to conform to <abbr title="Request for Comments">RFC</abbr> 3986&apos;s definition.
  131. The easiest way to check for conformity is to check the port number against the regular expression contained in the <code>\st\y\uri::REGEXP_PORT</code> constant.
  132. I could copy the value to a constant in the <code>\st\y\uri\abstract_class\aaas</code> class, but that&apos;s always a bad idea.
  133. I could instead use this constant across classes, but that is a bit messy as well.
  134. It causes the <code>\st\y\uri</code> class to be loaded in cases where only that constant is needed.
  135. I ended up moving all regular expression constants from the <code>\st\y\uri</code> class into the <code>\st\y\uri\abstract_class\uri</code> class.
  136. It&apos;s a bit messy, but I think that it&apos;s the best option.
  137. It results in all of the basic regular expressions being loaded any time that any class dealing with <abbr title="Uniform Resource Identifier">URI</abbr>s or <abbr title="Uniform Resource Identifier">URI</abbr>-like strings is involved, but most of these will be actual <abbr title="Uniform Resource Identifier">URI</abbr>s, which would have loaded all of those anyway, and many <abbr title="Uniform Resource Identifier">URI</abbr>-like strings could probably use at least some of those regular expressions.
  138. </p>
  139. <p>
  140. I could have probably finished the classes relating to the two <abbr title="Uniform Resource Identifier">URI</abbr>-like string schemes that I started on today, but I didn&apos;t exactly get to work right away.
  141. I need to get better about that, especially if I&apos;m going to be employed.
  142. There isn&apos;t going to be any time to waste.
  143. </p>
  144. <p>
  145. For quite a while, I&apos;ve been struggling with the decision of whether or not to define my own exception classes in <abbr title="PHP: Hypertext Preprocessor">PHP</abbr>.
  146. On one side, the built-in exception classes use only integer exception codes.
  147. How do you choose meaningful integers to use as the exception codes? That can be fixed in descendant classes, as the only thing enforcing the use of numeric exception codes is the <code>__construct()</code> method, which can be overridden.
  148. Are child classes really warranted though? Furthermore, what can you put in a string-type exception code that would be useful for debugging? The exception code shouldn&apos;t be a full message about what went wrong, as that&apos;s what the exception message is for.
  149. Until today, I&apos;ve been using the built-in exception classes, using my <code>\st\y\string_to_code()</code> function to pack a short, semi-meaningful string into an integer to use as an exception code and <code>\st\y\code_to_string()</code> to later extract that string.
  150. I&apos;ve thought that that strategy is a little messy, but I didn&apos;t really know of a better option.
  151. However, it just occurred how to clean up that mess.
  152. I need custom exception classes that have that functionality built into them! That way, I can simply instantiate the exception classes using the short strings instead of pre-computing the integers and storing them in class constants defined in the classes that throw the exceptions! This has the added benefit of providing a clean way to deal with exceptions thrown from within non-class functions, as those can&apos;t define associated constants.
  153. I can also delete the class constants themselves, which are now obsolete, and add the method for extracting the strings as a class method.
  154. That way, an extra function file doesn&apos;t need to be <code>require</code>d by code that wants to check the exception code properly.
  155. I&apos;ll probably work on coding up the exception classes tomorrow.
  156. For compatibility with the built-in exception tree, I&apos;ll need to define my code as several leaves on the exception class family tree instead of as one class that extends the basic <code>\Exception</code> class.
  157. That way, programmers can still catch different classes of exception properly, distinguishing an <code>\UnderflowException</code> from a <code>\BadMethodCallException</code>.
  158. </p>
  159. <p>
  160. My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
  161. </p>
  162. <hr/>
  163. <p>
  164. Copyright © 2016 Alex Yst;
  165. You may modify and/or redistribute this document under the terms of the <a rel="license" href="/license/gpl-3.0-standalone.xhtml"><abbr title="GNU&apos;s Not Unix">GNU</abbr> <abbr title="General Public License version Three or later">GPLv3+</abbr></a>.
  166. If for some reason you would prefer to modify and/or distribute this document under other free copyleft terms, please ask me via email.
  167. My address is in the source comments near the top of this document.
  168. This license also applies to embedded content such as images.
  169. For more information on that, see <a href="/en/a/licensing.xhtml">licensing</a>.
  170. </p>
  171. <p>
  172. <abbr title="World Wide Web Consortium">W3C</abbr> standards are important.
  173. This document conforms to the <a href="https://validator.w3.org./nu/?doc=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2016%2F10-October%2F31.xhtml"><abbr title="Extensible Hypertext Markup Language">XHTML</abbr> 5.1</a> specification and uses style sheets that conform to the <a href="http://jigsaw.w3.org./css-validator/validator?uri=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2016%2F10-October%2F31.xhtml"><abbr title="Cascading Style Sheets">CSS</abbr>3</a> specification.
  174. </p>
  175. </body>
  176. </html>