16.xhtml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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/01-January/16.xhtml" />
  27. <title>Exceptions and shared memory &lt;https://y.st./en/weblog/2016/01-January/16.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/01-January/16.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/01-January/15.xhtml">&lt;Previous</a>
  60. <a rel="next" href="/en/weblog/2016/01-January/17.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>Exceptions and shared memory</h1>
  67. <p>Day 00315: Saturday, 2016 January 16</p>
  68. </header>
  69. <p>
  70. Last night, I had a pretty bad dream in which my laptop was starting to break down physically.
  71. The metal part where the hinge attaches to the screen was bending apart.
  72. The screen was starting to detach and it was only a matter of time before it was no longer functional.
  73. Once awake though, I realized that this laptop was not my own <a href="/en/domains/cepo.local.xhtml"><code>cepo</code></a> though.
  74. Cepo&apos;s shell is made of plastic, not metal.
  75. Still, what does this dream mean? Does it mean that I fear the destruction of my laptop?
  76. </p>
  77. <p>
  78. The power went out this morning.
  79. By the spider&apos;s own estimate, it was over halfway finished crawling that large website that I keep trying to have it crawl, but once again, it is going to have to start over.
  80. It had crawled 37890 pages and had an estimated 19770 pages left.
  81. I really hope some day to move past this site.
  82. </p>
  83. <p>
  84. Feeling stranded without Internet access, I used what power I had left in <code>cepo</code>&apos;s battery to work on wrapper classes.
  85. It is a good thing that I downloaded that <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> manual.
  86. Thankfully, the <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> website even offers a full-manual download option instead of requiring each page be visited and downloaded manually.
  87. Furthermore, the manual is under the <abbr title="Creative Commons Attribution 3.0 Unported">CC BY 3.0</abbr> license, so I do not have to feel bad about having a copy of it on my machine.
  88. I built the functions covered by today&apos;s section of the manual into three small classes dealing with shared memory.
  89. I experimented a bit, and it seems like if modified my spider to make use of them, it should be possible to set up a script that can check on the spider&apos;s progress without keeping the spider open in my terminal window at all times.
  90. It might not be able to allow me to hook into the continuing output flow that I would have if I kept it running in my terminal window, but it would give me the freedom to allow <a href="/en/domains/newdawn.local.xhtml"><code>newdawn</code></a> to be put to sleep at night, or even take <code>newdawn</code> outside the house if desired.
  91. </p>
  92. <p>
  93. As it turns out, we did not do much at the library in regards to Cyrus&apos; project.
  94. He needed to measure some shelves, but that was all.
  95. After that, he and our mother went home, while Vanessa and I stayed to participate in the monthly coloring club.
  96. Last time, i was somewhat unprepared.
  97. It was a fun idea in theory, but we were coloring ostensibly nonfree works.
  98. This time, I asked for a blank sheet of paper and did my best to draw <a href="http://floraverse.com/">Floraverse</a>&apos;s Andre from memory.
  99. I messed it up quite a bit, but it was still fun.
  100. After that, I started working on a line drawing using a ruler, but quickly realized that that was a bad idea.
  101. My underlying goal in attendance it to improve my eye hand coordination.
  102. Drawing lines using a ruler does not help me to do that.
  103. </p>
  104. <p>
  105. After Vanessa and I returned home, we met back up with Cyrus and our mother and attended an earthquake lecture at the local community collage.
  106. Much of the lecture was either about things I already knew or were above my head, but one important fact did stand out: the data that these people are gathering about seismic activity is publicly accessible.
  107. The people speaking at the lecture are the <a href="https://pnsn.org/">Pacific Northwest Seismic Network</a>, and their current goal seems to be to learn more about the fault line that lies just off the local coast in fairly shallow water.
  108. The lecturer also mentioned the <a href="/en/weblog/2015/07-July/04.xhtml">minor earthquake in Springfield not too long ago</a>, explaining that the reason that it was so weak is that it originated within the crust.
  109. Had it originated deep in the mantle, it would have been stronger, or if it had originated at a fault line, it would have possibly been devastating.
  110. </p>
  111. <p>
  112. Whenever I write my code to throw exceptions in case of error, I have to go back to the two lists of exceptions built into <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> to try to find the best exception for the job.
  113. Furthermore, the lists do not have information with them, instead they have links to the pages that do have the information.
  114. In other words, the manual is organized, and these lists are only indexes.
  115. However, I have been thinking for quite some time that I could really use a list for quick reference.
  116. Today, I sat down to create such a list.
  117. I understand that it is helpful to define one&apos;s own exceptions when one is using them in catch blocks and only wants to catch certain types of errors, but I think that in most other cases, it is better just to use the built-in exceptions.
  118. That said, it is probably best to use the most specific available exception that applies to the situation, so I also organized the exceptions into the following list so I could better visualize the built-in exception hierarchy:
  119. </p>
  120. <ul>
  121. <li><a href="https://secure.php.net/manual/en/class.throwable.php"><code>\Throwable</code></a><ul>
  122. <li><a href="https://secure.php.net/manual/en/class.error.php"><code>\Error</code></a><ul>
  123. <li><a href="https://secure.php.net/manual/en/class.arithmeticerror.php"><code>\ArithmeticError</code></a><ul>
  124. <li><a href="https://secure.php.net/manual/en/class.divisionbyzeroerror.php"><code>\DivisionByZeroError</code></a></li>
  125. </ul></li>
  126. <li><a href="https://secure.php.net/manual/en/class.assertionerror.php"><code>\AssertionError</code></a></li>
  127. <li><a href="https://secure.php.net/manual/en/class.parseerror.php"><code>\ParseError</code></a></li>
  128. <li><a href="https://secure.php.net/manual/en/class.typeerror.php"><code>\TypeError</code></a></li>
  129. </ul></li>
  130. <li><a href="https://secure.php.net/manual/en/class.exception.php"><code>\Exception</code></a><ul>
  131. <li><a href="https://secure.php.net/manual/en/class.errorexception.php"><code>\ErrorException</code></a></li>
  132. <li><a href="https://secure.php.net/manual/en/class.logicexception.php"><code>\LogicException</code></a><ul>
  133. <li><a href="https://secure.php.net/manual/en/class.badfunctioncallexception.php"><code>\BadFunctionCallException</code></a><ul>
  134. <li><a href="https://secure.php.net/manual/en/class.badmethodcallexception.php"><code>\BadMethodCallException</code></a></li>
  135. </ul></li>
  136. <li><a href="https://secure.php.net/manual/en/class.domainexception.php"><code>\DomainException</code></a></li>
  137. <li><a href="https://secure.php.net/manual/en/class.invalidargumentexception.php"><code>\InvalidArgumentException</code></a></li>
  138. <li><a href="https://secure.php.net/manual/en/class.lengthexception.php"><code>\LengthException</code></a></li>
  139. <li><a href="https://secure.php.net/manual/en/class.outofrangeexception.php"><code>\OutOfRangeException</code></a></li>
  140. </ul></li>
  141. <li><a href="https://secure.php.net/manual/en/class.runtimeexception.php"><code>\RuntimeException</code></a><ul>
  142. <li><a href="https://secure.php.net/manual/en/class.outofboundsexception.php"><code>\OutOfBoundsException</code></a></li>
  143. <li><a href="https://secure.php.net/manual/en/class.overflowexception.php"><code>\OverflowException</code></a></li>
  144. <li><a href="https://secure.php.net/manual/en/class.rangeexception.php"><code>\RangeException</code></a></li>
  145. <li><a href="https://secure.php.net/manual/en/class.underflowexception.php"><code>\UnderflowException</code></a></li>
  146. <li><a href="https://secure.php.net/manual/en/class.unexpectedvalueexception.php"><code>\UnexpectedValueException</code></a></li>
  147. </ul></li>
  148. </ul></li>
  149. </ul></li>
  150. </ul>
  151. <p>
  152. It is worth noting that the <code>\Throwable</code> interface and everything in the <code>\Error</code> branch of the tree are only available in <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> 7, not in <abbr title="PHP: Hypertext Preprocessor">PHP</abbr>5.
  153. It seems that <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> 7 is built to be more object-oriented than <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> 5, so these added exceptions are available for internal use, allowing the language to throw exceptions instead of raising errors.
  154. It sounds like if these built-in exceptions are not caught, the regular error handler will be called, but hopefully the exception&apos;s backtrace will be kept intact when this happens and will be output with the error message.
  155. </p>
  156. <p>
  157. Before going to bed, our mother gave Vanessa, Cyrus, and I a strange quiz that made me nervous.
  158. Much of it was about how we feel about things, but with her being the type to overreact about things and in many ways be intolerant, I did feel the need to lie in my answers.
  159. I talked to Cyrus later, and is seems that he had come to a similar conclusion when he had assessed the situation.
  160. I did not get a chance to speak with Vanessa about it, but my guess is that she reached the same conclusion that we did and took the same precautionary measures.
  161. </p>
  162. <p>
  163. This winter, I was pretty cold, as most of the blankets that we have are made from animal products, so I refused to use them.
  164. At least, that is what I thought at the time.
  165. I had thought that fleece was synthetic, but someone told me that it was an animal product.
  166. Being busy, I never looked into it, but the other day, someone else told me that fleece is made of polyester! I looked into it today, and it turns out that the cloth that people typically call &quot;fleece&quot; is actually called <a href="https://en.wikipedia.org/wiki/Polar_fleece">polar fleece</a>.
  167. This fabric is also known as &quot;polar wool&quot;, &quot;vega wool&quot;, and &quot;velo wools&quot;, but despite its animal-sounding names, it is made of <a href="https://en.wikipedia.org/wiki/Polyethylene_terephthalate">polyethylene terephthalate</a>, a type of polyester.
  168. Fleece is just plastic! Had I actually done research when I was told that it was an animal product, I could have been warm this winter.
  169. </p>
  170. <p>
  171. It seems that <a href="https://opalrwf4mzmlfmag.onion/">wowaname</a>&apos;s server is back up! That must be a relief for her.
  172. When my server is down, I feel stranded, even if my laptop is still online.
  173. I assume that she feels similarly.
  174. </p>
  175. <p>
  176. It sounds like the plan to go to Eugene and Springfield tomorrow or the next day may still happen.
  177. If this does happen before the spider finishes crawling the huge website that it is working with, it will once again have to be interrupted.
  178. It will have to begin its progress from scratch yet again.
  179. The alternative is to leave <code>newdawn</code> in Coos Bay, but that would mean potentially being unable to write a journal entry or two while events are still fresh in my mind.
  180. </p>
  181. <p>
  182. My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
  183. </p>
  184. <hr/>
  185. <p>
  186. Copyright © 2016 Alex Yst;
  187. 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>.
  188. If for some reason you would prefer to modify and/or distribute this document under other free copyleft terms, please ask me via email.
  189. My address is in the source comments near the top of this document.
  190. This license also applies to embedded content such as images.
  191. For more information on that, see <a href="/en/a/licensing.xhtml">licensing</a>.
  192. </p>
  193. <p>
  194. <abbr title="World Wide Web Consortium">W3C</abbr> standards are important.
  195. This document conforms to the <a href="https://validator.w3.org./nu/?doc=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2016%2F01-January%2F16.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%2F01-January%2F16.xhtml"><abbr title="Cascading Style Sheets">CSS</abbr>3</a> specification.
  196. </p>
  197. </body>
  198. </html>