<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Keith Gabryelski on Medium]]></title>
        <description><![CDATA[Stories by Keith Gabryelski on Medium]]></description>
        <link>https://medium.com/@keithgabryelski?source=rss-ab7286956006------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_Tm6bEbe0PYhpJKWR_l3dg.jpeg</url>
            <title>Stories by Keith Gabryelski on Medium</title>
            <link>https://medium.com/@keithgabryelski?source=rss-ab7286956006------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 12:51:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@keithgabryelski/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Database Normalization]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@keithgabryelski/database-normalization-ec9b97567088?source=rss-ab7286956006------2"><img src="https://cdn-images-1.medium.com/max/2600/0*ByU6T7aredJGLyKW" width="10800"></a></p><p class="medium-feed-snippet">Normal Forms with examples</p><p class="medium-feed-link"><a href="https://medium.com/@keithgabryelski/database-normalization-ec9b97567088?source=rss-ab7286956006------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@keithgabryelski/database-normalization-ec9b97567088?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec9b97567088</guid>
            <category><![CDATA[relational-databases]]></category>
            <category><![CDATA[normal-form]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Wed, 08 Apr 2026 21:20:55 GMT</pubDate>
            <atom:updated>2026-04-08T21:20:55.188Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Dungeons of Eternity: Drop Rate Statistics]]></title>
            <link>https://medium.com/@keithgabryelski/dungeons-of-eternity-drop-rate-statistics-583ce3b23627?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/583ce3b23627</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[meta-quest]]></category>
            <category><![CDATA[dungeons-of-eternity]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[drop-rate]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Wed, 21 Feb 2024 15:56:00 GMT</pubDate>
            <atom:updated>2024-02-21T15:56:00.111Z</atom:updated>
            <content:encoded><![CDATA[<h3>Dungeons of Eternity: Drop Rate Statistics, Obsession</h3><blockquote>I want to thank <a href="https://discord.com/channels/@me/1186027297850015874">Discord’s June Blaire</a> for their original work on Gear Drop rates. All data is available in a Google Sheet: <a href="http://bit.ly/dungeons-of-eternity-statistics">http://bit.ly/dungeons-of-eternity-statistics</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*bKMZbxaZWr7XOAV9" /><figcaption>Dungeons of Eternity</figcaption></figure><p>I’ve been playing this game obsessively since its release in October. One of the first questions I asked was “what are the chances I’ll get a crossbow with reload”</p><p>First let me tell you that all data was collected by level 50 characters. I’ve made no attempt to create any predictions for non-endgame players.</p><p>With a little google sheet tweaking; this is actually three pie charts overlayed, i was able to get a starter answer to my question:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lbB_NppOsg9oS3t25ILzVA.jpeg" /><figcaption>An initial attempt at gear classification and drop rates</figcaption></figure><p>With a little D3 work thrown into the picture I was able to create a more interactive radar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iagJOi9CJf2Cc99UKqUesg.png" /></figure><p>This is available at <a href="https://script.google.com/macros/s/AKfycbxJcFDaXY95Y78EL0b4gBtJvq1KPl8-X2emFnyA9BH_fGYX9GbWUu9yj_mhoXJagcY/exec">Google AppScript DoE Radar</a> source code is <a href="https://script.google.com/u/0/d/MmZ8euLByvc0RqzGbgYj7KG69uuqT7c2h/edit?uiv=2&amp;mid=ACjPJvGN5QurlcK6tIbDzgvlnll9Pj7YLnoK15pxI7quhVyGlRQWiQSvIm4kiUyzG4mPK2FfaSkdEfiuUrBD9AAsyEtZBca89THaDOTTK-YG54h4FiUkNs4PDwoluGi13L5HKrumyxlOnMk">available here</a>. The base for all this code is <a href="https://docs.google.com/spreadsheets/d/15XGevBozTrsKYo2EGDgq5onnf2fHgTcJfXuA5vTeSnY/edit?usp=sharing">available here</a>.</p><p>After some work, I threw this Sankey Chart together that includes all perk rate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJAbYFAtu0dfboZmrxEhiA.png" /><figcaption>Sankey Chart showing perks</figcaption></figure><p>Back to google sheets for a version of the perk drop-rate statistics in Radar Chart form</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*N7I5Zi-_fm8YhSvPIFR6Zg.png" /><figcaption>Perk Drop-rate Radar Chart</figcaption></figure><p>After collecting enough data I was also able to create some box charts of the damage ranges of each type of weapon (sliced in various ways)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88f94JccPdUUdLi3P42zmw.jpeg" /><figcaption>All Weapon Damage Ranges by Weapon Name</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*ibArYwSizxTab0tt8OHQRQ.png" /><figcaption>Damage Ranges by Category</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*7YC15x1hh65VQ9BkEWKXng.png" /><figcaption>Legendary Damage Ranges ordered by max damage value</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*yq_Qaq6kq20Z1tLl-L40Kg.png" /><figcaption>Damage Ranges by Grouping</figcaption></figure><p>This is just a quick overview of the work I’ve done to determine Weapon drop-rate and perk-rates for the Meta Quest VR game Dungeons of Eternity</p><p>Please Enjoy and use the code/data provided however you wish:</p><blockquote><a href="http://bit.ly/dungeons-of-eternity-statistics">http://bit.ly/dungeons-of-eternity-statistics</a></blockquote><blockquote><a href="https://script.google.com/home/projects/1yQJEBPw_FhLYTkOHKsR8_9fjGPVGXzbd5whPBPM4WyuR1unKZXolFgsC/edit">Base code for reading and processing data in Google AppScript</a></blockquote><blockquote>some R code for processing DoE spreadsheets: <a href="https://github.com/keithgabryelski/Dungeons-of-Eternity-Gear-Drop-Rate/blob/main/dungeons-of-eternity-gear-drop-rates.R">https://github.com/keithgabryelski/Dungeons-of-Eternity-Gear-Drop-Rate/blob/main/dungeons-of-eternity-gear-drop-rates.R</a></blockquote><p>I can be found haunting <a href="https://discord.com/channels/1113164402313674802/1113172723003306024">Dungeon of Eternity’s Discord Channel</a> as <a href="https://discord.com/channels/1113164402313674802/1139566787529289748">Protagosus</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=583ce3b23627" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Uncle Al’s Stuffies]]></title>
            <link>https://medium.com/@keithgabryelski/uncle-als-stuffies-6811ff7dc8d4?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/6811ff7dc8d4</guid>
            <category><![CDATA[recipe]]></category>
            <category><![CDATA[quahog]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Mon, 24 Jul 2023 00:27:47 GMT</pubDate>
            <atom:updated>2023-08-02T04:37:38.679Z</atom:updated>
            <content:encoded><![CDATA[<p>My Family’s favorite Portuguese Stuffed Quahogs with Chorizo recipe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*TItwKlaFoRt8vGiqmFhCQA.jpeg" /><figcaption>Stuffies</figcaption></figure><p>You’ll need CHOWDER-size quahogs to hold the stuffing (for baking and for serving). You can use any kind of quahog for the meat (the smaller are more tender), I typically use a mixture depending on availability AND whether I am collecting more CHOWDER-size quahogs for serving.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*Qjh8uafWYRQcKDSnzjttWw.jpeg" /><figcaption>Quahog sizes</figcaption></figure><h3><em>Ingredients:</em></h3><blockquote><em>15 CHOWDERS SHELLs (for serving)<br>30 LITTLE-NECKS (for meat)<br>Loaf of day old bread, stale or in oven at 180° until dry<br>Large onion, diced<br>2 Green peppers, diced<br>4 Red hot peppers, diced<br>8 garlic cloves, minced<br>Link chorizo, 1/4&quot; cubed<br>Link linguica, 1/4&quot; cubed<br>Stick of butter<br>Clam juice<br>Salt and Pepper to taste</em></blockquote><h3><em>Directions:</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*mYCytxcj8NBCCHSC_X-1Kw.jpeg" /><figcaption>Little necks</figcaption></figure><blockquote><em>Wash quahogs<br>Steam (2” water) quahogs just long enough for them to open (2 mins) — save the water<br>Shuck quahogs<br>Mince quahogs in blender to your desired size (I just pulse several times). Set aside<br>Sauté onions, peppers, garlic in full stick of butter just long enough to soften slightly</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*cpnx3x25__JNW7LzbuxT9w.jpeg" /><figcaption>The Stuffing</figcaption></figure><blockquote><em>Break up dried bread into small pieces.<br>In large bowl combine bread with chopped quahogs, sautéed veggies, chorizo and linguica.<br>Add the saved quahog broth to get overall mixture to desired consistency. <br>Add salt and pepper to your desired taste.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gC5Sp0MnBK6yJuBhrFzwAQ.jpeg" /><figcaption>Stuffies; before the bake</figcaption></figure><blockquote><em>Scoop mixture into quahog shell halves. Do not compact. Leave somewhat loose so they don’t come doughy during baking.<br>Place on large cookie sheet.<br>Bake in 375° oven for about a half hour to just get a light brown top appearance.</em></blockquote><h3><em>Notes:</em></h3><blockquote>I’ve used boxed stuffing in addition to stale bread, the seasoning packet is perfectly reasonable addition.</blockquote><blockquote>Larger quahog meat is perfectly fine. CHOWDERs can be stringy if not chopped finely.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLWUc94nGwVnETDCb96Img.png" /><figcaption>Stuffies; the finished product</figcaption></figure><h3>Eating:</h3><blockquote><em>Reheating in 300° oven for 15 minutes adds a crunch that is lovely.</em></blockquote><blockquote><em>Just before eating, drench with Tabasco</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*Ei0rqm9vaBY8fl4jcyfDEg.jpeg" /><figcaption>Dems gud fude</figcaption></figure><blockquote>Save the largest quahog shells for next time. Scrub them clean with soap and water.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6811ff7dc8d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fix New Macbook Pro Track Pad being Too Large]]></title>
            <link>https://medium.com/@keithgabryelski/fix-new-macbook-pro-track-pad-being-too-large-a163784bd2a2?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/a163784bd2a2</guid>
            <category><![CDATA[macbook-pro]]></category>
            <category><![CDATA[trackpad]]></category>
            <category><![CDATA[typo]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Sun, 02 Aug 2020 03:12:28 GMT</pubDate>
            <atom:updated>2020-08-02T03:26:15.920Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fix New Macbook Pro Track Pad Size Causing Typos</h3><h4>If your palms lay on the new trackpad producing typos, use Karabiner-Element with Karabiner-MultitouchExtension to reduce the active area of the track pad</h4><p>Download <a href="https://karabiner-elements.pqrs.org/">Karabiner-Elements</a>, install it, authorize it, run it and select the Misc Preferences tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxYKhWztcxjMVi3KKLlr7A.png" /><figcaption>Karabiner-Elements allows you to remap device input</figcaption></figure><p>Then click on “Open Karabiner-MultitouchExtension app”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KT6rgDixzVOz5X_SF2gS4g.png" /><figcaption>Karabiner-MultitouchExtension app allows you to deaden the edges of the track pad so rested palms don’t cause mis-clicks.</figcaption></figure><p>Rest your fingers on the the home keys or where-ever your hands rest normally while typing. Notice the blue dots, those are your palms (they’ll be RED if they are in the action area.</p><p>Adjust the “ignored area” to suit your needs, ensuring to reduce the size until the red dots turn blue as you see above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JMJfAvItklXUpDtzQcvHtA.png" /></figure><p>and win.</p><p>I am not affiliated with Karabiner-Elements in any way — just found this to be essential for working with the new Macbooks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a163784bd2a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vinho do Porto]]></title>
            <link>https://medium.com/@keithgabryelski/vinho-do-porto-194d30c691d7?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/194d30c691d7</guid>
            <category><![CDATA[port-wine]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[vinho-do-porto]]></category>
            <category><![CDATA[wine]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 00:26:52 GMT</pubDate>
            <atom:updated>2020-06-19T00:26:52.881Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NJNTZ3GuG6E30cNb8X8WwA.png" /><figcaption>Vinho do Porto by Keith Gabryelski</figcaption></figure><p>My book is now available online and in PDF format.</p><p>Download a PDF of <a href="https://www.icloud.com/iclouddrive/0N5pmXtpz941rakPo9g9Y9QhA#Vinho_do_Porto">Vinho do Porto</a> by Keith Gabryelski or <a href="https://sites.google.com/a/gabryelski.com/gabryelski-com/portwine/book-pages">see the pages</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=194d30c691d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Formatting SQL Statements for Readability]]></title>
            <link>https://medium.com/@keithgabryelski/formatting-sql-statements-for-readability-1f0327231177?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f0327231177</guid>
            <category><![CDATA[opinionated]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[formatting-code]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Sat, 09 May 2020 09:06:12 GMT</pubDate>
            <atom:updated>2020-05-09T09:06:12.293Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the many years I’ve been using SQL I’ve found some truths:</p><ol><li>People who know SQL pronounce it SEE-KWELL.</li><li>People who don’t know SQL pronounce it ES KEW EL.</li><li>Most all formatting of SQL statements are ad-hoc and/or don’t allow readers much of a chance to use their natural eye scanning abilities to visually parse the statements and component expressions.</li></ol><p>Here are best practices for formatting SQL statements I’ve developed over the years. They have worked for my teams and me. I hope they help you write readable code. When not obvious I’ve added explicit reasons for the rules</p><p>You’ll notice some of the syntax is specific to PostgreSQL — please accept the focus as just my main interest.</p><h3><strong><em>A Quick Overview</em></strong></h3><p>I won’t be covering schema normalization and naming conventions (I’ll write other blog posts on those subjects), but let me summarize some basic best practices on this here because you will be seeing the conventions in the examples.<br> Most of these are just one dude’s opinion (J1D0). Again, they have been used over many years, work for my teams and me but I consider most of them less important than some order of consistency. Here you go:</p><ul><li>Follow some semblance of normalization</li><li>Identifiers (names of tables and columns) should be all lower case with words separated by underscores</li><li>Name your tables plural nouns (users, profiles, and posts)</li><li>Don’t use SQL keywords as column names (from, limit, order)</li><li>Use adjectives for Boolean columns (use visible, not is_visible or visible_p)</li><li>Use TRUE and FALSE not ‘t’ and ‘f’ for Boolean values</li><li>Use VERB_at for timestamps (created_at, updated_at, logged_in_at)</li><li>Use VERB_on for dates reported_on</li><li>Tables should have a created_at column (NOT NULL DEFAULT now()) if the table is every added to</li><li>Tables should have an updated_at column if rows are ever updated</li><li>ID is your primary key column (typically)</li><li>&lt;tablename in singular form&gt;_id is a foreign key</li><li>Use foreign key constraints</li><li>Use unique when needed</li><li>Type fields should be a foreign key reference to another table (not a column that is basically an enumeration)</li><li>Fields in a table should be ordered ID, CREATED_AT, UPDATED_AT, &lt;dependent reference columns&gt;, &lt;state columns that are ordered by importance/use&gt;</li></ul><p>For the most part I’ll be talking about the SELECT statement, I’ll give rules for other SQL statements, but for now, let’s use the following, albeit convoluted example, to name pieces of the SELECT statement:</p><pre>SELECT<br> DISTINCT<br>  a.id AS alpha_id,<br>  b.id AS beta_id,<br>  g.id AS gamma_id,<br>  d.id AS delta_id,<br>  sum(d.value) AS total<br>FROM<br>  alphas AS a,<br>  betas AS b,<br>  (</pre><pre>SELECT<br>        DISTINCT</pre><pre>beta_id FROM</pre><pre>deltas UNION</pre><pre>SELECT<br>        DISTINCT</pre><pre>beta_id FROM</pre><pre>epsilons<br>  ) AS c</pre><pre>INNER JOIN gammas AS g ON g.id = a.beta_id</pre><pre>INNER JOIN (</pre><pre>SELECT<br> child_id, count(*) as num</pre><pre>FROM alphas</pre><pre>WHERE<br> visible = TRUE</pre><pre>GROUP BY<br>    child_id</pre><pre>) AS ap ON<br> ap.child_id = a.id AND ap.num &gt;= g.min_parents</pre><pre>LEFT OUTER JOIN deltas AS d ON d.id = g.delta_id</pre><pre>WHERE<br> a.visible = TRUE AND b.id = a.beta_id AND c.beta_id = a.beta_id</pre><pre>GROUP BY alpha_id, beta_id,</pre><pre>gamma_id,</pre><pre>delta_id<br>      HAVING</pre><pre>count(*) &gt; 1 AND</pre><pre>total &lt; 100<br>      ORDER BY</pre><p><em>select list</em></p><p><em>table list (with a sub-select)</em></p><p><em>Join operation</em></p><p><em>subselect</em></p><p><em>where conditions group by list</em></p><p><strong>total DESC;</strong></p><p><strong><em>The Golden Rule</em></strong></p><p>The first rule of any rule-set should be the same:</p><p><strong>RULE: Always do the right thing</strong></p><p><em>having conditions order by list</em></p><p>That is: break the rules when the rules are wrong, they obfuscate the code or otherwise make it difficult to read.</p><p>Humans are smarter than rules — use your human!</p><h3><strong><em>The Rules For SELECT Statements</em></strong></h3><h4><strong>RULE: For simple statements use one line</strong></h4><p>Lines less than your team’s max code length (whatever it is: hopefully over 125 columns these days) need not be broken up unless they are complex (have a sub- select, use CASE expressions or use more than one function)</p><pre>SELECT id FROM users WHERE id = 42;</pre><p>Simple is its own reward, don’t fuss about the simple things.</p><h4><strong>RULE: CAPITALIZE keywords</strong></h4><p>It’s easier to parse clauses when the keywords stand out.</p><h4><strong>RULE: Separate operators from operands with one space<br>RULE: Use one space after commas to separate components of lists and function arguments</strong></h4><p>We no longer need to worry about the amount of memory spaces take up in code or the length of lines; and it allows the eye to delaminate between parts of an expression.</p><pre>SELECT id, username FROM users WHERE id = 42;</pre><h3><strong><em>The Rules For long and complicated SELECT Statements</em></strong></h3><h4><strong>RULE: Format queries onto multiple lines that are anything other than dead simple</strong></h4><p>There is no longer a need to worry about a SQL statement fitting height-wise on a 24 row terminal. The extra lines ensure the code is clear. Use the lines.</p><p>Example for the next few rules:</p><pre>SELECT<br> DISTINCT<br>  id,<br>  last_logged_in_at,<br>  first_name,<br>  last_name,<br>  born_on<br>FROM<br>  users<br>WHERE<br>  username = ? AND<br>  encoded_password = ? AND<br>  banned = FALSE<br>ORDER BY<br>  last_name,<br>  first_name;</pre><p><strong>RULE: Clause keywords go on their own line and are left justified</strong></p><p>SELECT, FROM, WHERE, ORDER BY et al should be left justified with clause components indented two spaces.</p><p>This is a basic design layout rule: things aligned vertically will be grouped together by the human eye. This allows the eyes to distinguish the different sections of the SELECT statement</p><h4><strong>RULE: Clause components go on a separate line and are indented two spaces</strong></h4><p>The eye can scan single line expressions well but needs to skip the keyword (which takes a different part of the brain to recognize). Separating the keyword from its components allows the eye to also group the components (should there be many).</p><h4><strong>RULE: Separate list elements onto individual lines aligned by their first character with the comma at the end of the line<br>RULE: Separate expressions onto individual lines aligned by their first character with the conjunction operators (AND/OR) at the end of the line</strong></h4><p>Separators at the end of the line allow the brain to recognize that the expression will continue onto the next line. Without them, the brain needs to parse the next line to figure out if the expression is complete. Take, for instance, SQL formatted this way (NOT RECOMMENDED):</p><pre>SELECT<br>  ,id<br>  ,last_logged_in_at,<br>  ,first_name<br>  ,last_name<br>  ,date_of_birth<br>FROM<br>  users<br>WHERE<br>  username = ?<br>  AND encoded_password = ?<br>  AND banned = FALSE;</pre><p>This is quite like writing instructions for dismantling a bomb like this:</p><ol><li>Cut the blue wire</li><li>But first: cut the red wire</li></ol><h4><strong>RULE: IN and EXIST sub-selects should be indented as you would if the select statement was not a sub-select</strong></h4><p>That is, if it is simple: it should be on one line. If it is not simple, it should be formatted using the general rules of sub-selects. The only difference is that a sub- select’s parentheses should abut the select statement as:</p><pre>SELECT<br>  *<br>FROM<br>  users<br>WHERE<br>  user_status_id IN (SELECT<br>                       id<br>                     FROM<br>                       good_statuses<br>                     WHERE<br>                       visible = TRUE)</pre><p>alternatively</p><pre>SELECT<br>  *<br>FROM<br>  users<br>WHERE<br>  user_status_id IN (<br>    SELECT<br>      id<br>    FROM<br>      good_statuses<br>    WHERE<br>      visible = TRUE<br>  )</pre><h4><strong>RULE: long mathematical expressions in the select list should be broken up reasonably with operators at the end of the line and indented one space after the first line<br>RULE: long mathematical expressions in the where clause should be broken up reasonably with operators at the end of the line</strong></h4><pre><strong>SELECT<br>  order.id,<br>  order_details.product_id,<br>  order_details.unit_price *<br>    order_details.quantity AS regular_price,<br>  (1 - order_details.discount) * order_details.unit_price *<br>    order_details.quantity AS price_after_discount<br>FROM<br>  order<br>INNER JOIN order_details ON<br>  order_details.order_id = order.id AND<br>  order_details.voided = FALSE<br>WHERE<br>  order.voided = FALSE;</strong></pre><p>It’s tough to make this look reasonable, but do as best as you can to make it readable.</p><h4><strong>RULE: The DISTINCT keyword should be indented on the next line and one space from the SELECT keyword</strong></h4><p>Meh. Find another place for it.</p><h3><strong><em>The Rules For JOIN Operations</em></strong></h3><p>Example for the first few JOIN rules:</p><pre>SELECT<br>  a.id AS alpha_id,<br>  b.id AS beta_id<br>FROM<br>  alphas AS a<br>INNER JOIN betas AS b ON<br>  b.id = a.beta_id AND<br>  b.visible = TRUE;</pre><h4><strong>RULE: Use the AS keyword for table aliasing (instead of omitting it)</strong></h4><p>Two identifiers next to each other without an operator can be mistaken for an accidental mistype.</p><h4><strong>RULE: Use INNER JOIN syntax instead of table-list syntax for joins</strong></h4><p>Joins operations are easier to understand when the conditions are close to the table being joined.</p><h4><strong>RULE: Break up join operations at the ON keyword with the join conditions on a separate lines indented two spaces<br>RULE: Format join conditions as you would a <em>where clause</em></strong></h4><h4><strong>RULE: Indent sub-selects two spaces from their parentheses which are left aligned with the first character of the join keyword</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f0327231177" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating from sw-precache-webpack-plugin to workbox-webpack-plugin]]></title>
            <link>https://medium.com/@keithgabryelski/migrating-from-sw-precache-webpack-plugin-to-workbox-webpack-plugin-eed9f39aa3b3?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/eed9f39aa3b3</guid>
            <category><![CDATA[workbox]]></category>
            <category><![CDATA[gist]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[sw-precache]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Wed, 06 May 2020 23:59:28 GMT</pubDate>
            <atom:updated>2020-05-06T23:59:28.993Z</atom:updated>
            <content:encoded><![CDATA[<h4>SWPrecacheWebpackPlugin is longer being updated; what do?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zp89TFbQllnAgJzMB3rfCQ.png" /></figure><p>I’ve found it difficult to complete many of my rough-drafts here on MEDIUM mainly due to the time it takes me to polish the drafts into something I want to show.</p><p>For the time being, I’m going to start posting essences of the work. People have called these GISTs and I will keep to that term (although I prefer to use MEDIUM as the content store)</p><p>Here is my first attempt:</p><p>The Gist of it:</p><pre>const SWPrecacheWebpackPlugin = require(‘sw-precache-webpack-plugin’);</pre><pre>...</pre><pre>// Generate a service worker script that will precache,<br>// and keep up to date, the HTML &amp; assets that are part of the<br>// Webpack build.</pre><pre> new SWPrecacheWebpackPlugin({<br>  // By default, a cache-busting query parameter is appended to<br>  // requests used to populate the caches, to ensure the<br>  // responses are fresh.<br>  // If a URL is already hashed by Webpack, then there is no concern<br>  // about it being stale, and the cache-busting can be skipped.<br>   dontCacheBustUrlsMatching: /\.\w{8}\./,<br>   filename: ‘service-worker.js’,<br>   logger(message) {<br>     if (message.indexOf(‘Total precache size is’) === 0) {<br>       // This message occurs for every build and is a bit too<br>       // noisy.<br>       return;<br>     }<br>     console.log(message);<br>   },<br>   minify: true,<br>  // For unknown URLs, fallback to the index page<br>   navigateFallback: appFallbackURL,<br>  // Ignores URLs starting from /__ (useful for Firebase):<br>  // <a href="https://github.com/facebookincubator/create-react-">https://github.com/<br>  //   facebookincubator/create-react-</a>app/issues/2237#<br>  //      issuecomment-302693219<br>   navigateFallbackWhitelist: [/^(?!\/__).*/],<br>  // Don’t precache sourcemaps (they’re large) and build asset<br>  // manifest:<br>   staticFileGlobsIgnorePatterns: [/\.map$/,<br>                                   /asset-manifest\.json$/],<br>  // Work around Windows path issue in SWPrecacheWebpackPlugin:<br>  // <a href="https://github.com/facebookincubator/">https://github.com/facebookincubator/</a><br>  //    create-react-app/issues/2235<br>   stripPrefix: appBuild.replace(/\\/g, ‘/’) + ‘/’,<br> }),</pre><p>Is now:</p><pre>const { GenerateSW } = require(‘workbox-webpack-plugin’);</pre><pre>...</pre><pre>// Generate a service worker script that will precache,<br>// and keep up to date,<br>// the HTML &amp; assets that are part of the Webpack build.<br> new GenerateSW({<br>  // For unknown URLs, fallback to the index page<br>   navigateFallback: appFallbackURL,<br>  // Ignores URLs starting from /__ (useful for Firebase):<br>  // <a href="https://github.com/facebookincubator/">https://github.com/facebookincubator/</a><br>  //  create-react-app/issues/2237#issuecomment-302693219<br>   navigateFallbackAllowlist: [/^(?!\/__).*/],<br>  // Don’t precache sourcemaps (they’re large) and build<br>  // asset manifest:<br>   exclude: [/\.map$/, /asset-manifest\.json$/],<br> }),</pre><h4>Summary:</h4><p><em>workbox-webpack-plugin</em> is nearly a drop-in replacement for <em>sw-precache-webpack-plugin</em>.</p><p>Many options now have reasonable defaults and can be removed altogether.</p><p>Many options have been renamed but are not easy to find even though the documentation attempts to help:</p><ul><li><a href="https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw">Migrate from sw-precache or sw-toolbox | Workbox | Google Developers</a></li><li><a href="https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#generatesw_plugin">Workbox webpack Plugins | Google Developers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eed9f39aa3b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Ravioli with Kids]]></title>
            <link>https://medium.com/@keithgabryelski/making-ravioli-with-kids-bb206a38e2fa?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb206a38e2fa</guid>
            <category><![CDATA[ravioli]]></category>
            <category><![CDATA[kids]]></category>
            <category><![CDATA[recipe]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Sun, 03 Jan 2016 07:33:43 GMT</pubDate>
            <atom:updated>2016-01-03T19:28:11.914Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HlQJRyyJOCh0EMIUZJgelw.jpeg" /></figure><p>One of the funnest recipes to make with kids is fresh raviolis.</p><p>A few tips:</p><ul><li>Some kitchen supplies and equipment are useful but not absolutely required: plastic wrap and parchment paper is most helpful, a rolling machine and molds or stamps will make things easier but are not even recommended for your first attempts.</li><li>Use a simple dough recipe.</li><li>Somewhere to dry the pasta without stacking (stacked raviolis stay wet and stick together). Once the pasta is dry you can store it stacked over parchment paper, freeze it or use it immediately.</li><li>Give yourself plenty of time for the two cups of flour recipe (below) which will make 48–64 small raviolis depending on how thin you roll the dough. Consider it 3–4 hours until meal time (with kid involvement it will be closer to 4 hours): mix and knead dough: 20 minutes, rest dough: 30 minutes, roll, cut and fill dough: 60 minutes, drying: 1 hour, cook 5 minutes.</li><li>Make the pasta dough ahead of time, it will need to rest for at least 30 minutes and can keep for 24 hours in refrigerator. This is the messiest part and requires some kneading (which can be tough for kids), so do it before the kids get involved.</li><li>Make a simple filling (cheese) and let the kids make it as the dough is resting. Once you start rolling pasta dough, anything that is not wrapped in plastic, will dry out faster than you can make more filling.</li><li>Sauce is almost not required. Butter takes no time, oil and parsley takes even less time, red sauce is simple to make, white sauce is more difficult.</li></ul><h3>The Equipment</h3><p>Clear plastic wrap is used for storing the pasta while it rests (and to prevent the stored dough from drying while you roll and cut a portion of it)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*XSbCtEc651tdzm95Sggwjg.gif" /><figcaption>required: clear plastic wrap</figcaption></figure><p>Parchment paper for drying the raviolis. My father-in-law would use a clean bed-sheet as there was little room on the counters and tables in his small kitchen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x3hU-QflFbFj2duMi1LYwg.jpeg" /><figcaption>required: parchment paper</figcaption></figure><p>Less required is a pasta rolling machine. A rolling pin will suffice for adults but the dough is not as easy for kids to work with and the machine will roll the dough much thinner than you’ll be able to do by hand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*arkqvFEUDaXbeBS-w0YejA.jpeg" /><figcaption>more than helpful: pasta maker</figcaption></figure><p>A dough scraper will make the mixing easier and help cleaning up the work area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*2uyVarFZL3eVJau_Z3yG5g.jpeg" /><figcaption>helpful: dough scraper</figcaption></figure><p>A ravioli mold is not least required. It’s fasters than a stamp as you make many raviolis at a time and they will be shaped perfectly, but you can cut the dough into squares by hand and fold it into triangles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*8xR91yK-yNWaJldiBXTPGg.jpeg" /><figcaption>helpful: Ravioli mold</figcaption></figure><p>A stamp is also not required: The raviolis will look neat but a circular cookie cutter or a glass will work just fine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*-inzTvadR4iKMrbcDmXvmg.jpeg" /><figcaption>helpful: ravioli stamp</figcaption></figure><h3>The Dough Recipe</h3><p>This recipe makes a ball of dough the size of a softball, you’ll cut this into four pieces and each piece should make between 8–24 raviolis depending on how thin you roll pasta and small you make the raviolis:</p><ul><li>1 cup all-purpose flour</li><li>1 cup semolina flour</li><li>2 eggs</li><li>2 tablespoons vegetable oil</li><li>1 teaspoon salt</li><li>tablespoons of water</li></ul><p>Semolina makes the pasta a little rougher (less rubbery if you will) and easier to work with, but is not required, substitute all-purpose flour if that is simpler. More eggs will add additional binding, increase the color from off-white to to yellow and even orange (depending on the yolk color), you also won’t need to add water.</p><h3>Make the dough ahead of time</h3><p>Mix the ingredients on a flat surface. Use the scrape to help collect the dough. The dough may look more like dry breadcrumbs an not stick together into a ball: add water and/or another egg.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m4PyN9iVTEhB_CCGfu92Jg.jpeg" /><figcaption>mix the dough on a flat surface</figcaption></figure><p>Knead the dough for five minutes until the dough is even and silky. Form it into a ball.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijlU9iJmla3GV4iJ-y4sWA.jpeg" /><figcaption>pasta dough is tough for kids to knead and roll, but it is fun</figcaption></figure><p>Wrap the dough in plastic wrap and let it rest at room temperature for 30 minutes or in the refrigerator for up to 24 hours.</p><h3>Mix the filling</h3><p>Cheese filling is pretty easy</p><ul><li>8 ounces ricotta</li><li>4 ounces cream cheese</li><li>4 ounces shredded mozzarella cheese</li><li>4 ounces shredded parmesan cheese</li></ul><p>and my son loves pumpkin filling</p><ul><li>15 ounce can pumpkin puree (not pie filling!)</li><li>1 cup shredded parmesan cheese</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_9CecNF2sT4Wkw9qGIlXg.jpeg" /><figcaption>pumpkin ravioli with just two ingredients (pumpkin puree and shredded parmesean cheese): kid approved</figcaption></figure><h3>Roll the dough</h3><p>Cut the ball of dough into four equal pieces, roll one piece out now, store the rest in plastic to keep them from drying out.</p><h4>Using A Rolling Pin</h4><p>Flour the work areas so the dough will not stick to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*dOTjx75T_q0AwP_5PwwT8g.jpeg" /><figcaption>kids will have trouble rolling out pasta dough alone, team-work may be needed</figcaption></figure><p>Roll the dough out as thin as you can without tearing, fold it in half and rolling it out again as thin as possible.</p><p>With each fold you will be able to roll the dough out a little thinner without tearing it.</p><p>If the dough does tear, seal it with a touch of water (if necessary), fold it over and roll it out again.</p><h4>Using a rolling machine</h4><p>Rolling machines can be a bit touchy, some things to remember:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JyPCF_pR-0vMmTxO84BvMw.jpeg" /><figcaption>Multi-colored pasta is a little tricky, but doable: <a href="http://homecookinginmontana.blogspot.com/2009/02/homemade-multi-colored-pasta.html">http://homecookinginmontana.blogspot.com/2009/02/homemade-multi-colored-pasta.html</a></figcaption></figure><ul><li>Lock the machine down to the countertop as tight as possible.</li><li>Three kids can help: one to feed the pasta in, one to turn the crank, and one to hold the pasta as it is coming out of the machine.</li><li>It is easier to feed dough into the machine if it is already rolled out a little, use a rolling pin to start things off.</li><li>Hold the pasta machine down as the crank is turning, this will prevent the wing nut attaching the pasta machine to the counter-top from coming loose.</li><li>Start with the machine at the widest rolling position, each time the dough moves through the machine narrow the rolling pins one notch.</li><li>Every second notch or if the dough tears, fold the dough over and move it through the machine at the same notch level a second time.</li><li>It is easier to work with pasta that is at the second to thinnest notch mark, advanced work will make the pasta almost tissue paper thin.</li><li>You’ll need to pull the pasta away from the machine as it is being rolled out. Do not stretch-pull the pasta, just hold it away so the pasta does not fold up and stick together</li></ul><p>When the dough is rolled out evenly to 1/16th of an inch, you are ready to cut.</p><h3>Cut and fill the raviolis</h3><h4>Stamps, cookie cutters and cups</h4><p>Using a stamp, cookie cutter or cup, cut the dough in to circles, fill them and fold them over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*werzEKeZ6Tzzpjk2hCadUQ.jpeg" /><figcaption>pumpkin ravioli: use a cup to cut the pasta into consistent shapes</figcaption></figure><p>Use water between the two lips of the pasta at the fold point and fork the edges to seal the pasta</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiHrJumFG-br9HvvdPha0Q.jpeg" /><figcaption>Fold the ravioli over to make a semi-circle, use a little water on your finger to seal the lip</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*roPyABsvBMeutbvG_KLzew.jpeg" /><figcaption>cheese ravioli: press the edges of the semi-circle to seal the ravioli</figcaption></figure><h4>Pasta molds</h4><p>With a piece of rolled out pasta cut to fit over the mold, quickly fill the indentions with a small amount of filling.</p><p>Hint: It is sometimes easier for a kid to use two baby spoons instead of teaspoons and fingers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0E0gcYvzmVHqDk9lAabqCQ.jpeg" /><figcaption>filling pumpkin ravioli using a mold</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_nqERkgho4nVY2jc9zqokA.jpeg" /><figcaption>A multi-colored pasta dough made with loving care</figcaption></figure><p>Lay a second sheet of pasta over the top of the filled ravioli indentions and with your hands, work the air out of the ravioli (if there is any).</p><p>If there is a top piece of the mold, press it over the filled pasta to cut the ravioli pieces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JrxeScUASLvOA4TWq7q8gw.jpeg" /><figcaption>two piece molds press the top part to cut the raviolis</figcaption></figure><p>If the mold only has one have, use a rolling pin to press the two pasta sheets together and cut the raviolis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHGwmudN5ypoMAIIWEUO0Q.jpeg" /></figure><h4>Tortellini</h4><p>Smaller cut circles, sealed in a similar way to the hand folded raviolis, pull the ends together and pinch the corners together: boom tortellini</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZRqXjJzapvB_dMAEmhSbA.jpeg" /><figcaption>hand made tortellini</figcaption></figure><h4>Hand Cut Tagliatelle</h4><p>If there is any pasta dough left ver, roll it out into a large sheet, flour it heavily as you fold it over three or four times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_nm8iUoppX1Q_hf7La-fiQ.jpeg" /><figcaption>hand-cut tagliatelle</figcaption></figure><p>With a sharp knife, slice across the fold and hang the pasta to dry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWl35HBDXuolQQddSWTcww.jpeg" /><figcaption>drying hand-cut tagliatelle</figcaption></figure><p>A special attachment for pasta machines can be added to cut the pasta.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xzPWgPDg4YrHv0_gaWRzpQ.jpeg" /><figcaption>hand-made tagliatelle using the pasta machine attachment</figcaption></figure><p>If the rolled pasta drys out too fast consider cutting it into strip noodles</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W2_NNw5dPytVZOK5X1dabg.jpeg" /><figcaption>cut into noodles because the pasta dried before it could be formed into raviolis</figcaption></figure><h3>Drying the pasta</h3><p>Let the pasta dry for at least an hour (and maybe two) on parchment paper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1FXIb9LiR90XqvwvM7D6Dg.jpeg" /><figcaption>multi-colored raviolis</figcaption></figure><h3>Cooking the pasta</h3><ol><li>boil water in a medium to large pot with with a teaspoon of salt</li><li>gently place ravioli in the boiling water</li><li>when the ravioli raises to the surface (2 minutes maximum), it is done</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqR2kkB4aZYpm_iGoDaauA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb206a38e2fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Be A Professional Drinker Part One]]></title>
            <link>https://medium.com/@keithgabryelski/how-to-be-a-professional-drinker-part-one-574737a2b670?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/574737a2b670</guid>
            <category><![CDATA[drinking]]></category>
            <category><![CDATA[alcohol]]></category>
            <category><![CDATA[how-to]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Tue, 01 Dec 2015 19:05:07 GMT</pubDate>
            <atom:updated>2015-12-03T04:48:23.960Z</atom:updated>
            <content:encoded><![CDATA[<h3>How To Be A Professional Drinker (Part One): Know Thyself</h3><p>A little over a decade ago, I was talking with friends about how some bar goers (young and old) didn’t seem to understand how to be a polite guest, let alone a pleasant partier. To be fair, I hadn’t understood the basics until sometime in my mid 20s when I started venturing out on a regular basis.</p><p>After some discussion we settled on some essential information everyone that enters a bar should understand:</p><ol><li>The personality types of drinkers and enough self awareness to understand their own specific drinking habits</li><li>What, where and how to drink as a polite guest</li><li>How to properly engage a bartender so that you can become regular</li></ol><p>I started to write the skeleton of the book titled <strong>How To be a Professional Drinker</strong>,<strong> </strong>even so much as fleshing out the first several chapters, but I left it incomplete for many years. Here I present part one: <strong>Know Thyself</strong>.</p><p>The next parts will be posted in the coming weeks: <strong>Know Thy Drink, Know Thy Limit</strong> and <strong>Finding Your Watering Hole</strong></p><p>Anyone that has spent time around people that are drinking has probably noticed the change in behavior those people show over the night. Although they may not have actually thought about the subject enough to nail down the specifics, they may have noticed there are drinkers who, no matter how many times they’ve been out drinking, don’t seem to understand what their limit is. They may also have noticed that certain people are gregarious and affable when drunk and some others always seem to be looking for a fight.</p><p>Observations are the cornerstone of insight. There are broadly two classes of drinkers, non-professional and professional. As you work your way to becoming a professional drinker, you’ll notice that these stages can be classified even further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*0sEoygpBYiV-Vwon3SszZw.jpeg" /></figure><h4>Non-Professional Drinkers</h4><p>Non-professional drinkers are those that are not yet cognizant of their drinking status and do not understand their own limit. They can be further classified into three other categories: <em>Neophytes</em>, <em>Amateurs</em>, and <em>Sport Drinkers</em>.</p><p>Everyone starts out as a <strong>neophyte drinker</strong>, and stays there until the first time they exceeded their limit so much that they throw up, at which time they move immediately to <em>Amateur</em> status.</p><p>Non-professional drinkers can stay in <strong>amateur</strong> status for a long time, even a life time. To progress to a professional drinker they must realize the amount of alcohol it takes for them to get sick and how it affects them and others.</p><p><em>Amateur Night</em> is generally meant to describe a holiday where drinking is a major part of the evening: New Year’s Eve and St. Patrick’s Day are great examples of nights where non-drinkers go out and <a href="http://meaningfulnessoflittlethings.blogspot.com/2008/03/origins-tie-one-on.html">tie one on</a>, which can generally lead to a shit-show as observed from the amount of alcohol involved arrests and the city streets glistening with pools of sick. I extend Amateur Night to Friday and Saturday nights when a lot of non-professional drinkers go out.</p><p><strong>Sport drinkers</strong> associate drinking with game playing, whether it be a participatory or spectator sport, the object is to game with drinking.</p><p>In fact, sport drinkers are the only type of drinker that spans the Non-Professional/Professional border and can be either or both passive and active.</p><p>Sunday football at the sports bar is a great example of the passive version of this type of drinker while those that play softball, on a casual team, with a beer in their hand or play games to get drunk, like <a href="https://en.wikipedia.org/wiki/Quarters_%28game%29">quarters</a> and <a href="https://en.wikipedia.org/wiki/Beer_pong">beer pong</a>, are considered active sport drinkers.</p><h4>Professional drinkers</h4><p>Professional drinkers have basically figured out that they are going out to a bar to drink and be social and may or may not get drunk. They generally know their limit but that doesn’t mean they don’t over indulge: they just tend to be capable of handling themselves without the need of a spotter when they do get drunk.</p><p>Professional drinkers can be classified into seven categories which define how they act when they are drunk, remarkably these are similar to the Walt Disney characters The Seven Dwarfs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AOUltkwVfGwPhc691Vr7gQ.jpeg" /><figcaption>Professional Drinkers: The Seven Dwarfs</figcaption></figure><p><em>Dopey, Grumpy, Happy, Bashful</em><strong> </strong>and<strong> </strong><em>Sleepy drunks</em> are all obvious: if you aren’t one of these types of drunks you probably know someone who is or you can spot them across the room immediately.</p><p>There is no value judgement on these classifications, Sleepy drunks are pretty easy to deal with, unless you have to get them home, and Happy drunks are also easy to deal with but that doesn’t mean their drinking always leads to happy outcomes, it just means their personality is gregarious while they are drunk.</p><p>But, if you’re a Grumpy drunk, you should probably find a different profession and leave drinking to those that don’t tie themselves to such destructive behavior.</p><p>The two others dwarfs might need some explanation:</p><p><em>Doc</em><strong><em> </em></strong><em>drunks</em> are those types of drinkers that want to explain things to you, like Cliff Clavin from the TV show <a href="http://www.imdb.com/title/tt0083399/combined">Cheers</a>. If a subject comes up and someone just has to speak “The Peloponnesian War has interesting parallels to the situation we are talking about right now” they are probably a Doc dunk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*FbN-9zMsrchW42WfSYznYA.jpeg" /><figcaption>Clifford C. Clavin: the classic Doc<em> </em>Drunk</figcaption></figure><p>And instead of <em>Sneezy drunks, </em>there are<em> Sleazy drunks. </em>You can find your own pictures for these professional drinkers on other websites.</p><h3>What Kind Of Drinker Are You?</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fun060yOh6Vs%3Fstart%3D1144%26feature%3Doembed%26start%3D1144&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dun060yOh6Vs%26feature%3Dyoutu.be%26t%3D19m4s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fun060yOh6Vs%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/eef858340e57b1c937dc7423d9262c29/href">https://medium.com/media/eef858340e57b1c937dc7423d9262c29/href</a></iframe><p>To know thyself is to know how you drink and how your personality changes when you are drunk. Are you a non-professional drinker that wishes to stay oblivious to what effects drinking has on you and others? Are you a Happy or Dopey drunk or someone that always looks for trouble after having a few?</p><p>You should understand where you fit in the drinking hierarchy, how you got there and where you are going (if anywhere).</p><p><strong>Know thyself</strong> and in the coming weeks I’ll talk about about how to best choose where to drink, what is the appropriate drink for you and how to be a polite guest when you enter the bar.</p><h3>About the Author</h3><p>Keith Gabryelski is generally a happy drinker, wrote a book on <a href="http://www.amazon.com/Vinho-do-Porto-Port-Wine/dp/0971710600">Port Wine</a> and makes a mean Bloody Mary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ArjeiR3RTiX_jHMvTF2gnQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=574737a2b670" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Character Sets and Encodings]]></title>
            <link>https://medium.com/@keithgabryelski/a-practical-guide-to-character-sets-and-encodings-b5362447456f?source=rss-ab7286956006------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5362447456f</guid>
            <category><![CDATA[unicode]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[utf-8]]></category>
            <dc:creator><![CDATA[Keith Gabryelski]]></dc:creator>
            <pubDate>Sat, 21 Nov 2015 15:55:30 GMT</pubDate>
            <atom:updated>2015-11-27T00:28:52.346Z</atom:updated>
            <content:encoded><![CDATA[<p><em>or: What’s all this about ASCII, Unicode and UTF-8?</em></p><p>This guide was originally developed in collaboration with <a href="https://www.linkedin.com/in/caridavidson/">Cari Davidson</a> while we were working at CustomMade, Inc. to explain the basics of character sets and encoding to python/javascript coders that had little introduction to the subject beyond the obvious learned about the ASCII character set as one works with it.</p><p>I’ve re-written it to fit better into a form presentable on <a href="https://medium.com/u/504c7870fdb6">Medium</a>, and present the slide deck at the end in-case that form is more usable.</p><p>A basic understanding of <a href="https://en.wikipedia.org/wiki/ASCII">ASCII</a>, <a href="https://en.wikipedia.org/wiki/Hexadecimal">hexadecimal</a> and <a href="https://en.wikipedia.org/wiki/Array_data_structure">arrays</a> is assumed.</p><h3>Two Concepts</h3><p><strong>Character Sets:</strong> a collection of characters associated with numeric values. These pairings are called “code points”.</p><p><strong>Encoding: </strong>how a sequence of code-points are represented as an array of bytes.</p><h4>ASCII: An Ancient Character Set</h4><p><em>American Standard Code for Information Interchange</em></p><p><strong>US-ASCII</strong> is a character set (and an encoding) with some notable features:</p><p>Values are between 0–127 (x00–x7F)</p><p>ASCII code-point 32 (decimal) represents a SPACE</p><p>ASCII code-point 65 represents the uppercase letter A</p><p>The string “Foo Bar” is represented by the following 8-bit bytes:</p><pre><strong>Hexadecimal Values:</strong> 46 6F 6F 20 42 61 72<br><strong>ASCII Characters:</strong>    F  o  o     B  a  r</pre><p>Note: there is no ASCII value for the copyright symbol: ©. To compensate for this, people restricted to ASCII characters in a document would represent the copyright symbol with three characters “(C)” (the letter-C surrounded by parentheses).</p><h4>Why are we here?</h4><p>We are here because the English-centric nature of computer science lead to a character set (ASCII) that was reasonable for the time and for english, but not sufficient to support all languages.</p><h4>ASCII CODES</h4><p>The following chart is familiar to Unix users that have ever typed <a href="http://man7.org/linux/man-pages/man7/ascii.7.html">man ascii</a> at a shell prompt (which is actually where I scraped the information). A more in depth explanation is available here: <a href="https://en.wikipedia.org/wiki/ASCII">https://en.wikipedia.org/wiki/ASCII</a></p><p>The following table shows all ASCII characters and their hexadecimal values:</p><pre><strong>00</strong> nul <strong>01</strong> soh <strong>02</strong> stx <strong>03</strong> etx <strong>04</strong> eot <strong>05</strong> enq <strong>06</strong> ack <strong>07</strong> bel</pre><pre><strong>08</strong> bs  <strong>09</strong> ht  <strong>0A</strong> nl  <strong>0B</strong> vt  <strong>0C</strong> np  <strong>0D</strong> cr  <strong>0E</strong> so  <strong>0F</strong> si</pre><pre><strong>10</strong> dle <strong>11</strong> dc1 <strong>12</strong> dc2 <strong>13</strong> dc3 <strong>14</strong> dc4 <strong>15</strong> nak <strong>16</strong> syn <strong>17</strong> etb</pre><pre><strong>18</strong> can <strong>19</strong> em  <strong>1A</strong> sub <strong>1B</strong> esc <strong>1C</strong> fs  <strong>1D</strong> gs  <strong>1E</strong> rs  <strong>1F</strong> us</pre><pre><strong>20</strong> sp  <strong>21</strong> !   <strong>22</strong> “   <strong>23</strong> #   <strong>24</strong> $   <strong>25</strong> %   <strong>26</strong> &amp;   <strong>27</strong> ‘</pre><pre><strong>28</strong> (   <strong>29</strong> )   <strong>2A</strong> *   <strong>2B</strong> +   <strong>2C</strong> ,   <strong>2D</strong> —   <strong>2E</strong> .   <strong>2F</strong> /</pre><pre><strong>30</strong> 0   <strong>31</strong> 1   <strong>32</strong> 2   <strong>33</strong> 3   <strong>34</strong> 4   <strong>35</strong> 5   <strong>36</strong> 6   <strong>37</strong> 7</pre><pre><strong>38</strong> 8   <strong>39</strong> 9   <strong>3A</strong> :   <strong>3B</strong> ;   <strong>3C</strong> &lt;   <strong>3D</strong> =   <strong>3E</strong> &gt;   <strong>3F</strong> ?</pre><pre><strong>40</strong> @   <strong>41</strong> A   <strong>42</strong> B   <strong>43</strong> C   <strong>44</strong> D   <strong>45</strong> E   <strong>46</strong> F   <strong>47</strong> G</pre><pre><strong>48</strong> H   <strong>49</strong> I   <strong>4A</strong> J   <strong>4B</strong> K   <strong>4C</strong> L   <strong>4D</strong> M   <strong>4E</strong> N   <strong>4F</strong> O</pre><pre><strong>50</strong> P   <strong>51</strong> Q   <strong>52</strong> R   <strong>53</strong> S   <strong>54</strong> T   <strong>55</strong> U   <strong>56</strong> V   <strong>57</strong> W</pre><pre><strong>58</strong> X   <strong>59</strong> Y   <strong>5A</strong> Z   <strong>5B</strong> [   <strong>5C</strong> \   <strong>5D</strong> ]   <strong>5E</strong> ^   <strong>5F</strong> _</pre><pre><strong>60</strong> `   <strong>61</strong> a   <strong>62</strong> b   <strong>63</strong> c   <strong>64</strong> d   <strong>65</strong> e   <strong>66</strong> f   <strong>67</strong> g</pre><pre><strong>68</strong> h   <strong>69</strong> i   <strong>6A</strong> j   <strong>6B</strong> k   <strong>6C</strong> l   <strong>6D</strong> m   <strong>6E</strong> n   <strong>6F</strong> o</pre><pre><strong>70</strong> p   <strong>71</strong> q   <strong>72</strong> r   <strong>73</strong> s   <strong>74</strong> t   <strong>75</strong> u   <strong>76</strong> v   <strong>77</strong> w</pre><pre><strong>78</strong> x   <strong>79</strong> y   <strong>7A</strong> z   <strong>7B</strong> {   <strong>7C</strong> |   <strong>7D</strong> }   <strong>7E</strong> ~   <strong>7F</strong> del</pre><p>It’s noteworthy to describe the first 32 values (and the last value) which are known as <a href="https://en.wikipedia.org/wiki/Unicode_control_characters">control characters</a>. There may be a textual form for the characters in some character sets but they are mainly used to control text display and form (for instance, x08 (BS or backspace) is used to move the cursor one position to the left)</p><p>Please check <a href="https://en.wikipedia.org/wiki/ISO_2047">ISO 2047</a> for definitions of specific control characters in the table above.</p><h4>Unicode is a character set</h4><p><a href="https://en.wikipedia.org/wiki/Unicode">Unicode</a> is a superset of ASCII with character values between x0–x10FFFF (1,114,111 possibilities). Unicode characters whose values are between x0–x7F are exactly the same characters as those in the in the ASCII chart above.</p><p>Unicode doesn’t specify an encoding, though. It is just a character and number</p><p>Note: the Unicode code-point for the copyright symbol © is represented by the number 169 (xA9)</p><p>http://unicodelookup.com</p><h3>Encodings</h3><p>An encoding translates a sequence of code points to a sequence of bytes and is defined by its <strong>meta data</strong>, <strong>byte ordering</strong> and <strong>compression</strong>.</p><p><strong>Meta data</strong> is well understood parts of the data that are used to describe the overall format of the data.</p><p>Example: if I told you that any series of characters that start with the lowercase letter X can be interpreted as a hexadecimal number, and all other series of digits can be interpreted as decimal numbers: we might describe the “x” as meta-data describing the <a href="https://en.wikipedia.org/wiki/Radix">radix</a> of the number.</p><p><strong>Byte ordering</strong> or <a href="https://en.wikipedia.org/wiki/Endianness">endianness</a> describes which order bytes should be arranged in a sequence. For all practical purposes there are two orders multi-byte characters can be ordered:</p><ol><li>Most significant byte first, called big endian, would be like writing a date as year, month, day or 2015–11–21. If you were writing the ten thousand two hundred and forty seven you would write it in big endian as: 10247</li><li>Least significant byte first, called little endian, would be like writing a date as day, month then year or as: 21–11–2015. If you were writing the ten thousand two hundred and forty seven you would write it in little endian as: 74201</li></ol><p>There are good reasons to pick either of the formats, although they may not be obvious. Big endian is a little more natural, it is how we write numbers: from left to right.</p><p>but, little endian offers some interesting advantages for hardware multi-byte addition routines. Take the following two numbers 10247 and 37499 as arrays of numbers in big endian format that we would like to add together:</p><pre>   10247<br>+  97499<br>========<br>  107746</pre><p>A third grader would add these two numbers from left to right using carry addition.</p><p>But it is much simpler (for hardware) to add the numbers together if the digits are presented in reverse order:</p><pre>index: 00 01 02 03 04 05<br>       -----------------<br>        7  4  2  0  1<br>+       9  9  4  7  9<br>========================<br>        6  4  7  7  0  1</pre><p>Because any additional carry digits can be added on to the end of the array instead of inserted into memory at the beginning.</p><p><strong>Compression: </strong>methods for using the least number of bytes to transmit the common code-point values.</p><p>In some encodings, ASCII characters are supported in a compatible way by assuming that all character values between x00 and x7F (those with their high bit not set) are assumed to be single byte value (that is, represented by a single 8-bit value with the 8th bit not set), any value larger than x7F is represented by two or more bytes.</p><p>See the next section for more information about this.</p><h4>Popular Encodings</h4><p><strong>ASCII</strong>: 7-bits</p><p><strong>Latin-1</strong>: <strong>8-bit ASCII</strong> or named in a different standard than we’ve talked about: <strong>ISO-8859–1</strong></p><p><a href="https://en.wikipedia.org/wiki/UTF-8"><strong>UTF-8</strong></a>:<strong> </strong>is backwards compatible with ASCII as it using single byte values for ASCII characters, but multi-byte values for non-ASCII characters:</p><p><a href="https://en.wikipedia.org/wiki/UTF-8#Description">The following table</a> describes how code-points are encoded in UTF-8:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JVQgAaDA8vE_xIDJHky3Dg.png" /></figure><p>The string “Foo Bar” is represented by the following bytes:</p><pre><strong>Hexadecimal Values:</strong> 46 6F 6F 20 42 61 72<br><strong>ASCII Characters:</strong>    F  o  o     B  a  r</pre><p>The string “Foo © Bar” is represented by the following bytes:</p><pre><strong>Hexadecimal Values:</strong> 46 6F 6F 20 C2 A9 42 61 72<br><strong>Characters:</strong>          F  o  o        ©  B  a  r</pre><p>Notice that C2A9 represents the copyright symbol, why? Because we are trying to represent xA9, which in binary is 10101001 which can’t be represented as a single byte because its high bit is set. Instead it is represented as two byte values in as:</p><pre>Binary:        1100 0010 1010 1001<br>Control bits:  xxx       xx<br>Data Bits:        x xxxx   xx xxxx<br>Hexadecimal:      C    2    A    9<br>UNICODE:                         ©</pre><p><a href="https://en.wikipedia.org/wiki/UTF-16"><strong>UTF-16</strong></a>: An encoding standard that use at least two byte values to encode 1,112,064 possible unicode code-points.</p><p><a href="https://en.wikipedia.org/wiki/UTF-32"><strong>UTF-32</strong></a>: or UCS-4 is a fixed-length encoding.</p><p>It may be useful for you to review <a href="https://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings">how various encodings compare</a> to each other.</p><h3>Tips and tricks when writing code</h3><p><strong>Specify your encoding: </strong>every communication should announce its encoding so the receiver can interpret the encoded data correctly, examples below:</p><h4><strong>HTML</strong></h4><pre>Content-Type: text/html; charset=ISO-8859–1<br>Content-Type: text/html; charset=UTF-8</pre><h4><strong>XML</strong></h4><pre>&lt;?xml version=”1.0&quot; encoding=”UTF-8&quot;?&gt;</pre><h4><strong>SQL</strong></h4><pre>DEFAULT CHARSET=utf8</pre><h4><strong>CSS</strong></h4><pre>@charset “utf-8”;</pre><h3>Why do i see little boxes</h3><p>When a web page calls for a character to be rendered that the browser can’t display, the browser substitutes a little box, a question mark or some other symbol. The computer can’t display the character may be <a href="http://sizes.com/help/little_boxes.htm">because</a> of several reasons:</p><ul><li>its operating system is obsolete</li><li>the browser is obsolete</li><li>no font with that particular character has been installed on your computer</li><li>your system as not been configured to display asian fonts.</li></ul><h3>Some Unix Commands</h3><p>Just so you understand my environment, I’m running on a MAC, here is the output of the uname command:</p><pre>laptop$ uname -a</pre><pre>Darwin El-Guapo.local 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64</pre><pre>laptop$</pre><h4>Use ‘od’ to view the output</h4><pre>laptop$ echo -n “Foo Bar” | od -t x1 -t a<br>0000000 46 6f 6f 20 42 61 72<br>         F  o  o  sp B  a  r<br>0000007</pre><pre>laptop$ echo -n “Foo © Bar” | od -t x1 -t a<br>0000000 46 6f 6f 20 c2 a9 20 42 61 72<br>         F  o  o sp c2 a9 sp  B  a  r<br>0000012</pre><h4>Environment variables:</h4><pre>laptop$ env | grep ‘\(LC_.*\|LANG\)’<br>LC_ALL=en_US.UTF-8<br>LANG=en_US.UTF-8<br>LC_CTYPE=en_US.UTF-8</pre><h4>ssh config: ~/.ssh/config</h4><pre>Host *<br> SendEnv LC_* LANG</pre><h4>A command to convert between character sets</h4><pre>iconv -f ISO-8859-1 -t UTF-8 &lt; infile &gt; outfile<br>iconv --list</pre><h3>The Take Away</h3><p>Character sets are character/value pairs named code-points. The code point for capital letter A in ASCII is 65 (in decimal, x42 in hexadecimal). Unicode is an expanded set used to represent non-english expansions (and symbols like copyright ©)</p><p>Encodings define how code-point values are represented in memory (or in a data stream). Many encodings exist, concentrate on UTF-8 as it is extremely popular because it both a single byte encoding which is backwards compatible with ASCII and multibyte encoding for other Unicode characters.</p><p>Declare your encoding in whatever programming language or document format so that programatic readers can’t correctly interpret its context.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5362447456f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>