{"id":43712,"date":"2018-08-21T01:35:23","date_gmt":"2018-08-21T05:35:23","guid":{"rendered":"http:\/\/shamusyoung.com\/twentysidedtale\/?p=43712"},"modified":"2018-08-21T13:58:31","modified_gmt":"2018-08-21T17:58:31","slug":"you-hate-it-already","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=43712","title":{"rendered":"You Hate It Already"},"content":{"rendered":"<p>Programming is different from a lot of other creative endeavors because it <em>feels good<\/em> when you expunge your recent work. If I&#8217;m editing my book and I realize an entire passage is redundant, I don&#8217;t enjoy killing it. Without an editor pushing me, I might even leave it in. Same goes for when I&#8217;m making music. If I lay down a bass line and later realize it&#8217;s just not working, I don&#8217;t get a thrill from canning it. Likewise for texture maps and 3D models. If it&#8217;s something I made recently, then I hate to get rid of it. <\/p>\n<p>For contrast, if I come up with a shorter, clearer, more elegant piece of code, then deleting the old code is pretty satisfying. Sometimes I get caught up in the desire to make the code as small as possible and mess around with small details that don&#8217;t matter, just because it feels good to have something happen in five lines rather than six. (It only counts if I&#8217;ve really simplified something. If you take the complexity of line #6 and add it to line #5 than you&#8217;ve made the code shorter, but not simpler. And you may have made it a little more convoluted, which is worse.)<\/p>\n<p>For those of you browsing the archives from the future<span class='snote' title='1'>I do wonder why you&#8217;re browsing the boring &#8220;Notices&#8221; category, but that&#8217;s your business.<\/span>, last week the site looked like this:<\/p>\n<p><!--more--><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/site_archive_aug2018_old.jpg' width=100% alt='Old hotness.' title='Old hotness.'\/><\/div><div class='mouseover-alt'>Old hotness.<\/div><\/p>\n<p>I&#8217;d planned to just do a small update. There were a bunch of little annoyances that had been eating at me for months and I wanted to fix them. The RSS links were a little hard to read due to being small blue-on-black text. The Twitter rollout was crooked. Sometimes blockquotes and other enclosed text would use the giant red drop cap, which is only supposed to happen at the start of a post. There was an annoying horizontal scrollbar that would appear at certain screen widths. You could only see the link to the forums if you were browsing on a desktop at 1080p or more. It was hard to read mouseover text from a mobile screen<span class='snote' title='2'>The mouseover text is now automatically visible in mobile view.<\/span>. And so on. <\/p>\n<p>But then <a href=\"?p=43692\">my site went down<\/a>. I spent about 24 hours watching the CPU gauge bounce up and down between 96% and 100%, which really got me thinking about performance. You might remember that last January I was trying to figure out <a href=\"?p=41607\">how much load my site puts on the server<\/a>. WordPress themes are not created equal and a badly-designed theme can consume an order of magnitude more power than a good one. <a href=\"?p=42796\">I like knowing about resource usage<\/a>, and since <a href=\"?p=43338\">I moved to my new webhost<\/a> I now have the ability to monitor things like CPU, memory, and bandwidth usage. I&#8217;ve been wanting a feature like that since the early days of this site.   <\/p>\n<p>For those of you reading the archives in the future, I have changed this site to look like this:<\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/site_archive_aug2018_new.jpg' width=100% alt='New & Busted.' title='New & Busted.'\/><\/div><div class='mouseover-alt'>New & Busted.<\/div><\/p>\n<p>Yes, this is a very dry theme. This style was all the rage a couple of years ago<span class='snote' title='3'>There&#8217;s a built-in WordPress theme that features this exact style of layout. It&#8217;s called &#8220;Twenty Fifteen&#8221;. So if you&#8217;re following what the hip youngsters are doing in web design, this layout is a little out of fashion.<\/span>. I set things up this way because this layout is fairly trivial and I was able to throw it together in a couple of hours. <\/p>\n<p>In the process, I completely gutted the code that runs the site. (Yes, I use source control. Don&#8217;t worry. Nothing was deleted for good.) This theme is a fraction of the size of the old one. I deleted much more than I wrote. This theme has accumulated a lot of cruft over the years. Unused CSS. Redundant PHP. Superfluous SQL queries. HTML clutter. I&#8217;ve never made PHP code that I found to be beautiful, but this code is probably the least ghastly PHP I&#8217;ve ever written.<\/p>\n<p>I think that what we&#8217;re left with represents the bare minimum of features required to make this site go. We&#8217;ve lost the rotating backgrounds, the thing that shows off popular posts from the archives, the big links across the top, and a bunch of other stuff. I doubt the raw HTML is all that much smaller, but it&#8217;s created using a fraction of the lines of code and about a dozen fewer database queries for the front page.<\/p>\n<p>My plan is to see how this theme performs during busy periods. Once I get some sort of baseline measurement for resource usage, I can start adding bells and whistles until this looks like a videogame site again.<\/p>\n<h3>So What&#8217;s New?<\/h3>\n<p>I&#8217;ve added a feature to do a &#8220;boxed quote&#8221;. Sometimes I want to break up a giant wall of text. The most obvious way of doing this is to insert an image. But sometimes an image is overkill. Or it will end up too close to a later image and drown out the text. Or there isn&#8217;t a contextually appropriate image to go with the topic at hand. In these cases, publications often toss in a boxed quote<span class='snote' title='4'>I&#8217;m not sure what the real print media lingo is for this concept. I thought it was &#8220;pullquote&#8221;, but that seems to be something else.<\/span>. <\/p>\n<p>[quote|Like, how am I supposed to know what parts of my article are worth quoting? It makes it look like I&#8217;m broadcasting that I think I&#8217;ve said something clever.]It wasn&#8217;t until I added this feature that I realized how odd it is to use on your own material. Choosing a good quote to fill the box is something an editor normally does for you. But I&#8217;m my own editor, and it feels vaguely narcissistic to put my own quotes in boxes. It makes it look like I&#8217;m broadcasting that I think I&#8217;ve said something clever, and announcing your cleverness is a great way to undermine it. It&#8217;s the print equivalent of going, &#8220;Did you see what I did there? Huh? Did you? Pretty good, right?&#8221;<\/p>\n<p>So I dunno. Maybe I&#8217;ll be too self-conscious to use it. On the other hand, inserting a boxed quote requires way less effort than finding, sizing, saving, uploading, and embedding an image. So perhaps laziness will prevail and you&#8217;ll see these things all the time.<\/p>\n<p>For the record: A lot of site features aren&#8217;t enabled on small screens. There&#8217;s a boxed quote in this article, but if your screen drops below 1440px wide then the theme hides a bunch of details to save space. <\/p>\n<p>As always, let me know about any usability issues you have.<\/p>\n<p><strong>EDIT:<\/strong> After I made the theme live, I was hit with another <a href=\"https:\/\/en.wikipedia.org\/wiki\/Botnet\">botnet<\/a> attack. <\/p>\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"en\" dir=\"ltr\">Yes, I know my site is still down \/ running slow. This is what it&#39;s looked like for the last 12 hours. <a href=\"https:\/\/t.co\/o2OQjmTxfe\">pic.twitter.com\/o2OQjmTxfe<\/a><\/p>\n<p>&mdash; Shamus! Young! (@shamusyoung) <a href=\"https:\/\/twitter.com\/shamusyoung\/status\/1031923642094047232?ref_src=twsrc%5Etfw\">August 21, 2018<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>Which means that a lot of the feedback is muddled. Maybe the reply system is malfunctioning because of the new theme, or maybe files \/ transactions are getting lost in the deluge. How annoying. <\/p>\n<p>Last night I wrote a twitter thread about the attack. Here&#8217;s the start of it:<\/p>\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"en\" dir=\"ltr\">Since my site is down, I&#39;ll just continue blogging via Twitter. Here&#39;s where we are now:<br \/>A botnet is trying to brute-force the password on my site. I&#39;ve removed the login page so it&#39;s a waste of time, but the flood of traffic is still choking the site.<\/p>\n<p>&mdash; Shamus! Young! (@shamusyoung) <a href=\"https:\/\/twitter.com\/shamusyoung\/status\/1031792233102671872?ref_src=twsrc%5Etfw\">August 21, 2018<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Programming is different from a lot of other creative endeavors because it feels good when you expunge your recent work. If I&#8217;m editing my book and I realize an entire passage is redundant, I don&#8217;t enjoy killing it. Without an editor pushing me, I might even leave it in. Same goes for when I&#8217;m making [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[],"class_list":["post-43712","post","type-post","status-publish","format-standard","hentry","category-notices"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/43712","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=43712"}],"version-history":[{"count":8,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/43712\/revisions"}],"predecessor-version":[{"id":43721,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/43712\/revisions\/43721"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}