20.xhtml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 © 2017 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/2017/07-July/20.xhtml" />
  27. <title>Hair care and a potential unibrow &lt;https://y.st./en/weblog/2017/07-July/20.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/2017/07-July/20.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/2017/07-July/19.xhtml">&lt;Previous</a>
  60. <a rel="next" href="/en/weblog/2017/07-July/21.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>Hair care and a potential unibrow</h1>
  67. <p>Day 00866: Thursday, 2017 July 20</p>
  68. </header>
  69. <section id="general">
  70. <h2>General news</h2>
  71. <p>
  72. I have strange hair growing just above my nose now.
  73. I swear it wasn&apos;t there before.
  74. Am I starting to develop a unibrow?
  75. That&apos;ll be so weird if it&apos;s what&apos;s going on.
  76. </p>
  77. <p>
  78. I looked into hair care tips not too long ago, and while I&apos;m ignoring some of them, I&apos;m following others.
  79. One thing I&apos;m working with is the cleaning of it.
  80. Apparently, you shouldn&apos;t use shampoo unless your hair&apos;s actually dirty, but you should use conditioner every time.
  81. It&apos;s been only a few days of following this advice, and already, my hair looks loads nicer.
  82. </p>
  83. <p>
  84. I agreed to meet my mother today, but like usual, she&apos;s not responding to messages.
  85. The problem is that she&apos;s on the nation&apos;s screwiest carrier and doesn&apos;t use email.
  86. My messages often don&apos;t reach her via <abbr title="Short Message Service">SMS</abbr>, but that&apos;s the method she insists I try to reach her with.
  87. I asked before coming over, got no response, went to her place anyway, rang the doorbell, and again got no response.
  88. Whatever.
  89. More study time for me, though I&apos;d have even more if I wasn&apos;t wasting time trying to meet her.
  90. I didn&apos;t even want to go when I agreed to, but she really wanted it.
  91. In the evening, she wrote to me to see if I was home, even though I told her I wouldn&apos;t be.
  92. I told her I had the morning off and had to be at work in the evening.
  93. If she wants to e away in the morning when we agreed to meet up, that doesn&apos;t mean she can reschedule to meet me at night when she knows I&apos;m busy.
  94. </p>
  95. <p>
  96. At work, I thought about something that seems to add up with my newly-discovered hodgepodge brain.
  97. I forget why, but at one point as a child, my mother had my testosterone levels checked.
  98. They turned out to be low.
  99. Of course they&apos;re low though, I&apos;m half feminine and the expected level doesn&apos;t account for the fact that I&apos;m not fully masculine.
  100. </p>
  101. <p>
  102. My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
  103. </p>
  104. </section>
  105. <section id="university">
  106. <h2>University life</h2>
  107. <p>
  108. I wrote up my initial discussion post for the week:
  109. </p>
  110. <blockquote>
  111. <p>
  112. A <code>ServerSocket</code> doesn&apos;t actually manage any connections, and instead just acts as a listener.
  113. It waits for connection requests from clients, then spawns <code>Socket</code>s to manage the new connections.
  114. A <code>Socket</code> isn&apos;t always on the server though.
  115. Clients also use <code>Socket</code>s to communicate.
  116. One <code>Socket</code> is needed for each the client and server machine.
  117. It&apos;s worth noting that one machine could be both the client and the server.
  118. (This is usually accomplished by having the client connect to <code>localhost.</code> or <code>127.0.0.1</code>.)
  119. In this case, both endpoints still need a <code>Socket</code> instance.
  120. </p>
  121. <p>
  122. (When using the local domain, <code>localhost.</code>, the trailing dot is usually omitted.
  123. However, if your system can&apos;t handle it <strong>*with*</strong> the trailing dot, it&apos;s technically a bug in your system.
  124. Additionally, any domain using the <code>localhost.</code> <abbr title="Top Level Domain">TLD</abbr> is supposed to lead back to the originating machine, though in practice, most systems don&apos;t seem to implement this.
  125. For example, connecting to <code>example.localhost.</code> or <code>test.example.localhost.</code> <strong>*should*</strong> connect to the local machine, but usually won&apos;t because that feature is so rarely implemented.
  126. Again, that&apos;s a bug in your operating system&apos;s <abbr title="Domain Name System">DNS</abbr> resolver, not an invalid domain name.)
  127. </p>
  128. <p>
  129. Using the <code>ServerSocket</code> class is basically just a waiting game.
  130. Usually, you&apos;d want to create an instance of it using its constructor, <code>ServerSocket.ServerSocket(port)</code>, passing in an integer representing the port you want to listen on, then start up a loop and call <code>ServerSocket.accept()</code>.
  131. <code>ServerSocket.accept()</code> will tie up the program (or if your program is multithreaded, just that one thread of the program), and wait for an incoming connection. When it gets one, it&apos;ll return an object of type <code>Socket</code>, which you can use to complete the connection.
  132. If the call to <code>ServerSocket.accept()</code> isn&apos;t within a loop, your program will accept one connection, then finish up without accepting any more.
  133. </p>
  134. <p>
  135. If you&apos;re running the server, <code>Socket</code> objects are retuned by <code>ServerSocket.accept()</code>.
  136. If you&apos;re instead running the client, <code>Socket</code> objects can be obtained through the class&apos; constructor: <code>Socket.Socket(host, port)</code>.
  137. The host can be any valid host name, including both domain names and <abbr title="Internet Protocol">IP</abbr> addresses, and the port must be an unsigned, 16-bit integer.
  138. The <code>Socket</code> object contains two streams, one for input and one for output.
  139. <code>Socket.getInputStream()</code> and <code>Socket.getOutputStream()</code> can be used to retrieve those, respectively.
  140. The book didn&apos;t cover how to handle these stream objects directly, but they can be wrapped in objects of familiar classes, such as <code>Scanner</code> and <code>PrintWriter</code>.
  141. When you&apos;re done using the connection, <code>Socket.close()</code> should be called to free up memory and let the other machine know you&apos;re done.
  142. </p>
  143. </blockquote>
  144. </section>
  145. <hr/>
  146. <p>
  147. Copyright © 2017 Alex Yst;
  148. 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>.
  149. If for some reason you would prefer to modify and/or distribute this document under other free copyleft terms, please ask me via email.
  150. My address is in the source comments near the top of this document.
  151. This license also applies to embedded content such as images.
  152. For more information on that, see <a href="/en/a/licensing.xhtml">licensing</a>.
  153. </p>
  154. <p>
  155. <abbr title="World Wide Web Consortium">W3C</abbr> standards are important.
  156. This document conforms to the <a href="https://validator.w3.org./nu/?doc=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2017%2F07-July%2F20.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%2F2017%2F07-July%2F20.xhtml"><abbr title="Cascading Style Sheets">CSS</abbr>3</a> specification.
  157. </p>
  158. </body>
  159. </html>