<?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 Paul Bailey on Medium]]></title>
        <description><![CDATA[Stories by Paul Bailey on Medium]]></description>
        <link>https://medium.com/@pizzapanther?source=rss-3dc4df28f62b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hCcn_Afn4IlNtOg9.png</url>
            <title>Stories by Paul Bailey on Medium</title>
            <link>https://medium.com/@pizzapanther?source=rss-3dc4df28f62b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 14:27:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pizzapanther/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[Did the Supreme Court Just Protect Racism By Individuals?]]></title>
            <link>https://medium.com/@pizzapanther/did-the-supreme-court-just-protect-racism-by-individuals-241c6c76015d?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/241c6c76015d</guid>
            <category><![CDATA[racism]]></category>
            <category><![CDATA[sexism]]></category>
            <category><![CDATA[supreme-court]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 15:32:14 GMT</pubDate>
            <atom:updated>2020-06-17T18:47:49.080Z</atom:updated>
            <content:encoded><![CDATA[<p>This past week the Supreme Court decided upon a consolidation of three cases on the rights of LGBTQ individuals in the workplace. The decision affirms that employers can not discriminate on the basis of sexuality or gender identity. And as usual those on the left announced victory and those on the right cried overreach of the government. And for both groups what was most surprising is that this decision was spear headed by Trump’s own conservative pick, Neil Gorsuch. How did this happen? Maybe there is more to this decision than a straight liberal vs conservative narrative. When thinking more about this decision, I think it could have unintended consequences that each side may dislike.</p><p>The cases center around Title VII of the Civil Rights Act of 1964 which protects employees against discrimination based on race, color, national origin, sex, and religion. Obviously, at the time gender identity wasn’t on the minds of the law makers and not explicitly written into the law. However, the majority opinion of the court is that this was implied. The argument goes like this. Say you have a woman and a gay man. The woman is straight and married to a man and the gay man is married to a man also. Let’s say the gay man is fired because he is gay. This is discrimination based on sex because you have a woman that has done the same thing and she was not fired. So the firing decision was based on the sex of the individual thus it is discrimination.</p><p>From a liberal point of view, this sounds great. Why should an employer have the ability to base decisions on your sexual orientation. However, that logic is only half truth. Sure the decision is based on sex, but it is also based on actions of the individual. Before this, the Civil Rights Act prohibited discrimination based on only attributes and not actions by the individual. So while this decision effectively protects you against ill intention employers, it opens up the employees to not be judged on many actions that could be considered sexist or racists. So essentially it protects you against racist sexist companies while simultaneous allowing racist sexist behaviors in individuals.</p><p>Let’s say you have two individuals at a fast food restaurant, a white person and a black person. Both like to use the N-word loudly when greeting their black friends. As a business owner you don’t want customers to get the wrong idea when a white person says the N-word. According to the logic above, this use of the N-word is alright and not a fireable offense because if you did fire the white person you would be firing him based on his race. Most of us would agree using the N-word is acceptable for the black person but not the white person. You could argue that using the N-word is not right for any of the workers. But that is sort of the point. With this logic, the only fireable offenses are those which are universally bad. You can’t have something that is bad for one individual and not another based on sex or race. Race and sex have essentially been thrown out of the context of any individual action.</p><p>Let’s take another example. The woman who was just fired for calling the police on a black bird watcher challenging her in the park about her unleashed dog. The employer essentially fired her because she is a white woman. If she was a black man would she have gotten fired? According to the new interpretation of the law, I think she has a case to sue. If she were a black man, the whole incident is a misunderstanding and not that awful. But if she is a white woman than it has much more impact. But now because of this new interpretation an employer can not base it’s decision on the more impactful and reality based version.</p><p>I’m not a law expert or even a law novice but I think the supreme court just opened the door for individuals to express bad behaviors with no consequences from their employers. In the long run this has much worse implications for both sides. For conservatives you can’t hire or fire people based on values that apply to sex. For the liberals you can’t hire or fire based on racism because then you are judging based on race. Please comment if you have more insights because it kind of sounds awful no matter which side your on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=241c6c76015d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tools for Writing Python CLI Applications]]></title>
            <link>https://medium.com/hackernoon/tools-for-writing-python-cli-applications-ba52db1e454f?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba52db1e454f</guid>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-cli-applications]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Sun, 20 Jan 2019 16:00:28 GMT</pubDate>
            <atom:updated>2019-03-26T20:59:17.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*QHHPIbdEoG6iXqy1U_YUQg.gif" /></figure><p>If you’re a Python developer you have probably used many command line tools and maybe even had to write a few yourself. Writing CLI tools can be anywhere from really fun to really frustrating. Here are a few of my favorite tools that can help you write a command line applications in Python. Every project has different goals and requirements, so there isn’t one clear winner. However, hopefully this guide will help you choose one that fits your needs.</p><h3>argparse</h3><p><a href="https://docs.python.org/3/library/argparse.html">argparse</a> is part of the standard library and gives you a way to parse command-line options, arguments, and sub-commands. For me argparse is a little more on the frustrating end of the spectrum of development. However, argparse is much improved over older standard library options, and since it is part of the standard library it’s always there with no extra installation needed. If you are looking to not include many dependencies in your code, or you have few very options to parse, then argparse is a good choice. Also since it is part of the Python standard library you will probably run into this module sometime in your career. So it won’t hurt to get familiar with argparse.</p><h3>click</h3><p><a href="https://click.palletsprojects.com/">click</a> sells itself as the “Command Line Interface Creation Kit” and it definitely lives up to it. I find click to be less frustrating to use than argparse but in addition to ease of use, it includes many more tools. So while it is easier in the beginning of using it, it is paradoxically harder to learn because of it’s sheer size. If you want to build an advanced CLI application, click probably has a feature to help you. It includes tools like confirmation prompts, password prompts, variables parsed from the Environment and command line, printing in color, paging support, waiting for a keypress, and more. click is a really great tool to write beautiful and advanced CLI applications.</p><h3>fire</h3><p><a href="https://github.com/google/python-fire">fire</a> is the newest of these three modules and fills a great sweet spot for writing CLI applications. fire helps you write CLI applications with the fewest lines of extra code. With argparse and click you end up writing many lines to configure and document your application. fire on the other hand will take any existing Python code you have and make it a command line tool. It auto documents the tool based on function or class inputs.</p><p>I find fire extremely awesome for taking existing code and making it into a CLI tool. Also if you start off with fire, I find it forces you into a good architectural style so your code can be both a CLI tool and a library to be imported. So if you are looking for something extremely easy to use with a moderate feature set, fire is your pick.</p><h3>TLDR</h3><ul><li><a href="https://docs.python.org/3/library/argparse.html">argparse</a>: Use argparse to lessen your dependencies and for simple to moderately complex CLI applications.</li><li><a href="https://click.palletsprojects.com/">click</a>: Use click if you are looking for something that can be easy to start with but also gives you tools to write really complex CLI applications.</li><li><a href="https://github.com/google/python-fire">fire</a>: Use fire if you want the easiest solution to creating a CLI application or you want to take some existing code and turn it into a CLI application.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba52db1e454f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/tools-for-writing-python-cli-applications-ba52db1e454f">Tools for Writing Python CLI Applications</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Fail-Safes: How Your Code Can Suck but It Doesn’t Matter]]></title>
            <link>https://medium.com/hackernoon/software-fail-safes-how-your-code-can-suck-but-it-doesnt-matter-ef0c6cf7591c?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef0c6cf7591c</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Wed, 28 Nov 2018 00:10:14 GMT</pubDate>
            <atom:updated>2018-11-28T00:10:14.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*gPP6hpX-qdCk9ncSBEWKGw.jpeg" /></figure><p>I’ve been surprised over the years how many software developers don’t get how putting fail-safes in their code is good thing. Many perceive it as purposely allowing bugs or supporting an architecture that is sub-par. But I find it to be necessary to build a system that is resilient when things fail. Without them you falsely try to build the perfect system which will never happen in real life.</p><p>What is a fail-safe: <a href="https://www.merriam-webster.com/dictionary/fail-safe">incorporating some feature for automatically counteracting the effect of an anticipated possible source of failure</a></p><p>For me fail-safes are an admission that my code will suck at some point even if I try my hardest, so I need to put some safety nets in place to catch me when I’m stupid.</p><p>Here is a typical scenario that often rubs developers the wrong way:<br><strong>Manager:</strong> We found a bug!<br><strong>Developer 1:</strong> Let’s find the root cause and fix it.<br><strong>Developer 2:</strong> The root cause is resource A hangs when we call it on Ground Hog’s Day sometimes. It will probably a take a lot of time to debug and fix resource A.<br><strong>Manager:</strong> Release now!<br><strong>Developer 2:</strong> Well even if we fix the root cause, this could fail in other ways and have the same result. Why don’t we write a timeout that kills the call to resource A and retries, then we will be covered in this scenario and network failure scenarios.<br><strong>Developer 1:</strong> Our code and architecture must be prefect!</p><p>As a developer it feels sleazy to allow such a glaring imperfection and then do something that just sweeps it under the rug. Should you fix the root cause? Yes, but you can often find fail-safes that cover a multitude of problems that you know of and don’t know of and allow you to move forward towards a deadline. To code in reality means you will have to accept some imperfections in your code and that your coding and architecture skills may fail you. In the long term in this scenario, yes you should fix the root cause, but you should also leave the fail-safe in for unexpected errors. In the short term the fail-safe gives you some breathing room to prioritize things.</p><p>This scenario could also shift the other way if the failure was more often. In this case a timeout would still help but might be such a high performance penalty all the time that you have to fix the root cause. However, it would still cover you in unexpected situations.</p><p>Another pattern I often follow is do what is absolutely necessary for the user facing transaction and then ship everything else off to a background task. The transactional code I then consider more important and may even test more than the background code. If background code fails, the time frame for fixing something is much more expanded and the user often will not notice. Again many developers consider this as inviting bad design. However, when everything is important, nothing is important. So isn’t it better to prioritize the most valuable part of the code? In this case the fail-safe is making the transactional code as small as possible so that failures do not effect user experience as much.</p><p>The last example I would like to note is an architectural style many Javascript frontend frameworks use, the Virtual DOM. The Virtual DOM allows you to make lots of changes to the DOM but then only render what is different. This effectively allows developers to be really bad at their jobs. In a perfect world, you would keep track of every change needed to the DOM and only do what is necessary. This would be more performant than any virtual DOM could be. However, in practice it is hard to keep that level of discipline especially over a large group of developers. So frontend frameworks have implemented some what of a fail-safe for the developer to be bad and write non-optimized code that comes out pretty fast anyways.</p><p>Next time you find yourself in a situation where the answer is “we need to be better developers”, “test more”, or “we need to fix the root cause”, ask yourself if there is fail-safe which will allow you to be bad? Maybe you should only be bad for a while or maybe like the Virtual DOM it is something that allows you to be bad all the time. In the real world we need levers that allow us to prioritize and give us the flexibility to act badly. You won’t be on your A game 100% of the time so find ways to add slack.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef0c6cf7591c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/software-fail-safes-how-your-code-can-suck-but-it-doesnt-matter-ef0c6cf7591c">Software Fail-Safes: How Your Code Can Suck but It Doesn’t Matter</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hacking Celery to Write a Code Formatting API]]></title>
            <link>https://medium.com/@pizzapanther/hacking-celery-to-write-a-code-formatting-api-22776894279e?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/22776894279e</guid>
            <category><![CDATA[celery]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Sun, 30 Sep 2018 15:44:43 GMT</pubDate>
            <atom:updated>2018-09-30T15:57:07.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OxEg5CVRVFA3wbauzn9fNA.jpeg" /></figure><p>Code Format API Docs: <a href="https://www.neutron64.com/help/code-format">https://www.neutron64.com/help/code-format</a></p><p>Recently I decided the world needed a code formatting API. Code formatting is all the rage recently with tools like <a href="https://golang.org/cmd/gofmt/">gofmt</a>, <a href="https://prettier.io/">prettier</a>, and <a href="https://black.readthedocs.io/en/stable/">black</a>. However, I wanted to be able to format code without having to worrying about installing all the different tools. So I wrote a code format API. Can you make a HTTP request? Then you can format some code.</p><p>The API takes in code and then routes it to the appropriate tool for formatting. My backend is written in Python and I was already using <a href="http://www.celeryproject.org/">Celery</a> for a distributed task queue. I could simply execute the tool on the command line and send in the code via stdin. However, I wanted to see if could have a tighter integration that wouldn’t need to have to constantly reload code on the command line. So what if I put tasks on to the Celery queue and have different languages execute the tasks? Celery really isn’t designed for this. There are some other implementations for putting tasks on the queue in other languages, but there is no real protocol for executing tasks in languages other than Python.</p><h3>Separate Queues For Different Languages</h3><p>The first problem was making sure each language picked up only tasks that it could handle. The easiest way to do this was to make each language worker work on a separate queue. So when adding tasks I made sure to route them to the correct queue like so:</p><pre># python code<br>async_result = celery_app.send_task(<br>  &#39;prettier_format&#39;,<br>  args=[code, parser, options]<br>  queue=&#39;prettier&#39;<br>)</pre><p>By default Celery serializes tasks into JSON. Since JSON is pretty universal now, this makes it easy to pick up the task and run it. Also by default Celery uses RabbitMQ for a queue. Since I also wanted easy access to the queue in many languages, I decided to go with Redis instead. While not as featureful in Celery as a queue, it is good enough and is has good clients written in many more languages.</p><h3>Javascript Celery Worker</h3><p>Javascript was the first worker I wanted to implement since I wanted to implement prettier. Prettier supports a wide variety of code formatting so I knew it would give me a good feature set without having to implement many different tools.</p><p>I needed to solve two problems:</p><ol><li>get a task off the queue</li><li>return the results</li></ol><p>To get a task off a Redis queue you use the pop command: redis_client.blpop(‘prettier’, 0, process_prettier);. That line does a blocking pop and executes the callback process_prettier on the data. When processing that queue’s data we need to de-serialize if from a string.</p><pre>// JS Code<br>var data = JSON.parse(data_string);<br>var args = JSON.parse(atob(data.body))[0];</pre><p>Notice you have to de-serialize twice. Once to get the job data, then a second time since the arguments to the job are also serialized. Also notice the arguments are also base64 encoded. This is done if you are using binary data in one of your arguments.</p><p>You now have your input and can do processing. So you’ll want to store your results when the processing is complete. To do this you need to structure the data in a way Celery knows how to process and both publish and set the results. See code below.</p><pre>// JS Code<br>var id = data.headers.id;<br>var key = `celery-task-meta-${id}`;</pre><pre>result = {<br>  status: &quot;SUCCESS&quot;,<br>  result: result_data,<br>  traceback: null,<br>  children: [],<br>  task_id: id<br>};<br>result = JSON.stringify(result);<br>redis_results_client.set(key, result, &#39;EX&#39;, 60);<br>redis_results_client.publish(key, result);</pre><p>After you set and publish the results, your Python code will pick up the results with a async_result.get().</p><h3>Conclusions</h3><p>You can see it only takes a few lines of code to hack together a Celery worker in another language that works. Most of the hard work in doing this is exploring how Celery implements it’s queue protocol. By following the code above you can now skip some of that investigation.</p><p>The downside to this hack is it doesn’t support all the features of Celery like retrying, error reporting properly, etc. However, you can get a stable worker that can handle lots of work and can be scaled.</p><p>I would like to formalize a more official Celery Javascript worker in the future. If this is something you think you would use, leave me a comment and maybe we can collaborate.</p><p>Also let me know if you would ever use a code formatting API: <a href="https://www.neutron64.com/help/code-format">https://www.neutron64.com/help/code-format</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22776894279e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Like Big Frameworks and I Can Not Lie]]></title>
            <link>https://medium.com/@pizzapanther/i-like-big-frameworks-and-i-can-not-lie-3df646575b5e?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3df646575b5e</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Sun, 02 Sep 2018 18:21:37 GMT</pubDate>
            <atom:updated>2018-09-02T18:27:15.707Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Originally posted on 04/07/2015 on the Neutrondrive Blog</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*Kq3fT61G-z3MkplRb1vuuA.jpeg" /></figure><p>All the rage lately is to trash frameworks and to profess how smart you are and show you can do the same development with libraries and/or micro frameworks. You also show that you are a real developer by coming up with your own abstractions and algorithms. With all this hate going around for big frameworks, I wanted to come out and say: “I like big frameworks and I can not lie, You other brothers can’t deny”.</p><p>Yes frameworks can suck because instead of coding, you often feeling like you’re fighting the framework and having to learn a very specific way of coding. However, I think it you find a good framework, this is minimized and the benefits are great.</p><h3>Me Not So Smart</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*Vuc0GmmlLf2s6P_GcbC3Qw.jpeg" /></figure><p>Frameworks give you abstractions, best practices, and a direction of how you should architect your application. All of this I’m very grateful for because number one I don’t want to come up with this my self and number two I’m not smart enough to come up with all of this myself. I may have some good ideas but probably not as many as a framework that is vetted by a big community. Frameworks give you great ideas on how to get things done and when you don’t like a particular thing, remove it and come up with your own solution. Don’t reinvent the wheel especially when there is a good chance someone invented a wheel better than yours.</p><h3>It’s Not All About You</h3><p>Frameworks really aren’t about you. They are really about the other people on your team. If you create your own abstractions, best practices, and architecture that is great, you’re a rock star developer! But many things can go wrong in regards to your team that has to use your creation. First, maybe you’re not as smart as you think and your solution sucks. Now your team is stuck with coding using some Frankenstein code you came up with.</p><p>Second, learning your custom framework or architecture is probably going to be harder than learning an open and public framework. You probably aren’t going to document things as well as a public framework and make endless videos and talks on the subject of teaching people how to use your abstractions and best practices. With a public framework you may also be able to hire people who already know the framework and can come on your team and make an immediate impact with no training. So unless you’re in a big company that can handle these costs, using a custom solution is really going to slow down your team.</p><h3>Community Abstractions and Best Practices</h3><p>Lastly, using frameworks helps to bring out discussions about the best abstractions and practices. If I were building an abstraction about a duck billed platypus where I abstracted it as furry duck and this abstraction really worked well for my company and project, that is great. But really it would be easier to train my team if I used the better classification of the platypus as a duck billed mammal. I may have been really smart to come up with the original abstraction but until I discuss this with others in my industry or community does it become easy common knowledge. Of course there are other ways to discuss these issues without a framework, but having the framework helps facilitate the discussion because I think it is always good to see these abstractions and practices in action in a way that many people can implement easily. It gives the community an easy way to grok new ideas in terms of something they are used to. A good framework will know in addition to suppling code and tools for development, one of its core duties is to facilitate community discussions about the best shared practices.</p><h3>Conclusions</h3><p>So with all that said, sign me up for the next big framework! Every new framework gives me new ideas and teaches me a few new tricks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3df646575b5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get Your Frontend off My Lawn]]></title>
            <link>https://medium.com/@pizzapanther/get-your-frontend-off-my-lawn-d5e72977ee25?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5e72977ee25</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[single-page-applications]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Wed, 23 May 2018 16:47:54 GMT</pubDate>
            <atom:updated>2018-07-13T00:11:53.978Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*IxZo89pvb0x6qZ7TE5UCkw.jpeg" /></figure><p>With modern web applications, we often split the frontend and backend into components that can be developed separately. So we develop each piece and when we go to deploy the final product you have to decide whether to deploy each piece to a separate domain or combine the two into one deployment.</p><p>Using different domains is probably the easiest for not having to modify your code to use it in production. With this method, the first problem you’ll encounter is having to account for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS">CORS headers </a>(Cross-Origin Resource Sharing) in your backend code. There are many libraries to help you with that task. The second problem is having to setup and possibly pay for two different deployments. For smaller applications and teams or in certain situations, deploying everything together can be preferable. This is doable but can seem kind of weird for seasoned developers.</p><p>What is the cause of all the weirdness? When we combine the frontend and backend in a <a href="https://en.wikipedia.org/wiki/Single-page_application">single page application</a> (SPA), the backend must serve up all of its usual API routes and static files but then any unmatched request gets served to index.html instead of showing a 404. It looks something like this:</p><pre>Incoming Request -&gt;<br>   1. Does it match an API route?<br>   2. Does it match a static file path?<br>   3. No match, then return index.html<br>      (additional routing is now handled by frontend code)</pre><p>Because the frontend includes URL routing with via the browser’s <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API">History Push State</a>, it is up to the frontend to have the final word on unmatched URLs. So you will not get a proper 404 status code with this method. To the end user this is not a big deal because you can still show “Not Found” pages. But you’ll probably want to be more careful about SEO and where you direct search engines to scrape your site if you move content.</p><h3>Backend Implementations for SPA Routing</h3><p>If combining the two components is for you, I wanted to show you how this can be done in several different frameworks. Again this isn’t necessarily the best method, but does have advantages in certain use cases. Some cases where I like to use this method:</p><ul><li>I don’t want to setup two deployments (small team, small app)</li><li>The application is installed locally by a user and must run under one domain like localhost.</li></ul><h3>Nginx</h3><p>If you have Nginx running in front of your code, you can use the web server to handle your initial routing so you don’t have to make modifications to your code. A simplified configuration is below.</p><pre>server {<br>  # Backend routes<br>  location /api/ {<br>    proxy_pass <a href="http://localhost:8000/">http://localhost:8000</a>;<br>    # probably more stuff here<br>  }<br>  <br>  # Static Files (optional)<br>  location /static/ {<br>    root /path/to/static/files;<br>  }</pre><pre>  # Frontend <br>  location / {<br>    root /path/to/frontend/build;<br>    try_files $uri /index.html;<br>  }<br>}</pre><p>Note the try_files directive. That tells Nginx to try and match the URL to a static file and if not fallback to index.html.</p><h3>ExpressJS</h3><pre>// optional static files<br>app.use(&#39;/static&#39;, express.static(&#39;path/to/static/files&#39;));</pre><pre>// frontend build<br>app.use(express.static(&#39;path/to/build&#39;));</pre><pre>// Backend routes</pre><pre>// Catch all for frontend<br>app.get(&#39;*&#39;, function (req, resp) {<br>  resp.sendFile(_dirName + &#39;/path/to/build/index.html&#39;);<br>});</pre><h3>Tornado (Python)</h3><pre>class FrontendHandler(tornado.web.StaticFileHandler):<br>  def validate_absolute_path(self, root, absolute_path):<br>    try:<br>      return super().validate_absolute_path(root, absolute_path)</pre><pre>    except tornado.web.HTTPError as exc:<br>      if exc.status_code == 404 and \<br>        self.default_filename is not None:<br>        absolute_path = self.get_absolute_path(<br>          self.root, self.default_filename)<br>        return super().validate_absolute_path(root, absolute_path)</pre><pre>      raise exc</pre><pre>def make_app():<br>  return tornado.web.Application([<br>    # Backend routes<br>  <br>    # Optional static files<br>    (r&#39;/static/(.*)&#39;, tornado.web<strong>.</strong>StaticFileHandler, {<br>      &#39;path&#39;: &#39;/path/to/static/files&#39;}),</pre><pre>    # Frontend<br>    (r&#39;/(.*)&#39;, FrontendHandler, {<br>      &#39;path&#39;: &#39;/path/to/frontend/build&#39;,<br>      &#39;default_filename&#39;: &#39;index.html&#39;}),<br>  ])</pre><h3>Django</h3><p>With the Django setup I’m assuming you are already using something like <a href="http://whitenoise.evans.io/en/stable/">WhiteNoise</a>. This setup serves the frontend index.html as a Django template. You could get rid of that and the TEMPLATES settings change; however, I like to do it this way to inject variables that need to be changed for production use.</p><p><strong>settings.py</strong></p><pre>TEMPLATES = [<br>  {<br>    # Other Template settings<br>    &#39;DIRS&#39;: [<br>      &#39;/path/to/frontend/build&#39;<br>    ],<br>  }<br>]</pre><pre>STATIC_URL = &#39;/static/&#39;<br>STATIC_ROOT = os.path.join(BASE_DIR, &quot;static-compiled&quot;)</pre><pre>STATICFILES_DIRS = [<br>    &#39;/path/to/frontend/build&#39;<br>]</pre><p><strong>urls.py</strong></p><pre>urlpatterns = [<br>  # Backend URLs</pre><pre>  re_path(r&#39;(.*)&#39;, main.views.frontend),<br>]</pre><p><strong>main/views.py</strong></p><pre><a href="http://twitter.com/cache_page">@cache_page</a>(CACHE_TIMEOUT)<br>def frontend(request):<br>  return TemplateResponse(request, &#39;index.html&#39;, {})</pre><p>If you would like to add your framework to this list, let me know on <a href="https://twitter.com/pizzapanther">Twitter: PizzaPanther</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5e72977ee25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Use Neutron64.com Web Based IDE?]]></title>
            <link>https://medium.com/neutron-studio/why-use-neutron64-com-web-based-ide-b037c4d177f0?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b037c4d177f0</guid>
            <category><![CDATA[termux]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[chromebook]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Mon, 07 May 2018 20:27:34 GMT</pubDate>
            <atom:updated>2018-05-07T20:27:34.294Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*UNr_zUizIeh84aPCIoj5IA.jpeg" /></figure><p><a href="https://www.neutron64.com/">Neutron64.com</a> is web based code editor. The whole idea of having a generic code editor that runs in a web browser may sound strange to most, so in this article I’ll outline some of the reasons you might want to try out <a href="https://www.neutron64.com/">Neutron64</a>.com for your everyday development.</p><h3>The History of Neutron</h3><p>When the first commercial Chromebook was released, I purchased it and pretty much loved it. However, I’m a developer and what’s a developer want to do? Develop software of course. So I set out on a search for a web based IDE that I could use on a Chromebook. There are two problems that needed to be solved: editing code and running that code. There were many choices but none of them worked for me. They were either very constrained to one particular situation, like editing frontend Javascript, or constrained to one particular backend. I needed something that could be flexible and support many types of development. Thus Neutron IDE was born, a lightweight web based editor that could be installed on a server of your choice and then you could edit and run code on that machine.</p><h3>Modern Day Neutron</h3><p>Fast forward to today and Neutron is much the same but covers even more situations and use cases. Neutron is now a progressive web app that can be used with zero installation and configured to work with remote or local code. Some of the unique features of Neutron:</p><ul><li>Edit code directly off of multiple Google Drive accounts</li><li>Edit local and remote code</li><li>Settings follow you from machine to machine</li><li>Integrated terminal</li><li>Fast setup with <a href="https://termux.com/">Termux</a> on Chromebooks</li></ul><p>Even today with many more web based IDE options, Neutron is easy to use and more flexible.</p><p>So if you are looking to use your Chromeook for development or you just want a flexible lightweight editor that integrates with many environments easily checkout <a href="https://www.neutron64.com/">Neutron64.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b037c4d177f0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neutron-studio/why-use-neutron64-com-web-based-ide-b037c4d177f0">Why Use Neutron64.com Web Based IDE?</a> was originally published in <a href="https://medium.com/neutron-studio">Neutron Studio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neutron64.com Now Easier to Setup]]></title>
            <link>https://medium.com/neutron-studio/neutron64-com-now-easier-to-setup-e6b4e5c3832e?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6b4e5c3832e</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[chromebook]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Mon, 07 May 2018 18:58:48 GMT</pubDate>
            <atom:updated>2018-05-07T19:00:55.472Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*xY5UqbOBPfeobJdjcD5R4A.jpeg" /></figure><p>With the latest release of of <a href="http://neutron64.com/">Neutron64.com</a> we’ve added some automation into the setup process which should make it easier and faster to get going while still keeping the editor flexible for many different uses and environments.</p><h3>New Install Script</h3><p>First we created a new install script that will take care of installing all of the dependencies for different target systems. To use it, simply run:</p><pre>curl -o- https://community.neutron64.com/scripts/install-nbeam.py | python</pre><p>The quick install works for Amazon Linux, Ubuntu, Debian, Cent OS 7, and Termux right now. If you don’t see your system supported or find problems please report them at our Github <a href="https://github.com/pizzapanther/n64-community">pizzapanther/n64-community</a> or feel free to send us a pull request with your update.</p><h3><strong>Automated SSL Certificates</strong></h3><p>To setup remote environments securely, an SSL certificate is required. Acquiring certificates has become less cumbersome but is still something we wanted our users to have to avoid. Now with remote setups nbeam setup_remote or nbeam setup_termux will automatically get an SSL certificate installed. The process takes about two minutes. And you can still specify your own certificate if you wish.</p><h3>Termux Setup</h3><p>Lastly, if you are a <a href="https://termux.com/">Termux</a> user, we made sure the install process works smoothly and easily. Just use the script above and the nbeam setup_termux command. This lets Neutron64 run flawlessly on Android devices and Chromebooks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6b4e5c3832e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neutron-studio/neutron64-com-now-easier-to-setup-e6b4e5c3832e">Neutron64.com Now Easier to Setup</a> was originally published in <a href="https://medium.com/neutron-studio">Neutron Studio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Rocket Mortgage Doesn’t Work for Me]]></title>
            <link>https://medium.com/@pizzapanther/why-rocket-mortgage-doesnt-work-for-me-6a03e7d12086?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a03e7d12086</guid>
            <category><![CDATA[real-estate]]></category>
            <category><![CDATA[mortgage]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Sun, 06 May 2018 14:55:42 GMT</pubDate>
            <atom:updated>2018-05-06T14:55:42.886Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1pDIh8B6CEuGVA4xnC9FQ.jpeg" /></figure><p>Currently I’m in the middle of the mortgage process. During the beginning of the process, I decided to try out Rocket Mortgage. I’ve heard about it from many of the podcasts I listen to and love the recent commercials with one of my favorite actors Keegan-Michael Key. Also any time I can do something faster with less paperwork in an app, I’m all over it. So what’s not to love? Well it turns out there are few deal breakers for me. And since you don’t hear much except positive praise right now for Rocket Mortgage, I thought I’d document some of it’s downsides.</p><h3>The Good</h3><p>It’s not all bad. Rocket Mortgage does have some advantages. Here are a few I found.</p><ul><li>Great interest rates. Their lower rate helped me negotiate a lower rate with the lender I eventually went with.</li><li>A more streamlined and automated process. Their process starts online and is automated to go through your accounts, so it is less painful initially to get pre-qualified for a loan.</li></ul><h3>The Bad</h3><p>Once you are in the pipeline, you are a sales target and nothing more. Rocket Mortgage uses the typical tools that other tech companies use to push sales. Expect welcome e-mails as soon as you sign up, followed by the typical litany of automated spam e-mails when you disengage or need to follow up on something. This whole process really gets on my nerves because every tech company follows it. Just because I sign up for your service doesn’t mean I want a storm of automated e-mails. Also other tech companies, stop sending me e-mails from “your founder” unless it really is the founder e-mailing me personally. We can all see through your bullshit marketing now.</p><p>With Rocket Mortgage though, in addition to spam e-mails, expect phone calls and snail mail too. Yay! On the good side, since they use typical marketing tools, you can opt out. When I got tired of all the automated communication, I simply opt-ed out. I actually still wanted to engage with Rocket Mortgage at this point, but I wanted my agent to call when we had something to really talk about, not when she was prompted to by some automated system. However, a simple human conversation has been removed from the Rocket Mortgage process. Only machine initiated interactions are allowed. So I never heard from them again, until they dropped the offer.</p><h3>The Ugly</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*InhNpGB0G9bHL5cxe4uVng.png" /></figure><p>After not being too impressed with the typical Silicon Valley marketing pipeline techniques used to sell me a mortgage, I tried a local company. They gave me an offer and using Rocket Mortgage I was able to get their rate down. However, one curious thing came up. During the time I got the Rocket Mortgage offer, Equifax Mortgage accessed my credit. Because of the <a href="https://www.consumer.ftc.gov/blog/2017/09/equifax-data-breach-what-do">Equifax breach last year</a> and the lack of government response of any punishment, I think it’s our duty as consumers not to use or trust companies that use Equifax. So I choose to vote with my dollars and not use anyone associated with Equifax.</p><p>Like I said, it’s not all bad but Rocket Mortgage is not the tech savior of mortgages like it is touted to be in it’s advertising. Shop around and be conscious of the techniques used to push you to a sale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a03e7d12086" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[If you want to become a 10X developer, Teach]]></title>
            <link>https://medium.com/@pizzapanther/if-you-want-to-become-a-10x-developer-teach-8ec59fc9f50e?source=rss-3dc4df28f62b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ec59fc9f50e</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Paul Bailey]]></dc:creator>
            <pubDate>Tue, 17 Apr 2018 20:53:17 GMT</pubDate>
            <atom:updated>2018-04-17T21:05:47.896Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*lWS69rfUjcf_5k0peJ663g.jpeg" /></figure><p>We often hear about the fabled 10X developer. Whether or not it is true I’ll leave up to you to decide. But it is often good to have ideals for us to strive towards even if we can never reach them. That can lead to unhealthy expectations for sure, but what if there were real ways we could get closer to that ideal. My question then is, are there real things we can deliberately do to get us closer to being a 10X developer?</p><p>I believe teaching development to others is one of those things. I’ve always heard the saying “if you want to master something, teach it”, so I’ve volunteered to give presentations and talks. However, it really didn’t hit home until I started teaching at a developer bootcamp. Here is a break down of the different levels of teaching and how they may make you a better developer.</p><h3>Pair Programming</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fGPdW7UHZnusDZvpVoerqQ.jpeg" /></figure><p>While this isn’t explicit teaching, depending on the pair, teaching and guidance can occur both ways. With the pressure of someone else around, you have to think more logically about what you are doing and how to explain it. Also the exchange of ideas can expand your knowledge base. However, as you get more comfortable in this situation, learning may decrease.</p><h3>Tech Talks</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fsrb6bXZHbgDsc%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fsrb6bXZHbgDsc%2F200w_d.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fsrb6bXZHbgDsc%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="319" frameborder="0" scrolling="no"><a href="https://medium.com/media/1eda3563b09d04a21150dcebb85958f3/href">https://medium.com/media/1eda3563b09d04a21150dcebb85958f3/href</a></iframe><p>This is was my first foray into teaching. Giving a presentation about a subject forces you to think about how you would explain a concept and if it is something you never used before, forces you to learn something new. Also if you put yourself under the scrutiny of questioning, you have to think about things deeper or from other perspectives then you could come up with alone. Even if I can’t answer a question on the spot, I often find myself thinking about it later and coming up with the correct answer. That sucks for your presentation but is great in the long run.</p><h3>Mentoring</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F6ySFKd72MyV4Q%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F6ySFKd72MyV4Q%2Fgiphy-downsized.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F6ySFKd72MyV4Q%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="217" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcfc0dadf4165357dda10dc788eb18d2/href">https://medium.com/media/fcfc0dadf4165357dda10dc788eb18d2/href</a></iframe><p>Mentoring while not teaching, comes close and provides similar benefits. Being on the hook for advice will often force you to think of different perspectives and problems. And you may often give the wrong advice. But usually when this happens you learn about your wrongness in the future and feel really bad, and thus a lesson sticks with you forever. Once you get good at mentoring, maybe you give less advice but either way, ideas you communicate to other people normally make you scrutinize them more.</p><h3>Boot Camps and Hands on Workshops</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*8TKONUaYEyjd-u2LzttZjQ.jpeg" /></figure><p>Boot camps and hands on workshops can bring you to an even higher level of development nirvana. While it is much like a tech talk, the hands on practice with many different people and many different problems can really help you enhance your skills. Also with a shorter talk you can avoid issues pretty easily. In a longer format, you have to deal with more problems and people. You will have to learn quickly how to explain things but also how to keep things simple so a room of beginners can execute your exercises. With people writing code on their own and then coming to you for help, you’ll also learn to debug other people’s code. After teaching at a bootcamp for a year, I can guess many fixes for bugs with little to no information. While you encounter debugging on the job too, a boot camp or workshop can expose you to more variety in a compressed time frame.</p><p>By exposing yourself to one or many of theses things, you can up your development skills. Will you ever become a 10X developer? Maybe not but you will inch closer everyday. With that said, make sure you also don’t forget to code regularly. By going too far down the teaching road, you could become too academic and fall out of practice. It is often easy to talk about code and hard to put it into practice. However, by mixing teaching into your coding career, you can see great results.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ec59fc9f50e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>