<?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 Produxt Manager on Medium]]></title>
        <description><![CDATA[Stories by Produxt Manager on Medium]]></description>
        <link>https://medium.com/@acp8?source=rss-b750c0a74e96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VCbrPZ6riCtUaNPzMd2rzw.jpeg</url>
            <title>Stories by Produxt Manager on Medium</title>
            <link>https://medium.com/@acp8?source=rss-b750c0a74e96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 10:54:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@acp8/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[LinkedIn APIs — unauthorized_scope_error]]></title>
            <link>https://acp8.medium.com/linkedin-apis-unauthorized-scope-error-7566860ad3c0?source=rss-b750c0a74e96------2</link>
            <guid isPermaLink="false">https://medium.com/p/7566860ad3c0</guid>
            <category><![CDATA[api-resources]]></category>
            <category><![CDATA[developer-portal]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Produxt Manager]]></dc:creator>
            <pubDate>Sat, 05 Dec 2020 09:12:32 GMT</pubDate>
            <atom:updated>2020-12-05T09:12:32.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>LinkedIn APIs — unauthorized_scope_error</h3><p>If you run into this error: unauthorized_scope_error when trying to call certain LinkedIn APIs, here is a reference of which permissions you can use and cannot use with LinkedIn when you first create an application through <a href="https://www.linkedin.com/developers/">https://www.linkedin.com/developers/</a></p><h3>APIs using Authorization Code Flow (3-legged OAuth)</h3><blockquote>All APIs using Client Credential Flow (2-legged OAuth) are not available for use through the LinkedIn Developer Portal initially. You will need to go through certain Partner Programs to obtain access.</blockquote><p>You will need to enable Sign in with LinkedIn Product to have the user grant permission to your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*jnlj2McyiCe3DhhmLPHQcw.png" /></figure><p><strong><em>r_liteprofile</em></strong> — Required to retrieve name and photo for the authenticated user.</p><p><strong><em>r_emailaddress</em></strong> — Retrieve primary email address on the authenticated user’s behalf.</p><p><strong><em>w_member_social</em></strong> — Post, comment and like posts on behalf of an authenticated member. (Need to enable Share on LinkedIn)</p><p>Here are permissions that are not available publicly (although it is documented in the public LinkedIn developer document site).</p><p><strong><em>r_basicprofile</em></strong> — Required to retrieve name, photo, headline, and vanity name for the authenticated user</p><p><strong><em>r_compliance</em></strong> — Required to retrieve activities for compliance monitoring and archiving</p><p><strong><em>w_compliance</em></strong> — Required to manage and delete data for compliance</p><p><strong><em>r_primarycontact </em></strong>— Retrieve primary authenticated member handles (email or phone number) on the authenticated user’s behalf.</p><p><strong><em>r_1st_connections</em></strong> — Required to retrieve 1st-degree connections</p><p><strong><em>r_compliance</em></strong> — Required to retrieve your activity for compliance monitoring and archiving</p><p><strong><em>w_organization_social</em></strong> — Post, comment and like posts on behalf of an organization.</p><p><strong><em>r_organization_social </em></strong>— Retrieve organizations’ posts, comments, and likes.</p><p><strong><em>r_member_social</em></strong> — Retrieve posts, comments, and likes on behalf of an authenticated member.</p><p><strong><em>w_organization_social</em></strong> — Post, comment and like posts on behalf of an organization.</p><p><strong><em>rw_ads</em></strong> — Create ads and creatives for a sponsored account</p><p><strong><em>rw_organization_admin</em></strong> — Manage organizations pages and retrieve reporting data.</p><p><strong><em>r_ads</em></strong> — Read an authenticated member’s ad accounts. Restricted to ad accounts in which the authenticated member has one of the following ad account roles.</p><p><strong><em>r_ads_reporting</em></strong> — Retrieve reporting for advertising accounts.</p><p><strong><em>r_1st_connections_size </em></strong>— Retrieve the count of an authenticated member’s 1st-degree connections.</p><p><strong><em>r_sales_nav_analytics</em></strong></p><p><strong><em>r_sales_nav_display</em></strong></p><p><strong><em>r_fullprofile</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7566860ad3c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Computation of Randomness]]></title>
            <link>https://medium.com/swlh/computation-of-randomness-c40aab177b0?source=rss-b750c0a74e96------2</link>
            <guid isPermaLink="false">https://medium.com/p/c40aab177b0</guid>
            <category><![CDATA[random]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[computation]]></category>
            <dc:creator><![CDATA[Produxt Manager]]></dc:creator>
            <pubDate>Sat, 09 May 2020 18:54:51 GMT</pubDate>
            <atom:updated>2020-05-12T22:37:23.307Z</atom:updated>
            <content:encoded><![CDATA[<p>Python random.random() on Linux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nzQnvNIf0REllwF6DyBsIA.jpeg" /></figure><p>If computers are deterministic, how the hell does it calculate randomness? After traversing through blogs and forums, I could not find all encompassing article that went through the steps from input to output for this:</p><pre>import random</pre><pre>random.random()<br>&gt;&gt;0.08436837268585984</pre><p>Explore with me as I dive into the concepts and the code on computing randomness. I am using Python 3.7 on Linux.</p><p><em>Disclaimer: Take this article as exploratory technical journalism, not as an authoritative source — I am more interested in concepts rather than precise details. I look at the happy path and do not cover any conditions throughout the process of generating a random number or error handling. Please feel free to point out any mistakes that need correcting, to clarify any confusing points, or to share interesting information that should be added. Thanks!</em></p><h3>Adding random bytes to /dev/urandom</h3><p>The first step of our journey is looking at how the computer can even <em>get</em> random numbers. There are pseudorandom number generators where there are a lot of processing that can simulate randomness but given enough runs, we can start to see some patterns and predictability emerging.</p><p>See the blue plotting in the below gif. This is from a pseudorandom number generator and given enough steps you can see a pattern here — randomness is not supposed to be predictable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rpfpmt-OlXiM2vGw45NQQg.gif" /><figcaption>credit to Khan Academy: <a href="https://www.youtube.com/watch?v=GtOt7EBNEwQ&amp;feature=youtu.be">https://www.youtube.com/watch?v=GtOt7EBNEwQ&amp;feature=youtu.be</a>)</figcaption></figure><p>Do you recall cryptoquotes in your daily newspaper (when newspapers were a thing)? There are seemingly random characters in the quote. But knowing the patterns of English, you can decipher the message and find the generators for this pseudorandomness e.g. A is actually T, T is actually I.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/0*P6ltGNp3_ChOmhnH.jpg" /></figure><p>There are better ways to produce randomness and a solution that is widely used is to Hardware Random Number Generators which we will explore here. There are a lot of steps from between your input, running Python’s random.random() function and Python’s output. We will first look on how to get a bunch of random data from the Hardware Random Number Generator to put into a file called /dev/urandom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_sssLcrBNuHAuTXTUd_KQ.png" /><figcaption>Workflow from bits to output</figcaption></figure><p>Hardware Random Number Generators collect information running through CPU or the motherboard. It will collect bytes that run through the CPU and motherboard from external sources that is supposed to generate noise, random data e.g. keyboard, mouse, audio, video. It is not so much generating random data. It is more like sampling data randomly at certain intervals through an oscillator e.g. 300 MHz. This sampling is then added to a file called an Entropy Pool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*ult3lQfe3lb9cG9-VFhllw.png" /><figcaption>Sampling bytes at certain intervals</figcaption></figure><p>Have you played the game with your spouse of coming up with your baby’s name? You probably sampled names you hear from all kinds of random sources, such as listening to some side conversation in a cafe, passing by signs on the highway and looking for interesting street names, etc. This sampling is very similar in that the external inputs are randomized instead internally generating a random name yourself.</p><p>There are more processes than just sampling, such as ensuring the sampled bytes are valid random bytes and controlling for biases, or changing the frequency in which you sample which is supposed to create more randomness. A lot of the design is not public knowledge. In the Linux code, it comments how it interfaces with Intel Hardware Random Number Generators but I could not find any precise details. I understand that this may be proprietary and a sense that if this knowledge is publicly known, then it would be easier to hack systems by understanding the generators. I did find some designs through OneRNG which is a USB random number generator that uses an avalanche diode to sample random bytes for the Entropy Pool. <a href="http://onerng.info/">http://onerng.info/</a> . The premise of OneRNG is that the generator should <strong><em>verifiable </em></strong>in order to be secured. I would like to explore this as some point.</p><p>The Entropy Pool is not the entropy as you would suspect if you have studied Thermodynamics but Entropy as in the Information Theory sense from Claude Shannon. <a href="http://math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf">http://math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf</a></p><p>Noise i.e entropy is produced by environmental factors like mouse clicks which is supposed to be outside the deterministic framework of the computer.</p><p>Next, there is a Linux driver that is able to access the Entropy pool called /dev/hwrng and starts writing random bytes to a file called dev/urandom.</p><p>To see these random bytes, open Terminal and do the following command:</p><pre>hexdump /dev/urandom</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*oegxTyF6uDFNGGfsJkRa4A.png" /><figcaption><em>Note: This will keep running in your Terminal so use Command + Z to suspend the command</em></figcaption></figure><p><em>Another Note: I ran cat /dev/urandom and it did a lot of funky things.</em></p><p>The numbers on the left are the addresses in memory followed by the sampled random bytes in hexadecimal form.</p><p>There is another file called /dev/random that we will not go into but a note is that random bytes are constantly being consumed by other programs such as encryption. It is possible to exhaust, or use up, all of the random bytes in the /dev/random file or Entropy Pool. In this event, random numbers are then calculated through some algorithms such as SHA-1. It being deterministic, it is easy for hackers to reverse engineer the random byte used to create an encryption key. It is highly advisable in the community to use /dev/urandom. Others are trying to explicitly add other sources of random data that they keep feeding random bytes into Entropy Pool such USB, webcam, etc…</p><p>Now that we have random bytes in the /dev/urandom file, we are now on our next step of pulling those random bytes to produce a random number from our Python random.random() function.</p><h3>Grabbing bytes from /dev/urandom</h3><p>When you do random.random() in Python, it makes use of some Linux OS files to grab the random bytes from dev/devurandom.</p><p>random.random() is a function of the random library that is shipped with Python. Python, being built on top of C, can access some of the C files that runs on Linux, in this case the random.c file which is able to interact with the /dev/urandom file where our random bytes are.</p><p>In Linux, a program called random.c will grab some bytes from this file.</p><p>This module provides access to operating system functionality that is<br>standardized by the C Standard and the POSIX standard (a thinly<br>disguised Unix interface).</p><p>ef random(self):<br> “””Get the next random number in the range [0.0, 1.0).”””<br> return (int.from_bytes(_urandom(7), ‘big’) &gt;&gt; 3) * RECIP_BPF</p><p>os/_init.py</p><pre>def urandom(n):<br>    <em>&quot;&quot;&quot;Return a string of n random bytes suitable for cryptographic use.<br><br>    </em><strong><em>:type</em></strong><em> n: int<br>    </em><strong><em>:rtype</em></strong><em>: bytes<br>    &quot;&quot;&quot;<br>    </em>return b&#39;&#39;</pre><p>Then this goes to builtins.py</p><pre>class int(object):<br>    <em>&quot;&quot;&quot;<br>    int([x]) -&gt; integer<br>    int(x, base=10) -&gt; integer<br>    <br>    Convert a number or string to an integer, or return 0 if no arguments<br>    are given.  If x is a number, return x.__int__().  For floating point<br>    numbers, this truncates towards zero.<br>    <br>    If x is not a number or if base is given, then x must be a string,<br>    bytes, or bytearray instance representing an integer literal in the<br>    given base.  The literal can be preceded by &#39;+&#39; or &#39;-&#39; and be surrounded<br>    by whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.<br>    Base 0 means to interpret the base from the string as an integer literal.<br>    &gt;&gt;&gt; int(&#39;0b100&#39;, base=0)<br>    4<br>    &quot;&quot;&quot;</em></pre><p>Then this pass a cls into from_bytes</p><pre><br>def from_bytes(cls, *args, **kwargs): # real signature unknown<br>    &quot;&quot;&quot;<br>    Return the integer represented by the given array of bytes.<br>    <br>      bytes<br>        Holds the array of bytes to convert.  The argument must either<br>        support the buffer protocol or be an iterable object producing bytes.<br>        Bytes and bytearray are examples of built-in objects that support the<br>        buffer protocol.<br>      byteorder<br>        The byte order used to represent the integer.  If byteorder is &#39;big&#39;,<br>        the most significant byte is at the beginning of the byte array.  If<br>        byteorder is &#39;little&#39;, the most significant byte is at the end of the<br>        byte array.  To request the native byte order of the host system, use<br>        `sys.byteorder&#39; as the byte order value.<br>      signed<br>        Indicates whether two&#39;s complement is used to represent the integer.<br>    &quot;&quot;&quot;<br>    pass</pre><p>Then off to posix.py</p><pre>def random(self):<br>    <em>&quot;&quot;&quot;Get the next random number in the range [0.0, 1.0).&quot;&quot;&quot;<br>    </em>return (int.from_bytes(_urandom(7), &#39;big&#39;) &gt;&gt; 3) * RECIP_BPF</pre><h3>Python processing of the random bytes</h3><p>This gets 7 bytes from urandom, choose the first byte, shift 3 bits to the right</p><p>b’\x90/\x05\xf5hu\x11&#39;</p><p>I am not sure why getting ‘Big’ Significant Bit is important, so if you know, let me know. Also, not sure why we shift 3 bits to the right.</p><p>Then we multiple by RECIP_BPF</p><pre>BPF = 53        # Number of bits in a float<br>RECIP_BPF = 2**-BPF</pre><p>2^-53</p><ul><li><a href="https://en.wikipedia.org/wiki/Double_precision">Double precision</a>, usually used to represent the “double” type in the C language family (though this is <a href="https://en.wikipedia.org/wiki/C_data_types#Basic_types">not guaranteed</a>). This is a binary format that occupies 64 bits (8 bytes) and its significand has a precision of 53 bits (about 16 decimal digits). <a href="https://en.wikipedia.org/wiki/Floating-point_arithmetic">https://en.wikipedia.org/wiki/Floating-point_arithmetic</a></li></ul><p><a href="https://docs.python.org/2.5/ref/power.html">https://docs.python.org/2.5/ref/power.html</a></p><p>Finally, you will get your random number between 0 and 1!</p><pre>random.random()<br>&gt;&gt;0.08436837268585984</pre><p>There are a lot of questions that I would like to explore at some time.</p><p><strong>How do Hardware Random Generators Work like OneRNG?</strong></p><p><strong>How does random.c handle the Entropy Pool?</strong></p><p><strong>What happens when you run out of random bytes while running a statistical experiment that runs let’s say 1,000,000 trials in a short amount of time?</strong></p><p><strong>There are more processing of the random bytes collected from the Entropy Pool such as the Mersenne Twister that Python uses? How does this work?</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c40aab177b0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/computation-of-randomness-c40aab177b0">Computation of Randomness</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[鸿门宴 — Hongmen Banquet]]></title>
            <link>https://acp8.medium.com/%E9%B8%BF%E9%97%A8%E5%AE%B4-hongmen-banquet-c44bfb80ab5?source=rss-b750c0a74e96------2</link>
            <guid isPermaLink="false">https://medium.com/p/c44bfb80ab5</guid>
            <category><![CDATA[friendship]]></category>
            <category><![CDATA[chinese-proverb]]></category>
            <category><![CDATA[鸿门宴]]></category>
            <category><![CDATA[idioms]]></category>
            <category><![CDATA[seven-warring-states]]></category>
            <dc:creator><![CDATA[Produxt Manager]]></dc:creator>
            <pubDate>Sat, 09 May 2020 18:24:40 GMT</pubDate>
            <atom:updated>2020-05-09T18:24:40.773Z</atom:updated>
            <content:encoded><![CDATA[<h3>鸿门宴 — Hongmen Banquet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nXj03eEAiVqCST9t" /><figcaption>Photo by <a href="https://unsplash.com/@_zachreiner_?utm_source=medium&amp;utm_medium=referral">Zach Reiner</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Dear Monty,</p><p>“This is a Hongmen Banquet” — “这是鸿门宴啊!”. This is a pretty fun idiom as this is jam packed with ancient history. Basically, you would use this idiom to describe a situation where it appears to be festive, celebratory, fun, an opportunity for pacification, but it is really a situation that is dire, dangerous, or even deadly. A situation that is created under <em>false pretenses</em>, expressed with <em>a lie through one’s teeth, </em>harboring <em>ulterior motives</em>. This resembles <em>a trojan horse</em>, but much more involved than a trojan horse as conspirators put on a continuous facade to lower suspicions, lower defenses, and do damage.</p><p>Let’s dive into the story.</p><h3>The Story</h3><h4>Background</h4><p>Around the later part of 3rd century BC, at the time when Rome is fighting Carthage during the 2nd Punic Wars, the State of Qin had overtaken other states in China during the period of the 7 Warring States.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_90ym1Ch0HkianvMdrYWQ.gif" /><figcaption>Benedetta blair / CC BY-SA (<a href="https://creativecommons.org/licenses/by-sa/4.0">https://creativecommons.org/licenses/by-sa/4.0</a>)</figcaption></figure><p>Liu Bang, before he became the Emporer of Han and ruled over all of China, rose up as a leader of one of the many rebellious factions against Qin. He joined forces with another prominent leader named Xiang Liang out of the Chu city of Wu. Xiang Liang installed King Huai II as the ruler of the Chu state.</p><p>Xiang Liang died in the Battle of Dingtao and King Huai II promoted Xiang Liang’s nephew Xiang Yu as Duke. King Huai II then made a directive for Liu Bang and Xiang Yu: whoever enters the Qin homeland, Guanzhong, will be granted “King of Guanzhong”. Guanzhong was known as one of the richest areas in China at the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*U8tgzvTIwoQbMXo7v5aIFQ.png" /></figure><p>As Xiang Yu is making his way to the Qin homeland, he got caught up at the Battle of Julu against the Qin army. During this time, Liu Bang made his way to Xianyang through Wu Pass through the Qin Mountains. He conquered the pass and was able to enter and capture Xianyang City, the capital of Qin, with the last Qin Emperor surrendering to Liu Bang.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*K59SRFvQu4P6kYmXLswI5Q.png" /></figure><p>Here, we start the story of the contention between Liu Bang and Xiang Yu. Liu Bang instructed his troops to block passes to Xianyang City including the Hangu Pass to prevent pillaging and chaos. Xiang Yu, hearing that Liu Bang had made it to Qin homeland first, hastily made his way to the Qin homeland but was stopped at Hangu Pass by Liu Bang’s troops</p><h4>Liu Bang (39 years old) and Xiang Yu (26 years old) at the Hongmen Banquet</h4><p>司马迁 — Sima Qian records the story in 史记 — Records of the Grand Historian.</p><p>I pulled the translated story from ctext.org and modified the text for readability, particularly on naming and removing irrelevant characters.</p><p><a href="https://ctext.org/shiji/xiang-yu-ben-ji">Annals of Xiang Yu</a></p><p><strong>Supplemental Character List</strong></p><p>Cao Wushang — mole within Liu Bang’s army.</p><p>Fan Zeng — advisor to Xiang Yu</p><p>Xiang Bo — Chu’s Chief Minister of the Left, Xiang Yu’s uncle, friend of Zhang Liang</p><p>Zhang Liang — Marquis of Liu, serving under Liu Bang</p><p>Xiang Zhuang — Sword dance performer</p><p>Fan Kuai — Liu Bang’s stableman</p><p><strong>Story</strong></p><p>Xiang Yu’s troops came to Hangu Pass. The pass was guarded by Liu Bang’s soldiers so Xiang Yu could not get through. Apart from this, it was said that Liu Bang had already occupied Xianyang City. Xiang Yu hence got fiercely angry, so he ordered to have the blockage attacked. Then he got through the pass and marched towards Xianyang City. Liu Bang’s troops were stationed in Bashang; he did not have the chance to meet Xiang Yu. A military officer of Liu Bang, Cao Wushang, secretly sent a messenger to Xiang Yu, saying: “Liu Bang intends to be king of Guanzhong and possess all the treasures of Qin.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*u06ax-ajQQHpJi_AzzDyUA.png" /></figure><p>Xiang Yu broke out into a rage and said: “Prepare my soldiers tomorrow morning. I will destroy Liu Bang’s army!” At that time, Xiang Yu had 400,000 men stationed in Hongmen, Liu Bang had 100,000 men in Bashang.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*TLC4o6FNqadWIy2hr2TOhQ.png" /></figure><p>Fan Zeng, advisor to Xiang Yu, said to Xiang Yu: “When Liu Bang was in Shandong, he was very greedy for treasures and beauties. But today in Guanzhong, treasures are untouched, women are intact. This reveals his tremendous ambition. I had his Qi observed, and it is like dragon and tiger, in five colors — this is the Qi of the Son of Heaven. Strike him at once and do not miss!”</p><p>Chu’s Chief Minister of the Left Xiang Bo, Xiang Yu’s uncle, was a friend of Zhang Liang, Marquis of Liu. Zhang Liang worked for Liu Bang at the time. Xiang Bo rode out to Liu Bang’s camp under the cover of the night, met Zhang Liang privately, told him about the assault and asked him to escape, saying: “You will die if you stay.”</p><p>Zhang Liang said: “I was appointed as Liu Bang’s servant by the king of Han. Now that Liu Bang is in danger, it is not justifiable for me to escape. I have to warn him.”</p><p>So Zhang Liang came to Liu Bang and told him everything. Liu Bang was surprised and scared, he asked: “What should I do?”</p><p>Zhang Liang asked: “Who gave you the idea to block Hangu Pass?”</p><p>Liu Bang said: “Someone told me to guard the pass and keep off other lords in order to be king of the Qin territory. I took that advice.”</p><p>Zhang Liang asked: “Can your troops match Duke Xiang Yu’s troops?”</p><p>Liu Bang remained silent for a while, and then said: “Of course we cannot, what should I do?”</p><p>Zhang Liang said: “Please go and tell Xiang Bo that you dare not betray Duke Xiang Yu.”</p><p>Liu Bang asked: “How do you know Xiang Bo?”</p><p>Zhang Liang answered: “We were old friends in the Qin times, he was guilty of murder and I saved his life. So today he came to save mine in emergency.”</p><p>Liu Bang asked: “Who of you is older, you or Xiang Bo?”</p><p>Zhang Liang said: “He is elder than me.”</p><p>Liu Bang said: “Call him in for me. I will treat him as my elder brother.”</p><p>Zhang Liang went out and invited Xiang Bo. So Xiang Bo came in to see Liu Bang. Liu Bang honored him with a toast and promised him a marriage, saying: “After I came to Guanzhong, I dare not touch anything. I sealed the treasury and waited for the Duke Xiang Yu. I guarded the pass only to restrain bandits and for security. I have been expecting the Duke day and night, how could I betray him? Please tell the Duke that I dare not do such unvirtuous things!”</p><p>Xiang Bo promised, and he said to Liu Bang: “Tomorrow you have to apologize to Duke Xiang Yu early.”</p><p>Liu Bang said: “Yes.” So Xiang Bo rode back to the camp of Duke Xiang Yu in the night, and told Duke Xiang Yu what Liu Bang had said.</p><p>Xiang Bo said: “If it were not for Liu Bang, how could you so easily come to Guanzhong? It is not a noble thing to kill a man of merit. We had better treat him well.” Duke Xiang Yu agreed.</p><p>The second day, accompanied by one hundred cavalrymen, Liu Bang came to meet Duke Xiang Yu in Hongmen. Liu Bang apologized: “The Duke and I fought side by side against Qin. The Duke fought on the northern side of the Yellow river, and I fought on the south. I did not expect that I could be the first to break into Guanzhong and defeat Qin, and finally meet the Duke here. There must be a petty man trying to casts a bone between the Duke and me.”</p><p>Duke Xiang Yu said: “This is all because of your officer, Cao Wushang. Otherwise I would not have done this. ”Duke Xiang Yu invited Liu Bang to a feast on that day. Duke Xiang Yu and Xiang Bo sat facing the East. Fan Zeng sat facing the South. Liu Bang sat facing the North. Zhang Liang sat beside Liu Bang facing the West. Fan Zeng glanced several times at Duke Xiang Yu, holding the jade on his girdle to hint that it was time to take action. Duke Xiang Yu remained silent and did not react. Fan Zeng stood up, came out and found Xiang Zhuang, said to him: “The Lord has not the heart to kill. You should go in and toast, then ask to do a sword performance, and kill Liu Bang on his seat. Otherwise we all will be his prisoner one day.”</p><p>So Xiang Zhuang went in and toasted, then he said: “The Lord drinks with Liu Bang, but there is no entertainment in the army, please allow me to do a sword performance.”</p><p>Duke Xiang Yu said: “Approved.” Xiang Zhuang drew his sword and danced. Xiang Bo also drew his sword and danced along, protecting Liu Bang obscurely with his body. Xiang Zhuang had no chance.</p><p>At this moment, Zhang Liang went out to the gate and found Fan Kuai. Fan Kuai asked: “How is the situation?”</p><p>Zhang Liang said: “Very dangerous! Xiang Zhuang is doing a sword performance, intending to kill Liu Bang!”</p><p>Fan Kuai said: “This is urgent! Let me in, I will save him with my life.” Fan Kuai broke through the gate with shield and sword. The guards tried to stop him. He crashed the guards to the ground with his shield. Then he rushed in to the hall, stood facing the west with the mantle on his shoulders, his eyes opening so wide that the brow ridge was about to break up.</p><p>Duke Xiang Yu touched his sword and asked: “Who is this?”</p><p>Zhang Liang said: “This is Liu Bang’s stableman, Fan Kuai.”</p><p>Duke Xiang Yu said: “A hero! Bestow wine on him!” Fan Kuai was then given wine. He gave thanks on his knees, then stood up and drank it all. Duke Xiang Yu said: “Bestow pork on him!” He was then given raw pork. Kuai laid his shield on the ground, put the pork on it, cut the pork with his sword and ate. Duke Xiang Yu asked: “Hero! Can you drink again?”</p><p>Fan Kuai answered: “Even death will not scare me, how would wine! The emperor of Qin was as cruel as tiger and wolf, killing and torturing the people without an end. So the people revolted against him. King Huai made the agreement with all lords that the first who broke into Guanzhong should be king. Since Liu Bang defeated Qin and took over Xian Yang City, he kept nothing for himself. He sealed the palace and waited for the King’s arrival. He ordered his men to guard the pass only to prevent bandits and emergencies. You did not award such a man of merit, but instead trusted lies and tricks, intending to kill him. This is the same behavior as the dead Qin. I suggest your highness not do this.”</p><p>The King did not answer him, instead he only said: “Sit.” Fan Kuai then took the seat beside Zhang Liang. After a while, Liu Bang got up and went out to the washroom, and asked Fan Kuai to come with him.</p><p>As Liu Bang has come out, Duke Xiang Yu ordered a lieutenant to call him back in. Liu Bang said to Fan Kuai: “I came out without saying goodbye, what should I do now?”</p><p>Fan Kuai said: “The most powerful never mind small matters; the most polite never care about small etiquette. Now they are knife and chopping block, we are fish in between, why need we say goodbye?”</p><p>So Liu Bang decided to leave. He ordered Zhang Liang to stay and apologize for him. Liang asked: “Have you brought anything here?”</p><p>Liu Bang said: “I have a pair of white jade for the Lord, and a pair of jade pecks for Fan Zeng. They were angry so I dare not give them. Please deliver the gifts for me.”</p><p>Zhang Liang said: “Yes.”</p><p>At that time, the camp of Duke Xiang Yu was in Hongmen, and the camp of Liu Bang was in Bashang, 40 li from each other. Liu Bang discarded his chariot and rode alone, followed by Fan Kuai and three others with swords and shields in their hands. They took a shortcut at the foot of the mountains. Liu Bang told Zhang Liang before they left: “It is only 20 li to our camp through this path. You go back in when you estimate that we have arrived.” Liu Bang reached his camp after a while.</p><p>Zhang Liang went back in to the hall and apologized: “Liu Bang has drunk too much, he cannot say his farewells. He ordered me to give this pair of white jade to the Lord, and this pair of jade pecks to the high general.”</p><p>Duke Xiang Yu asked: “Where is Liu Bang?”</p><p>Liang said: “He heard that the Lord intended to blame him for his fault, so he left and should have arrived in his camp.”</p><p>Duke Xiang Yu accepted the jade and put it on the table. Fan Zeng took the jade pecks, put them on the ground and broke them with his sword, saying to Xiang Yu: “Ah! You idiot, I cannot help you! It shall be Liu Bang who will defeat you. We all will be imprisoned by him!”</p><p>Upon arriving in his camp, Liu Bang executed Cao Wushang.</p><h3>Afterthoughts</h3><p>Liu Bang would later go on to defeat Xiang Yu as his advisor, Fan Zeng had predicted and later became the first Han Emporer of all of China.</p><p>It appears that 鸿门宴 has been used for quite some time. Within the Romance of the Three Kingdoms, there are 2 instances of this used. The first instance is when Liu Bei and Cao Cao had met. Two of Liu Bei’s generals hearing of the meeting came to join the meeting where Cao Cao references the Hongmen Banquet, Xiang Zhuang(the sword dance performer instructed to kill Liu Bang), Xiang Bo (Xiang Yu’s uncle that was trying to pacify the situation between Liu Bang and Xiang Yu), and Fan Kuai (Liu Bang’s stableman that burst in during the Hongmen Banquet after hearing the plotted assassination).</p><blockquote>天雨方住，見兩個人撞入後園，手提寶劍，突至亭前，左右攔擋不住。操視之，乃關、張二人也。原來二人從城外射箭方回，聽得玄德被許褚、張遼請將去了，慌忙來相府打聽；聞說在後園，只恐有失，故衝突而入。卻見玄德與操對坐飲酒。二人按劍而立。操問二人何來。雲長曰：「聽知丞相和兄飲酒，特來舞劍，以助一笑。」操笑曰：「<strong>此非鴻門會</strong>，安用項莊、項伯乎？」玄德亦笑。操命：「取酒與『二樊噲』壓驚。」關、張拜謝。 — 《<a href="https://ctext.org/sanguo-yanyi/ch21?searchu=%E9%B8%BF%E9%97%A8&amp;searchmode=showall#result">曹操煮酒論英雄，關公賺城斬車胄</a>》</blockquote><blockquote>The shower had passed, and there appeared two men rushing through the garden, both armed. In spite of the attendants, they forced their way to the pavilion where sat the two friends. They were Guan Yu and Zhang Fei.<br>The two brothers had been outside the city at archery practice when Cao Cao’s invitation had come so peremptorily. On their return they heard that two officers had arrived and led away Liu Bei to the Prime Minister. They hastened to his palace and were told their brother was with his host in the grounds, and they feared something had happened. So they rushed in.<br>Now when they saw their brother quietly talking with Cao Cao and enjoying a cup of wine, they took up their usual places and meekly stood waiting.<br>“Why did you come?” said Cao Cao.<br>“We heard that you, Sir, had invited our brother to a wine party, and we came to amuse you with a little sword play,” said they.<br>“<strong>This is not a Hongmen Banquet,</strong>” replied Cao Cao. “What use have we for Xiang Zhuang and Xiang Bo of old?”<br>Liu Bei smiled. The host ordered wine to be served to the two “Fan Kuais” to allay their anxiety. — <a href="https://ctext.org/sanguo-yanyi/ch21?searchu=%E9%B8%BF%E9%97%A8&amp;searchmode=showall#result">In A Plum Garden, Cao Cao Discusses Heroes; Using The Host’s Forces, Guan Yu Takes Xuzhou</a></blockquote><p>Here the second instance:</p><blockquote>二人對舞於筵前。魏延目視劉封，封亦拔劍助舞，於是劉瑰、冷苞、鄧賢各掣劍出曰：「我等當群舞，以助一笑。」玄德大驚，急掣左右所佩之劍，立於席上曰：「吾兄弟相逢痛飲，並無疑忌，<strong>又非鴻門會上</strong>，何用舞劍？不棄劍者立斬！」劉璋亦叱曰：「兄弟相聚，何必帶刀？」命侍衛者盡去佩劍。眾皆紛然下堂。玄德喚諸將士上臺，以酒賜之，曰：「吾兄弟同宗骨肉，共議大事，並無二心。汝等勿疑。」諸將皆拜謝。劉璋執玄德之手而泣曰：「吾兄之恩，誓不敢忘！」二人歡飲至晚而散。玄德歸寨，責龐統曰：「公等奈何欲陷備於不義耶？今後斷勿為此。」統嗟歎而退。《<a href="https://ctext.org/sanguo-yanyi/ch61?searchu=%E9%B8%BF%E9%97%A8&amp;searchmode=showall#result">趙雲截江奪阿斗，孫權遺書退老瞞</a>》</blockquote><p>Let me know if you find some idiom that reflects 鸿门宴 in the Western canon. One incident found in Western ancient history is that of Philip II of Macedon. However, Phillip II was actually assassinated at the banquet for his daughter’s wedding reception. Although Liu Bang escaped the assassination plot at 鸿门宴, the modern use of 鸿门宴 also describes situations where one is anticipating being betrayed or framed by someone who is putting up the facade.</p><p>What immediately comes to mind from studying 鸿门宴 is the notion of flattering. There is a certain suspicion to be had for those who <em>butter you up</em> to later cook you, who <em>fatten you up </em>to later serve you as a feast. I recall reading Cicero’s passage about Friendship in that there is “no greater pestilence to friendship than flattery”. True friends are honest with each other to the point that it can hurt as uncovering the truth sometimes does.</p><p>Your non-Flattering Friend,</p><p>Andrew</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c44bfb80ab5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[沉默是金 — Silence is Golden]]></title>
            <link>https://acp8.medium.com/%E6%B2%89%E9%BB%98%E6%98%AF%E9%87%91-silence-is-golden-4da2ae538e86?source=rss-b750c0a74e96------2</link>
            <guid isPermaLink="false">https://medium.com/p/4da2ae538e86</guid>
            <category><![CDATA[silence-is-golden]]></category>
            <category><![CDATA[proverbs]]></category>
            <dc:creator><![CDATA[Produxt Manager]]></dc:creator>
            <pubDate>Sun, 26 Apr 2020 23:24:17 GMT</pubDate>
            <atom:updated>2020-04-26T23:46:57.629Z</atom:updated>
            <content:encoded><![CDATA[<h3>沉默是金 — Silence is Golden</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iewYjY3Igdfvvtmc" /><figcaption>Photo by <a href="https://unsplash.com/@guillaumedegermain?utm_source=medium&amp;utm_medium=referral">Guillaume de Germain</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Dear Monty,</h3><p>沉默是金 translates to “silence is golden”.</p><p>In modern English, <em>silence is golden</em> can mean it is better to keep quiet in order to not incriminate someone or yourself, similarly how lawyers tell their clients that <em>loose lips sink ships</em>. Or it could mean silence is a blissful state, kind of like how parents feel when all their children are finally asleep. Or it could provide cover to an introvert’s temperament, a justification for why we opt to quietly observe instead of engaging in verbal diarrhea spitting out every thought the moment it develops in the mind. Or it could mean, <em>if you have nothing nice to say, then don’t say nothing</em>.</p><p>The use of 沉默是金 is just as varied as <em>silence is golden </em>but without the negative interpretations like “you should keep silent, or else!”. I recall the male protagonist in Chinese dramas and movies, the guy who is the cool, calm, collected archetype who spares minimal words while his talkative, clumsy friend is there for comedic effect. My friend noticed very early on in high school, the moment that he stopped talking, the more people listened to him when he does talk. Another friend in high school, an aspiring car mechanic, taught himself car repair by practicing on the cars of our high school classmates and even teachers. How was able to persuade them that he knew how to fix cars? He kept silent while he worked on their engines, not revealing any doubt or uncertainty that was running through his mind. They assumed he knew what he was doing.</p><p>So, well, what is it? What is the true meaning of 沉默是金 and <em>silence is golden</em>? Do they mean the same thing? If we look into the history of its usage, will we find some insights on how we should view silence? Here, I explore.</p><h3>Silence is Golden</h3><p>One of the earliest use of <em>silence is golden </em>is by Thomas Carlyle in 1833, in his novel, <strong>Sartor Resartus: The Life and Opinions of Herr Reufeldröchkh, </strong>a mostly philosophical and sometimes satirical novel. He writes:</p><blockquote>Silence is the element in which great things fashion themselves together; that at length they may emerge, full-formed and majestic, into the daylight of Life, which they are thenceforth to rule. Book III page 174</blockquote><p>He summarizes this section on silence with “Speech is silvern, silence is golden” that he translates from Swiss German:</p><blockquote>Sprechen ist silbern, schweigen is golden</blockquote><p>The proverb definitely presents itself with a transcendentalist quality like the Solitude chapter in <strong>Henry David Thoreau’s Walden</strong>. It talks of a state of being, a state where one can be in silence, in solitude. A state where one can hear the voice of his own thoughts.</p><p><em>Silence is golden </em>later appears in 1853 in <strong>Richard Chenevix Trench’s On the Lessons in Proverbs</strong> where he writes:</p><blockquote>Thus, how many of these popular sayings and what good ones there are on the wisdom of governing the tongue, -I speak not now of those urging the duty, though such are by no means wanting, — but the wisdom, prudence, and profit of knowing how to keep silence as well as how to speak. The Persian, perhaps, is familiar to many: Speech is silvern, silence is golden. — pages 63–64</blockquote><p>There are other sources that attribute this phrase towards Eastern Mediterranean origin.</p><p>In the fifth volume (1871)of the <strong>Journal of Royal Asiatic Society of Great Britain</strong> lists the proverb:</p><blockquote>حكي من فضه و <strong>السكوت من ذهب</strong></blockquote><blockquote>“Speech is of silver, silence is of gold.” — An old proverb in Syria; a comparatively new saying amongst us. — page 347</blockquote><p>German sources also point to Eastern Mediterranean origin.</p><p>Franz Lorenz von Dombay in 1795 collects and translates in <strong>Popular-Philosphie der Araber, Persicer und Türken</strong> (Popular Arabic, Persion, and Turkish Philosophy):</p><blockquote>Reden ist Silber , Schweigen aber ist Gold</blockquote><blockquote>Speaking is silver, silence is gold. — page 194</blockquote><p>So far, we know that the original use of <em>silence is golden</em> does NOT mean to NOT talk. <em>Silence is golden</em> does not mean there is a risk to incriminate someone or yourself, a risk to reveal secrets, a risk to utter words that you cannot unsay as they say, <em>putting the toothpaste back in the toothpaste tube</em>. It does not mean that speech is not valuable. We know that speech is valuable like silver, but silence is more valuable. When is silence more valuable than speaking? It will be interesting to see how حكي من فضه و <strong>السكوت من ذهب </strong>is<strong> </strong>used, particularly within any ancient texts. Let me know if you have found anything. I have searched and found none so far.</p><p>So is silence more valuable than speech or in other words, is speech not as valuable as silence? Digging into the history of 沉默是金 will give us some clues.</p><h3>沉默是金</h3><p>Chinese texts do not seem to compare silence to speech as Western sources do. In fact, looking at the Chinese characters for silence is interesting. 默 means quiet and 沉 means submerged. Submerged in quietness, in silence, seems like it has a contemplative, even meditative quality to it. Like other Chinese proverbs, 沉默是金 has a story behind it which I found on <a href="https://idiom.wlps.kl.edu.tw/story/36204">https://idiom.wlps.kl.edu.tw/story/36204</a>. It is a story of three gold men which I translate and interpret as follows.</p><h4>Three Gold Men</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*gdxilB3fO_wW6ojpaIoHbw.jpeg" /></figure><p>An envoy from a small nation visited the emperor of China and brought tribute of three golden statues. All three statues were of an identical man. The emperor was pleased having received the tribute until one of the men in the envoy presented a puzzle to the emperor.</p><p>Which of the three gold men is the most valuable?</p><p>The emperor examined the three gold men and thought about the many ways one statue could be more valuable than the others. The emperor also invited a master craftsman to examine the workmanship of each one. The master craftsman even weighed the statues and found it to be of the same weight. The emperor was becoming distressed and felt he could lose face: how could a country as great as China cannot answer a puzzle presented by a smaller nation? The envoy was about to return home without receiving an answer to the puzzle from the emperor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*gie3Fs4nX_SNloFeasYbAg.jpeg" /></figure><p>Finally, an old minster of the palace thought of a way to solve the puzzle. The emperor called the envoy to the main hall of the palace and the old minister took out three straws of rice. He inserted the first straw of rice through the ear of the first gold man. The straw of rice went out the other ear on the other side of the statue. He then inserted the second straw of rice through the ear of the second gold man. The straw fell out through the mouth of the second gold man. Finally, he inserted the third straw of rice through the ear of the third gold man. The straw of rice fell into the belly of the third gold man without making a sound. The old minister then said, “The third gold man is the most valuable.” The envoy nodded their heads yes.</p><p>There are two aspects to the story that demonstrates 沉默是金。</p><p>The gold men are identical in terms of weight, material, and workmanship but what made one more valuable than the other is the ability to contain more value than itself. The first man had something that<em> went through one ear and out the other. </em>The second man has something inserted into ear and went straight out the mouth, kind of like how people who watch TED talks and then become instant experts promoting the bite size nuggets of knowledge they picked up. What makes the third gold man more valuable is that anything added to it will make it more valuable: its value of the other two gold men is itself while the value of the third gold man is itself PLUS anything it can contain.</p><p>Nan Huai Chin is explaining how he was able to obtain his position, most likely when he became a military commander at the age of 21 and cites Confucius. Confucius explained to his student that in order to become a good official, the student will need to be knowledgable and to be knowledgable is to learn more, see more, experience more.</p><blockquote>子張學干祿。子曰：「多聞闕疑，慎言其餘，則寡尤；多見闕殆，慎行其餘，則寡悔。言寡尤，行寡悔，祿在其中矣。」论语 — 为证：15</blockquote><p>There are some Taoist tenants as well. Laozi teaches that the value of a vase is not the vase itself but the space within it.</p><blockquote>三十輻，共一轂，當其無，有車之用。埏埴以為器，當其無，有器之用。鑿戶牖以為室，當其無，有室之用。故有之以為利，無之以為用 — 道德经：11</blockquote><p>Wisdom is defined as knowledge that goes through some internalization and this idea propagates throughout time and space.</p><p>Michel du Montaigne in his Essays:Book One 25 Of Pendantry writes:</p><blockquote>We take the opinions and the knowledge of others into our keeping, and that is all. We must make them our own. We are just like a man, who, needing fire, should go and fetch some at his neighbor’s house, and, having found a fine big fire there, should stop there and warm himself, forgetting to carry any back home. What good does it do us to have our belly full of meat if it is not digested, if it is not transformed into us, if it does not make us bigger and stronger? Do we think that Lucullus, whom books, without experience, made and fashioned into such a great captain, used them in our manner?</blockquote><p>The other aspect of 沉默是金 is the emperor thinking of how to solve the puzzle. The emperor kept an open mind and listened to the old minister despite the master craftsman not being able to solve the puzzle. <em>People have two ears, one mouth for a reason</em>. I found a very fascinating practice for Amazon product management where a Product Manager spends time contemplating a particular product initiative, think of every possible question that can come up in response to the initiative and distills this into a 6 page paper. The Product Manager then calls a meeting for all stakeholders where the stakeholders spend the first 30 minutes in complete silence reading the 6 page paper and the rest of the time debating and deciding whether to go through with the initiative. This is quite the departure from typical practice where a meeting is called and a very small group of people of dominant and vocal participants monopolizes the meeting time leaving others voiceless.</p><p>If we could spend more time on processing and producing rather than on consuming. If we could connect all these bite size pieces of experience and compose wisdom from it. If we could spend time trying to develop our thoughts instead of passing along our half baked thoughts to others expecting the others to bake the other half. If we could sit in silence, listening to what others say instead of listening to our own mind figuring out, working on, only focusing on our own response. If we could source knowledge and inspiration from any person, any place, any experience. It will be golden.</p><p>Your friend,</p><p>Andrew Pongco</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4da2ae538e86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solving — The MySQL server is running with the — secure-file-priv option so it cannot execute this…]]></title>
            <link>https://acp8.medium.com/solving-the-mysql-server-is-running-with-the-secure-file-priv-option-so-it-cannot-execute-this-d319de864285?source=rss-b750c0a74e96------2</link>
            <guid isPermaLink="false">https://medium.com/p/d319de864285</guid>
            <category><![CDATA[mac-os-x]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Produxt Manager]]></dc:creator>
            <pubDate>Mon, 06 Jan 2020 20:02:44 GMT</pubDate>
            <atom:updated>2020-01-06T20:02:44.775Z</atom:updated>
            <content:encoded><![CDATA[<h3>Solving — The MySQL server is running with the — secure-file-priv option so it cannot execute this statement</h3><p>When running MySQL8.0.18 on Mac OS X 10.14.6 Mojave, I tried executing this command:</p><pre>mysql&gt; SELECT ... INTO OUTFILE file;</pre><p>I then ran into this error:</p><pre>The MySQL server is running with the --secure-file-priv option so it cannot execute this statement secure_file_priv</pre><p>When I ran this:</p><pre>mysql&gt; SHOW VARIABLES LIKE &#39;secure_file_priv&#39;;</pre><p>I got this:</p><pre>+------------------+-------+</pre><pre>| Variable_name    | Value |</pre><pre>+------------------+-------+</pre><pre>| secure_file_priv | NULL  |</pre><pre>+------------------+-------+</pre><p>So I thinking that I just need to change the value assigned to secure_file_priv, I did this:</p><pre>mysql&gt; set @@secure_file_priv = &#39;&#39;;</pre><p>Then I got this:</p><pre>ERROR 1238 (HY000): Variable &#39;secure_file_priv&#39; is a read only variable</pre><p>This took awhile to find out how to change secure_file_priv but this is what I did. You can set this variable for the server with this file ~/.my.cnf</p><p>Go to Terminal and then:</p><pre>$vi ~/.my.cnf</pre><p>Then enter this (copy and paste¹ ²)</p><pre>[mysqld]</pre><pre>secure_file_priv               = &#39;&#39;</pre><p>You can change the directory to be any directory that you want MySQL to write files to.</p><p>Press <strong>esc </strong>to get out of Editor Mode, then <strong>:</strong>, and then <strong>wq </strong>to save and quit vi.</p><p>Now QUIT out of your mysql client and restart the MySQL server</p><pre>$sudo /usr/local/mysql/support-files/mysql.server restart</pre><p>When you go back into your mysql client, you will see this after running <strong>mysql&gt; SHOW VARIABLES LIKE ‘secure_file_priv’;</strong></p><pre>+------------------+-------+</pre><pre>| Variable_name    | Value |</pre><pre>+------------------+-------+</pre><pre>| secure_file_priv |       |</pre><pre>+------------------+-------+</pre><p>Once you try <strong>mysql&gt; SELECT … INTO OUTFILE file;</strong> this should write a new file for you³.</p><p>[1] If you don’t put [mysqld] into your .my.cnf file, you might get this:</p><pre>mysql: [ERROR] Found option without preceding group in config file /Users/<em>username</em>/.my.cnf at line 1.</pre><pre>mysql: [ERROR] Fatal error in defaults handling. Program aborted!</pre><p>[2] I tried putting this:</p><pre>[mysqld]</pre><pre>secure_file_priv=“”</pre><p>I then <strong>QUIT</strong> the mysql client, restarted the mysql server, and then relaunched the client. When I did <strong>SHOW VARIABLES LIKE ‘secure_file_priv’; </strong>it still showed <strong>NULL</strong>.</p><p>I found this article <a href="https://geodatawrangler.lazym8.com/blog/2017/02/16/secure-file-priv">https://geodatawrangler.lazym8.com/blog/2017/02/16/secure-file-priv</a></p><p>which showed that there is some spacing between the variable and the expression. After doing just copying and pasting, it worked.</p><p>[3] You may run into this issue when trying to <strong>mysql&gt; SELECT … INTO OUTFILE file</strong></p><pre>ERROR 1 (HY000): Can&#39;t create/write to file &#39;/<em>path</em>/<em>to</em>/<em>file</em>&#39; (OS errno 13 - Permission denied)</pre><p>You will just need to change the permission of the directory where you want MySQL to write files to with Terminal:</p><pre>chmod 1777 /<em>path</em>/<em>to</em>/<em>file</em></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d319de864285" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“ERROR 1148 (42000): The used command is not allowed with this MySQL version” when doing LOAD DATA…]]></title>
            <link>https://acp8.medium.com/error-1148-42000-the-used-command-is-not-allowed-with-this-mysql-version-when-doing-load-data-95a8fdcdcc3c?source=rss-b750c0a74e96------2</link>
            <guid isPermaLink="false">https://medium.com/p/95a8fdcdcc3c</guid>
            <category><![CDATA[troubleshooting]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Produxt Manager]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 21:59:10 GMT</pubDate>
            <atom:updated>2020-01-02T22:05:40.544Z</atom:updated>
            <content:encoded><![CDATA[<h3>“ERROR 1148 (42000): The used command is not allowed with this MySQL version” when doing LOAD DATA LOCAL FILE with MySQL8.0.18</h3><p>This writing is just in case you get stuck following this tutorial from MySQL -&gt; <a href="https://dev.mysql.com/doc/refman/8.0/en/loading-tables.html">https://dev.mysql.com/doc/refman/8.0/en/loading-tables.html</a></p><p>When loading data into a table using a .txt file using mysql, the MySQL Command-Line Client that comes with the MySQL 8.0.18 package and executing this command:</p><pre>mysql&gt; LOAD DATA LOCAL INFILE &#39;path/file.txt&#39; INTO TABLE table_name LINES TERMINATED BY &#39;\r&#39;;</pre><p>you may encounter this error:</p><pre>ERROR 1148 (42000): The used command is not allowed with this MySQL version</pre><p>A possible solution is to ensure that the MySQL server and mysql Command-Line client is enabled to read files locally. By default the MySQL server and the mysql Command-Line client are disabled by default.</p><p>To enable the MySQL server to read local files, run the following in the mysql Command-Line client</p><pre>mysql&gt; SET GLOBAL local_infile=1;</pre><p>1 means ‘ON’.</p><p>If you run</p><pre>mysql&gt;SHOW VARIABLES;</pre><p>you will see local_infile is now ON.</p><p>Now you will need to restart your mysql Command-Line client session from the Terminal assuming to you are in the mysql directory</p><pre>$sudo bin/mysql -u <em>user </em>-p --local-infile=1</pre><p>Now if execute the LOAD DATA LOCAL INFILE command, you should now say your Query is OK.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95a8fdcdcc3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>