<?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 Electra Chong on Medium]]></title>
        <description><![CDATA[Stories by Electra Chong on Medium]]></description>
        <link>https://medium.com/@electra_chong?source=rss-ea32b0502c1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MYHgC8WPwhr2MwRFj8Pqew.jpeg</url>
            <title>Stories by Electra Chong on Medium</title>
            <link>https://medium.com/@electra_chong?source=rss-ea32b0502c1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 18:15:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@electra_chong/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[What is ‘CORS’? What is it used for?]]></title>
            <link>https://medium.com/@electra_chong/what-is-cors-what-is-it-used-for-308cafa4df1a?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/308cafa4df1a</guid>
            <category><![CDATA[browser-security]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[ajax]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Mon, 18 Sep 2017 03:49:24 GMT</pubDate>
            <atom:updated>2017-10-22T22:32:59.198Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the first features I worked on at my job as a software engineer was to provide support for CORS requests in our product, the <a href="http://www.zenko.io/cloudserver/">Zenko CloudServer</a>. <em>What is CORS? </em>I thought. <em>What is it used for? </em>Before I could start working on this feature, I had to build up a knowledge of what CORS was in the first place.</p><p>“CORS” stands for <strong>C</strong><em>ross</em>-<strong>O</strong><em>rigin</em> <strong>R</strong><em>esource</em> <strong>S</strong><em>haring</em>. It allows you to make requests from one website to another website in the browser, which is normally prohibited by another browser policy called the Same-Origin Policy (SOP).</p><p>Recently, the topic of CORS resurfaced at work, when one of our contractors was having problems making a request to the CloudServer API in a browser. CORS was the answer to this problem, and since it’s a problem that other junior developers may encounter when working with APIs in the browser, I thought I would share what I’ve learned in case it might be helpful. 😊</p><p>Disclaimer: I have gathered the information I’m presenting here from an amalgam of resources already out there on the web (linked at the bottom of this post). Please don’t hesitate to correct or clarify misleading information if you spot a misunderstanding!</p><p><strong>Prerequisite knowledge:<br></strong><a href="http://rve.org.uk/dumprequest">What a HTTP request looks like</a><br><strong>Helpful knowledge:<br></strong><a href="https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started">Javascript and AJAX requests</a><br>Familiarity with APIs</p><h3>To understand CORS, one must understand Same-Origin Policy.</h3><p>At the crux of it, CORS and SOP are both browser policies that have developed in response to issues of browser security and vulnerabilities.</p><p>The specific browser vulnerability that Same Origin Policy is meant to address is called “cross-site request forgery” (CSRF, or alternatively XSRF, don’t you love all these acronyms?).</p><p>Before browsers implemented SOP, malicious websites were able to exploit cookies (see: <a href="http://www.pctools.com/security-news/what-are-browser-cookies/">what are cookies?</a> here) stored by your browser to make unauthorized requests to other domains. Some of these unauthorized requests could do things like make purchases, delete user information, fetch sensitive data, etc. 😱</p><p>As an example, you might go to a banking website and provide some credentials to log into your account. Your username is stored in a secure browser cookie for a certain period of time so the bank can tell you are still logged in instead of having you login another time with each page you access. That’s nice!</p><p>Later on, you go to an innocent-seeming webpage listing some facts about bunnies. Unbeknownst to you, the webpage’s HTML also has a little Javascript script to make an AJAX request (see: <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest">XMLHttpRequest</a>) to the previous banking website to make a wire transaction to another account. Because your session is still authenticated with the cookie that was stored earlier, the banking website thinks it’s just you clicking on a link on their site to submit a wire transaction. Oh no!</p><p>The easy fix was for browsers to detect when a request is made from one website to another and prevent the response from being readable. This is the Same-Origin Policy.</p><h4>Wait a minute, how can I load images from another website on my own then?</h4><p>You might know that loading images from other sites and embedding other content on your webpage requires browsers to send GET requests to fetch data from another web server, and haven’t had any problems doing this.</p><p>Unlike AJAX requests, browsers do allow embedding most content from other websites, such as images, script tags, css, etc, by default. Some possible exceptions are iframes, depending on the site’s configuration, and fonts, depending on the browser.</p><p>This does leave an avenue of attack open for CSRF/XSRF attacks, since you could use an &lt;img src=‘…’/&gt; to make a malicious GET request to another website rather than loading an image. This means servers have to do some additional work on their end to implement security, by using CSRF tokens or transaction tickets, if GET requests can result in any unwanted side effects or revealing confidential information. Read more here: <a href="https://stackoverflow.com/a/29167709">https://stackoverflow.com/a/29167709</a> and <a href="https://stackoverflow.com/a/27294846">https://stackoverflow.com/a/27294846</a> (where CRSF Tokens is bolded).</p><h3>So what if I want to make an AJAX request to an outside API in a browser script?</h3><p>Vice versa, what if you are developing an API and you want to allow people to make AJAX (or newer web APIs like Fetch) requests to your API in the browser? Or more simply, you want to make sure anyone can access a font you are sharing from your website, regardless of their browser?</p><p>At last, we’ve arrived at CORS.</p><p>CORS allows servers to specify certain trusted ‘origins’ they are willing to permit requests from. Origins are defined as the combination of protocol (http or https), host (a domain like <a href="http://www.example.com/">www.example.com</a> or an IP address) and port. Browsers which implement the CORS policy will include a HTTP header called ‘Origin’ in requests made with AJAX, including above information the value.</p><h4>Simple requests</h4><p>To instruct the browser to expose server responses to a HTTP requests from certain origin, the web server must respond to the request with an additional HTTP response header, ‘Access-Control-Allow-Origin: &lt;origin&gt;’. Alternatively, the web server may expose its responses to all origins by specifying a value of ‘*’, e.g. ‘Access-Control-Allow-Origin: *’.</p><p>Simple, huh?</p><h4>Preflight requests</h4><p>This might be sufficient for simple GET, HEAD, or POST requests without any special http headers. However, for DELETE and PUT request, ‘unsafe’ requests which may impact the server’s data, or GET, HEAD and POST requests with customized headers, the browser will send a “preflight” request to find out the CORS result prior to sending the actual request (only if the preflight response determines access is permitted).</p><p>The preflight request is an OPTIONS request made to the same HTTP path as the actual request, with a couple of HTTP headers:</p><ul><li>Origin — The origin header that would be included with the actual request being made by the website.</li><li>Access-Control-Request-Method — The method of the actual request being made by the website.</li><li>Access-Control-Request-Headers — A comma-separated list of headers that would be included in the actual request.</li></ul><p>Web servers that wish to support CORS requests must respond to preflight requests with the following HTTP headers:</p><ul><li>Access-Control-Allow-Origin — The whitelisted origin, or ‘*’</li><li>Access-Control-Allow-Methods — A comma-separated list of HTTP methods the web server wishes to permit for cross-origin requests</li><li>Access-Control-Allow-Headers — A comma-separated list of HTTP headers the web server wishes to permit for cross-origin requests</li></ul><p>If any of the information in the response headers does not match the actual parameters of the request, the browser will not send the actual request, preventing unwanted side-effects from the server receiving the cross-origin request. (After all, including ‘Access-Control-Allow-Origin’ in the response to any of the other requests does not prevent those requests from being made to the server; it only prevents the browser from displaying the response.)</p><p>There are more CORS headers the server may respond with, including ‘Access-Control-Expose-Headers’, ‘Access-Control-Max-Age’, and ‘Access-Control-Allow-Credentials’. Rather than go into too much detail, I would encourage you to take a look at <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS">MDN’s detailed article about CORS</a> (examples of HTTP requests/responses included!) and the meaning of each header.</p><h4>But what if I am using an API, not developing one?</h4><p>You may notice all of the above is related to the response that must be sent from the server side. Typically, your browser or browser SDK will send the Origin request header and create preflight requests for you when you are making an AJAX request.</p><p>Instead, you may need to configure the service you are using to permit your origin, a list of origins, or all origins. As an example, the Zenko CloudServer, which follows Amazon’s S3 Protocol, exposes <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTcors.html">an API method</a> (Put Bucket CORS) you can use to configure a bucket with a CORS configuration with CORS rules which are used to determine server responses to CORS requests. (This is the feature I worked on that I mentioned at the beginning of the article.)</p><p>I might update this article later with a guide to using Put Bucket CORS with Zenko CloudServer in case the examples are helpful, but since this article is targeted at junior developers, I thought it would be most helpful to understand how CORS as a whole works in any case.</p><h3>Conclusion</h3><p>I hope this broad overview helped make CORS make a little more sense than it might have if you dug into the topic without it. Honestly, it is meant more as a primer than a complete resource, and I encourage you to look at the resources listed in “Further Reading” below to finish painting a complete picture of CORS.</p><p>Feel free to leave your feedback as to whether it helped you or if anything could be clarified. In the meantime, this summary by <a href="https://medium.com/u/152f65dab15">Julia Evans</a> may be appropriate:</p><h3>⚡Julia Evans⚡ on Twitter</h3><p>CORS (browser security is confusing!)</p><h3>Further Reading</h3><p><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS">MDN Article on CORS</a><br><a href="https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy">MDN Article on Same-Origin Policy</a><br><a href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing">CORS — Wikipedia</a><br><a href="https://en.wikipedia.org/wiki/Cross-site_request_forgery">Cross-Site Request Forgery — Wikipedia</a><br><a href="https://en.wikipedia.org/wiki/Same-origin_policy">Same-Origin Policy — Wikipedia</a><br><a href="https://stackoverflow.com/questions/29167428/same-origin-policy-and-cors-whats-the-point">same-origin policy and CORS — what’s the point?</a> (StackOverflow)<br><a href="https://stackoverflow.com/questions/14681292/same-origin-policy-and-cors-cross-origin-resource-sharing">Same origin Policy and CORS (Cross-origin resource sharing)</a> (StackOverflow)<br><a href="http://restlet.com/blog/2015/12/15/understanding-and-using-cors/">Understanding and using CORS— Restlet</a><br><a href="https://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/">Cross-domain Ajax with Cross-Origin Resource Sharing — NCZOnline</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=308cafa4df1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[small pink octopus [1/100]]]></title>
            <link>https://medium.com/100-days-of-crochet-maybe-knitting/small-pink-octopus-1-100-2fb3473f1e5f?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fb3473f1e5f</guid>
            <category><![CDATA[amigurumi]]></category>
            <category><![CDATA[100daysproject]]></category>
            <category><![CDATA[octopus]]></category>
            <category><![CDATA[crochet]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Mon, 11 Sep 2017 01:18:52 GMT</pubDate>
            <atom:updated>2017-09-11T01:36:42.778Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s been a while since I crocheted, so I wanted to start off with a small and easy project that I could finish quickly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K8N_gIhdv5yT5kw_AB4zAg.jpeg" /><figcaption>Before the mouth was sewn on.</figcaption></figure><p><a href="http://blog.mohumohu.com/">mohumohu</a> is responsible for the design for this little guy, and you can find the free pattern here: <a href="http://blog.mohumohu.com/post/117524437877/amigurumi-octopus-pattern">http://blog.mohumohu.com/post/117524437877/amigurumi-octopus-pattern</a></p><p>It’s been long enough that I had to look up how to do a magic ring again and invisible decrease. Here’s the video/resources I used:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fp298HxgsO1s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp298HxgsO1s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fp298HxgsO1s%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d068b9e28c446770499f1e1083e99462/href">https://medium.com/media/d068b9e28c446770499f1e1083e99462/href</a></iframe><p>For the invisible decrease, I like Planet June’s helpful guide:<br><a href="https://www.planetjune.com/blog/amigurumi-help/invisible-decrease/">https://www.planetjune.com/blog/amigurumi-help/invisible-decrease/</a></p><p>He’s a cute little bugger and reminds me of the little jelly-fish dolls that are created by Tsukimi and company in <a href="https://en.wikipedia.org/wiki/Princess_Jellyfish"><em>Kuragehime</em></a>. Maybe I’ll do a <a href="http://pin.it/NnAPUIz">jellyfish amigurumi</a> down the line!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBxQ-vJOwqx5F7dT9erLbw.jpeg" /><figcaption>Modeled on my sister’s head (complete with the mouth).</figcaption></figure><p>I pinned some ideas for projects while searching for quick and easy ones, so if you’re interested in what else I might do: <a href="https://www.pinterest.com/electrachong/crochet/">https://www.pinterest.com/electrachong/crochet/</a><br>I’ll likely continue to do small, cute and quick projects for a while before I take up larger projects.</p><p>Some in-progress photos:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VnuNH7tcreeQxuEBpAFCCA.jpeg" /><figcaption>The inside at row 4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2fDbop0go1FeiJtG19duFA.jpeg" /><figcaption>What ends up being the outside at row 4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6bGD_RO4GRYsmXbpxhWDdw.jpeg" /><figcaption>After rows 5–8</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqyvKfjLsqGdIMkJWLparw.jpeg" /><figcaption>Stuffed and with eyes sewn in, before the legs are attached.</figcaption></figure><p>Sorry I’m so lazy to properly resize and color edit the obviously phone-taken photos!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fb3473f1e5f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-crochet-maybe-knitting/small-pink-octopus-1-100-2fb3473f1e5f">small pink octopus [1/100]</a> was originally published in <a href="https://medium.com/100-days-of-crochet-maybe-knitting">100 Days of Crochet (+ maybe knitting)</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[About 100 Days of Crochet (+ maybe knitting)]]></title>
            <link>https://medium.com/100-days-of-crochet-maybe-knitting/about-100-days-of-crochet-maybe-knitting-5a416a481be8?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a416a481be8</guid>
            <category><![CDATA[crochet]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Mon, 11 Sep 2017 00:53:59 GMT</pubDate>
            <atom:updated>2017-09-11T00:53:59.170Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Click here to read about </em><a href="https://medium.com/100-days-of-watercolor-gouache/about-100-days-of-watercolor-gouache-f388dfab9f77">100 Days of Watercolor &amp; Gouache</a><em> and </em><a href="https://medium.com/memory-bank/about-memory-bank-b3843ab35f28">memory bank</a><em>.</em></p><p>As promised, here is 100 Days of Crochet (and maybe knitting if I take it up).</p><p>I started to crochet after I graduated from college. I was lingering on campus because of my post-graduation job in the IT department at my college, and still felt like I could cash in on my student identity since I never left.</p><p>During college, I found it difficult to make time for hobbies and extracurriculars, so although I attended one or two meetings for the college’s charity crochet and knitting club, I didn’t make a habit of it.</p><p>Now that I had time after my set 9–5 schedule, I wanted to try crochet out and see if I could learn to make cute stuffed animals out of yarn (“amigurumi”) that I had seen on the Internet here and there. Luckily, the college club still had all the yarn and tools for me to try it out. ;) (Yes, I crashed my college’s student club after I graduated and was working as college staff.)</p><p>I found that with the help of others to demonstrate it in person, crochet is an easy skill to learn. It was relaxing, didn’t take much thought, and resulted in cute creations like hats or amigurumi that I could gift to friends without spending a lot of money. As you might imagine, it’s a therapeutic hobby.</p><p>I’ve struggled with light-to-moderate depression since towards the end years of high school, and I find that having therapeutic hobbies is a happy solace. There’s just something satisfying about yarn pooling beneath your fingers and transforming into a finished product, just like any creative process which results in something new and of your creation.</p><p>Here’s to relaxing, creative hobbies!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a416a481be8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-crochet-maybe-knitting/about-100-days-of-crochet-maybe-knitting-5a416a481be8">About 100 Days of Crochet (+ maybe knitting)</a> was originally published in <a href="https://medium.com/100-days-of-crochet-maybe-knitting">100 Days of Crochet (+ maybe knitting)</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[cactus [2/100]]]></title>
            <link>https://medium.com/100-days-of-watercolor-gouache/cactus-2-100-308ce25d7dae?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/308ce25d7dae</guid>
            <category><![CDATA[gouache]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[watercolor]]></category>
            <category><![CDATA[100daychallenge]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Fri, 23 Jun 2017 07:41:29 GMT</pubDate>
            <atom:updated>2017-06-23T07:50:01.573Z</atom:updated>
            <content:encoded><![CDATA[<p>Still doing more stuff with wet on wet v. wet on dry technique. Here’s a tutorial I tried out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*6rOnC3HKIJcMuyAVtsQgcA.jpeg" /><figcaption>Here’s a cactus. Sorry for the photo quality, probably not going to improve a lot on that mark.</figcaption></figure><p>Doesn’t look <em>terrible</em>, but you can compare it to the original:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPL2Gy7ohbeND7gmc4-GDDqOFu9SPlcwRj3&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTjLvO87Pqc0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTjLvO87Pqc0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/37826783eb3b68dd4c3cabd0f18b689f/href">https://medium.com/media/37826783eb3b68dd4c3cabd0f18b689f/href</a></iframe><p>Hehe. I think this guy specializes in painting flowers in watercolor with few, precise strokes. You can see him pushing the water around and controlling where the pigment ends up to achieve smooth gradients and subtle shadows.</p><p>One thing that would probably help me to achieve the same outcome is if I had real watercolor paper, because I could work the paint for a lot longer. For now I use nice-quality sketch paper that seems to tolerate water relatively well, but it’s not the same as watercolor paper. While I was adding other leaves to the cactus, the leaves I started with dried up so it wasn’t possible to keep on pushing the pigment and adding more to the base.</p><p>A good exercise would probably be to limit myself to one leaf or shape at a time and see if I can achieve the same sophisticated look with practice.</p><p>Actually, I do have several sheets of watercolor paper, but they’re expensive (like 12 in a single booklet..) so I’m saving them for when I feel confident and can use them to their full potential.</p><p>You can have a sneak peek of what else I started painting here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TclV7jrGlFNmbw9qHnfpQQ.jpeg" /></figure><p>I actually started with the sketch on the left but I accidentally smudged some paint while erasing. The nice thing about gouache (among several other nice things I mentioned in the <a href="https://medium.com/100-days-of-watercolor-gouache/goldfish-gouache-1-100-d04b36f3fdc">previous</a> entry) is that you can reactivate the paint even if it dries with water, so you can smudge away accidental marks. With watercolor, once done is done and will be seen FOREVER. Anyway, I used some water to wipe off the smudges, but it left the paper damp and I had to leave the rest of it to dry before continuing on it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=308ce25d7dae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-watercolor-gouache/cactus-2-100-308ce25d7dae">cactus [2/100]</a> was originally published in <a href="https://medium.com/100-days-of-watercolor-gouache">100 Days of Watercolor &amp; Gouache</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[goldfish (gouache) [1/100]]]></title>
            <link>https://medium.com/100-days-of-watercolor-gouache/goldfish-gouache-1-100-d04b36f3fdc?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d04b36f3fdc</guid>
            <category><![CDATA[gouache]]></category>
            <category><![CDATA[watercolor]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[100daychallenge]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Wed, 21 Jun 2017 07:00:19 GMT</pubDate>
            <atom:updated>2017-06-23T07:17:51.034Z</atom:updated>
            <content:encoded><![CDATA[<p>goldfish (gouache) [1/100]</p><blockquote>Warning! Long exposé on the qualities of watercolors and gouache follows. Wow, how can she go on for so long on such a topic, you’ll think to yourself …</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PC6Nu46SOHcHN1X-OxTYOg.jpeg" /><figcaption>goldfish done with gouache</figcaption></figure><p>To get into watercolors and gouache, I’ve been watching Youtube videos. I found this one really helpful and easy to understand for how to use watercolors (wet on wet v. wet on dry):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1Fgkwcym4j4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1Fgkwcym4j4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1Fgkwcym4j4%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/39616f2d301521613b5d7067e02f5457/href">https://medium.com/media/39616f2d301521613b5d7067e02f5457/href</a></iframe><p>You might not expect it from the product (heh), but I actually took an Illustration class once when I was studying abroad in Florence where the primary medium was watercolor. Our professor was a great fan of the talented children’s book illustrator <a href="http://www.robertoinnocenti.com/">Roberto Innocenti</a>, and she insisted as beginners we try to learn watercolors using his particular, rigorous method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dXIN6kslgDUaNcwxcPzrew.jpeg" /><figcaption>An example of Roberto Innocenti’s watercolor illustrations, for <a href="https://www.amazon.com/Adventures-Pinocchio-Creative-Editions/dp/1568461909">The Adventures of Pinocchio</a></figcaption></figure><p>This method consisted of carefully drawing a bead of water paint from one starting point to fill an entire section using strokes of the same direction, being quick to prevent the water edge being pushed to fill the area from getting too dry before reaching the end. Not to mention being careful to avoid marring precious watercolor paper with damaging oils by not to resting your arm or hand on the paper at any time. :-)</p><p>Essentially, this achieved a flat, uniform wash without ugly stroke marks or patches with visible boundaries, with the idea that once we mastered the fundamentals with discipline, we could progress to blending colors and fancier techniques. As you can imagine, the larger the area to paint with one color, the harder this technique was (you have to paint very rapidly!).</p><p>I was terrible at grasping this technique, probably because I couldn’t figure out that I needed to use more water and maybe a bigger brush to paint without things drying out. My room mate, a graphic design major who was also taking the class and had used watercolors before, witnessed me struggle and told me with mercy that there are different methods of watercolor painting and this method of watercolor is not the only way to learn how to use them.</p><p>In retrospect, I do appreciate the introduction to watercolors that class gave me, because I had no concept of how exacting and demanding watercolor technique can be. I had no concept of technique in watercolor, at all, in fact — think of when you’re a kid in kindergarten, and the teacher pulls out watercolor palettes and just tells you to mix the paint with water and have at the canvas. That was about my knowledge of how to use watercolors.</p><p>I didn’t manage to make anything beautiful with watercolors in that class, but it was my starting point for further exploration in watercolors on my own, so the instructive experience is still very precious to me. I do, however, think that it’s good to allow beginners to enjoy and explore the medium a bit to learn how it feels natural and build an intuition of a medium first (the counterargument of the professor being that it’s bad to allow beginners to learn bad habits), and that’s the approach I take on my own.</p><p>Watercolors are dear to my heart because when you have familiarity with the process behind a medium, you can appreciate the artistry and beauty of a piece all the more. (It’s the same for me for ceramics! All the ubiquitous pottery is more interesting to me for having taken ceramics classes before.) I love how watercolors can be translucent and layered, and mixed together to produce beautiful gradients. Besides, they’re really accessible for a hobbyist in that you just need some quality paper, any cheap watercolor palette, a brush, and some water.</p><p>I was intrigued by gouache because they were a purported close watercolor neighbor, and therefore similarly accessible to me. Gouache is interesting because it has some sort of duality, at least to my perceptions, in that it can be a flat, matte paint that can make opaque layers (covering layers underneath), but it can also be diluted with water to achieve a more watercolor-like effect, with the marbling and translucent qualities.</p><p>I also love the vibrant colors of gouache — they can hold a lot more pigment than watercolors — and gouache dries quickly. It’s a really flexible medium that I’ve enjoyed playing with, and I think the majority of my paintings will be in gouache for this reason. Because of my background with watercolors, I mostly use it like watercolor, but I hope someday in the future to try more vector-like matte paintings and layering.</p><p>For now, the aforementioned video seemed like a good start. My goal was to play with wet on wet and wet on dry techniques, and fancy goldfish seemed like a suitable subject for blending colors. As you can see in the photo, it’s not really clean and there’s some messy details, but maybe if I paint 10 more goldfish, I’ll be able to make some pretty goldfish by the end. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d04b36f3fdc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-watercolor-gouache/goldfish-gouache-1-100-d04b36f3fdc">goldfish (gouache) [1/100]</a> was originally published in <a href="https://medium.com/100-days-of-watercolor-gouache">100 Days of Watercolor &amp; Gouache</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[About 100 Days of Watercolor & Gouache]]></title>
            <link>https://medium.com/100-days-of-watercolor-gouache/about-100-days-of-watercolor-gouache-f388dfab9f77?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f388dfab9f77</guid>
            <category><![CDATA[creativity]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Wed, 21 Jun 2017 05:33:57 GMT</pubDate>
            <atom:updated>2017-06-21T07:21:59.105Z</atom:updated>
            <content:encoded><![CDATA[<p>A few days ago I started “<a href="https://medium.com/memory-bank">memory bank</a>”, a project inspired by Jean Hsu to document 100 of my memories in writing. Her project in turn was inspired by the #<a href="https://thegreatdiscontent.com/100days">100DayProject</a>, which encourages people to perform a creative action every day for 100 days and share their daily progress on social media.</p><p>I’m actually not quite so ambitious myself, and I follow the “every day” part of the directive loosely (read: I don’t follow it). But I do really like the format of this project, especially because lately I’ve been feeling like I have so many creative pursuits that it’s hard to maintain motivation in any of them. Between my watercolor / gouache, crochet, sewing, and more, how do I make progress in any of my hobbies??</p><p>So I decided I’m going to start a 100 Day project for each of my main creative hobbies! This is the first, soon to be followed by 100 Days of Crochet, and when I start my sewing class, 100 Days of Sewing, and who knows, one day there might be 100 Days of Digital Painting and …</p><p>“Wait a minute, Electra,” you say. “Aren’t you getting ahead of yourself? Does it really make sense to start 5 big projects when you just said you had trouble finding focus?!”</p><p>I don’t really want to stop doing any of my creative hobbies; my main goal with the 100 Day Projects is just to keep better track of my progress in each. One hundred is a nice, round number and feels like an attainable benchmark. By tracking my progress in iterations, I feel like I might be able to be more intentional about the way I spend my time and take more enjoyment in the process.</p><p>Medium is a somewhat strange platform to be sharing your art, but I like it because it’s what feels intuitive and natural to me. There’s also a likelihood I’ll write about each of the pieces, more or less like a blog in the absence of having an actual blog hosted on a personal website.</p><p>Stay tuned for 100 Days of Crochet … :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f388dfab9f77" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-watercolor-gouache/about-100-days-of-watercolor-gouache-f388dfab9f77">About 100 Days of Watercolor &amp; Gouache</a> was originally published in <a href="https://medium.com/100-days-of-watercolor-gouache">100 Days of Watercolor &amp; Gouache</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[catfish from the market [1/100]]]></title>
            <link>https://medium.com/memory-bank/catfish-from-the-market-1-100-3ba648ab3420?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ba648ab3420</guid>
            <category><![CDATA[asian-food]]></category>
            <category><![CDATA[childhood-memories]]></category>
            <category><![CDATA[fish]]></category>
            <category><![CDATA[asian-culture]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Sun, 18 Jun 2017 05:54:33 GMT</pubDate>
            <atom:updated>2017-06-18T06:10:43.802Z</atom:updated>
            <content:encoded><![CDATA[<p>Back when we lived in San Jose for a bit when I was around 7 or 8, my mom would sometimes shop at nearby medium-sized Asian markets where they sold fresh fish. I think in that area, they were usually Vietnamese.</p><p>Asian markets are a different breed, or at least the one from my memory was. At the back where they sell the fresh fish, it’s loud with the sounds of the ticket machine printing stubs for people to get their allotted time at the counter, the spray of water hose, and the din of the fish butchers and customers yelling at each other over all the noise.</p><p>These markets have some tanks for live fish, crabs and lobsters (housed separately) to swim around in a crowded tank until the time of their purchase. They also usually had some large sea snails and turtles or frogs.</p><p>Anyway, my mom usually wouldn’t be a patron for the fish in those tanks, I assume because they were larger, whole live pieces and probably more expensive than purchasing the so-called dead fish lying stacked on ice in front of the tank displays. So-called, I say, because there was one time a fish visibly jumped when she prodded it for inspection.</p><p>FYI, my mom is a very hands-on and experienced grocery shopper. She likes to inspect her prospective purchases pick the freshest, or biggest, or heaviest (when it’s price per piece, not per lb) to add to the cart. When it comes to fish, the freshness is the most important. So what she’d do is grab one of the plastic bags for selecting and bagging the fish, place her hand in it, and prod the fish to feel how springy it us, inspect the shine of the skin/scales, turn it over and inspect the eyes to see how dead they look (the least dead, the better).</p><p>The fish that flapped around for a beat or two when she did this was a catfish. She picked it and one other that did the same, and took them home in their plastic bags. Then when she got home, she filled up a little crab-shaped red plastic play pool we had lying around in the backyard with some water from the garden hose and let it sit for some time to let the chlorine dissipate. (I’m not sure how she kept the fish alive during that time).</p><p>When the chlorine had dissipated, she released our two new friends into the crab-shaped pool and we watched them, to our quiet amazement, wriggle a little bit and settle at the bottom of the pool, having apparently survived their ordeal on the fish market.</p><p>They actually lived for several months, according to my mom. I know they lived at least a week or two. We didn’t offer much in the way of food for them (I assume my mom would have probably said something about catfish eating mud if we asked) and the crab pool would get quite murky and dirty over time. Besides, the pool was shallow and it gets pretty hot in San Jose during the summer, although we tried to keep the pool under the shade of the avocado tree.</p><p>For whatever reason it was, they seemed to get more listless and do less well after some time, and it was at this point my mom fished them out to give them their final blow and serve us fish at dinner that night.</p><p>I’m sure my mom would have been happy to keep the catfish for as long as they lived if they could produce baby catfish and end up producing our own little fish farm for us. She’s recounted with some admiration that her own father had something to this effect in her childhood. Alas, it was not to be.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ba648ab3420" width="1" height="1" alt=""><hr><p><a href="https://medium.com/memory-bank/catfish-from-the-market-1-100-3ba648ab3420">catfish from the market [1/100]</a> was originally published in <a href="https://medium.com/memory-bank">memory bank</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[about memory bank]]></title>
            <link>https://medium.com/memory-bank/about-memory-bank-b3843ab35f28?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3843ab35f28</guid>
            <category><![CDATA[memories]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Sun, 18 Jun 2017 04:59:19 GMT</pubDate>
            <atom:updated>2017-06-18T04:59:19.746Z</atom:updated>
            <content:encoded><![CDATA[<p>This project was inspired by Jean Hsu’s <a href="https://medium.com/100-days-of-memories">100 Days of Memories</a> project. If you haven’t checked out her writing, you should! Her stories are funny, endearing and relatable all at the same time.</p><p>Reading about Jean’s memories made me feel an impulse to similarly log down some of my own. Memories are really strange. I feel like the brain is just one big archive which gathers sensory and emotional details during an experience and stashes them away, leaving them to gather dust until you decide you ought to retrieve them.</p><p>Until you remember a memory, it’s almost like you’ve essentially forgotten that experience. And even the act of remembering is so transient. Once you’re done, back into the dusty bins they go, leaving you with only the vaguest wisps of what happened in the past.</p><p>There are so many memories I’d like to retain and cherish after only 20 years of gathering experiences, but they also seem to weigh my mind down like mental clutter. Maybe recording those memories will give them a more permanent form, freeing my brain to make space for new memories. Ha, ha.</p><p>Anyway, my goal is similarly to log at least 100 memories, not necessarily each day or every week, so I felt like following the format of the 100 Days of Memories project would help me keep track of how many memories I’ve written down as I go. Wish me luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3843ab35f28" width="1" height="1" alt=""><hr><p><a href="https://medium.com/memory-bank/about-memory-bank-b3843ab35f28">about memory bank</a> was originally published in <a href="https://medium.com/memory-bank">memory bank</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the difference between a hard link and a symbolic link?]]></title>
            <link>https://medium.com/@electra_chong/what-is-the-difference-between-a-hard-link-and-a-symbolic-link-c4f504731cb7?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4f504731cb7</guid>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[holberton-school]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Mon, 17 Apr 2017 05:24:53 GMT</pubDate>
            <atom:updated>2017-04-17T05:24:53.595Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is the second in a series of posts aimed at beginners for using a shell to navigate their Unix environment. If you are unfamiliar with what a shell is and how it works, check out the first post: </em><a href="https://medium.com/@electra_chong/what-happens-when-you-type-ls-c-and-hit-enter-in-a-shell-387035cef4b0"><em>What happens when you type ls *.c and hit Enter in a shell</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xKDGvK3XDpmkKu78CVYKow.png" /><figcaption>Matcha pudding. Photo credit: <a href="http://www.justonecookbook.com/">Just One Cookbook</a></figcaption></figure><p>Let’s continue our adventures in the shell.</p><p>Let’s pretend you are a fantastic home cook and are building a sweet new website to showcase your latest food blogs and recipes. Every time you make something new, you take multiple photos and store them in a folder, such as home/Documents/Photos/Food Photos/Matcha Pudding/.</p><p>Unfortunately, in order to use these pictures in your website, you need to also have them in your website project folder. You could move them all, but it’s kind of a pain because you like being able to go to your Photos folder and see your food photos along with your travel and family photos, all neatly organized and where you’ve had them all along.</p><p>You could copy them all into a new folder within your website project folder, but that’s also kind of a pain because you already have several gigs of photos in that folder, so it would be a waste of hard disk space, and besides, you’d have to keep both folders updated whenever you add a new photo. That doesn’t seem quite ideal, either.</p><p>Wouldn’t it be great if you could just create a shortcut in your website project folder? A regular shortcut (or Mac alias) won’t work with standard web servers like Apache or nginx. But you can create the system equivalent of a shortcut to a file, using — guess what?? The command line!</p><h3>Symbolic Links</h3><p>The most straightforward way to accomplish our goals might be to create a symbolic link to the Matcha Pudding/ folder in an images/ folder in our web project folder, /var/www. ln is the Bash command you can use to do so (man ln for more information):</p><pre>/ᐠ｡.｡ᐟ\ electra [www] 02:10 PM $ sudo mkdir images/<br>/ᐠ｡.｡ᐟ\ electra [www] 02:10 PM $ sudo ln -s ~/Documents/Photos/&quot;Food Photos&quot;/&quot;Matcha Pudding&quot;/ images/<br>/ᐠ｡.｡ᐟ\ electra [www] 02:10 PM $ cd images/&quot;Matcha Pudding&quot;<br>/ᐠ｡.｡ᐟ\ electra [Matcha Pudding] 02:11 PM $ ls<br>Green-Tea-Pudding-1.jpg<br>Green-Tea-Pudding-10.jpg<br>Green-Tea-Pudding-2.jpg<br>Green-Tea-Pudding-3.jpg<br>Green-Tea-Pudding-4.jpg<br>Green-Tea-Pudding-5.jpg<br>Green-Tea-Pudding-6.jpg<br>Green-Tea-Pudding-7.jpg<br>Green-Tea-Pudding-8.jpg<br>Green-Tea-Pudding-9.jpg<br>Green-Tea-Pudding-Ingredients.jpg<br>Green-Tea-Pudding.jpg<br>/ᐠ｡.｡ᐟ\ electra [Matcha Pudding] 02:11 PM $</pre><blockquote>/ᐠ｡.｡ᐟ\ electra [www] 02:10 PM $ sudo mkdir images/</blockquote><p>First, I made the images/ folder in my website project folder using mkdir. I use sudo to do the operation as the ‘super user’, or root user, because the folder is write-protected.</p><blockquote>/ᐠ｡.｡ᐟ\ electra [www] 02:10 PM $ sudo ln -s ~/Documents/Photos/“Food Photos”/“Matcha Pudding”/ images/</blockquote><p>This is where I create the symbolic link, by specifying the -s option while using ln. The first argument is the source I want to link from, and the second argument is the directory I’d like to place the link.</p><p>The tilde (“~”) in the first argument is a special character that represents the home folder. By the way, I use quote marks for the folders with spaces because if you read the first article in this series, you’d know Bash detects separate arguments by spaces. The quote marks are also special characters that force Bash to ignore the spaces and read the whole path as one long string.</p><p>The -s option stands for ‘symbolic’. We can also make hard links, which we’ll cover in a moment.</p><blockquote>/ᐠ｡.｡ᐟ\ electra [www] 02:10 PM $ cd images/“Matcha Pudding”<br>/ᐠ｡.｡ᐟ\ electra [Matcha Pudding] 02:11 PM $ ls<br>Green-Tea-Pudding-1.jpg<br>Green-Tea-Pudding-10.jpg<br>Green-Tea-Pudding-2.jpg<br>Green-Tea-Pudding-3.jpg<br>[…]<br>/ᐠ｡.｡ᐟ\ electra [Matcha Pudding] 02:11 PM $</blockquote><p>After that, I change directories to the Matcha Pudding link and list the contents — voilà! It’s the same as the home/Documents/Photos/Food Photos/Matcha Pudding/ contents.</p><h4>How it works</h4><p>To understand what’s happening here, it might be helpful to get a larger picture of how data is stored on the system.</p><p>For every file, you have two sets of data: the actual data — the content of the file itself — and metadata, which is information about the file, such as when it was last modified, who created it, the size of the file, etc, as well as the location of the actual data on the disk. On Unix systems, these pieces of metadata are stored separately in what are called ‘inodes’.</p><p>When you list a file, what you are retrieving directory entries. Each of these reference inodes so you can get all the relevant information about the file. A <em>symbolic</em> link, however, is a special file you create that contains in its own inode the path to another file or directory, which Bash can interpret to deliver or allow you to modify the files you want.</p><p>That means the symbolic link does not directly reference the original inode. And <em>that</em> means if you delete or move the file the symbolic link contains the path to, the symbolic link will remain but no longer work. Here’s an example:</p><pre>/ᐠ｡.｡ᐟ\ electra [Matcha Pudding] 03:06 PM $ cd ..<br>/ᐠ｡.｡ᐟ\ electra [images] 03:06 PM $ mv ~/Documents/Photos/&quot;Food Photos&quot;/&quot;Matcha Pudding&quot; ~/Documents/Photos/&quot;Food Photos&quot;/tmp<br>/ᐠ｡.｡ᐟ\ electra [images] 03:06 PM $ ls<br>Matcha Pudding@<br>/ᐠ｡.｡ᐟ\ electra [images] 03:06 PM $ cd Matcha\ Pudding<br>-bash: cd: Matcha Pudding: No such file or directory</pre><p>In the commands above, I move back to the parent directory (cd ..) and then rename the Matcha Pudding/ folder to tmp/ using the mv command. When I try to access the symbolic link again, it tells me the file or directory no longer exists.</p><h3>Hard Links</h3><p>What if I told you there were links that actually reference the inode of a file? These are called hard links, and as you might imagine, you can create them by omitting the -s option.</p><p>Now, let me throw a mental curveball here. Those directory entries I mentioned before? All hard links that serve to link data to a filename in a certain directory. When you create a file, you’re doing a few things: you store the data somewhere on the disk, you create metadata which stores the location of the data and other information in an inode, and you create a hard link to the inode in a certain directory.</p><p>When you create a <em>new </em>hard link using ln, you are not linking to the hard link (what we conventionally think of as the file) you use as the source, but the inode of that hard link. You can delete or move original file you used as the source, and the new link will still be able to access the correct data. (The inode is deleted when all existing hard links to it are deleted).</p><p>In the following, I create a new folder called Matcha Pudding 2/ and create new hard links for all the files currently in tmp/ (what we renamed the actual Matcha Pudding folder to) in the new folder, using a wildcard. I delete the original Green Tea Pudding.jpg using rm but show that we can still access the same data using ls with the new hard link.</p><pre>/ᐠ｡.｡ᐟ\ electra [images] 04:22 PM $ ls<br>Matcha Pudding@<br>/ᐠ｡.｡ᐟ\ electra [images] 04:22 PM $ sudo mkdir &quot;Matcha Pudding 2&quot;<br>/ᐠ｡.｡ᐟ\ electra [images] 04:23 PM $ sudo ln /Users/electra/Documents/Photos/&quot;Food Photos&quot;/tmp/* &quot;Matcha Pudding 2&quot;<br>/ᐠ｡.｡ᐟ\ electra [images] 04:23 PM $ ls &quot;Matcha Pudding 2&quot;<br>Green-Tea-Pudding-1.jpg<br>Green-Tea-Pudding-10.jpg<br>Green-Tea-Pudding-2.jpg<br>Green-Tea-Pudding-3.jpg<br>Green-Tea-Pudding-4.jpg<br>Green-Tea-Pudding-5.jpg<br>Green-Tea-Pudding-6.jpg<br>Green-Tea-Pudding-7.jpg<br>Green-Tea-Pudding-8.jpg<br>Green-Tea-Pudding-9.jpg<br>Green-Tea-Pudding-Ingredients.jpg<br>Green-Tea-Pudding.jpg<br>/ᐠ｡.｡ᐟ\ electra [images] 04:25 PM $ rm ~/Documents/Photos/&quot;Food Photos&quot;/tmp/Green-Tea-Pudding.jpg<br>/ᐠ｡.｡ᐟ\ electra [images] 04:25 PM $ ls -l &quot;Matcha Pudding 2&quot;/Green-Tea-Pudding.jpg<br>-rw-r--r--@ 1 electra  staff    40K Apr 16 13:37 Matcha Pudding 2/Green-Tea-Pudding.jpg<br>/ᐠ｡.｡ᐟ\ electra [images] 04:26 PM $</pre><p>You cannot create hard links to directories, however, so you must weigh which option suits your needs best. 😉</p><h4>Summary</h4><p>When you create a hard link, you essentially create a new file that references the same data as the source, without copying the data to a new location. When you create a symbolic link, you create a link to the <em>filename / path </em>instead. This also means you can create symbolic links to other symbolic links, while all hard links will just reference the original data.</p><p>Further reading:</p><ul><li><a href="http://www.linux-mag.com/id/8658/">What’s an inode?</a></li><li><a href="https://unix.stackexchange.com/questions/22394/why-are-hard-links-to-directories-not-allowed-in-unix-linux">Why are hard links to directories not allowed in Unix?</a></li><li>Original reference: <a href="http://stackoverflow.com/questions/185899/what-is-the-difference-between-a-symbolic-link-and-a-hard-link">StackOverflow</a></li></ul><p><em>Thanks to Nami from Just One Cookbook for permission to use her photo of matcha pudding in this post. Her </em><a href="http://www.justonecookbook.com/green-tea-pudding/"><em>matcha pudding recipe</em></a><em> served as inspiration for this Medium post!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4f504731cb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happens when you type ls *.c and hit Enter in a shell]]></title>
            <link>https://medium.com/@electra_chong/what-happens-when-you-type-ls-c-and-hit-enter-in-a-shell-387035cef4b0?source=rss-ea32b0502c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/387035cef4b0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[holberton-school]]></category>
            <dc:creator><![CDATA[Electra Chong]]></dc:creator>
            <pubDate>Sun, 16 Apr 2017 08:39:37 GMT</pubDate>
            <atom:updated>2017-04-16T08:47:30.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sn1jXQKuatyCO1Mk7fR_Sg.gif" /><figcaption>100% Accurate Depiction Of A Hacker’s Desktop. Original source: <a href="https://www.reddit.com/r/techsupportgore/comments/14j8ai/100_accurate_depiction_of_a_hackers_desktop/">reddit</a></figcaption></figure><p><em>This is the first in a series of two posts aimed at beginners for using a shell to navigate their OS environment.</em></p><h3>What is a shell?</h3><p>(skip this section if desired)</p><p>To start off with, if you don’t know what a shell is, it is an executable program like any other on your computer. On a Mac, you can open a shell by going to Spotlight or your Application folder and searching for ‘Terminal’. You can do the same on a standard flavor of Ubuntu. Windows computers have a different built-in shell program called Powershell, or cmd.exe in older operating systems than Windows 10.</p><p>If you bothered to open a shell just now, you should see a prompt followed by a highlighted cursor (a good hint that you can type something). This is called the command line.</p><p>What does this program do? You might have seen the likes of it on movies or TV shows that feature hackers, like that <a href="https://en.wikipedia.org/wiki/Hackers_(film)">oldschool movie with Angelina Jolie</a> or the more recent show Mr. Robot. You can enter commands on the aptly-named command line which will allow you to navigate your computer’s files and directories, modify them, and display information about and control system resources.</p><p>In other words, you can use the shell to navigate your computer much like graphical interfaces like Finder on Mac OS or Windows Explorer on Windows. (Actually, according to <a href="https://en.wikipedia.org/wiki/Shell_(computing)">Wikipedia</a>, graphical user interfaces are also a kind of shell!) Now — why would you want to do that, instead of just using Finder or Explorer?</p><p>When you become adept as using the command line shell, you will find it’s actually a lot faster to type and read information than it is to click and scroll around to find something you’re looking for. Not only that, you’re very powerful in a shell: you can do much more than looking in directories and opening files with all the built-in commands that are available. If you’re looking to become a developer or software engineer, you will find this is very handy.</p><p>Finally, did you know in the olden days when computers were new inventions, textual interfaces and command lines were the only way of interacting with the operating system? Isn’t it cool to pretend you were one of those early-day users of computers and know how to get around a computer like one of them? If I’m sensing uncertainty from you, that’s OK. <em>I </em>personally think it’s very cool. 😎</p><h4>Let’s talk about an example command, ls.</h4><p>In the rest of this article, we will be covering an example command from <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">Bash</a>, a type of shell built into Unix environments, which is the most commonly-used environment for software development.</p><p>If you’ve worked in a shell in a Unix environment before, you probably know ls is a handy command. You may also be familiar with wildcards (‘*’), and used them to list all the files of a particular type.</p><p>Here’s the files in a sample directory when using ls :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*MEfSl4xcq6cxJ9T4jGbQ4g.png" /></figure><p>When I use ls *.c, I can get all the files that end in the *.c extension (files written in the C language):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*0uxLKiwSylva4CSHYO20OA.png" /></figure><p>If you’re not familiar with these commands, have no fear. We’ll break down what’s happening step-by-step to give a better picture of what the shell does when you type these words. You can also skip to the next section if you are a bit familiar with ls and just want to find out how it works. ;)</p><p>ls is a command that stands for “list directory contents” (abbreviated, “<strong>l</strong>i<strong>s</strong>t”). Let’s take a look at the entry for ls in the Bash manual. You can find this same content by entering man ls in your terminal.</p><blockquote>NAME<br> ls — list directory contents</blockquote><p>So far, so good.</p><blockquote>SYNOPSIS<br> ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file …]</blockquote><p>This gives you information about the usage of the command. The command itself, ls , is followed by the ‘arguments’ or ‘operands’ it takes, meaning the information you can feed to the command for it to work, in the form of words.</p><p>The first set of character in braces are possible options (flags preceded by a dash, such as ls <strong>-a</strong> or ls <strong>-l</strong> or ls <strong>-als</strong> ) you can use. Since we didn’t use any options in our example command ls *.c , we won’t be covering any of them here, but they are all listed in the manual entry if you would like to read about their meanings.</p><p>The second set of characters in braces indicate that you can specify a file, and the ellipses means you can specify more of them, meaning you can list many files, not just one. The braces mean that both operands/arguments, options and the files, are optional.</p><blockquote>DESCRIPTION<br> For each operand that names a file of a type<br> other than directory, ls displays its name as<br> well as any requested, associated information.<br> For each operand that names a file of type direc-<br> tory, ls displays the names of files contained<br> within that directory, as well as any requested,<br> associated information.</blockquote><blockquote>If no operands are given, the contents of the<br> current directory are displayed. If more than<br> one operand is given, non-directory operands are<br> displayed first; directory and non-directory op-<br> erands are sorted separately and in lexicographi-<br> cal order.</blockquote><p>It’s kind of formal language, but if you take the time to read it, I don’t think it should be more difficult to understand than my own writing. Nonetheless, to paraphrase, ls will list the names of any files you specify. If you list any directories, it will list the files within those directories. Finally, it explains the result of our first example where we used ls by itself: if no arguments are given, it will list the files of the current directory (by default, your home folder if you just opened a shell). The listed results are alphabetized.</p><h4>Okay, cool. <strong>But what really happens here??</strong></h4><p>Surely you didn’t think I went through all the trouble of explaining what typing ls does to explain something you could figure out from the first two screenshots. Nah. If you’re going to use a shell, you might as well know how it works.</p><p>I mentioned the term arguments before. Bash detects arguments much the same way you detect separate words: it looks at a string of words and splits them up by the spaces between the words.</p><p>In actuality, ls itself is an argument that we feed to the command line. That means in the example command ls example.txt , there are two arguments:</p><p>ls arg o, and example.txt arg 1 (presumably a file)<br>In the computer field, we start numbering by 0 instead of 1 by convention.</p><p>The first argument, arg 0, is a special argument in Bash. This is a command and must be an executable file. Every time you type a word and hit Enter in bash, you are actually running another program, starting it from the shell. Wow, who knew, right?</p><p>You can find out where this program is located by using the Bash command which (type man which for more information):</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 11:05 PM $ which ls<br>/bin/ls</pre><p>This means “ls” is a file located in a folder named “bin”. “bin” in turn is located in the root folder of your system (which ultimately houses all of your files and folder), symbolized by the leading slash. And of course, which itself is a program:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 11:29 PM $ which which<br>/usr/bin/which</pre><p>These are called absolute paths, because they give the path to the file starting from the root folder, instead of relative to your current directory. An example of the latter would be example.txt, which is interpreted as a file in your current directory (n_trees in the example). An easy way to remember is that absolute paths will start with a /.</p><p>You can run these commands directly by typing the absolute path to the program as the first argument:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 01:36 AM $ /bin/ls /<br>Applications              etc<br>Library                   home<br>Network                   installer.failurerequests<br>System                    net<br>Users                     private<br>Volumes                   sbin<br>bin                       tmp<br>cores                     usr<br>dev                       var<br>/ᐠ｡.｡ᐟ\ electra [n_trees] 01:36 AM $ /bin/ls /bin<br>[          df         launchctl  pwd        tcsh<br>bash       domainname link       rcp        test<br>cat        echo       ln         rm         unlink<br>chmod      ed         ls         rmdir      wait4path<br>cp         expr       mkdir      sh         zsh<br>csh        hostname   mv         sleep<br>date       kill       pax        stty<br>dd         ksh        ps         sync<br>/ᐠ｡.｡ᐟ\ electra [n_trees] 01:36 AM $</pre><p>Which raises the question, how does Bash know where to find the program you are executing if you don’t give it the absolute path? In our case, it’s not like ls is located in the current folder.</p><p>The answer lies in a special environmental variable called PATH .</p><h3>Environmental Variables</h3><p>To sum it up quickly, environmental variables contain information about the environment used by Bash. You can set your own variables, and environmental variables, but that’s a topic for another time (see further reading listed at the bottom).</p><p>You can print environmental variables by using the command env (FMI: man env):</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 11:53 PM $ env<br>SSH_AGENT_PID=49219<br>TERM_PROGRAM=iTerm.app<br>TERM=xterm-256color<br>SHELL=/bin/bash<br>CLICOLOR=1<br>TERM_PROGRAM_VERSION=3.0.14<br>OLDPWD=/Users/electra<br>TERM_SESSION_ID=w0t0p1:D0DCB8B0-9A86-4DA2-AD48-9DD200C6E665<br>USER=electra<br>__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0<br>LSCOLORS=ExFxBxDxCxegedabagacad<br>PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS<br>PWD=/Users/electra/hbtn_repos/holbertonschool-low_level_programming/n_trees<br>LANG=en_US.UTF-8</pre><p>Woah, that’s a lot of information. We’re only concerned about PATH. To print the value of a single variable or environmental variable, you can use the echo command (FMI: … you get the drill) and the dollar sign to invoke the variable:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 11:57 PM $ echo $PATH<br>/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS</pre><p>Notice anything here? The folders where which and ls were located (as well as echo and env if you would like to check) are listed in the value for PATH, separated by colons along with some other absolute paths.</p><p>What Bash does with the first argument you give it, if you do not give it an absolute path, is check in each of the directories listed in PATH to see if it can find an executable file by that name in that folder. If not, it returns this:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 12:07 AM $ sunshinepie<br>-bash: sunshinepie: command not found</pre><p>This means that, even if we moved ls to our current folder from /bin/ls and tried to invoke it using a relative path, we would get this:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 12:07 AM $ ls<br>-bash: ls: command not found</pre><p>That’s because Bash only checks the folders listed in PATH and our current folder, n_trees, is not listed there. But we could <a href="http://www.troubleshooters.com/linux/prepostpath.htm">totally add it</a>. Like I said, I don’t want to stray from the topic too much, so I’ll move on.</p><h3>What about wildcards?</h3><p>The remaining arguments are passed to ls to deal with. But before Bash passes these arguments to the new program, it interprets any special characters.</p><p>The $ is one special character in Bash which translates the names of variables into their values. * is another one. Let’s use the echo command to find out how Bash interprets it:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 01:00 AM $ echo  *<br>a.out free_str_array.o main.c ntree_free.o ntree_insert.c ntree_print.o string_split.o tree.h tree.h.gch</pre><p>These are all the files in our current directory. But as we saw earlier, you can add characters onto the wildcard:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 01:03 AM $ echo *.c<br>main.c ntree_insert.c</pre><p>Bash looks at the files in your current directory and expands the * to match any files which follow the same pattern, where the * can be any set of characters. You can also put characters in front of the *:</p><pre>/ᐠ｡.｡ᐟ\ electra [n_trees] 01:06 AM $ echo m*.c<br>main.c</pre><p>Earlier we saw ls can take multiple arguments, including multiple files. To be honest, Bash doesn’t really care what ls does. ls is the one in charge of taking the arguments that are passed to it, detecting if there are any options and what to do with those, and finding out if the files listed exist in the directory and listing them alphabetically.</p><p>On the other hand, ls does not want to bother figuring out what files match an asterisk and how to separate arguments. That’s Bash’s job, and he, she or they, whichever personification you prefer, comes earlier in the assembly line.</p><p>To summarize:</p><ol><li>We pass a string, “ls *.c” to Bash via the commandline</li><li>Bash reads the string and transforms the special character so the string becomes: “ls main.c ntree_insert.c”</li><li>Bash divides up the arguments by the whitespace into the following list: “ls”, “main.c”, and “ntree_insert.c”</li><li>Bash detects the first argument is not an absolute path, and searches for a file by that name in the paths listed in $PATH</li><li>Bash finds ls in /bin/ and executes the program, passing it the remaining arguments “main.c” and “ntree_insert.c”</li><li>ls takes the remaining arguments and performs special operations to list those files if they exist in the current directory</li><li>Bash prints the prompts and waits for your next command.</li></ol><p>If you think about it, the shell is pretty smart (or dumb, depending on the way you look at it). It doesn’t memorize how to handle all of the possible input you may give it, but delegates the work to programs that it can find when you instruct it to carry out a command. And you, by knowing how it works, can call yourself smart too!</p><p>Further reading:</p><ul><li><a href="http://linuxcommand.org/lc3_lts0080.php">Bash Expansion</a></li><li><a href="http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_02.html">Bash Variables</a></li><li><a href="http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_01.html">Shell Initialization Files</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=387035cef4b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>