<?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 Justin Clark on Medium]]></title>
        <description><![CDATA[Stories by Justin Clark on Medium]]></description>
        <link>https://medium.com/@jpclark6?source=rss-292fe1f2ac39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*rQe2JTP4BnZH1rnYA6NV1Q.jpeg</url>
            <title>Stories by Justin Clark on Medium</title>
            <link>https://medium.com/@jpclark6?source=rss-292fe1f2ac39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 15:48:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jpclark6/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[Develop Denver Day 1]]></title>
            <link>https://medium.com/inside-the-embassy/develop-denver-day-1-88322844f4b5?source=rss-292fe1f2ac39------2</link>
            <guid isPermaLink="false">https://medium.com/p/88322844f4b5</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[develop-denver]]></category>
            <dc:creator><![CDATA[Justin Clark]]></dc:creator>
            <pubDate>Tue, 20 Aug 2019 19:21:36 GMT</pubDate>
            <atom:updated>2019-10-31T19:49:10.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tl990MmJg1dyHijQ5r3ZbQ.jpeg" /></figure><p>Denver’s tech scene has been thriving and growing for years now, and that was mirrored in this year’s Develop Denver conference that was the largest yet, growing 15% over last year. It was a great opportunity for Ambassador to gain knowledge about clever programming solutions, the latest tech trends, topics surrounding the workplace, and the future of tech, both in Denver and as a global industry.</p><p>The conference was held in Denver’s growing RiNo (River North) district, a home of many tech companies. A focus at this year’s conference was to foster community and inclusivity between the attendees by giving plenty of opportunities to speak to other developers and people in the industry. The opening address outlined how inclusion was to be a mindset and a verb, and that the focus should be on inclusion rather than intimacy — branch out and meet new people and invite others into the conversations rather than sticking with those you know. The opening talk also featured keynote speaker Rachel Carlson, CEO and CoFounder of Guild Education outlining why her company chose Denver as their headquarters: the feeling of the city, proximity to nature, and amazing talent pool.</p><p>Some highlights from Day 1 were the talks ‘Logging In: Creating Space for Mental Health in the Workplace’, a round of lightning talks on topics from JavaScript to internet censorship, ‘Cultivating Continuous Learning in your Software Team’, and ‘Beyond the Keg: How to Build and Maintain a Thriving Company Culture’. At Ambassador we have a huge focus on our OUTCARE values so I found the talks on culture especially interesting. One main takeaway was that culture does not equal perks. Perks are nice to have at job but they don’t make you happy to arrive at work every morning. They don’t foster teamwork, fun, or hard work. Culture must be cultivated. This starts by having clear values that are embodied from the top down. New hires can’t come in to the company just because they checked boxes on the job posting. They need to be a good fit in the company. Being a good fit doesn’t have to mean being the same as everyone else either. It can mean filling in gaps in the culture, balancing out the team, or adding to the team in new and unique ways. Instead of finding a good company fit, <em>find a good company addition</em>.</p><p>We were also able to attend a workshop at the conference that focused on communication. The main purpose was to learn to ‘Lock It In’ when having discussions. This means to verify that the other person heard and understood everything you said not by asking questions like “Does that make sense?” but by asking questions like “To check for understanding, can you repeat back what I said to you?” Often times, especially when there is a power difference between positions, people don’t want to say they didn’t understand or didn’t hear everything, and sometimes they may think they understood but they missed some points. However, to state back what was talked about requires understanding. This lets both people know where more clarification is needed which ultimately leads to more productivity, growth in communication, and a more open environment.</p><p>The day finished up with a social gathering where we naturally talked about what we learned with each other — gathering information on talks we hadn’t even attended. Despite being a conference for developers there was a large variety of people and professions that showed up and this gave new perspectives for the topics of the day. Much like the talks discussed throughout the day, providing breakfast and lunch were a nice perk of the conference, but it was the culture, atmosphere, and quality talks that really brought us back for another day.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88322844f4b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/inside-the-embassy/develop-denver-day-1-88322844f4b5">Develop Denver Day 1</a> was originally published in <a href="https://medium.com/inside-the-embassy">Inside the Embassy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to 3D Print Anything]]></title>
            <link>https://medium.com/@jpclark6/how-to-3d-print-anything-caa093f60ce7?source=rss-292fe1f2ac39------2</link>
            <guid isPermaLink="false">https://medium.com/p/caa093f60ce7</guid>
            <category><![CDATA[3d-scanning]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[3d-printing]]></category>
            <dc:creator><![CDATA[Justin Clark]]></dc:creator>
            <pubDate>Sat, 16 Mar 2019 18:19:19 GMT</pubDate>
            <atom:updated>2019-03-16T18:19:19.023Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article I’ll show you how to make a 3D model of anything using just a camera and free software. I’ll go through how to take pictures of the object, how to use free software to create a digital model using the images, and finally how to clean up the scanned model to make a printable .stl file.</p><p>First off begin by downloading the programs I’ll be using — I use <a href="https://www.3dflow.net/3df-zephyr-free/">3DF Zephyr</a> to create the model from the images, and <a href="http://www.meshmixer.com/">Meshmixer</a> to clean up the object. Unfortunately while Meshmixer is available on Windows and macOS, 3DF Zephyr is only available for Windows. It will also process the images faster if you have a graphics card, though it’s not required. Depending on the object and quality, using a graphics card to process the object typically only takes about 5 minutes at standard settings.</p><p>The first step is to take pictures of the object. The free version of 3DF Zephyr allows you to take up to 50 pictures. I’d strongly recommend using all 50 pictures for best results. The more the better. The subject must stay still the whole time, and the scene should have textures and a matte finish. In other words, reflective surfaces won’t work well, and neither will surfaces that are plain and one color. The best objects have rich textures and outlines, such as people, chairs, sculptures, rocks, etc.</p><p>For this example I’ll be using my cat sleeping on a chair. She loves to get into strange positions and I thought it would be fun to have a miniature model of her. It’s a good example of what to do when you don’t have 360 degree access, and also a good example of the type of object that works best — no reflective surfaces and lots of textures.</p><h3>Taking the Pictures</h3><p>To get best results you’ll want to take a lot of overlapping images in sequential order. This allows the software to stitch the images with better results, although technically not required. The more overlap the better results you’ll have. Taking a lot of overlapping images in one direction and then curving around and taking images closer and from a different angle also helps —notice in the following pictures how the later pictures wrap back around and give a different angle. The program can only stitch what it can directly see, so make sure to get all the surfaces you want to reproduce. I can get away without taking pictures of the back of the chair because Meshmixer will fill in any gaps, and on the chair the back side is just a flat surface which works well for filling in, although not nearly perfect. It will take some cleanup. Ideally I’d take pictures of the back of the chair also, but I don’t have access in this picture.</p><p>Here is the full image set I’ll be using.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t6ziW6fLAjL0QK8Bnrgs5g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NjSzmoJ2jvuYlmhT7oMEfg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sRiIqvsaMnL14ubXwdkUKA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rlQtDdP3zf4pN5nefgTWGw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O6y2xguIvoGvgjqKf02dnA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPC1WZ0-BXmQBbnBWsmH3Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*639USERgyusqw2Pbg6LvZQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0aKoY2gNJwVhpJDnOBmn1w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dwKKA00VfqQ7bIEge8rC6Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66ZKvoLIB6DScQC1YxyVmQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LcnhMbuKp0J-km5Pko7XMg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKUjfFh09YvivroKCMYAfw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnEzAeEza_VR9T0ySuBhtg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Bg3zEYRoX9n6q0K6U6RNA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5PVrrSysD0Avz57lQJ5tTQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXVUu5ll9zLNWk2DsnqbYw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOnFsM9t2oXaHrwPhLewAQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YqNqWR5g-I5kkPaozi1rdA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Z-MManPL-ZE_AZRh2btkQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8wBJwpgsdwVJBNctMDyXiQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dchkIVsnrGc7ChEV62WBKQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*neqlLRqtjaMuwwWRoR3s8Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SoVXcoub8I3H-I4pfGwl0A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSpwzW_wc6HI6R1XnapYUQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3kyblYRpFXAoBbPG0AJZew.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GXGCgTUSS8HDzPLP3HR3xA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3zFW_fl2TSuIfzUZU3ESg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nw9DRBUrmJII5TOG59tskw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0qnpIkee76ondtf7ZsosXQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6B255dcl97xbGF8OjLOow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W4kM7M14MZR-5gCWqSpg_g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3SZT3d8S6wGD-NA7zJ-1zA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yFWGG7RveEHFMO9-8RqlCg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mYndPLQSs04iimtGnST1Qg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Ru6KVCv6o6g2-egg4kF4g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xwVtFyGhBWvNi0Gy9vV82Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWaPOUwT5vnMRP7GXpD4pQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSuUHUOAKVDfxRu8qkI5BQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zx8GWgqB3RvBuIqiL68l-A.jpeg" /></figure><h3>Zephyr Environment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtT5UXOneHRndNfXdavWcA.png" /></figure><p>There are tons of options but I have only used a few to make my models so far. To begin on the top toolbar click on ‘Workflow -&gt; New Project’. New Project Wizard will pop up. The first screen defaults work fine, so click next which will bring you to the ‘Add Photos’ screen. Add all of the photos using the ‘+’ button, and then click next.</p><p>The next screen asks for camera settings, but defaults work fine. Click next again.</p><p>The next screen asks for camera orientation. I typically only use ‘Close Range’ or ‘Human Body’ for the category, and either ‘Default’ or ‘Deep’ for the Preset. For this example I’ll use ‘Close Range’ and ‘Default’. Then click next, and then ‘Run’ on the next page. It will now attempt to extract key points to stitch the images together. This took about a minute. Ideally once this is finished you’ll see nothing but green ‘YES’s which means it found how the image fits together in the whole. If too many are red you’ll have to retake the pictures. A few red ‘NO’s are usually okay though.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOQMOe8ltf2sZip2f2ISTw.png" /><figcaption>Fancy Processing Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3QELXyKXzmuI-52JiKdgCQ.png" /><figcaption>Success!</figcaption></figure><p>You can now see a rough 3D image of what it found. The blue camera lenses show all the angles you took the photos. Pretty cool!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*zBhDcZIdgDQ44wJ1E6u2OA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*6Sk4b-vxbd8X4lrQhdQh_w.png" /></figure><p>Now to make it better. Now go back to the top bar and click on ‘Workflow — &gt; Dense Point Cloud Generation…’. This will let us create a high quality dense point cloud which can be used to form the object mesh we need. Defaults usually work fine for this process, although I’m going to use ‘Presets -&gt; High Details’ since I want … well… high details. This is the most lengthy step. Using High Details this step took approximately 17 minutes with a GeForce GTX 1070 graphics card and i7-7700K CPU, but the Default setting is much quicker. I’m not exactly sure how much better High Detail is, but I usually just walk away while it finishes. This is the step that really shows how the final product will be.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*csETa4vgb1K6Cy2gcl6Ing.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*LnyYJqsZp_1h43Rwszxbsw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*obl3kQk-ibGEmLEOT2e7cw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*GFyWbsKXv-JHtPb20HntfA.png" /><figcaption>Pretty amazing quality overall!</figcaption></figure><p>You can also click on the images on the bottom of the screen to see how the software saw the image and how it fits in to the whole.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9IYCv_8IskYsYNQVb-DJQA.png" /><figcaption>Image overlayed on point cloud</figcaption></figure><p>Next step is to go to the top bar and click on Workflow again, and then Mesh Extraction. This will give us our mesh we need. The first page asks for the point cloud to use, default is good since it’s the only one we have. Again on the next step I’ll be using Close Range and High Detail, although Default detail is fine. This step took approximately 5 minutes. Now it’s coming together!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*ijJsIjR3u1YYpmW5a6Ty9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*_OVhFn5qd3d4-GBD5Lrr4w.png" /></figure><p>For the last step in Zephyr we’ll export the mesh. Again click on Workflow at the top, and then Generate and export enhanced mesh… For best results, although intensive in memory and computing, use the following settings, then click next. The more target triangles the better the resolution. If nothing else make sure the export options are set to OBJ:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*mvtfrk8zH27Pk5-ijZXJLg.png" /></figure><p>It’s fine to use lower settings, although as expected, you will lose some detail. At high quality this step took me about a minute. We’re done! — …with Zephyr. Now to clean up the mesh. This is the open ended part that you can spend hours on if you want.</p><h3>Meshmixer</h3><p>Open the created .obj file in Meshmixer. This is where slow computers will have issues. If you are having issues lower the settings on the final mesh generation above and try again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ysO62-mT5h2HUc34PAI-TQ.png" /></figure><p>For those of you who have never used Meshmixer it’s free software that you can use to edit mesh objects, and then export to .stl. There are tons of features, although overall the software is a little clunky but powerful.</p><p>Now we need to delete all of the surfaces we don’t want — all of the surfaces that aren’t the chair or the cat. I find it easiest to select all of the surfaces I DO want, and then hit “i” to inverse the selection, and then hit “Delete” to get rid of everything. This leaves the smallest amount of ‘floating’ surfaces to clean up later. You can do a rough pass first, and then polish it up with a smaller tool. Use “[“ and “]” to make the tool bigger and small, as is common with most editing software. The select tool is on the left bar called appropriately “Select”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z0if-8trgVuzTj1CAFPZDA.png" /><figcaption>Select what you want to keep, then hit ‘i’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fEFuU-EzqEM23cFF-L-Ytg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*OL0o9MtGmWsXYvNf5jjRxg.png" /></figure><p>Now clean up the object removing the extra parts, such as the remaining floor in mine. Select in short pieces. Ctrl Z is your friend!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*9ZcZhEuaPf07oRnghYKx9w.png" /><figcaption>Good enough!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*qDLtOHgcpCzOTocVMClSvA.png" /><figcaption>Back side currently</figcaption></figure><p>Next to make it solid. Click on the left toolbar’s “Analysis” button, and then click on “Inspector”. This will show you all of the holes and floating surfaces. Right now it’s just an infinitely thin surface, but we want it to be one continuous thin surface. Click on all of the floating spheres to clean up each issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*FmIQO4puAdBvJaFntkbbnQ.png" /></figure><p>The hardest to fill will be the back of the chair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*zFdqTP2emNbfgY4FsxY5Lg.png" /><figcaption>One continuous surface</figcaption></figure><p>Now to make it solid. This step is the toughest to get right, and will depend on how good your images are. Ideally it’s just one plane such as the missing bottom or ground. This chair has two surfaces, the back and the bottom, so it won’t be perfect, but we can clean it up later. To do this click on the left toolbar button “Edit”, and then “Make Solid”. The default settings will lose a ton of the detail we got from Zephyr, so move the Solid Accuracy slider to the right to increase quality and decrease triangle size. Do this for the the Mesh Density slider also. This step is CPU intensive. Slow computers may crash, so save often! Keeping the sliders equal seems to work well, and I’m going with 0.052 mm cell size. Hit Update to see the changes. Some detail was lost, but it should be perfectly fine for the size I’m printing it at. If it looks fine, hit Accept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijUI7dAZfm1FbhMkDijLPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*hwLeSKL4qemnhkSjS1cP0Q.png" /></figure><p>This is printable now, although the back side looks bad. The next step is to use the Sculpt tool on the left toolbar to make it look like we want it to. This is a huge tutorial in itself, so I won’t go into the details. <a href="https://www.youtube.com/watch?v=Sy3bz01mN-0">This</a> is one quick tutorial, although <a href="https://www.youtube.com/results?search_query=meshmixer+sculpting+tutorial">many exist on youtube</a> and the web.</p><p>FINALLY we want to create a smooth surface for the bottom to stick to the print bed. Click on the Edit tool on the left toolbar, and then Plane Cut. Adjust the settings until the bottom is fully cut and it’s in the orientation you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*mGSVaTyidkDyMusUgM163A.png" /></figure><p>You’re now finished! To export go to File -&gt; Export, and then make sure it is set to .stl.</p><h3>Printing</h3><p>Open it up in your favorite slicer, and you’re ready to go!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*vyiLjjKhI5hbgYMqIGIpvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*meYzgN3l-HXCDQp1NDCiDA.png" /></figure><h3>Final Product</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DFCApoAQ6tvMqszDQ3EK5A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2N8wBg8l5fcH9uu9JEaeA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AV8K61L-d88B5bTnkye10w.jpeg" /><figcaption>Printed at 0.1 mm layer height. I need to adjust my Y axis belt…</figcaption></figure><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caa093f60ce7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create Self Referential Database Tables with ActiveRecord and Rails 5.2]]></title>
            <link>https://medium.com/@jpclark6/how-to-create-self-referential-database-tables-with-activerecord-and-rails-5-2-9599579a0164?source=rss-292fe1f2ac39------2</link>
            <guid isPermaLink="false">https://medium.com/p/9599579a0164</guid>
            <category><![CDATA[self-referential]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[activerecord]]></category>
            <dc:creator><![CDATA[Justin Clark]]></dc:creator>
            <pubDate>Sun, 24 Feb 2019 18:51:55 GMT</pubDate>
            <atom:updated>2019-02-24T18:51:55.967Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Create Self Referential Database Tables with Active Record and Rails 5.2</h3><p>Recently I had to create a self referential relationship in Rails to describe a user that can have friends that are also users. It was similar to when someone follows someone else on social media in the sense that friending someone didn’t mean the other person was instantly friends with the original requestor. The problem was that I didn’t know how to do that. Given Rails’ convention over configuration mantra I knew it had to have some tricks to it. After looking around online I discovered that all of them were either for previous versions of Rails, didn’t describe what I needed it to do, or just didn’t work for whatever reason.</p><p>I finally played around with it on my own and got it working so I’ll quickly share the steps for how I did it in hopes that it may save someone else some time. For this example I will use a table of users that can be friends with other users. The crux of the problem is that you have a has_many relationship to itself. Ideally you want ‘:user has_many :users’, or more specifically ‘:user has_many :users, through: :user_users’. However this won’t work so we’ll need to use some tricks.</p><ol><li>Create the migrations in the terminal. We’ll assume a simple user with an email and name. Since a friend table doesn’t exist we just need to store a friend_id that we’ll create later</li></ol><pre>&gt; rails g migration CreateUsers email:string name:string</pre><pre>&gt; rails g migration CreateFriendships user:references friend_id:bigint</pre><pre>&gt; rake db:migrate</pre><p>2. Create the models. The main thing here is to create the relationships that will tell Active Record where to point to when we call user.friends on a user in our table. Since a ‘Friend’ table doesn’t actually exist we’re also creating a mock table called friends but telling Active Record it is actually just a user. This is done by giving it the parameter of class_name: ‘User’ when calling it from the user or friendship models.</p><pre># models/user.rb<br>class User &lt; ApplicationRecord<br>  has_many :friendships<br>  has_many :friends, through: :friendships, class_name: &#39;User&#39;<br>end</pre><pre># models/friendship.rb<br>class Friendship &lt; ApplicationRecord<br>  belongs_to :user<br>  belongs_to :friend, class_name: &#39;User&#39;<br>end</pre><pre># models/friend.rb<br>class Friend &lt; ApplicationRecord<br>  has_many :friendships<br>  has_many :users, through: :friendships<br>end</pre><p>3. You’re actually finished now, but I’ll quickly show how you can add a friend and test it out.</p><pre># db/seeds.rb<br>user_1 = User.create(email: &#39;example@gmail.com&#39;, name: &#39;Han Solo&#39;)<br>user_2 = User.create(email: &#39;example_2@gmail.com&#39;, name: &#39;Harry Potter&#39;)<br>user_1.friends &lt;&lt; user_2</pre><pre>In terminal:<br>&gt; rake db:seed<br>&gt; rails c<br>&gt; user_1.friends<br># [user_2]<br>&gt; user_2.friends<br># []</pre><p>Hopefully it works for your use case. Good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9599579a0164" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails Engine Back End API Using RESTful Routing]]></title>
            <link>https://medium.com/@jpclark6/rails-engine-back-end-api-using-restful-routing-c5b8ceca1f78?source=rss-292fe1f2ac39------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5b8ceca1f78</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Justin Clark]]></dc:creator>
            <pubDate>Sun, 27 Jan 2019 19:58:56 GMT</pubDate>
            <atom:updated>2019-01-27T19:58:56.898Z</atom:updated>
            <content:encoded><![CDATA[<p>Rails Engine was a back end API I built in Rails to expose a PostgreSQL database including tables such as customers, merchants, items, and transactions. With over 50 end points it has full access to all categories and relationships in the database, but also full search functionality based on parameters such as ID, created at date, or name, and also statistics such as top merchants by revenue, top items for a merchant, sales by date, and a customer’s top merchant.</p><p>To approach the project organization was key. Having so many routes required careful name spacing and well thought out tests. Here is a sample of the routes:</p><pre>Rails.application.routes.draw do</pre><pre>  namespace :api do</pre><pre>    namespace :v1 do</pre><pre>      namespace :customers do</pre><pre>        get &#39;/&#39;, to: &#39;customers#index&#39;</pre><pre>        get &#39;/find&#39;, to: &#39;find_customers#show&#39;</pre><pre>        get &#39;/find_all&#39;, to: &#39;find_customers#index&#39;</pre><pre>        get &#39;/random&#39;, to: &#39;random#show&#39;</pre><pre>&lt; LOTS MORE&gt;</pre><p>Since this project was based on test driven development, the next challenge was writing good tests that were able to test all the functionality, especially the statistics and relationships. This required many relationships. Instead of starting from scratch for each end point I was able to make a comprehensive list of 3–5 items in each table with varying relationships and then reuse this throughout my entire project. That proved to be very useful and saved a lot of time. The full list of tables included: customers, merchants, items, invoices, invoice items, and transactions. Here’s a short example including customers, merchants, and items:</p><pre>@customer_1 = create(:customer)</pre><pre>@customer_2 = create(:customer)</pre><pre>@customer_3 = create(:customer)</pre><pre>@merchant_1 = create(:merchant)</pre><pre>@merchant_2 = create(:merchant)</pre><pre>@merchant_3 = create(:merchant)</pre><pre>@item_1 = create(:item, merchant: @merchant_1, unit_price: 250)</pre><pre>@item_2 = create(:item, merchant: @merchant_1, unit_price: 1000)</pre><pre>@item_3 = create(:item, merchant: @merchant_2, unit_price: 3000)</pre><pre>@item_4 = create(:item, merchant: @merchant_2, unit_price: 4000)</pre><pre>@item_5 = create(:item, merchant: @merchant_3, unit_price: 5000)</pre><pre>@item_6 = create(:item, merchant: @merchant_3, unit_price: 6000)</pre><p>Another challenge was to design this app using RESTful routing. Given the amount of end points this required over 30 controllers. Each controller only had either #index or #show, depending on whether it was designed to return one element or a list. Here’s an example of the main customers controller:</p><pre>class Api::V1::Customers::CustomersController &lt; ApplicationController</pre><pre>  def index</pre><pre>   render json: CustomerSerializer.new(Customer.all)</pre><pre>  end</pre><pre>  def show</pre><pre>   render json: CustomerSerializer.new(Customer.find(params[:id]))</pre><pre>  end</pre><pre>end</pre><p>Another aspect of this project was that we needed to pass a spec harness that was given to us. This would be very useful such as providing backwards compatibility when designing a new API version. The biggest challenge with this was making sure all the names were correct. The API adhered to the standards at <a href="https://jsonapi.org/">jsonapi.org</a> which meant it needed to include a type. Calling something an ‘item’ versus ‘items’ would fail the spec harness, so attention to details and reading through the tests in the spec harness was important.</p><p>The statistics sections were a fun aspect that used ActiveRecord to help with database queries. After a ton of practice I finally feel pretty good using SQL and ActiveRecord. Here’s an example request for finding the top merchants by revenue, access point: /api/v1/merchants/most_revenue?quantity=3</p><pre>def self.top_revenue(quantity)</pre><pre>  Merchant.select(&#39;merchants.*, sum(invoice_items.unit_price *      invoice_items.quantity) as revenue&#39;)</pre><pre>    .joins(invoices: :invoice_items)</pre><pre>    .joins(invoices: :transactions)</pre><pre>    .where(transactions: {result: 0})</pre><pre>    .group(:id)</pre><pre>    .order(&quot;revenue desc&quot;)</pre><pre>    .limit(quantity)</pre><pre>end</pre><p>After building this API some of my main takeaways are that through RESTful naming conventions make projects easier to organize, and many controllers is better than packed, non-RESTful controllers both when creating the project, but more importantly when looking back and trying to figure out which controller does what. Having a customers/favorite_merchant_controller makes it very obvious what that controller does. If I were to do the project over I don’t think I would change very much. I’m happy with how it turned out.</p><p>As for next steps, I’d like to host the app to get it live and for everyone to use. The next step would be to build a front end to see the results of calls to the API, or if I can find a lot of time, build a nice looking front end to really use the data in a practical use, and allow for data entry into the database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5b8ceca1f78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Campfires Per Airplane —]]></title>
            <link>https://medium.com/@jpclark6/campfires-per-airplane-b35003e0f615?source=rss-292fe1f2ac39------2</link>
            <guid isPermaLink="false">https://medium.com/p/b35003e0f615</guid>
            <category><![CDATA[bizarre-units]]></category>
            <category><![CDATA[aviation]]></category>
            <category><![CDATA[campfire]]></category>
            <dc:creator><![CDATA[Justin Clark]]></dc:creator>
            <pubDate>Sun, 27 Jan 2019 17:47:39 GMT</pubDate>
            <atom:updated>2019-01-27T17:47:39.768Z</atom:updated>
            <content:encoded><![CDATA[<h3>Campfires Per Airplane</h3><p>Airplanes are wondrous machines, both in their simplicity and their complexity. Take a hollow cylindrical shell, slap on some wings and some engines, throw in some fuel and a runway, and suddenly you’re 6 miles in the air going to your destination at a comfortable 550 mph with a smooth enough ride that they serve you drinks in an open container. Of course with 115 years of additional engineering since the first flight airplanes have grown in complexity, but the concepts are mainly unchanged. One huge advancement in the field of aeronautics was the invention of the jet engine, making its first flight in 1941. Similar to the airplane itself, the jet engine is an engineering feat from the compressor blades to how to cool the engine, but the concept itself is fairly simple. Compress air as it enters the engine, add fuel and combustion in the middle of the engine, and then harness some of the energy to maintain the process as the air heats and expands, and use some energy to provide work for your system. In terms of an airplane this means forward motion.</p><p>I imagine anyone who has flown on a plane can appreciate the raw power you feel on takeoff as the pilot opens up the throttle and you’re pressed into the back of your seat. And then again as the plane leaves the ground and feels like it’s pointing straight up into the sky.</p><p>During a recent summer camping trip I was standing around a campfire on a chilly night and enjoying the warmth of a campfire. There may have been a plane flying overhead, or maybe my thoughts were just wandering, but I started thinking about planes and the energy they must need in order to fly. A campfire seemed like the perfect ‘unit’ of power to put it into a human perspective. So that’s what I’ll outline below.</p><p>Quick warning, this is number and unit heavy analysis that is meant more as a fun back of the envelope calculation. Another reason I wanted to explore this further is because I can hear how many gallons of fuel will be burned during a flight, but what would the answer really tell me? Spoiler, a 737 can hold about 7,000 gallons of fuel. Can you picture what 7,000 gallons of fuel looks like? What about the flames produced with that much fuel being burned? The question I want to answer is how many campfire units of power are produced every time I take a flight?</p><p>For a quick refresher: energy does not rely on time. 10 calories is 10 calories. Power is energy per time. In other words, 10 calories expended in 1 second is producing 10 times more power than 10 calories expended in 10 seconds. The total energy is the same, but the power is different. I wanted to compare the power of a campfire (the energy being produced each second) to the power of an airplane (the energy both engines are producing each second). By comparing the two values, the time unit cancels out and I should be able to find: `1 plane flying = _x_ many campfires burning` I imagined this would be a large number, so I wanted to find how many campfires would I be responsible for on a flight? In other words, _x_ many total campfires divided by the number of people on the plane.</p><p>It seemed like an easy path of logic to find the answer — find gallons of fuel burned per second on a flight, convert this to a weight, find out the power equivalent (in watts), divide that by the number of people on the flight, and then compare it to the weight of wood being burned as well as the energy density of wood (again to find watts) as the fire rages on. Unfortunately there are a large number of variables involved in each of these calculations. The universe knows the answer, but I’ll have to settle for a rough estimate. Some variables included in the calculations are whether there is a headwind. How big of a campfire are we talking about? Who’s flying the plane? How many people are on the flight? How heavy is their luggage? How warm is the atmosphere? So here’s the back of the envelop calculation, but first the assumptions.</p><p>I decided to make a Boeing 737 the plane of choice since this is the plane I’ve travelled on most while flying around the USA. A rough estimate I found from a pilot testimony is that the plane will burn roughly 5000 lbs of fuel per each hour of flight [<a href="https://www.usatoday.com/story/travel/columnist/cox/2014/10/12/boeing-737/17036931/">https://www.usatoday.com/story/travel/columnist/cox/2014/10/12/boeing-737/17036931/</a>]. Wikipedia states the newer 737’s hold about 7,000 gallons of fuel [<a href="https://en.wikipedia.org/wiki/Boeing_737">https://en.wikipedia.org/wiki/Boeing_737</a>] and at 6.7 pounds per gallon of fuel [<a href="http://mye6b.com/Fuel/">http://mye6b.com/Fuel/</a>], that would give each 737 about 9 hrs of flight. Seems at least within the right ballpark of truth, and plenty of fuel to fly from coast to coast.</p><p>By dividing the 5,000 pounds per hour of fuel consumption by 6.7 pounds per gallon, an airplane burns about 750 gallons of fuel each hour, or roughly (assuming 500 mph) 0.7 mpg. Not so bad for a 150,000 pound flying machine carrying over 120 people. This aligns nicely with some un-cited wikipedia figures talking about 80 mpg per person on a flight.</p><p>Since a gallon of fuel contains roughly 120,000 kJ of energy [<a href="https://afdc.energy.gov/fuels/fuel_comparison_chart.pdf">https://afdc.energy.gov/fuels/fuel_comparison_chart.pdf</a>], that means the plane burns about 100 gigajoules of energy each hour producing 29 megawatts. Part 1 complete. A flying plane needs roughly 29 megawatts of power to fly. Roughly equivalent to 2,900 microwaves turned on, or about 20 per person. But this isn’t about microwaves per airplane, it’s fires per airplane.</p><p>To the campfire. Campfires can vary in size by a lot, but I found that a normal campfire produces about 8 kW of energy. This one’s harder to verify, but could I imagine that a fire is roughly equivalent to 8 space heaters (often about 1 kW)? Yes, it seems like a ballpark figure. One large variable I discovered was the water content of the wood will largely affect how ‘warm’ the fire feels and how large it seems to be. Each bit of steam produced by the fire takes a lot of energy to turn water in to steam, essentially wasted energy. I’ll go with it though. This one required the most amount of guessing. I found plenty of figures describing how much energy is held in wood, but could not find anyone who has actually measured how much lighter (weight, not brightness) a fire gets during its burn, since this is required to figure out how much fuel is actually burning. The best I could find is a very rough estimate, and unfortunately based on an analysis from stack exchange [<a href="https://physics.stackexchange.com/questions/194367/how-big-is-a-1kw-fire">https://physics.stackexchange.com/questions/194367/how-big-is-a-1kw-fire</a>]. Doing the math this puts an airplane at about 3,683 campfires burning during the entire flight, or about 20 campfires for any given person. Given all the assumptions I’ve had to make, I think a range between 15–25 campfires seems reasonable.</p><p>So next time you’re on a flight, imagine yourself and everyone around you each being surrounded by 20 campfires, and that’s roughly the amount of power contained in the engines getting you to your destination. It’s amazing the amount of power we’re able to harness: that a relatively small amount of metal can contain the power of almost 2000 campfires, and then convert it to forward motion (although only about 50% is converted in to work). For another rough estimate, that’s about 8000 sq ft of campfire per engine, or about 3x the floor space of an average American home, all burning and producing huge amounts of energy.</p><p>Some other silly conversions: <br>For individual passenger equivalents:<br>- 2,000 candles<br>- 3/4 of a soda can of fuel burned per minute of travel<br>- 3/4 of a shot glass of fuel burned per mile of travel<br>For the whole plane:<br>- 1 keg worth of fuel burned each minute of flight</p><p>For a rough comparison, at 60 mph a car that gets 30 mpg will burn through about 1/3 of a soda can of fuel per minute, or 2/3 of a soda can of fuel per mile. In this scenario 2 people in the car will burn more fuel for a trip than if they were flying, but 3 people will burn less fuel than if they were flying.</p><p>Thanks for reading if you made it through. I always find it interesting to try and put different, seemingly unrelated comparisons together, but it helps me to understand large numbers intuitively rather than as numbers on a spreadsheet. I hope you found it interesting too!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b35003e0f615" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Github Lessons Learned]]></title>
            <link>https://medium.com/@jpclark6/github-lessons-learned-7ca0545700e4?source=rss-292fe1f2ac39------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ca0545700e4</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Justin Clark]]></dc:creator>
            <pubDate>Mon, 21 Jan 2019 00:31:58 GMT</pubDate>
            <atom:updated>2019-01-21T00:31:58.160Z</atom:updated>
            <content:encoded><![CDATA[<p>Here at my halfway point through the backend engineering program at Turing, one hugely beneficial aspects of the curriculum has been how to program with a team. There are plenty of resources all across the internet about how to start rails apps, learn javascript, make websites look professional with CSS, or even how to work on a programming team, but one benefit of having a school to go to every day has been the hands on learning experience of working with other people on the same coding project. It’s one thing to read and hear about it, but being able to make and learn from mistakes is the best way to have it really sink in. The main tools we use for projects are Git and Github.</p><p>Any command for Git is easily accessible on the internet so I won’t be going in to the details on commands. Some good cheatsheets can be found <a href="https://education.github.com/git-cheat-sheet-education.pdf">here</a> or <a href="http://files.zeroturnaround.com/pdf/zt_git_cheat_sheet.pdf">here</a>. Our first paired project was to create a Battleship game. While our instructors tried their best to teach us good practices (and were very effective overall), some mistakes need to be made to let them really sink in. We were constantly creating new branch names with nondescript names such as jc_1, jc_2, or even jc_3. I didn’t realize at the time how naming branches effectively can be a huge boon to productivity, especially if you run in to problems later on and need to revert to a previous branch. Each day we’d make pull requests to the master branch so that we could work on the same code, sometimes without all of our tests even passing.</p><p>Fast forward two months to a group project to build a mock commerce site Rails app with 5 people and we were now seeing the power and simplicity of organized, thoughtful Git structure. Our repository was much more readable, but we were also able to work more efficiently and effectively as a team. Code reviews were much easier when you knew exactly what you were looking for due to a nicely named branch with descriptive commit messages. Here are some of the main lessons I’ve learned so far:</p><ol><li>Never work on the master branch. We were taught this from our first project onward, but it’s one you have to be mindful of in order to change branches again anytime you pull from master. Text editors usually show you what branch you’re on, but the easiest way I’ve avoided this problem is to have my branch name in my command line. Add this to your bash profile to list your current directory and git branch:</li></ol><pre>export PS1=&quot;\\w:\$(git branch 2&gt;/dev/null | grep ‘^*’ | colrm 1 2)\$ &quot;</pre><p>2. Make descriptive branch names and commit messages. In other words, make what you say matter. This is an easy one that just takes a small amount of effort. Not only will it help when other people are merging your branch to know what they’re merging, but it will also help if you ever run in to problems and need to revert some code. It’s much easier to know where you added that new functionality when the branch is named ‘new_functionality’ than ‘jc_4’.</p><p>3. Don’t be afraid to merge to branches other than master. Originally we’d work on a branch, and then merge to master. Work on a branch, and then merge to master. But on our last project with more moving parts, sometimes we’ll split up user stories between people and will just merge on to other branches while we finished a story. This seems a bit like common sense, but mainly the reason we didn’t do this on our first project was a lack of knowledge that you could do this (git fetch and merge), and also lack of experience about how nice it is to always have a working master branch, which leads to number four.</p><p>4. Only merge to master if all tests are passing and the code runs smoothly. This is crucial for agile practices. Always have a working product on master. This also helps for impromptu reviews to be able to switch to a working copy at any time.</p><p>5. Delete unused branches. This one is up for debate, but I personally find it much easier to navigate the branches and merge branches when I am not going through a giant list of branches that are available. Everything is saved in the Git history so none of the information is lost, so this is more of a house-keeping item.</p><p>6. TBD — learning is a process, and I’ll always be open to better ways to do something. To act like this is a complete list would be ludicrous. There’s always ways to improve!</p><p>This is far from a complete list of best Git practices and in a year, after working in the industry for a while, I’ll most likely change a few things and add some new items. For now it’s a big step up from where I started, and working on a team has become a lot easier because of it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ca0545700e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laugh Tracks Project]]></title>
            <link>https://medium.com/@jpclark6/laugh-tracks-project-1f5969457a39?source=rss-292fe1f2ac39------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f5969457a39</guid>
            <category><![CDATA[sinatra]]></category>
            <category><![CDATA[laugh-track]]></category>
            <dc:creator><![CDATA[Justin Clark]]></dc:creator>
            <pubDate>Mon, 03 Dec 2018 18:32:10 GMT</pubDate>
            <atom:updated>2019-01-07T23:28:48.171Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating Laugh Tracks To Learn</h3><p>Laugh Tracks was a one-week Sinatra based project I completed as a pre-introduction to Ruby on Rails. The functional goal of the project was to create a dynamic website that can display information about comedians and their specials. This included an index page of comedians with some specials they’ve done, including thumbnail images, lengths of each special, some calculated statistics about all comedians done at the database level, and functionality to add and delete comedians. It also included show pages for each comedian with larger images of each special, and additional stats for the individual comedian. Some of the learning goals were to implement a basic MVC structure, start learning the testing framework <a href="http://rspec.info/">RSpec</a> (after using <a href="https://github.com/seattlerb/minitest">MiniTest</a> up to this point), begin learning <a href="https://guides.rubyonrails.org/active_record_basics.html">ActiveRecord</a> (a Ruby ORM framework), and begin learning the basics of HTML and CSS. To see a copy of my repo with the full disclosure that it was an introductory project, see it <a href="https://github.com/jpclark6/LaughTracks">here</a>.</p><p>This project was approached with an always moving methodology. Since we received the project before we had gone over everything in class required for the project, it was a constant navigation of trying to complete parts of the site that I felt comfortable with, and then purposely putting off other parts that we hadn’t covered yet. This worked out in the long run since I didn’t have to redo any large part of the site after learning something vital. The main flow was to setup the basic MVC framework, setup the database, setup the models, setup the controller, and then start working on views. And then refactor, refactor, and then some more refactoring.</p><p>The most challenging part of the project for me was understanding how it should all be setup and how the MVC pieces should work together. I knew how to get it working but there are a lot of ways to get a working website even though they may not be correct. It mainly came down to what code went into what part of the project. I eventually got all of the database calls out of views which took the longest because it changed how I had to set up my HTML but is a vital part of the MVC structure. Another challenging part of the project was getting the image paths to work. I had a few coming off the internet and a few coming from the local images folder, but as soon as I got off of the main ‘/comedians’ page it would break one or the other. By making them all local I was able to solve this problem.</p><p>The thing I enjoyed most about this project was seeing how the Ruby code could dynamically change the HTML using embedded Ruby. It was interesting to see Ruby running in the background and interacting with the HTML that was displayed. Compared to the projects from the first 6 weeks of Turing that would run in the terminal window, this was a drastically different way to use the language. I also enjoyed the CSS styling. It was a nice switch up from the Ruby logic, and there was the instant gratification aspect as well from changing a small line of code and being able to visually see the difference. This project also presented a great learning opportunity to use the dev tools in chrome to style the page, which helped a lot, especially on pixel dimensions and figuring out which div to put a style on.</p><p>Here are a couple code snippets:</p><p>Controller —</p><pre>get ‘/comedians’ do<br> <a href="http://twitter.com/comedians">@comedians</a> = Comedian.sort(params)<br> <a href="http://twitter.com/all_specials">@all_specials</a> = Special.tot_specials(params[:age])<br> <a href="http://twitter.com/ave_special_length">@ave_special_length</a> = Special.average_length(params[:age])<br> <a href="http://twitter.com/all_cities">@all_cities</a> = Comedian.cities(params[:age])<br> erb :index<br>end</pre><p>Model:</p><pre>def self.sort(params)<br>    if params[:age]<br>      comedians = where(&quot;age = #{params[:age]}&quot;).order(&quot;last_name asc, first_name asc&quot;)<br>    elsif params[:sort]<br>      comedians = Comedian.all.order(&quot;#{params[:sort]}, last_name asc, first_name asc&quot;)<br>      if params[:sort] == &quot;name&quot;<br>        comedians = Comedian.all.order(&quot;last_name asc, first_name asc&quot;)<br>      end<br>    else<br>      comedians = Comedian.all<br>    end<br>    comedians<br>  end</pre><p>If I could go back and do this project over I would plan out my sorting algorithms first before I started any HTML. This would get rid of some of the patching I had to do to get it to all work out with layout and the stats. I would also plan out my HTML classes and ID’s better so that I could use the same .css stylesheet easier. I am using the same stylesheet for everything right now, but each page basically has its own layout inside of the stylesheet. With better naming I think I could have reused a lot more parts of the css. Doing the css was a lot of trial and error so my css sheet is also fairly unorganized, which I would fix. Grouping things together if they’re on the same page would make things easier so I’m not having to look over my css every time I want to add a new style to some class or ID I already have defined.</p><p>Overall the project went well. I was happy with how it all turned out, and I am excited that this is what we’re doing during the first week of mod 2 (overall week 7). I’m excited to see where we’ll be at the end of this mod and beyond.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f5969457a39" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>