<?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 Igor Petrov on Medium]]></title>
        <description><![CDATA[Stories by Igor Petrov on Medium]]></description>
        <link>https://medium.com/@igor.petrov?source=rss-ec902fc60d7a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*iysI2X3ZkWgelRhQ.</url>
            <title>Stories by Igor Petrov on Medium</title>
            <link>https://medium.com/@igor.petrov?source=rss-ec902fc60d7a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 07:03:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@igor.petrov/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to build your first Shopify app]]></title>
            <link>https://medium.com/free-code-camp/how-to-build-your-first-shopify-app-bc4edef32974?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc4edef32974</guid>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[shopify]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Wed, 01 Aug 2018 19:25:14 GMT</pubDate>
            <atom:updated>2018-08-01T19:25:14.990Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rTl2RMivof-SHDDYPsN6A.jpeg" /></figure><h3>Why build a Shopify App?</h3><p>I have always been excited about how the e-commerce market is growing, and have made various attempts to dive into this world. About five years ago, a partner and I built an e-commerce website selling and delivering flowers, a soft toy, and a greeting card packaged together as a gift. This was an idea validation attempt, and we didn’t take it seriously. So it ended soon.</p><p>Later, we tried to sell floor tiles (partnering with a guy who had worked in that area for several years) and it didn’t go well, either. Mostly, the reason was the same: it was a side project for us, and we knew nothing about the floor tile market.</p><p>But, during this time, we developed a lot of e-commerce websites for our agency’s clients. Most of these websites were built using <strong>Ruby on Rails</strong> and specifically <strong>Spree</strong>. And this direction was successful — we learned a lot about e-commerce website development and typical development problems (as well as marketing, shipping, and different business problems).</p><p>This year I’m working with a new partner who had good experience with the <strong>Shopify</strong> platform. We talked a lot and came up to an idea of developing a <a href="https://apps.shopify.com/influencify"><strong>Shopify</strong> app</a>. This platform is growing fast, and there’s a big demand on the market for extending platform possibilities.</p><p>Building a product, rather than doing custom development for someone, was exciting for me, too. So these two things — e-commerce and product development — have naturally combined into the idea of a <a href="https://apps.shopify.com/influencify"><strong>Shopify</strong> app</a>.</p><h3>Understanding app building complexity</h3><p>So you’ve come up with an idea for your application. Now you need to decide if your app will interact with merchants’ storefronts by extending templates or injecting some scripts. Or maybe you need to work with some third-party API and integrate it into your app, or extend a <strong>Shopify</strong> Admin.</p><p>Each part can be complex enough. So if you just need to do something with <strong>Shopify </strong>store data and output something in the Admin section, you are dealing with 1 type or 1 point of complexity. If you need to work with external APIs and still have some section in Admin, you have 2 points of complexity. And so on.</p><h3>Start development with a boilerplate</h3><p>Well, we can see that our app is quite complex (though for customers it looks like an easy one). Since we agreed on app idea and initial <strong>MVP</strong>, I started to research and found that <strong>Shopify</strong> has a great shopify_app <strong>Ruby</strong> gem.</p><p>This is a pretty cool stuff that saves you a lot of time: it generates for you a <strong>Shopify</strong> app framework without the need to setup <strong>OAuth</strong> flow manually. Other things to note:</p><ul><li>Generated Shop model</li><li>Simple Webhooks and ScriptTags registering</li><li>Authentication approaches</li><li>App Proxy verification (for your storefront customizations)</li></ul><p>I’ve launched a blank app in minutes, not hours.</p><h3>Use recommended tools</h3><p>Next, I have researched how to approach Admin UI in your app. I found out that <strong>Shopify</strong> simplifies this task for you as well with the power of their design framework <a href="https://polaris.shopify.com/"><strong>Shopify Polaris</strong></a>.</p><p><a href="https://polaris.shopify.com/"><strong>Polaris</strong></a> is a <strong>React.js</strong> components library, and this is the recommended way for extending the <strong>Shopify</strong> Admin section. Your app will look like a native <strong>Shopify</strong> app with admin sections like “Products” or “Orders” (<strong>Shopify</strong> uses it too, I guess).</p><p>You should use it instead of some custom theme, because it’s well documented, supported, and has guidelines.</p><h3>Extending Shopify Admin</h3><p>After a successful installation of <strong>Shopify Polaris</strong> into the project with the help of <strong>Webpacker</strong> or <strong>Yarn, </strong>you’ll be able to extend the <strong>Shopify</strong> Admin section.</p><p>For the welcome page (one that merchants will see after app installation with no data set up yet), then you’ll do these things:</p><ul><li>Add a route:</li></ul><pre>get ‘/welcome’ =&gt; ‘home#index’</pre><ul><li>Create a <strong>Rails</strong> controller:</li></ul><pre>class HomeController &lt; BaseAuthenticatedController<br> def index<br> end<br>end</pre><ul><li>Add a view template that just renders <strong>React</strong> component with the help of react-rails gem:</li></ul><pre># home/index.html.erb<br>&lt;%= react_component(&quot;Welcome&quot;, {<br>  apiKey: ShopifyApp.configuration.api_key,<br>  shopOrigin: &quot;<a href="https://#{">https://#{</a> <a href="http://twitter.com/shop_session">@shop_session</a>&amp;.url }&quot;,<br>  debug: Rails.env.development?,<br>  forceRedirect: !Rails.env.development? &amp;&amp; !Rails.env.test?<br>}) %&gt;</pre><ul><li>Create a <strong>React</strong> component that renders some <strong>Shopify Polaris</strong> components (like EmptyState, for example).</li></ul><p>The first step is quite clear for everyone who’s ever worked with <strong>Ruby on Rails</strong>. The second step should be as well, except the fact that you need to inherit your admin controllers from ShopifyApp::AuthenticatedController so every request will be authorized. I’ve created a subclass of this class for all future admin controller classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2BYWJpAZHNIzSgtICBCQFA.png" /></figure><p>The third step is about rendering. I’ve installed the react-rails gem which comes with a nifty react_component helper, and I’ve added a rendering of a welcome component passing all necessary properties. For Embedded Apps (those that extend <strong>Shopify</strong> Admin) you should pass at least apiKey and shopOrigin options to utilize <a href="https://polaris.shopify.com/components/get-started#using-embedded-components">embedded components</a> coming with <strong>Shopify Polaris</strong>. These <a href="https://polaris.shopify.com/components/get-started#using-embedded-components">embedded components</a> are just <strong>React</strong> wrappers around the <strong>Shopify</strong> Embedded App SDK.</p><p>And finally, I’ve written a Welcome component and placed it into the app/javascript/components folder according to config/webpacker.yml.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HL9JrMwbbqMo_i81DxJmMw.png" /></figure><p>Note that I’ve extracted some boilerplate, like the definition of shopOrigin and apiKey properties, into the BasePage component which is going to be a parent component for each app page. InfluencifyApp is a component that renders the Polaris AppProvider component, Page, inside it, and any children with {this.props.children} inside the Page.</p><p>With this setup, I’ve created other components with InfluencifyApp as a root component for each app page.</p><h3>Storefront customization</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl0HlKyMsMdcKINFTi%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fsouthparkgifs-l0HlKyMsMdcKINFTi&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl0HlKyMsMdcKINFTi%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/38369846a6a36547aa7589d9ae037225/href">https://medium.com/media/38369846a6a36547aa7589d9ae037225/href</a></iframe><p>There’s a good option in <strong>Shopify</strong> that allows you to customize a merchant’s storefronts: Script Tags. They are JavaScript files that will be injected into the storefront template.</p><p>You can register them easily using the shopify_app gem. Here is how I’ve registered a script for <a href="https://apps.shopify.com/influencify">Influencify</a> app (at config/initializers/shopify_app.rb):</p><pre># to include asset_url helper<br>include ActionView::Helpers::AssetUrlHelper<br>...<br>config.scripttags = [<br>    {event: &#39;onload&#39;, src: -&gt; (domain) { asset_url(https://medium.com/&#39;influencify.js&#39;,%20host:%20ENV[&#39;APP_DOMAIN&#39;]) } }<br>]</pre><p>Note that your scripts should be publicly accessible for all merchants across any of your deployments. I mean in terms of Rails, you shouldn’t have a digest in your script’s filename like influencify-dd432js....js , but instead, put the compiled version into a public folder or upload to CDN.</p><p>The second option is that you can have entire pages or parts of pages served by your app. That is, in case you need to display something or fetch some data from your injected script, you can register which URLs for merchants will be served by your app. This feature is known as <a href="https://help.shopify.com/en/api/guides/application-proxies">Application Proxies</a>. Again, to implement this in your app is way easier with the help of the shopify_app gem — just follow their <a href="https://github.com/Shopify/shopify_app#app-proxy-controller-generator">guides</a>.</p><h3>Testing</h3><p>Testing a <strong>Shopify</strong> app may be a little tricky, but it’s familiar for anyone who’s ever worked with third-party APIs and tested via tools like localtunnel or ngrok. So each time you’re going to test your app, just launch your favorite tunneling tool and update the “Whitelisted redirection URL(s)” field on your app settings page with a URL to your authentication callback that looks like this: <a href="https://myapp.localtunnel.me/auth/shopify/callback">https://myapp.localtunnel.me/auth/shopify/callback</a>.</p><p>To test your App Proxies endpoints for storefront customizations, you need to update this URL setting as well under the “Extensions” section.</p><p>Of course, to test an app you also need a test development store.</p><h3>Deployment</h3><p>There’s nothing special about deployment, since this is just a regular <strong>Ruby on Rails</strong> application. I’ve deployed my app to the <strong>Heroku</strong> platform with the <strong>Puma</strong> and <strong>Sidekiq</strong> processes specified via the Procfile.</p><p>Also, you need to set the environment variables that you are going to use in your app via ENV[&#39;SOMETHING&#39;].</p><p>One more thing to notice is I’ve added a <strong>Node.js</strong> buildpack, because had issues with building via <strong>Webpack</strong>:</p><pre>git:(master) heroku buildpacks     <br>=== influencify Buildpack URLs<br>1. <a href="https://github.com/heroku/heroku-buildpack-ruby">https://github.com/heroku/heroku-buildpack-ruby</a><br>2. <a href="https://github.com/heroku/heroku-buildpack-nodejs">https://github.com/heroku/heroku-buildpack-nodejs</a></pre><h3>Going further</h3><p>Well, as you can see, building an app the way it’s recommended by <strong>Shopify </strong>includes many different steps, and it may turn out to be a complex task for a non-experienced developer.</p><p>Of course, building an app is only the tip of the iceberg. The next steps in a <strong>Shopify</strong> app building venture are making good promo materials, submitting it to the App Store, marketing, and customer support/development after it has been approved.</p><p><em>If you liked this post, please click on </em>✋ <em>to spread the word.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc4edef32974" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-build-your-first-shopify-app-bc4edef32974">How to build your first Shopify app</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</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 replace jQuery with Vue.js in Ruby on Rails apps]]></title>
            <link>https://medium.com/free-code-camp/how-to-replace-jquery-with-vue-js-in-ruby-on-rails-apps-b4f4af192635?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4f4af192635</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Thu, 24 May 2018 19:21:56 GMT</pubDate>
            <atom:updated>2018-05-24T19:21:56.345Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VIrASrMWiySHstjaQwF4GA.jpeg" /></figure><p>If you are a <strong>Ruby on Rails</strong> developer and have been for several years, you’re probably used to using <strong>jQuery</strong> as the default option for developing the front end. Several versions ago, core <strong>Rails</strong> developers offered it as a standard, and in time it became the standard. <strong>jQuery</strong> was the #1 <strong>JavaScript</strong><em> </em>library, and it was very convenient to use it.</p><p>Since then, quite a bit of time has passed, but <strong>jQuery</strong><em> </em>is still the default option. Now, however, you need something different because of the growing complexity of client-side code. You might try React, Angular.js, or Vue.js, but you can only use one of these easily while making the smallest effort to integrate it into an existing or new app.</p><p>I used <strong>jQuery</strong> for a long time and it became a habit: if you start a new <strong>Rails</strong> app, <strong>jQuery </strong>is already there. You’re already familiar with it, and so you start to use it immediately.</p><p>Several years ago, I discovered that I liked <strong>Angular 1,</strong> because it was very simple to start with. But it still had redundant setup with app initializing, writing controllers, and injecting dependencies.</p><p>This is great for architecting your app in with an MVC (MVVM) approach.</p><p>But let’s say you have an existing app with a lot of <strong>jQuery</strong><em> </em>DOM manipulation code, and you want to start replacing this mess with something more supportable. Something like the following (which could be optimized, of course — but this is for the sake of example):</p><pre>$(document).ready(function(){</pre><pre>   ...<br>   $(&#39;#some-radio-button1&#39;).on(&#39;click&#39;, function(){<br>     if ($(this).is(&#39;:checked&#39;)) {<br>       // removing &quot;active&quot; classes, hiding some blocks<br>       // showing related block</pre><pre>     } else {</pre><pre>       // opposite of above<br>     }<br>   });</pre><pre>});</pre><h3>Why Vue.js?</h3><p>So why do I recommend replacing <strong>jQuery</strong> code with <strong>Vue.js</strong>? Because <strong>Vue.js</strong> is not just useful for writing complex <strong>JavaScript</strong> apps. You can also use it just for one simple task, like DOM manipulation. If this is all you need, it would be a good idea to go with <strong>Vue</strong>. And you can go further with it if you need to solve more complex tasks like routing, state management, and so on.</p><p>So, if you already have a project with a lot of <strong>jQuery</strong> code and you would like to get rid of those messy event handlers, you should definitely give <strong>Vue.js</strong> a try.</p><h4>Getting started</h4><p>If you are an old-school RoR developer and still manage assets via <strong>Sprockets</strong>, then just download and put vue.js to your vendor/assets/javascripts folder.</p><p>Next, require it from your main <strong>JavaScript</strong> manifest file (for example, application.js ):</p><pre>//= require jquery<br>//= require jquery_ujs<br>//= require bootstrap<br>//= require vue</pre><p>Then you need to instantiate a <strong>Vue</strong> instance and attach it to some element in your <strong>HTML</strong> code. For this purpose, you could create a separate vue_app.js (or .coffee) file inside app/assets/javascripts:</p><pre>window.vueApp = new Vue<br>  el: &#39;.off-canvas-container&#39;<br>  data:<br>    ...</pre><p>That’s it, now you can use <strong>Vue.js</strong>!</p><h3>Going further</h3><p>Now you can add data to your <strong>Vue</strong> instance data section and write some handlers in the methods section. But it’s better to use a core <strong>Vue.js</strong> unit: components.</p><p>The easiest way to continue with <strong>Vue.js</strong><em> </em>is to use your existing <strong>Rails</strong><em> </em>views and wrap some pieces of <strong>HTML</strong> into components. Let’s take a look how to achieve this.</p><p>For example, I have app/views/sellers/print_labels/new.html.erb and some <strong>jQuery</strong> code associated with this page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZaLBRo78lh3YKGS2YMbEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8bMqR0S_3mxrNDDUh8yIBA.png" /></figure><p>This is a shipping address form with inputs disabled by default. Once the user clicks the “pencil” icon, form fields will turn into accessible inputs and the “Save” button will be shown. Once “Save” is clicked, the form gets returned to its original state.</p><p>To replace this <strong>jQuery</strong> code with a simple <strong>Vue.js</strong> components, I’m creating app/assets/javascripts/components/print_labels.coffee with something like the following (but don’t forget to require your components folder from application.js):</p><pre>Vue.component &#39;print-labels&#39;,<br>  data: -&gt;<br>    isEditingAddress: false</pre><p>And then I use it in my <strong>Rails</strong> view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXSZnFHF2OF4gmDrfq0HpQ.png" /></figure><p>Several things to notice:</p><ul><li>If you want to keep the component template inside Rails views or partials, you should use the inline-template option.</li><li>v-cloak option is needed to display the component after it has been initialized and rendered</li><li>We use @click for attaching onclick event handlers (you can extract complex code to the component methods)</li></ul><p>Now we can get rid of the <strong>jQuery</strong> code because we’ve replaced it with a small <strong>Vue.js</strong> component (with just one data variable!).</p><p>Now it’s your turn! Go ahead with this approach, and I hope you’ll find yourself happy with <strong>Vue.js</strong> soon.</p><p><em>If you liked this post, please click on </em>✋ <em>to spread the word.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4f4af192635" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-replace-jquery-with-vue-js-in-ruby-on-rails-apps-b4f4af192635">How to replace jQuery with Vue.js in Ruby on Rails apps</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I discovered an API that helps you ship ecommerce products through multiple courier services.]]></title>
            <link>https://medium.com/free-code-camp/check-out-this-api-that-helps-you-ship-ecommerce-products-through-multiple-mail-services-725bcd9ce6f8?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/725bcd9ce6f8</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Wed, 25 Apr 2018 18:00:35 GMT</pubDate>
            <atom:updated>2018-04-26T03:13:58.844Z</atom:updated>
            <content:encoded><![CDATA[<h3>I discovered an API that helps you ship ecommerce products through multiple courier services. Here’s how to use it.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZtB3bSD2qOkRT3xJ_5gDQg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/uBe2mknURG4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Guillaume Bolduc</a> on <a href="https://unsplash.com/search/photos/shipping?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The past few months have been super busy time: I’ve worked on development for different e-commerce projects, joined a startup, and co-organized another one — all while preparing for an ultra-marathon.</p><p>It so happened that I was working on some e-commerce projects that were in need of shipping features. These projects were already bootstrapped by someone else (not written by me from scratch) and they had the <strong>Shippo</strong><em> </em>shipping<em> </em>service integrated into them. So this is how I met Shippo<em> </em>and started to work with it.</p><p>I don’t know if Shippo is the only option for shipping features in web apps, but it’s quite popular and has a pretty good and simple API. In this article, we will uncover several common tasks you may need to solve with this service, along with <strong>Ruby</strong>.</p><h4>Beginning with Shippo</h4><p>What you need first is to have a Shippo account and shippo gem bundled for your project:</p><pre>gem &#39;shippo&#39;, git: &#39;<a href="https://github.com/goshippo/shippo-ruby-client&#39;">https://github.com/goshippo/shippo-ruby-client</a>&#39;</pre><p>Next, you need to configure it with the API token you should have (Shippo gives you test or live tokens). Just put this in config/initializers/shippo.rb:</p><pre>Shippo::api_token = ENV[&#39;shippo_api_token&#39;]</pre><p>For working with ENV , you might use something like dotenv or figaro or <strong>Heroku</strong>.</p><h4>Validating addresses</h4><p>One cool feature Shippo has is allowing you to validate addresses. Let’s say you have address fields in your app’s users profiles, and you need to validate during sign up if the user’s address is correct. I came to a custom validator solution:</p><pre>class Profile &lt; ApplicationRecord<br>  validates_with ProfileAddressValidator<br>end</pre><p>And the validator code utilizing Shippo::Address API will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6FUc_jzCoqXsmYcCNPY8Kg.png" /></figure><h4>Creating a shipment/fetching rates</h4><p>The next popular task is to create a shipment in two steps. First, you are going to fetch shipping rates from different carriers (that you have set up in Shippo) and show them to your users so they can choose one. Second, based on the user’s choice, you’ll create a transaction (shipping label).</p><p>You may also offer a user interface for editing parcel sizes or just allow them to choose from pre-defined parcels/boxes.</p><p>Our first step might look like this:</p><pre>Shippo::Shipment.create(<br>  address_from: <a href="http://twitter.com/address_from">@address_from</a>,<br>  address_to: ADDRESS_TO,<br>  parcels: parcels,<br>  async: false<br>)</pre><p>In case you’re wrapping this into a service object, @address_from is something you want to pass into it. It should be like this (the same <em>Hash </em>for ADDRESS_TO which might be a constant, in case your users only send to one address):</p><pre>{<br>    :name =&gt; &#39;Apple&#39;,<br>    :street1 =&gt; &#39;One Apple Park Way&#39;,<br>    :city =&gt; &#39;Cupertino&#39;,<br>    :state =&gt; &#39;CA&#39;,<br>    :zip =&gt; &#39;95014&#39;,<br>    :country =&gt; &#39;US&#39;,<br>    :phone =&gt; &#39;+1 (408) 996–1010&#39;,<br>    :email =&gt; &#39;tim<a href="/service/mailto:george@stadiumgoods.com">@apple.com</a>&#39;<br>  }</pre><p>And finally, parcels is an array of such structures:</p><pre>{<br>  length: 10, # or something coming from params<br>  width: 10,<br>  height: 10,<br>  distance_unit: :in,<br>  weight: 3,<br>  mass_unit: :lb,<br>}</pre><p>After passing all these data and calling Shippo::Shipment.create you should get a shipment object which contains a rates attribute ( shipment.rates ).</p><h4>Create shipping label (transaction) based on selected rate</h4><p>We have a rate selected by the user, and we instantiated it (let’s say in a controller) in @selected_shipping_rate. Now just do this:</p><pre>transaction = Shippo::Transaction.create(<br>  rate: <a href="http://twitter.com/selected_shipping_ra">@selected_shipping_ra</a>te[&#39;object_id&#39;],<br>  label_file_type: &quot;PDF&quot;,<br>  metadata: <a href="http://twitter.com/ticket">@ticket</a>.token.to_s, # pass any additional data if needed<br>  async: false<br>)</pre><p>You should confirm whether it was successful or not by checking transaction[&quot;status&quot;] . It should be SUCCESS or something from the <a href="https://goshippo.com/docs/reference/rb#transactions">available statuses</a>. You may also be interested in transaction[&quot;tracking_number&quot;] and transaction[&quot;label_url&quot;] (the URL of the shipping label PDF file).</p><h4>Single call label creation</h4><p>You might want to create a shipping label with a single Shippo API call. Well, you can do this! In this case, you’ll use a concrete shipping carrier, like <strong>FedEx</strong>.</p><p>So this API call looks like a combination of two calls we did previously: carrier_account is a Carrier object id — you can get it with <a href="https://goshippo.com/docs/reference/rb#carrier-accounts-list">https://goshippo.com/docs/reference/rb#carrier-accounts-list</a> — and servicelevel_token is a corresponding token from this <a href="https://goshippo.com/docs/reference/rb#servicelevels">service levels enum</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7GF7uRIsTPEyES1LrNvmQ.png" /></figure><h4>Carriers settings</h4><p>For working carriers, you need to pass all the required data. This depends on the concrete shipping provider. Shippo<em> </em>has very good description <a href="https://goshippo.com/docs/carriers">page</a> about what’s needed. For example, for setting up FedEx you need to get from them at least the meter number and account number.</p><p><strong>One tricky thing about FedEx</strong><em>: </em>their test server is not very stable (and that fact was confirmed by Shippo support). So, sometimes you’ll be able to create shipments and request rates, but sometimes you’ll get this response: “FedEx API did not respond. Please try again in a few minutes.”</p><h4>Tracking shipments</h4><p>And finally, you might want to be like a “big brother” who is watching your shipments :-) Then you need to start tracking shipments so you’ll know when they have actually been sent and delivered.</p><p>Shippo<em> </em>has a Shippo::Track API for such a purpose, and webhooks that you can receive via HTTP. First, you should register that you’re going to track some shipment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5HyAafXK7fEIek134ZAqDg.png" /></figure><p>@shipping_label is our own object that we store in the database: we saved it after the successful Shippo transaction (shipping label) creation.</p><p>Second, you need to have a webhooks handler: in terms of Rails, you need to add a route and a controller.</p><p>Shippo will then send you data about tracking status updates, so you can then update the status information in the database and have everything in sync.</p><pre># Shippo webhook in routes.rb<br>post &#39;/shippo_webhook&#39; =&gt; &#39;shippo#track_shipment&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvrHEqe6TA4OqyK7wP3qIA.png" /></figure><p>Don’t forget to test this in development with your favorite development tunneling tool like ngrok or localtunnel . And of course, you need to login to your Shippo account and specify the URL that will receive webhooks and what types of webhooks they are.</p><h3>Conclusion</h3><p>Shippo is a great solution for pretty much anything when you need some shipping capabilities in your app. That’s why I would choose it for my next project.</p><p>If there’s something competitive on the market, let me know in comments. I’d love to hear about something really cool for shipping tasks.</p><p><em>If you liked this post, please click on </em>✋ <em>to spread the word.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=725bcd9ce6f8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/check-out-this-api-that-helps-you-ship-ecommerce-products-through-multiple-mail-services-725bcd9ce6f8">I discovered an API that helps you ship ecommerce products through multiple courier services.</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a multi-tenant app is easy…if you have an apartment!]]></title>
            <link>https://medium.com/free-code-camp/building-a-multi-tenant-app-is-easy-if-you-have-an-apartment-3465f6eda85b?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3465f6eda85b</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Wed, 20 Dec 2017 16:17:55 GMT</pubDate>
            <atom:updated>2017-12-20T16:17:55.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WXq8WqcR24xYG9PlOdwktw.jpeg" /></figure><p>These days, more and more startups are appearing on the <em>SaaS</em> market. For their apps, they have several development approaches to choose from. And one of the technical models is the <em>multi-tenancy</em> or <em>multi-tenant</em> app. If you’re going to share all your software with your startup customers — either with the ability to have separate data/content and URLs (say, <em>SaaS</em>), or just part of it — you need a <em>multi-tenant</em> app.</p><p>This is not the only choice: I should mention other approaches, but let’s just mention them — a comparison of different approaches could be a good topic for the next article.</p><p>Here is my list (ordered by implementation complexity):</p><ul><li>URL path-based <em>SaaS</em>. Easiest one. Single domain, single DB, etc. Application-level restrictions for data.</li><li>Multi-tenant <em>SaaS</em>. Medium complexity. Subdomain-based or domain-based. Multiple databases or schemas. Database-level restrictions for data.</li><li>Virtualization-based <em>SaaS</em> (thanks to <em>Docker</em> and friends!). High level of complexity. Subdomain/domain-based. Multiple apps and DB copies. Virtualization-level restrictions for data.</li></ul><h3>Multi-tenancy</h3><p>So what is <em>multi-tenancy</em>? <em>Multi-tenancy</em> is a software development architecture approach in which each client gets their own app configuration and data (strictly or softly isolated from other clients). Each “instance” is called a “<em>tenant.</em>”</p><p>Over the past few years, I’ve worked on several multi-tenant apps (I mostly did <em>multi-tenancy</em> from scratch). And even now, I’m working on two <em>multi-tenant</em> apps.</p><p>Let’s move on from the introduction and theory to the practice, and look at what could be used for <em>multi-tenant</em> apps in the world of <em>Ruby on Rails</em>.</p><h3>Apartment</h3><p>This is number one for <em>Ruby on Rails</em> apps. Let’s add it to <em>Gemfile</em>:</p><pre>gem ‘apartment’</pre><p>After bundle install you need to run a generator so you’ll get some basic configuration templates:</p><pre>bundle exec rails generate apartment:install</pre><p>Now you have config/initializers/apartment.rb where you can tweak how you want to use <em>Apartment</em>. The most important things that should be configured are: how “<em>apartment</em>” will know how to identify your tenants for storing data (we’ll assume it’s a <em>PostgreSQL</em> database where each <em>PostgreSQL</em> schema is a separate tenant), and how to show data depending on <em>HTTP</em> requests.</p><p>Ok, in one app I’m developing I have a Website <em>ActiveRecord</em> model with slug field. Therefore, the first setting looks like this, and each website is a <em>tenant</em>:</p><pre>config.tenant_names = lambda { Website.pluck(:slug) }</pre><p>Let’s say I decided to treat any subdomain as the website’s slug. So if I have a Website with my-awesome-website slug, then my-awesome-website.example.com will serve data from my-awesome-data DB schema. To have this behavior we need:</p><pre># require &#39;apartment/elevators/subdomain&#39;</pre><pre>...<br>Rails.application.config.middleware.use Apartment::Elevators::Subdomain</pre><p>The third setting you might need is excluding some models that should be shared across all <em>tenants</em>. Like Website itself from my example:</p><pre>config.excluded_models = %w{ Customer Website Plan Feature PlanFeature }</pre><h3><strong>Advanced tips</strong></h3><h4>Custom Elevator Class</h4><p>Ok, we’ve built a subdomain-based <em>multi-tenant</em> app, but what if we need a custom domains feature for our customers? But it still should be accessible from the subdomain as well. Then we need a custom elevator class — similar to what we’ve used above — Apartment::Elevators::Subdomain .</p><p>Elevator class should decide, based on the current request, what <em>tenant</em> (database/schema) should be used. In case we have a domain field on the Website model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*bzMJCW4VkxdHvmaMkBchPA.png" /></figure><p>Here we’ve created a custom elevator class (in lib/apartment/elevators/active_website.rb) inherited from Subdomain elevator and overridden by parse_tenant_name that should return tenant name based on a request. So first we call super and save the result in tenant variable. If we have a website with the domain set up as a requested domain, we’ll return such a slug (<em>tenant</em>). Otherwise, we fall back to subdomain.</p><h4>Not Found Page for incorrect tenants</h4><p>Task #2: what if some non-existent tenant was requested? Someone makes a request to no-such-tenant.example.com, but we don’t have such a database schema. The best thing we could do is to respond with some 404 page. This task is not about apartment directly, but is closely related.</p><p>We’ll enhance our elevator class like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w8IeqIQ9qngbN6mUEqFw3w.png" /></figure><p>What is ::NotFound you may ask? This is a simple middleware that I use for this purpose. Placed in app/middlewares it’s written as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q9PpJqtaN1cQ3wl1qUHkLg.png" /></figure><p>Task solved — client is happy!</p><h4>Excluded Subdomains</h4><p>If you need one or several subdomains to treat as a public <em>tenant</em> (not a client’s) and not to switch on requests for it, you would use the excluded_subdomains option. This option is available for Subdomain elevator and its subclasses of course:</p><pre>Apartment::Elevators::ActiveWebsite.excluded_subdomains = [&#39;app&#39;]</pre><h4>Seeding data</h4><p>If your <em>tenants</em> are already created, you could initialize them with data using db/seeds.rb. With rails db:seed it will be applied to each tenant.</p><p>But what if you need to initialize a just-created <em>tenant</em> (via Apartment::Tenant.create) with some data programmatically? Well, you could still do this by switching to <em>tenant</em> and creating some models (or executing the <em>Rake</em> task programmatically).</p><p>Look how spree_shared gem does this for popular spree gem (the code below is an updated version because spree_shared doesn’t work with the current <em>Spree</em> version):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P81laZ_H2bufXaihV_6TjQ.png" /></figure><p>If you need seeds to be applied to each <em>tenant</em>, you might write it this way (again, a modified example from spree_shared):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SZtJcXLDKleFtZUjuszJjw.png" /></figure><h4>Wrapping tenant creation into transaction</h4><p>The next step is wrapping the <em>tenant</em> creation into the transaction block, because we know that every <em>tenant</em> has a corresponding database model (Website or Customer ), and we want to make sure both the model instance and the <em>tenant</em> were created. This will make our app more transactional, and we won’t have a DB <em>tenant</em> without the corresponding model instance or vice versa.</p><p><em>Service Objects</em> comes to the rescue! For our hosted websites app, we might write something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*TV44g0JJgbKpx8tF3eqa4Q.png" /></figure><p>We need to handle possible exceptions: if a record or <em>tenant</em> wasn’t created for some reason.</p><h3>Conclusion</h3><p>Well, as you may see, developing <em>multi-tenant</em> apps is easy enough if you have good tools like the apartment gem. Let me know in the comments your cases of apartment appliance. Especially non-standard ones.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3465f6eda85b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/building-a-multi-tenant-app-is-easy-if-you-have-an-apartment-3465f6eda85b">Building a multi-tenant app is easy…if you have an apartment!</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Ruby on Rails Tips You Probably Don’t Know]]></title>
            <link>https://medium.com/hackernoon/5-ruby-on-rails-tips-you-probably-dont-know-8b80b4a0890f?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b80b4a0890f</guid>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ruby-on-rails-tips]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Tue, 14 Nov 2017 19:55:05 GMT</pubDate>
            <atom:updated>2019-04-30T09:41:54.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hl-Lr3zsvPIWn-HtQGVYyg.jpeg" /></figure><p>Since I started working with <a href="https://hackernoon.com/tagged/ruby"><em>Ruby</em></a><em> on </em><a href="https://hackernoon.com/tagged/rails"><em>Rails</em></a>, and after several years of using it passed by, I can’t stop wondering when I discover something new in <em>Ruby</em> world. Yes, this is how it works — you know, <em>Ruby</em> is for developer happiness (beyond this there are some other principles) and each year of using it and finding out new stuff supports this feeling inside.</p><p>Ok, so this article shares a bunch of stuff I discovered recently. They are rarely used methods and not a must-have in your code, mostly “syntax sugar”, but anyway it will make your code much cleaner. Some stuff is just new changes appeared with new <em>Ruby</em> or <em>Rails</em> versions.</p><h3>Hash#dig</h3><p>I didn’t meet this in anyone’s code for 7 years of RoR development and discovered recently. And it’s obvious why :-) The first <em>Ruby</em> version I worked with was 1.8, but this method was introduced in 2.3.</p><p>How many times did you do something like this:</p><pre>... if params[:user] &amp;&amp; params[:user][:address] &amp;&amp; params[:user][:address][:somewhere_deep]</pre><p>Think of dig as kind of safe navigation operator &amp;. but for <em>Hash</em> objects. So now you could rewrite such things:</p><pre>... if params.dig(:user, :address, :somewhere_deep)</pre><h3>Object#presence_in</h3><p>This one I found in the very good article about <a href="https://medium.flatstack.com/query-object-in-ruby-on-rails-56ea434365f0">Query Objects in Ruby on Rails</a>. It allows you to replace conditionals (often ternary) with single method call when you don’t actually need a boolean result of inclusion check, but a checked object itself. For example, your code looks like:</p><pre>sort_options = [:by_date, :by_title, :by_author]<br>...</pre><pre>sort = sort_options.include?(params[:sort]) <br>  ? params[:sort] <br>  : :by_date</pre><pre># Another option<br>sort = (sort_options.include?(params[:sort]) &amp;&amp; params[:sort]) || :by_date</pre><p>Doesn’t this look better?</p><pre>params[:sort].presence_in(sort_options) || :by_date</pre><h3>Module#alias_attribute</h3><p>Well, I found this very useful when I worked on a project with a legacy database. It had a table with weird column names like SERNUM_0, ITMDES1_0 and other. We mapped this table to an <em>ActiveRecord </em>model and instead of writing queries and scopes on it like WeirdTable.where(SERNUM_0: ‘123’) , we came up to using alias_attribute since it doesn’t just generate getter and setter (as well as a predicate method), but works in queries as well:</p><pre>alias_attribute :name, :ITMDES1_0<br>...<br>scope :by_name, -&gt; (name) { where(name: name) }</pre><h3>Object#presence</h3><p>This one is more popular than others. There’s pretty good explanation on <a href="https://apidock.com/rails/Object/presence">ApiDock</a>. So, object.presence is equivalent to:</p><pre>object<strong>.</strong>present? <strong>?</strong> object <strong>:</strong> nil</pre><h3>Module#delegate</h3><p>Still rarely used by most of the developers for some reason. The main purpose of this method is loose coupling and following the <a href="https://en.wikipedia.org/wiki/Law_of_Demeter"><em>Law of Demeter</em></a>. One of the good articles on this theme coming to mind is Avdi Grimm’s <a href="http://www.virtuouscode.com/2011/07/05/demeter-its-not-just-a-good-idea-its-the-law/">“Demeter: It’s not just a good idea. It’s the law.”</a> Also, check out short <a href="https://rails-bestpractices.com/posts/2010/07/24/the-law-of-demeter/">Rails Best Practices article</a> on utilizing delegate in context of applying the <em>Law of Demeter</em>. The snippet below describes this as well:</p><pre>class Profile &lt; ApplicationRecord<br>  belongs_to :user</pre><pre>  delegate :email, to: :user<br>end</pre><pre>...<br>profile.email # equivalent to profile.user.email</pre><p>I hope you’ve just discovered some of these tips above and find them useful. Happy coding!</p><p><em>If you liked this post, please click on </em>✋ <em>to spread the word.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b80b4a0890f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/5-ruby-on-rails-tips-you-probably-dont-know-8b80b4a0890f">5 Ruby on Rails Tips You Probably Don’t Know</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[How to create a blog with APIQ CMS]]></title>
            <link>https://medium.com/hackernoon/how-to-create-a-blog-with-apiq-cms-e6ccfc5f5e63?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6ccfc5f5e63</guid>
            <category><![CDATA[cms]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[saas]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Thu, 05 Oct 2017 20:08:03 GMT</pubDate>
            <atom:updated>2019-04-30T09:41:56.544Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qv7TugYXiHMtqsTW-dxpuA.jpeg" /></figure><p>Everyone knows that blog is the number one item in content marketing strategy.</p><p>There are a plenty places where you could setup your blog and start writing. But what if you need some custom content model for blogging? Then you’ll probably should choose self-hosted or cloud solution giving more flexibility in building your specific content model.</p><p>Today I’m going to show you how to make a blog using <a href="https://www.apiq.io/">APIQ CMS</a>. Let’s skip <a href="https://hackernoon.com/tagged/apiq">APIQ</a> installation steps and consider we already have blank <a href="https://hackernoon.com/tagged/cms">CMS</a> installation. By following steps below, you’ll get fully functional blog.</p><h3>Pick HTML template</h3><p>First, you need to have HTML either downloaded or prepared from scratch by HTML coder. I picked <a href="https://freehtml5.co/verb-free-html5-bootstrap-template-for-blog-websites/">this one</a>:</p><h3>Create first temlate</h3><p>Ok, in downloaded template archive I have index.html. I’m going to use it as a template for blog index page. Just paste html content, give template a name, and click “Add template”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LVmxJva8_PcRQpyx.jpg" /></figure><h3>Upload assets</h3><p>Now we need to upload all assets (under “Assets” section) we have in downloaded template, i.e. images, stylesheets and javascripts. You could select multiple at once. For my template, I uploaded js folder content first, then fonts, images and css.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HNdAjkDB6zRH9R2u.jpg" /></figure><p>Now we need to fix fonts URLs (like url(https://medium.com/&quot;../fonts/icomoon/icomoon.eot&quot;)) or other URLs in our stylesheets by inserting correct URLs from “Assets” section.</p><p>Next, let’s find in template’s content a place where page content should be injected and insert there special Liquor instruction {% yield %}. I’m going to insert it after &lt;div id=&quot;gtco-main&quot;&gt;&lt;div class=&quot;container&quot;&gt; and remove all content until closing tags.</p><h3>Create index page</h3><p>Now let’s create index page that uses just created template and paste there the content we’ve cut earlier from template. Once we have this in place, you should see something like this at website’s root:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*teZJF9v4qxKwR_SN.jpg" /></figure><h3>Create first model</h3><p>Next I’m going to make index page dynamic by introducing some models. First, I want main menu (Develop, Business and etc.) to represent blog categories. Let’s create Category model under APIQ Models section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Q2jFa5mkR7lV4Zy.jpg" /></figure><p>Now let’s output categories as menu snippet. I extracted &lt;ul&gt;...&lt;/ul&gt; from template into new snippet with “Menu” name and “menu” slug, and included this snippet in template with:</p><pre>{% include &#39;menu&#39; %}</pre><p>And finally, I modified snippet like this (name is the only property I added to Category model, permalink is built-in property):</p><pre>&lt;ul&gt;<br>  {% for category in: models.categories do: %}<br>    &lt;li&gt;&lt;a href=&quot;/{{ category.permalink }}&quot;&gt;{{ category.name }}&lt;/a&gt;&lt;/li&gt;<br>  {% end for %}<br>&lt;/ul&gt;</pre><h3>Create Post model</h3><p>Ok, I can add categories and have dynamic menu based on them. Let’s add second model — Post - and set up relationship between it and Category model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BWEqNBuTRCCqXV-6.jpg" /></figure><p>After this, I added one post belonging to “Development” category. Now I’m going to show the latest post as wide banner (as suggested by template design). I updated template’s content like this (notice how I fetched the most recent post ):</p><pre>{% assign recent_post = models.posts.order(&#39;created_at desc&#39;).first %}<br>&lt;header id=&quot;gtco-header&quot; class=&quot;gtco-cover&quot; role=&quot;banner&quot; style=&quot;background-image:url(https://medium.com/%7B%7B%20recent_post.image%20%7D%7D);&quot; data-stellar-background-ratio=&quot;0.5&quot;&gt;<br>  &lt;div class=&quot;overlay&quot;&gt;&lt;/div&gt;<br>  &lt;div class=&quot;container&quot;&gt;<br>    &lt;div class=&quot;row&quot;&gt;<br>      &lt;div class=&quot;col-md-7 text-left&quot;&gt;<br>        &lt;div class=&quot;display-t&quot;&gt;<br>          &lt;div class=&quot;display-tc animate-box&quot; data-animate-effect=&quot;fadeInUp&quot;&gt;<br>            &lt;span class=&quot;date-post&quot;&gt;{{ recent_post.created_at | strftime format: &#39;%d %B %Y&#39; }}&lt;/span&gt;<br>            &lt;h1 class=&quot;mb30&quot;&gt;<br>              &lt;a href=&quot;/{{ recent_post.permalink }}&quot;&gt;{{ recent_post.title }}&lt;/a&gt;<br>            &lt;/h1&gt;<br>            &lt;p&gt;&lt;a href=&quot;/{{ recent_post.permalink }}&quot; class=&quot;text-link&quot;&gt;Read More&lt;/a&gt;&lt;/p&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/header&gt;</pre><p>And now, below this header I’d like to list all posts. This is the only content of index page for this purpose:</p><pre>&lt;div class=&quot;row row-pb-md&quot;&gt;<br>  &lt;div class=&quot;col-md-12&quot;&gt;<br>    &lt;ul id=&quot;gtco-post-list&quot;&gt;<br>      {% for post in: models.posts.order(&quot;created_at desc&quot;) do: %}<br>        &lt;li class=&quot;full entry animate-box&quot; data-animate-effect=&quot;fadeIn&quot;&gt;<br>          &lt;a href=&quot;/{{ post.permalink }}&quot;&gt;<br>            &lt;div class=&quot;entry-img&quot; style=&quot;background-image: url(https://medium.com/%7B%7B%20post.image%20%7D%7D)&quot;&gt;&lt;/div&gt;<br>            &lt;div class=&quot;entry-desc&quot;&gt;<br>              &lt;h3&gt;{{ post.title }}&lt;/h3&gt;<br>              {{ post.preview }}<br>            &lt;/div&gt;<br>          &lt;/a&gt;<br>          &lt;a href=&quot;/{{ post.category.permalink }}&quot; class=&quot;post-meta&quot;&gt;{{ post.category.name }}  &lt;span class=&quot;date-posted&quot;&gt;{{ post.created_at | strftime format: &#39;%d %B %Y&#39; }}&lt;/span&gt;&lt;/a&gt;<br>        &lt;/li&gt;<br>      {% end for %}<br>    &lt;/ul&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1IwJlV-57cWCb6ww.jpg" /></figure><p>Index page should look like this (isn’t it cool?).</p><h3>Create template pages for Category and Post model</h3><p>This is our final step: we want to have category page and post page so our permalink properties will start working and point to concrete category or post. Let’s create these 2 pages as children of index page. The most tricky thing here is to enable Use as object template property and choose representable object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rmfACH_7UL3pwFPI.jpg" /></figure><p>Don’t forget to put some html displaying Category and Product in corresponding pages. In these pages you have access to current object via item object. I.e. you could output post’s content like this (on Post page):</p><pre>&lt;h1&gt;{{ item.title }}&lt;/h1&gt;<br>{{ item.content }}</pre><p>On Category page there’s one more trick for fetching current category’s posts (because I used belongs to field):</p><pre>{% assign posts = models.posts.find_all_by(category: item.id).order(&quot;created_at desc&quot;) %}<br>{% for post in: posts do: %}<br>...</pre><p>And that’s it — now I have completely dynamic and working Category page and Product page! And that’s all for this tutorial: we have pretty basic blog functionality with a lot of possibilities to improve it further. For example, you might add Published field to Post model and list only published posts by default, or maybe introduce posts tagging. Your imagination is the only limit, so just try it ;-)</p><p>You could find my final result at: <a href="http://patient-forest-605.app.apiq.io/">http://patient-forest-605.app.apiq.io</a></p><p><em>If you liked this post, please click on </em>✋ <em>to spread the word.</em></p><p><em>This </em><a href="https://www.apiq.io/2017/09/26/how-to-create-a-blog-with-apiq-cms/"><em>article</em></a><em> was originally published on APIQ CMS Blog.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6ccfc5f5e63" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-to-create-a-blog-with-apiq-cms-e6ccfc5f5e63">How to create a blog with APIQ CMS</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[Why Mentoring and Teaching Is Also Learning]]></title>
            <link>https://medium.com/hackernoon/why-mentoring-and-teaching-is-also-learning-eb9acfd4a4d2?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb9acfd4a4d2</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[teaching]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[mentorship]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Tue, 08 Aug 2017 20:19:10 GMT</pubDate>
            <atom:updated>2019-04-30T09:41:55.451Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9e3cGMv4E8C_7iUtPhlcTw.jpeg" /></figure><p>I’ve been teaching and mentoring trainees and junior-level developers since I’ve started working as <a href="https://hackernoon.com/tagged/cto">CTO</a> several years ago. There were several ways of doing this like Ruby on Rails offline courses called “Ruby Ninja” we organized locally for students, small developers group <a href="https://hackernoon.com/tagged/learning">learning</a> for local companies, individual Skype lessons, and courses, and finally online mentoring via HackHands or Codementor these days.</p><p>The first time I’ve taught someone (and “someone” was actually a class of 10 people) was a need of Ruby on Rails developers for our agency (to be honest) and I can’t say it was really comfortable for me. Rather, that was an exit from a comfort zone. After several lessons, I’ve felt more confident and understood the first benefit of teaching:</p><blockquote><strong>While teaching, you’ll improve and polish your public speaking skills</strong></blockquote><p>Next time, I told in-house course for a small group of company’s developers. That was a more special course (based on their wishes) and more advanced (compared to Ruby on Rails basics course for students) with some pieces of knowledge I didn’t know myself well enough. After completing that course, I’ve covered knowledge gaps and felt I’ve reached to a new level in Ruby (and actually course was mostly about Ruby, but not Rails). And came to probably the most obvious benefit of teaching:</p><blockquote><strong>While teaching, you’ll improve your primary skills</strong></blockquote><p>After spending more time on teaching and mentoring, I started to notice which people are more motivated, self-disciplined, talented, and which are don’t endeavor enough, try to find reasons for not doing and justifying themselves. And what’s good is the more you work with people (applies not just to teaching, but any communicative work), the more you discover these special behavioral triggers and quickly distinguish one type of learner from another by recognizing such triggers. A little bit of psychology lesson comes from this:</p><blockquote><strong>While teaching, you’ll learn people better</strong></blockquote><p>So, while doing regular learning, consider teaching someone at the same time — and you’ll double your skills set and learn speed.</p><p><em>If you liked this post, please click on ♥ to spread the word.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb9acfd4a4d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/why-mentoring-and-teaching-is-also-learning-eb9acfd4a4d2">Why Mentoring and Teaching Is Also Learning</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[Headless CMS Or Coupled CMS]]></title>
            <link>https://medium.com/hackernoon/headless-cms-or-coupled-cms-9952212249ca?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9952212249ca</guid>
            <category><![CDATA[website-development]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[cms]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[drupal]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Wed, 26 Jul 2017 20:14:05 GMT</pubDate>
            <atom:updated>2019-04-30T09:41:56.023Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why not both in one?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLqioRi4mM3gTf-On0ZRoA.jpeg" /></figure><p>Headless <a href="https://hackernoon.com/tagged/cms">CMS</a> or Coupled (database-driven) CMS? You’ve probably heard about this mess before (there’s a lot of articles on the internet) and want clarification on what CMS software to choose and especially in which case. The last one is the main point: your choice completely depends on what’s your content for.</p><h3>Headless CMS</h3><p>Headless CMS — content <a href="https://hackernoon.com/tagged/management">management</a> system that assumes only content layer, without representation layer. You create and organize content for later delivery to your website, mobile app, anything else.</p><p>Therefore, pros and cons obviously will look like this:</p><h4>Pros:</h4><ul><li>Separation of content and its presentation</li><li>Independency from presentation level: choose any frontend serving technology you like — static website generators, plain HTML and JS, web frameworks</li><li>Single place for your content: use it on any number of websites or mobile apps</li><li>Developers like APIs — not an obvious advantage, but makes sense because not every developer likes to learn special templating language</li></ul><h4>Cons:</h4><ul><li>You need one more layer to be managed somehow — presentation (so you probably need infrastructure: version control, web server, etc.)</li><li>Isolated costs: CMS itself payment, developer’s job payment, infrastructure payment likely</li><li>More “expensive” developer: pretty clear that developer should be more qualified and will spend more time</li><li>Could take time: you need to learn API, integrate with it, debug and test</li></ul><h3>Coupled CMS</h3><p>Coupled CMS — content managing system that handles both layers: content and presentation. These are old-school players like Wordpress, Drupal or similar. The idea is pretty similar — your website should be completely served by one system.</p><p>And here pros and cons for such type of CMS:</p><h4>Pros:</h4><ul><li>Solid system: content and its presentation (HTML) coupled together</li><li>Clear costs for website development: one system — one account — one payment</li><li>Low entry threshold for developers</li><li>Quick result: “API” already tested and integrated, you’ll see changes immediately</li></ul><h4>Cons:</h4><ul><li>Dependency on presentation layer: possibilities are limited</li><li>Website-only content (in case of API absence): you can’t use the same content in mobile apps of somewhere else</li><li>Learning for developers: they would prefer favorite language over special one</li></ul><p>As you may notice, some pros of first are cons for second and vice versa. Depending on your business tasks and the list above you can decide which one of these CMS types to choose. So these systems look like counterpart for each other. What if just to combine benefits from both eliminating all disadvantages by the way? Sounds interesting for me, and may be a good reason for researching and implementing in <a href="https://www.apiq.io/">APIQ CMS</a>.</p><p>What do you think about this possibility and does it make sense for you?</p><p><em>This </em><a href="https://www.apiq.io/2017/07/04/headless-cms-or-coupled-cms/"><em>article</em></a><em> was originally published on the </em><a href="https://www.apiq.io/blog"><em>APIQ CMS blog</em></a><em>.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9952212249ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/headless-cms-or-coupled-cms-9952212249ca">Headless CMS Or Coupled CMS</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[How to Build SaaS Using Docker-based Tools — Part 2]]></title>
            <link>https://medium.com/hackernoon/how-to-build-saas-using-docker-based-tools-part-2-529615ac6db0?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/529615ac6db0</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Wed, 19 Jul 2017 14:06:57 GMT</pubDate>
            <atom:updated>2019-04-30T09:41:56.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XFdAfu8xfUd9d8aKIJylzA.jpeg" /></figure><p>This is the second part of my <a href="https://hackernoon.com/tagged/docker">Docker</a> orchestration tools review. As a sequel of <a href="https://medium.com/@igor.petrov/how-to-build-saas-using-docker-based-tools-part-1-ceb1a96e0907">How to Build SaaS Using Docker-based Tools — Part 1</a>. Let’s try <a href="http://kontena.io/">Kontena</a> next.</p><h3>Kontena CLI</h3><p>The first impression of <a href="https://hackernoon.com/tagged/kontena">Kontena</a> is “really cool” and “very developer friendly”. The first thing you need to do is to install Kontena CLI. I’ve installed it both on MacOS and Ubuntu by following the documentation and didn’t have any problems with that. After installation, you can start using it right away because it’s very simple to use and <a href="https://kontena.io/docs/">documentation</a> is good enough (as opposed to Docker Cloud CLI).</p><p>For using Kontena, you need to have a master node — this is a machine that you could bootstrap on any cloud provider and that could be used as a central point for managing other nodes, grids, and services.</p><h3>Supported cloud providers</h3><p>At this moment, as mentioned in docs, Kontena supports 5 cloud providers: AWS, Azure, Digital Ocean, Packer and UpCloud. I’ve tried to setup it with Amazon Web Services. To start installing you master node on AWS, you need to setup AWS user with security credentials. Just go to AWS IAM and create a new user. For example, “kontena-master” or any other name. Make sure to check “Programmatic access” checkbox because you need to have access and secret keys. Then set permissions for the just created user by selecting <strong>“AmazonEC2FullAccess”</strong> policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1m_OhqRD6TRDtpKVx431Jw.png" /></figure><p>On the last step, you’ll get “Access Key ID” and “Secret access key”. Save it somewhere in your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*sF34otzKSeVV_91NiaIAKQ.png" /></figure><p>But that’s not all: you need to have an AWS EC2 Key Pair — these are keys you need for Kontena to be able to login into your nodes. Just switch your AWS Console to Amazon EC2 service and create a key pair. Once done, now you have all information to setup Kontena master node on AWS. Lets’ do this by using CLI command described in docs (don’t forget to change — storage and — type options according to your needs):</p><pre>$ kontena aws master create \<br>  --access-key &lt;aws_master_key&gt; \<br>  --secret-key &lt;aws_secret_key&gt; \<br>  --key-pair &lt;aws_key_pair_name&gt; \<br>  --type m3.medium \<br>  --storage 100 \<br>  --region eu-west-1</pre><p>During the process of master node creation, you will be asked for several questions. One is about authentication for accessing your Kontena managed infrastructure and recommended variant at this point is to go with authentication via Kontena Cloud. This is what I’ve chosen as well. But besides Kontena Cloud, any other OAuth2-compatible authentication providers could be used.</p><h3>Grids, Stacks and Services</h3><p>Let’s create the first grid: recommended initial node counts are 3,5,7 — according to etcd rules. These nodes will form a etcd cluster infrastructure — main nodes responsible for your cluster stability and failover.</p><pre>$ kontena grid create --initial-size=&lt;initial_node_count&gt; aws-grid</pre><pre># Now let&#39;s create AWS EC2 node in the current grid</pre><pre>$ kontena aws node create \<br>  --access-key &lt;aws_master_key&gt; \<br>  --secret-key &lt;aws_secret_key&gt; \<br>  --key-pair &lt;aws_key_pair_name&gt; \<br>  --type m4.medium \<br>  --storage 100 \<br>  --zone a \<br>  --region eu-west-1</pre><p>After your grid is ready for operating, you are becoming closer to prepare your infrastructure. Let’s say you have a web app that needs a database and of course, web server/load balancer. I’ve come to using micro-services approach and having each component in the separate container. There are two ways of organizing your containers:</p><ul><li>Via separate independent <a href="https://www.kontena.io/docs/using-kontena/services.html">Services</a> (that could be linked together)</li><li>Via <a href="https://www.kontena.io/docs/using-kontena/stacks.html">Stacks</a> (which is the preferred way and recommended by Kontena team)</li></ul><p>So Kontena Stack is actually an organized group of Services and Service is a group of containers using the same Docker image. The second option is what I’ve chosen and started preparing my stacks: stack for a web app, stack for DB, stack for a load balancer. You could use pre-defined Kontena images for database and load balancer, but you need to pack your web app into an image as well. I’ve already had one for my web app — APIQ CMS. So my services are Ruby on Rails app packed into Docker image, PostgreSQL and Load Balancer (web server with public HTTP exposure). Here are examples of my Stacks definition (you define it using YAML format and according to <a href="https://www.kontena.io/docs/references/kontena-yml.html">Kontena.yml</a>)</p><pre># lb-stack.yml<br>stack: apiq/lb<br>description: APIQ LB<br>expose: internet_lb<br>services:<br>  internet_lb:<br>    image: kontena/lb:latest<br>    ports:<br>      - 80:80<br>      - 443:443    <br>    deploy:<br>      strategy: daemon</pre><p>Need to note expose: option here — this allows you to expose your service to other stacks.</p><pre># db-stack.yml<br>stack: apiq/db<br>description: APIQ DB<br>expose: db<br>services:<br>  db:<br>    image: postgres:latest<br>    stateful: true</pre><p>A database is a stateful service and I guess you want to store you databases data somewhere and database nodes removal won’t affect your data.</p><pre># kontena.yml<br>stack: apiq/core<br>description: APIQ Core<br>variables:<br>  secret_token: # variable name<br>    type: string  # type (string, integer, boolean, uri, enum)<br>    from: # where to obtain a value for this variable<br>      random_string: 64 # still no value, auto generate a random<br>    to:<br>      env: SECRET_TOKEN # send this value to the vault on kontena master<br>services:<br>  app:<br>    image: webgradus/kms<br>    command: bundle exec rails s -p 3000 -b &#39;0.0.0.0&#39;<br>    environment:<br>      SECRET_TOKEN: ${SECRET_TOKEN}<br>      RAILS_SERVE_STATIC_FILES: &#39;true&#39;<br>      KONTENA_LB_INTERNAL_PORT: 3000<br>      KMS_ASSETS_STORAGE: &#39;fog&#39;      <br>    hooks:<br>      post_start:<br>        - name: db_create<br>          cmd: rails db:create<br>          instances: 1<br>          oneshot: true<br>        - name: db_migration<br>          cmd: rails db:migrate<br>          instances: 1<br>    links:<br>      - lb/internet_lb<br>      - db/db<br>    ports:<br>      - &quot;3000:3000&quot;<br>    secrets:<br>      - secret: AWS_ACCESS_KEY_ID<br>        name: AWS_ACCESS_KEY_ID<br>        type: env<br>      - secret: AWS_SECRET_ACCESS_KEY<br>        name: AWS_SECRET_ACCESS_KEY<br>        type: env<br>      - secret: AWS_REGION<br>        name: AWS_REGION<br>        type: env</pre><p>Let’s review this in details. First, variables section. This section allows you to define variables and the way of obtaining them that could be used in Kontena.yml. In my Stack file, I’m generating a random string and pass it to SECRET_TOKEN environment variable (that should be specified for the app). command defines the way app should be launched, environment — environment variables for an app as well as special Kontena variables (for example, KONTENA_LB_INTERNAL_PORT that links web app and load balancer). Next, I’ve defined several hooks executing Rails-specific tasks necessary for correct app bootstrapping — database creation and migration. It’s pretty clear that links section links app service with db and internet_lb services exposed from first two stacks. And secrets section is what Kontena Vault is responsible for — you’re specifying keys for API or database passwords accessible on the Grid level. In my example, I’m using Amazon S3 service in my web app and want any app service node to have access to Amazon credentials. Prepare your secrets by saving them into Vault:</p><pre>$ kontena vault write AWS_REGION us-east-1</pre><p>Now we could install prepared stacks on nodes:</p><pre>$ kontena stack install lb-stack.yml<br>$ kontena stack install db-stack.yml<br>$ kontena stack install --name cms-1 kontena.yml</pre><p>After this, I’ve got APIQ CMS instance connected to database and load balancer and available on the web. To find out public IP and check out your app in browser:</p><pre>$ kontena service show cms-1</pre><h3>Where is SaaS actually?</h3><p>Ok, very good question :-) So now after you’ve tried everything using CLI, it’s time to perform the same operations via Kontena Master REST API. Just generate API token and start installing app stacks on your customer demand. Follow <a href="https://kontena.io/docs/api/master/">API documentation</a> and write code in your favorite language.</p><pre>$ kontena master token create --expires-in 0 --token</pre><h3>Kontena Cloud</h3><p>Once you’ve signed up on Kontena Cloud and used it for authentication, you could login anytime and view the dashboard of your Kontena-based infrastructure (absolutely for free now). Really cool! There you’ll find your Grids, Nodes, Services, resources usage, and logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKJ1EjlKXWUUO87OI1u03g.jpeg" /></figure><h3>Community</h3><p>Next thing about Kontena need to mention is very good support from the core team. I’ve asked two questions on Kontena forum and always got responses. Also, there are many new resources appearing: video guides on YouTube, the regular email digest of Kontena news and updates, as well as blog posts.</p><p>In conclusion, I’d recommend to give it a try even if you don’t need to build SaaS. You could just manage infrastructure for your app by easy scaling your services, adding more nodes and grids.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=529615ac6db0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-to-build-saas-using-docker-based-tools-part-2-529615ac6db0">How to Build SaaS Using Docker-based Tools — Part 2</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[Voice Interface For Editing and Publishing]]></title>
            <link>https://medium.com/hackernoon/voice-interface-for-editing-and-publishing-8cfe84ab2a7f?source=rss-ec902fc60d7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cfe84ab2a7f</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[publishing]]></category>
            <category><![CDATA[voice-recognition]]></category>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[writing]]></category>
            <dc:creator><![CDATA[Igor Petrov]]></dc:creator>
            <pubDate>Sat, 08 Jul 2017 20:16:03 GMT</pubDate>
            <atom:updated>2019-04-30T09:41:57.267Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I84ePvekVUSegfItxqdzMw.jpeg" /></figure><p>Today publishing on the web became very simple and intuitive. There are a lot of good looking and functional editors that much closer to the WYSIWYG concept than ever before. For example, Medium’s editor. But anyway, writing an article takes a lot of time. At least, for me. So this article is about thoughts on possibilities of making this process more efficient and productive.</p><p>Here is the process: before writing a word or sentence, I think, trying to build the best sentence or phrase (that actually goes from already accepted thought). Next, I type it with a keyboard. After this, I’ll take a look at just written text to check if everything is correct and maybe some changes needed. Then probably it may need some styling — bold, italic, underscoring, adding links, images and etc.</p><p>My first assumption: what if I’ll think as less time as possible — similar to if I’m speaking with someone. And writing thoughts immediately, leaving them badly organized, but for <a href="https://hackernoon.com/tagged/future">future</a> organization. This should cut off publication writing significantly. And this is what could be done using voice recognition technologies.</p><p>I’ve found many voice dictation services and apps, but most of them just do recognition. What if I’d like to go further and want next steps described above to be processed automatically or via voice commands. For example, automatic grammar correction, applying styles by voice, and editing like “Hey, paste an image with iPhone here” or “Hey, go to the third paragraph and add a link to google.com for word <a href="https://hackernoon.com/tagged/google">Google</a>” or “Hey, cut off the second sentence in the fifth paragraph”. And finally, you’re doing something like “Hey, publish this on Medium, Reddit and LinkedIn”. You probably could end up saving as Word or PDF document straight to your cloud storage provider like Google Drive.</p><p>The second assumption and improvement are to add some AI to this: you often do internet search while writing a publication because you need references or facts so why not to ask a bot for doing this by providing a topic and several keywords.</p><p>Does it sound good only for me? :-) Well, nowadays this is completely possible to create an app or service similar to described above. Would it be useful for you?</p><p><em>If you feel like this may be interesting and is what you’d probably use, leave your thoughts in comments or email me to </em><a href="/service/mailto:garik.piton@gmail.com"><em>garik.piton@gmail.com</em></a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cfe84ab2a7f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/voice-interface-for-editing-and-publishing-8cfe84ab2a7f">Voice Interface For Editing and Publishing</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>
    </channel>
</rss>