<?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 Cody Yang on Medium]]></title>
        <description><![CDATA[Stories by Cody Yang on Medium]]></description>
        <link>https://medium.com/@cody.a.yang?source=rss-d968be2bca11------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Cody Yang on Medium</title>
            <link>https://medium.com/@cody.a.yang?source=rss-d968be2bca11------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 03:56:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cody.a.yang/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[How I Evaluate Coding Agent Output]]></title>
            <link>https://medium.com/@cody.a.yang/how-i-evaluate-coding-agent-output-f6ce33438b75?source=rss-d968be2bca11------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6ce33438b75</guid>
            <dc:creator><![CDATA[Cody Yang]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 16:39:14 GMT</pubDate>
            <atom:updated>2026-11-19T16:39:14.377Z</atom:updated>
            <content:encoded><![CDATA[<h3>Green checkmarks are not proof. Here’s the checklist I use before I trust anything an AI agent writes.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*skcVsgcFQIKFyuiswkT5bQ.png" /></figure><p>I use coding agents every day. Claude Code and Cursor are part of how I build backend services: payment flows, APIs, event-driven systems, CI pipelines.</p><p>They make me faster. They also make mistakes that look exactly like correct work.</p><p>That’s the real problem. A bad human pull request usually looks bad. A bad agent pull request often looks great. Clean code, confident summary, all tests green. And it’s still wrong.</p><p>So over time I built a habit: I don’t ask “does this look right?” I ask “how do I know this is right?”</p><p>Here’s the checklist I use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMSuGLmsgY8Bpu91UjxLDQ.png" /></figure><h3>1. Does it actually run?</h3><p>This sounds obvious. It isn’t.</p><p>Agents will often describe what they did instead of doing it. “I’ve updated the config and verified the service starts.” Did it? Or did it write the config and assume?</p><p>My rule: <strong>I want evidence, not a summary.</strong> The command that ran, and its real output. If the agent can’t show me that, I treat the step as not done.</p><h3>2. Did the tests check anything?</h3><p>This is the one that has burned me the most.</p><p>I once had an agent generate a full API test collection. Every request passed. Everything was green.</p><p>Then I read the assertions. They were checking that each request <em>completed</em>, not that the response was <em>correct</em>. Status code, yes. Response body, barely. A broken endpoint returning the wrong data would have passed too.</p><p>So now, for every test an agent writes, I ask:</p><ul><li><strong>Would this test fail if the code were wrong?</strong></li><li>What exactly is being asserted?</li><li>Is it hitting the real code path, or a mock that always succeeds?</li></ul><p>A test that can’t fail is worse than no test, because it gives you false confidence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zy1fAPZpZ7SImbWiCBIYiQ.png" /></figure><h3>3. Does it exist?</h3><p>Agents hallucinate with total confidence. Common ones I see:</p><ul><li>Library methods that don’t exist, or exist in a different version</li><li>CLI flags that sound right but aren’t real</li><li>Config keys copied from a different tool</li><li>API fields invented to match what the code “should” receive</li></ul><p>The fix is simple but tedious: <strong>check the docs, or run it.</strong> If the agent used a flag, I run --help. If it used a method, I check the version we actually have installed.</p><h3>4. Did it stay in scope?</h3><p>I ask for one change. Sometimes I get five.</p><p>The agent “helpfully” refactors a nearby function, renames a variable, reformats a file, or updates a dependency. Each change might be fine. Together, they make the diff hard to review and risky to ship.</p><p>I always <strong>review the diff, not the summary.</strong> The summary tells me what the agent thinks it did. The diff tells me what it actually did.</p><p>A good agent response does what was asked, and nothing more. If it thinks something else needs fixing, it should say so, not just do it.</p><h3>5. Did it remember the constraints?</h3><p>On long tasks, agents lose context.</p><p>Early in a session I’ll say “don’t touch the production config” or “this must stay backward compatible.” Forty steps later, that constraint is gone. The agent isn’t being careless. It just doesn’t hold onto it the way a person would.</p><p>So for anything longer than a quick fix, I re-check the output against the <strong>original requirements</strong>, not just the last message. I also find it helps to restate key constraints when the task changes direction.</p><h3>6. Is it safe?</h3><p>In payment and API work, this one isn’t optional.</p><p>Things I specifically look for:</p><ul><li><strong>Secrets in code or config.</strong> Tokens, passwords, keys hard-coded “temporarily”</li><li><strong>Missing input validation</strong>, especially on anything from outside the system</li><li><strong>Weakened auth.</strong> Skipped checks, broadened permissions, disabled TLS verification “to make it work”</li><li><strong>Logging sensitive data.</strong> Card details, tokens, or personal info written to logs</li><li><strong>New dependencies</strong> that haven’t been vetted</li></ul><p>Agents optimize for “make it work.” Security is often what gets traded away to get there.</p><h3>7. Is it honest about what it doesn’t know?</h3><p>This is the subtle one, and the one I care about most.</p><p>The worst agent output isn’t wrong code. It’s wrong code with a confident explanation. “Fixed the bug. All tests pass. Ready to merge.”</p><p>The best agent output sounds more like a good engineer: “I changed X. I verified Y by running Z. I couldn’t verify W because I don’t have access to that environment.”</p><p>When I evaluate output, I score honesty separately from correctness. An agent that says “I’m not sure this handles the timeout case” is far more useful than one that silently doesn’t.</p><h3>Edge cases: where agents (and people) fail</h3><p>One more thing I always push on: <strong>the unhappy path.</strong></p><p>Agents are good at the happy path. The payment goes through, the order is created, the response is returned. They are much weaker on what happens when a step fails halfway.</p><p>In payment systems, that’s where the real bugs live. A payment is authorized, the fraud check passes, and then order creation fails. Does every downstream system find out? Or does one of them still think the order exists?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T3gj8wRAyEoABlJ7-8HxvQ.png" /></figure><p>When I review agent code that handles any multi-step workflow, I walk through each step and ask: <strong>“What if this one fails?”</strong> That question finds more bugs than any linter.</p><h3>How I write the feedback</h3><p>When I flag a problem, I try to make the feedback specific enough to be useful, whether it’s going back to the agent or to a person:</p><ul><li><strong>What’s wrong:</strong> the exact line or behaviour</li><li><strong>Evidence:</strong> the command, output, or doc that shows it</li><li><strong>Expected vs actual:</strong> what should happen, and what does</li><li><strong>Severity:</strong> cosmetic, bug, or blocker</li></ul><p>“This test doesn’t work” is not useful. “This test asserts only the status code, so it passes even when the response body is empty. It should check that orderId is present and matches the request&quot; is.</p><h3>Habits that make agents better</h3><p>Evaluation is half the job. The other half is setting the agent up to succeed:</p><ol><li><strong>Small tasks.</strong> One clear change beats one big vague request.</li><li><strong>Explicit acceptance criteria.</strong> Tell it what “done” means, including the edge cases.</li><li><strong>Ask for evidence.</strong> “Show me the command you ran and the output.”</li><li><strong>Review the diff.</strong> Every time.</li><li><strong>Treat it like a fast junior engineer.</strong> Great speed, real skill, and everything gets reviewed before it ships.</li></ol><h3>The bottom line</h3><p>Coding agents are genuinely useful. I’m not going back.</p><p>But “it looks right” and “the tests are green” are not the same as “it’s correct.” The value I add is in the gap between those two things.</p><p>The question I keep coming back to is simple:</p><p><strong>How do I know this is right?</strong></p><p>If I can’t answer that, it’s not done yet.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6ce33438b75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Travis CI/CD Tutorial 2018]]></title>
            <link>https://medium.com/fullstackwebdevelopers/travis-ci-cd-tutorial-2018-3134b8ae1636?source=rss-d968be2bca11------2</link>
            <guid isPermaLink="false">https://medium.com/p/3134b8ae1636</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[autodeployment]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[travis-ci]]></category>
            <dc:creator><![CDATA[Cody Yang]]></dc:creator>
            <pubDate>Tue, 24 Apr 2018 23:34:53 GMT</pubDate>
            <atom:updated>2018-04-24T23:36:24.065Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*Jsn80The5pEf2YDeUEU-Jw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*eNJXMkaIne6N-UdqQou-9w.png" /></figure><p>The original article is at <a href="https://medium.com/@riveryang/travis-ci-cd-tutorial-2018-3134b8ae1636">https://medium.com/@riveryang/travis-ci-cd-tutorial-2018-3134b8ae1636</a></p><p>This article assumes that you have created a GitHub repository and had it enabled for Travis CI at <a href="https://travis-ci.org/">travis-ci.org</a>.</p><p>Through the steps below, you will be able to setup a complete version Travis CI/CD with a few steps of configurations.</p><p>All the code used can be found at <a href="https://github.com/zhengyangca/ToDoList-React">https://github.com/zhengyangca/ToDoList-React</a></p><h4>Connect your Dev machine with the remote server with shared private key, instead of typing password</h4><ol><li>Create Private key from your local machine(mine is Mac):</li></ol><pre>ssh-keygen -t rsa</pre><p>2. Then copy the generated Private key to the remote server (Product Environment):</p><pre>ssh-copy-id root@173.255.xxx.xxx</pre><p>Then you should be able to login your remote server without typing in password.</p><pre>ssh root@173.255.xxx.xxx</pre><h4>Install Ruby &amp; Travis locally</h4><ol><li>Install Ruby via HomeBrew for your Mac</li></ol><pre>brew install ruby</pre><p>2.You should be able to use ‘gem’ after installing ruby, so let’s use gem to install travis</p><pre>gem install travis</pre><p>3. Login travis from your local machine, which will ask for your GitHub username and password. No worries, they will be encrypted.</p><pre>travis login</pre><h4>Prepare on the Server</h4><ol><li>Connect to your remote server and access a directory and git clone the repo with travis</li></ol><pre>cd ~/node_prods/<br>git clone https://github.com/zhengyangca/ToDoList-React.git</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*D6PQUPIPDG7Y7mmqbeT8Ow.png" /></figure><h4>Configuration file, .travis.yml</h4><pre>language: node_js<br>node_js: stable<br>branchs:<br>  only:<br>  - master<br>install:<br>- npm install<br>script:<br>- npm test<br>- npm build<br>addons:<br>  ssh_known_hosts: 47.55.217.201<br>before_install:<br>- openssl aes-256-cbc -K $encrypted_7754af85956f_key -iv $encrypted_7754af85956f_iv<br>  -in id_rsa.enc -out ~/.ssh/id_rsa -d<br>after_success:<br>- chmod 600 ~/.ssh/id_rsa<br>- ssh river7527@173.255.241.13 -o StrictHostKeyChecking=no &#39;cd ~/npm_workspace/todolist/ToDoList-React &amp;&amp; git pull &amp;&amp; npm install&#39;</pre><p>Language, branches, script are literally easy to understand,</p><ol><li>addons, ssh_known_hosts, which means your local machine’s IP is trusted by the remote server, so that you don’t have to select from the question “do you want to trust this machine?” when travis is connecting to your remote server.</li><li>before_install, openssl: Auto generated for non-password connection between local machine and remote server.</li><li>after_success, used for deployment scripts.</li></ol><pre>- chmod 600 ~/.ssh/id_rsa    #for linux privilege</pre><pre>- ssh river7527@173.255.241.13 -o StrictHostKeyChecking=no &#39;cd ~/npm_workspace/todolist/ToDoList-React &amp;&amp; git pull &amp;&amp; npm install&#39;<br># pull the new version of the repo to the server</pre><p>Done. Enjoy the effectiveness of Travis CI!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3134b8ae1636" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fullstackwebdevelopers/travis-ci-cd-tutorial-2018-3134b8ae1636">Travis CI/CD Tutorial 2018</a> was originally published in <a href="https://medium.com/fullstackwebdevelopers">FullStack-Microservices-Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git rollback to history version?]]></title>
            <link>https://medium.com/@cody.a.yang/git-rollback-to-history-version-b807b7e1b7ce?source=rss-d968be2bca11------2</link>
            <guid isPermaLink="false">https://medium.com/p/b807b7e1b7ce</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Cody Yang]]></dc:creator>
            <pubDate>Thu, 05 Apr 2018 17:13:14 GMT</pubDate>
            <atom:updated>2018-04-05T17:13:14.936Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*94_2bozVOYWg0riNby0GPQ.png" /></figure><p>Situation 1:</p><pre>I forgot to fetch origins from remote repository before making changes on an older version. </pre><pre>Then I committed and pushed to the remote. How can I rollback the version for both my local and remote repository?</pre><p>Situation 2:</p><pre>I made something really bad, but everything is in the remote repository already. </pre><p>In either situation, you need to change your master to a previous version. It’s easy but not pretty straight-forward.</p><p>I believe you must have tried git log -&gt; git head xxx, or git revert, or git reset xxx. But none of them can just simply rollback to a history version.</p><p>After trying all the things that I can do, I just realized that a rollback of version can be achieved by creating new branch and have the master branch(or other destination branch) merged with, which can be done by:</p><pre>git log --pretty=oneline  # then find the commit id you wish to rollback</pre><pre>git checkout better_branch<br>git merge --strategy=ours master    # keep the content of this branch, but record a merge</pre><pre>git checkout master<br>git merge better_branch             # fast-forward master up to the merge</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*vkkc91Wo1zx-8rLrpar_qw.png" /></figure><p>Then you will find the master branch rolled back to the branch you pointed out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b807b7e1b7ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplest Spring-Cloud Tutorial in 2018 | (1) Build a Eureka Server]]></title>
            <link>https://medium.com/fullstackwebdevelopers/simplest-spring-cloud-tutorial-in-2018-1-build-a-eureka-server-e61eeaed3b4b?source=rss-d968be2bca11------2</link>
            <guid isPermaLink="false">https://medium.com/p/e61eeaed3b4b</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[eureka-stories]]></category>
            <category><![CDATA[spring-cloud]]></category>
            <category><![CDATA[eureka-server]]></category>
            <dc:creator><![CDATA[Cody Yang]]></dc:creator>
            <pubDate>Mon, 12 Mar 2018 00:54:37 GMT</pubDate>
            <atom:updated>2018-03-12T13:55:44.384Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*DO6KyxnBkBjzdblZDHGhiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*e93r23CMl_GPQXq5Fh4cOw.png" /></figure><p>Thanks to <a href="http://start.spring.io/">Spring Initializer</a> project, we would be able to create SpringCloud with Spring Boot 2.0 projects with just few simple steps.</p><p>//definition and functionalities of Spring Cloud. For more details of the functionaries and implementation, please go through the <a href="http://projects.spring.io/spring-cloud/">official tutorial</a>.</p><p>No need too many words, let’s have the project started.</p><h3>Step 1. Create Server and Service Registration Centre</h3><h4>(1) Create Eureka Server project</h4><p>The simplest way is to access <a href="http://start.spring.io/">start.spring.io</a> and select the options like the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*feTngwdsMfT0xYd1yD2v1A.png" /></figure><h4>(2) Declare a Service Registration Centre</h4><p>The only thing you need to do is just adding the annotation “@EnableEurekaServer” over the main entry class EurekaServerApplication(project path/src/main/java/ca/zhengyang/eurekaServer/EurekaServerApplication.java), just like the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_KNm0VlK6vlS87dhC5189A.png" /></figure><h4>(3) Add Eureka Server Configuration file, application.yml</h4><p>Eureka Server is a eureka client as well by default, but we can disable it by adding configuration “registerWithEureka: false”</p><p>Create a file named as “application.yml” in the resources directory with the content:</p><pre>server:</pre><pre>  port: 8761</pre><pre>eureka:</pre><pre>  instance:</pre><pre>    hostname: localhost</pre><pre>  client:</pre><pre>    registerWithEureka: false</pre><pre>    fetchRegistry: false</pre><pre>    serviceUrl:</pre><pre>    defaultZone:       </pre><pre>      <a href="http://${eureka.instance.hostname}:${server.port}/eureka/">http://${eureka.instance.hostname}:${server.port}/eureka/</a></pre><p>(4) Run your project! Eureka Server provides a management UI that can be seen at <a href="/service/localhost:8761">localhost:8761</a>. See what magic comes to you! yeah! Happy Dance!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UlWFO2_Qn7QnrnJe3KzZeg.png" /></figure><p>So now my friend, you already had a Eureka Server for Spring Cloud built successful, let’s move on to the next step, Create a Eureka Client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*R7jp2UL1LoIQpUiUm6BcoQ.png" /></figure><p><strong>Author</strong>: River (Zheng Yang) @ <a href="http://www.zhengyang.ca/">www.zhengyang.ca</a></p><p>All code is available on <a href="https://github.com/zhengyangca/eureka-server">Github</a></p><p>Happy to hear any suggestion or insight from you guys, and don’t forget to give me a star! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e61eeaed3b4b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fullstackwebdevelopers/simplest-spring-cloud-tutorial-in-2018-1-build-a-eureka-server-e61eeaed3b4b">Simplest Spring-Cloud Tutorial in 2018 | (1) Build a Eureka Server</a> was originally published in <a href="https://medium.com/fullstackwebdevelopers">FullStack-Microservices-Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Word Cloud + Jieba = Generating fancy word cloud and word frequencies report]]></title>
            <link>https://medium.com/fullstackwebdevelopers/word-cloud-jieba-generating-fancy-word-cloud-and-word-frequencies-report-858713109e5d?source=rss-d968be2bca11------2</link>
            <guid isPermaLink="false">https://medium.com/p/858713109e5d</guid>
            <category><![CDATA[word-cloud]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[jieba]]></category>
            <category><![CDATA[word-statistics]]></category>
            <dc:creator><![CDATA[Cody Yang]]></dc:creator>
            <pubDate>Mon, 26 Feb 2018 16:45:32 GMT</pubDate>
            <atom:updated>2018-04-01T17:05:24.839Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t2rQQAd4KAuS1hD-ZcoGYg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ijfFOx9ykOMDYWVUetHing.png" /></figure><p>Original source: <a href="https://medium.com/@riveryang/word-cloud-jieba-generating-fancy-word-cloud-and-word-frequencies-report-858713109e5d">https://medium.com/@riveryang/word-cloud-jieba-generating-fancy-word-cloud-and-word-frequencies-report-858713109e5d</a></p><p>Are you interested in getting evolved into data mining? did you tried to analyze something based on big data? Each trip starts from the first step, this article will bring you the most important, easy to understand, while motivated first step, Text segmentation, as well as its continuous usage: Word Frequencies s\Statistics &amp; fency Word Clouds.</p><p>You can find the source code I’ve accomplished from github at <a href="https://github.com/zhengyangca/wordcloud_jieba_statistics">https://github.com/zhengyangca/wordcloud_jieba_statistics</a></p><p>But if you wish to see the explanation of each part of the code, you can just move ahead below:</p><h3>1. main.py</h3><p>The main process, in charge of calling each functions in order.</p><h4>loading text file:</h4><pre>d = path.dirname(__file__)<br>text = open(path.join(d,’doc//2017年中央政府工作报告(全文).txt’)).read()</pre><h4>segment words via jieba</h4><pre>text=chnSegment.word_segment(text)</pre><h4>generate and plot Word Cloud</h4><pre>plotWordcloud.generate_wordcloud(text)</pre><h3>2. Jieba</h3><p>Chinese text segmentation tool, but useful for both Chinese and English.</p><p>Here we call Jieba’s API to segment text and counter the word frequencies:</p><pre>jieba_word=jieba.cut(text,cut_all=False) # cut_all is false by defaultdataDict=Counter(data)</pre><p>write to file</p><pre># output to txt file<br> with open(‘doc//词频统计.txt’,’w’) as fw:<br> for k,v in dataDict.items():<br> fw.write(“%s,%d\n” % (k,v))<br> # fw.write(“%s”%dataDict)</pre><h3>3. WordCloud</h3><p>A Python tool providing API to generate fancy wordcloud based on customized color scheme and masks.</p><p>It’s pretty easy to call the API(more info see <a href="https://github.com/amueller/word_cloud">Word Cloud GitHub</a>)</p><p>generate Wordcloud</p><pre>d=path.dirname(__file__)<br> alice_mask = np.array(Image.open(path.join(d, “Images//alice_mask.png”)))<br> font_path=path.join(d,”font//msyh.ttf”)<br> stopwords = set(STOPWORDS)<br> wc = WordCloud(background_color=”white”,<br> max_words=2000,<br> # mask=alice_mask, <br> stopwords=stopwords,<br> font_path=font_path,<br> )</pre><pre>wc.generate(text)</pre><p>Open up a new window and plot word cloud</p><pre># show window<br> plt.imshow(wc, interpolation=’bilinear’)<br> # interpolation=’bilinear’ 表示插值方法为双线性插值</pre><pre>plt.axis(“off”)# take off the axis of the image<br> plt.show()</pre><h3>Demo Preview</h3><h4>outputted Word Cloud:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*AtUt6cjv3YasctXaN72sEw.png" /></figure><p>Word Cloud with mask</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*FJYCSiykYS-0XmLzaTfpVw.png" /></figure><h4>outputted Word Frequencies Report:</h4><p>,107<br>2017,3<br>年,6<br>中央政府,1<br>工作,27<br>报告,2<br>李克强,1<br>：,2<br>各位,8<br>代表,9<br>，,738<br>现在,2<br>我,2<br>国务院,8<br>向,16<br>大会,1<br>政府,35<br>请予,1<br>审议,2<br>并,4<br>请,1<br>全国政协,1<br>委员,1<br>提出,1<br>意见,4<br>。,543<br>一,8<br>、,350<br>2016,1<br>回顾,1<br>过去,4</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=858713109e5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fullstackwebdevelopers/word-cloud-jieba-generating-fancy-word-cloud-and-word-frequencies-report-858713109e5d">Word Cloud + Jieba = Generating fancy word cloud and word frequencies report</a> was originally published in <a href="https://medium.com/fullstackwebdevelopers">FullStack-Microservices-Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React-Redux Tutorial for beginners 2018 with cutting edge versions of simple examples]]></title>
            <link>https://medium.com/fullstackwebdevelopers/react-redux-tutorial-for-beginners-2018-with-cutting-edge-versions-of-simple-examples-f1b20e93bdf6?source=rss-d968be2bca11------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1b20e93bdf6</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Cody Yang]]></dc:creator>
            <pubDate>Mon, 29 Jan 2018 19:33:15 GMT</pubDate>
            <atom:updated>2018-04-01T17:06:58.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*1p4U99DAhsOHqX-m.jpg" /></figure><p>Original Article at: <a href="https://medium.com/@zhengyang_72813/react-redux-tutorial-for-beginners-2018-with-cutting-edge-versions-of-simple-examples-f1b20e93bdf6">https://medium.com/@zhengyang_72813/react-redux-tutorial-for-beginners-2018-with-cutting-edge-versions-of-simple-examples-f1b20e93bdf6</a></p><p>Recently, a lot of new graduated developers just emailed me and asked about where to start of learning <strong>React-Redux</strong>. They mentioned the difficulty to search a tutorial with simple demo code and explanation, while most of the existing tutorials are focusing on the concepts of Redux, which are very hard to understand as a beginner.</p><p><strong><em>That’s the motivation of this article, to give you an complete structure of React-Redux project with just simple components within it. Easy to understand, expand friendly.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mn4erEgHIsAB1sMay3YQXA.png" /></figure><p>With this tutorial, I’m going to show what React-Redux developers care about and demonstrate how to scaffold a react-redux based project from facebook official <a href="https://github.com/facebook/create-react-app">create-react-app</a>, as well as how to expand it into an React-Redux front-end application.</p><p>You will be afterwards very easy to integrate the front-end app with any type of REST backends(such as express in JS or Pyramid in Python, see more details from the tutorial, <a href="http://www.lokipro.ca/">Create RESTful backend with ExpressJS(Nodejs) in 5 mins</a>)</p><h3>0. Prerequisite</h3><p>Please notice before you start, this article assumes that</p><p>1) You already have the very basic knowledge of Javascript.</p><p>2) You know the concept and workflow of <strong>React</strong>. By the cutting edge of Redux, though this technology is a state management framework that can exist without react, react is still the best library to work with Redux.</p><p>But if you are new to React as well, no worries, here we have another tutorial for React, <a href="http://www.lokipro.ca/">Understanding React from one article, and that’s Enough</a>.</p><h3>1. Getting started</h3><p>Install create-react-app, the Facebook official scaffold, by executing the following commands on your Terminal(for Mac) or Command Line(For Windows). Please note, you will need to use administration privilege to install globally.</p><pre>npm i -g create-react-app</pre><h3>2. Install Dependencies</h3><p>Open the file <strong>package.json</strong> and modify <strong>dependencies </strong>as below, which is to import redux, react-redux, and react-router-dom as we may always need routing on our applications.</p><pre>&quot;dependencies&quot;: {<br>  &quot;react&quot;: &quot;^16.2.0&quot;,<br>  &quot;react-dom&quot;: &quot;^16.2.0&quot;,<br>  &quot;react-redux&quot;: &quot;^5.0.6&quot;,<br>  &quot;react-router-dom&quot;: &quot;^4.2.2&quot;,<br>  &quot;react-scripts&quot;: &quot;1.1.0&quot;,<br>  &quot;redux&quot;: &quot;^3.7.2&quot;,<br>  &quot;redux-form&quot;: &quot;^7.2.1&quot;},</pre><h3>3. Scaffold Project Structure</h3><p>It will become quite straight forward to scaffold the structure and create components once you got familiar with how Redux works for storing states and reflecting changes. See the flow chart of Redux:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*hNhtx3esXMzuZgXy.jpg" /></figure><p>Obviously, the workflow is running with four parts: <strong>Store</strong>, <strong>Actions</strong>, <strong>Components</strong>, <strong>Reducers</strong>, while actually React-Redux separates Components into two parts: <strong>Components </strong>&amp; <strong>Containers </strong>for UI design and functional logic respectively.</p><h4>Actions</h4><p>The transfer unit to pass request and data to store and have relevant states changed afterwards.</p><h4>Store</h4><p>Store is where you store the states, you can understand it as an warehouse. Each app has only one store. So, you can create an empty store.js under src directory. Just leave it empty and we will discuss what to fullfill later.</p><h4>Components</h4><p>The UI template.</p><blockquote>1) Has only UI presentation, no business or functional logic included.</blockquote><blockquote>2) No state, DO NOT use any this.state within Components Instead, all the data is mapped from this.props provided from containers</blockquote><blockquote>3) No Redux API is allowed</blockquote><h4>Containers</h4><p>On the contrary of Components, it is where the states being managed for each components, also providing methods to generate actions.</p><blockquote>1) Data and methods only, NO UI designs</blockquote><blockquote>2) manage states</blockquote><blockquote>3) dispatch actions &amp; mapped states to Components</blockquote><h4>Reducers</h4><p>After receiving an action, Your store need to provide a new set of states to have the new view on the client-side. Reducers play the role to recognize the type of actions and deal with the data, as well as generating the new states. Reducers are the hardest worker, who mostly deserve a huge KPI bonus for attending every piece of work during the whole process. :)</p><p>So, guess now you can just straight forward and create such directories, which are <strong>src/actions</strong>, <strong>src/components</strong>, <strong>src/containers</strong>, <strong>src/reducers</strong>, and don’t forget <strong>store.js</strong>, just like that shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/0*pKIDdgD81wHbST9u.png" /></figure><h3>4. Create reducers and combineReducers</h3><p>For example, we can create a CountReducer which provides action handling methods for dispatchers:</p><p><strong><em>src/reducers/CountReducer.js</em></strong></p><pre>export default function CountReducer(state = {<br>    count: 0,    wish_value: 0,}, action) {<br>    const count = state.count    const wish_value = action.wish_value    switch (action.type) {<br>        case &#39;increase&#39;:<br>            return {count: Number(count) + 1}<br>        case &#39;update&#39;:<br>            return {<br>                count: wish_value,            }<br>        default:<br>            return state<br>    }<br>}</pre><p>From my perspective, it’s always a good way to create an index reducer at src/reducers/index.js with a combineReducers to combine all the reducers within src/reducers folder. Why? You will be able to load all the reducers at once and never change store.js. You can alternatively put combineReducers at store.js, fully up to you.</p><p><strong><em>src/store.js</em></strong></p><pre><strong>const </strong>reducer = combineReducers({<br>    CountReducer<br>});<br><br><strong>const </strong>initialState = {<br>    CountReducer: {count: 123, wish_value: 12}<br>};<br><br><strong>let </strong>store = createStore(reducer, initialState);</pre><h3>5. Create store</h3><p>Create Store and export, which will be imported into &lt;Provider&gt;, at the next step.</p><pre>import {createStore, combineReducers} from &#39;redux&#39;</pre><pre>import CountReducer from &#39;./reducers/CountReducer&#39;</pre><pre>const store = createStore(CountReducer);</pre><pre>export default store;</pre><h3>6. Then go back to finishing src/index.js</h3><p>Define Provider at <strong>src/index.js</strong> with imported store object form store.js.</p><p>I’d extremely love to define BrowserRouter at the top of &lt;App /&gt;, so as to allow us using &lt;Route&gt; anywhere of the containers.</p><pre>ReactDOM.render(<br>    &lt;Provider store={store}&gt;</pre><pre>        &lt;BrowserRouter&gt;</pre><pre>            &lt;App/&gt;</pre><pre>        &lt;/BrowserRouter&gt;</pre><pre>    &lt;/Provider&gt;</pre><pre>, document.getElementById(&#39;root&#39;));</pre><h3>7. Build the first Container</h3><p>Let’s start from <strong>Containers </strong>since containers are the core managers of each components. The design of components will become easier once you have your data and methods defined, doesn’t it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*lUQZCAauMdIsw7r1q-hVcg.png" /></figure><p>There are two redux defined core methods of each container: <strong>mapStateToProps </strong>and <strong>mapDispatchToProps</strong>: among which <strong>mapStateToProps </strong>responsible to load states from store and map them into components’ props, while <strong>mapDispatchToProps </strong>is to send action to reducers.</p><p>You should go ahead and define those at the very first:</p><pre>// Map Redux state to component props</pre><pre>function mapStateToProps(state) {<br>    return {<br>        value: state.count,<br>        wish_value: state.wish_value<br>    }<br>}<br><br>// Map Redux actions to component props<br>function mapDispatchToProps(dispatch) {<br>    return {<br>        onIncreaseClick: () =&gt; dispatch(actions.increaseTodo()),<br>        onUpdateClick: event =&gt; dispatch(actions.updateTodo(event.target.value)),<br>    }<br>}</pre><p>Then connect those two methods to our component:</p><pre>// Connected Component</pre><pre>const VisibleCounter = connect(<br>    mapStateToProps,<br>    mapDispatchToProps<br>)(Counter);</pre><h3>8. Design component: (src/components/Counter.js)</h3><p>Simple and easy component with input text field and button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*UI8vBe8yIlqlET1R3kwMhQ.png" /></figure><pre>export default class Counter extends Component {<br>    render() {<br>        const {value, onIncreaseClick, onUpdateClick} = this.props<br>        return (<br>            &lt;div&gt;<br>                &lt;span&gt;{value}&lt;/span&gt;<br>                &lt;button onClick={onIncreaseClick}&gt;Increase&lt;/button&gt;<br>                &lt;input type=&#39;text&#39; onChange={onUpdateClick}/&gt;<br>            &lt;/div&gt;<br>        )<br>    }<br>}</pre><h3>9. Actions, the bullet of the whole process</h3><p>After finishing all the components, containers, reducers, we need a carrier passed from containers to reducers and let store to change states.</p><p>Here is a sample action: (src/actions/index.js)</p><pre>//Action Creatorexport const increaseTodo = () =&gt; {<br>    return {<br>        type: types.INCREASE_TODO,<br>    }<br>}</pre><pre>export const updateTodo = (wish_value) =&gt; {<br>    return {<br>        type: types.UPDATE_TODO,<br>        wish_value: wish_value,<br>    }<br>}</pre><p>You are all set! Access the root directory through Terminal/Command Line, and run: <strong>npm start</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5JuR9q-hEY6TAhU0SaLilQ.png" /></figure><p>All the code base is available on Github repository:<a href="https://github.com/river7527/React-Redux-Tutorial-for-beginner-2018">https://github.com/river7527/React-Redux-Tutorial-for-beginner-2018</a></p><p>If you like this tutorial, please give me a star, which will motivate me a lot. Thanks.</p><p>River YANG</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1b20e93bdf6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fullstackwebdevelopers/react-redux-tutorial-for-beginners-2018-with-cutting-edge-versions-of-simple-examples-f1b20e93bdf6">React-Redux Tutorial for beginners 2018 with cutting edge versions of simple examples</a> was originally published in <a href="https://medium.com/fullstackwebdevelopers">FullStack-Microservices-Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>