<?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 Kilian Valkhof on Medium]]></title>
        <description><![CDATA[Stories by Kilian Valkhof on Medium]]></description>
        <link>https://medium.com/@kilianvalkhof?source=rss-f645a60e8b9f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*V5c_lXrEHW8muXWbpaNvHQ.jpeg</url>
            <title>Stories by Kilian Valkhof on Medium</title>
            <link>https://medium.com/@kilianvalkhof?source=rss-f645a60e8b9f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:32:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kilianvalkhof/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[The box model is not layout]]></title>
            <link>https://blog.prototypr.io/the-box-model-is-not-layout-7734cadef6f9?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7734cadef6f9</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[layout]]></category>
            <category><![CDATA[design-tools]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Mon, 14 Oct 2019 12:24:55 GMT</pubDate>
            <atom:updated>2019-10-15T10:23:44.699Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O9t_qmCItMssVcfpFzXgGA.png" /><figcaption><a href="https://undraw.co/illustrations">Image from Undraw</a></figcaption></figure><p>One term that keeps coming up in the design community as a stand-in for layout is “box model”, for example in “<a href="https://uxdesign.cc/design-tools-are-holding-us-back-1aca266b333e">Why don’t design tools have the box model?</a>” The CSS Box model is a well-defined term though, and it does not do layout.</p><p>If we keep referring to our imaginary perfect layout system in design tools as “box model”, we risk getting the wrong thing.</p><h3>So what’s the box model then?</h3><p>You might already know that in CSS, everything is a box. How these boxes are <em>positioned</em> on a page is layout, but the spacing around their content, with padding, border and then margin, is called the box model.</p><p>The content area of a box contains the actual content of the element, like the text or an image. Around that is placed the padding, which is the spacing <em>inside</em> the box. Then comes the border, which is, well, the border. This together constitutes the <strong>box</strong>, in CSS terms. Then, the margins are the spacing that is applied to the <em>outside</em> of the box, which can be used to separate elements from their neighbors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/0*CNCTFKz6In0mmDVg.png" /></figure><p>This, conceptually, is what the CSS box model is. Notice how none of this could be used to create anything but a nicely spaced single-column layout. For more advanced layouts, we need to use one of the three actual layout methods: CSS normal flow, Flex layout and Grid layout.</p><h3>CSS Normal flow</h3><p>Normal flow is what most people mean when they think of the way web pages are laid out. It’s how we describe the interaction between boxes.</p><p>In CSS Normal flow, each box (like above) is part of something called a “formatting context”. This can either be block, or inline. Inline ends up side-by-side, “on the same line”, and block boxes start on a new line, regardless of how much space is left on the previous line.</p><p>This doesn’t get us much in the way of layout, for that we need more advanced layout concepts. With CSS normal flow, the primary way we built more complex layouts was with float and position.</p><p>Floats were meant to provide a way to float images inside text, such that the text flowed around the image like in a magazine. Quickly, developers discovered they could also use it to create things like multi-column layouts.</p><p>Positioning then lets you take elements “out of the normal flow”, which could be useful to place elements on top of others or to always keep e.g. a heading in view.</p><p>Floats and positioning combined let us put elements anywhere on the page while still making sure elements could respond to other elements changing. That came with a lot of complexity though, and could break easily.</p><p>This doesn’t mean you shouldn’t use them anymore but for a lot of use cases, using either flex or grid is the preferred way:</p><h3>Flex layout and Grid layout</h3><p>All modern browsers now implement both the Flex layout and the Grid layout specification.</p><p>I won’t go into details on both of these methods. Flex layout is what you’d use if you are only interested in layout out elements in a single dimension (though, to confuse things, that dimension might run over several “inline” lines), and if you want to position things in two dimensions, you’d use Grid. This is a pretty big simplification and there is more nuance to it, but for the purpose of this article it’s sufficient.</p><p>Both are powerful ways to lay out boxes in a way that keeps them responsive to the changes of the boxes surrounding them and the boxes they’re in.</p><p>For a great rundown of the various layout methods and concepts in CSS, please check out the excellent MDN resources on <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout">CSS layout</a>.</p><h3>What do we want design tools to do?</h3><p>So when we ask for the box model, what is it that we really want design tools to do?</p><p>I think we want them to behave as if their artboards or their frames had a layout engine. Where if we updated a single element, the rest of the elements would be updated to “reflow” depending on the changes, and all of the tedious moving of elements across all artboards would be done for us.</p><p>Stacks and smart layouts help us with this for smaller elements, like components or symbols. Conceptually they’re similar to (a less powerful) Flex layout. But that’s just not enough, especially when you factor in multiple artboard for responsive design.</p><p>We want design tools to operate with a full layout engine, and that is not (just) the box model.</p><h4>Addendum</h4><p>Of course there are design tools that do have a full layout engine, and I’ve named a few in <a href="https://kilianvalkhof.com/2017/design/design-tools-for-2018/">previous</a> <a href="https://kilianvalkhof.com/2018/design/more-design-tools-for-2018/">posts</a>. The “big three” of design tools (Sketch, Figma and Adobe XD) don’t have a full layout engine, and that’s where most requests are aimed at.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7734cadef6f9" width="1" height="1" alt=""><hr><p><a href="https://blog.prototypr.io/the-box-model-is-not-layout-7734cadef6f9">The box model is not layout</a> was originally published in <a href="https://blog.prototypr.io/">Prototypr</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Polypane, browser for developers and designers,  available now]]></title>
            <link>https://medium.com/@kilianvalkhof/polypane-browser-for-developers-and-designers-available-now-ae98a9905816?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae98a9905816</guid>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[responsive-design]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[product-hunt]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Tue, 14 May 2019 07:56:22 GMT</pubDate>
            <atom:updated>2019-05-14T07:56:22.059Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HilZuBsYlWVaHixvIx69qQ.png" /></figure><h3>Polypane, browser for developers and designers, available now</h3><p>Polypane is out today! Polypane is a browser for developers, designers and everyone else that creates websites and webapps. This release has been a long time in the making, and has taken a lot of hard work in the past months to get this release out the door. I am incredibly proud of the app I’ll be sharing with all of you today.</p><p>Compared to the betas, Polypane 1.0 is much, much faster, has a bunch of super useful additional features and integrates much better with your operating system (no matter if you use Macos, Windows or Linux). There is a 7 day free trial available, and there are both personal and team licenses (from 3 users up) available.</p><p>Get it now at <a href="https://polypane.rocks/">Polypane.rocks</a></p><h3>Polypane in one minute and twenty seconds:</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhqhY6eHyQhI%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhqhY6eHyQhI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhqhY6eHyQhI%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/afc71b7702d6f651bac19ad9fabab341/href">https://medium.com/media/afc71b7702d6f651bac19ad9fabab341/href</a></iframe><p>I want Polypane to become the default browser for people that create websites and web applications. Your code editor and your UI Design tools are highly specialized tools that make you more efficient, prevent you from making mistakes and speed up your workflow. Your browser should do the same for you.</p><p>I’ll be hanging out on <a href="https://twitter.com/polypane">Twitter</a>, <a href="https://www.producthunt.com/posts/polypane-2">Product hunt</a> and <a href="https://news.ycombinator.com/item?id=19907593">Hacker news</a> all day responding to your comments and questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rBeueFYit8jR49khNsKalA.png" /></figure><h3>Thanks</h3><p>On a more personal note, The past period has been very tumultuous for me, and getting Polypane this far means more than I can express in this post.</p><p>I owe a huge amount of thanks to so many people for this. The people that have been giving me feedback on the betas for all this time, the people that have been helping me test the entire subscription flow, that have been sharing Polypane with their friends and colleagues, the people that helped me with honest and personal feedback on the app and the product and marketing, and most of all to the people who’ve supported me all this time, my girlfriend and my daughter above all.</p><p>Thank you for making this possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae98a9905816" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Polypane ready for release]]></title>
            <link>https://medium.com/@kilianvalkhof/getting-polypane-ready-for-release-20840763080c?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/20840763080c</guid>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[desktop-app]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[makers]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Mon, 29 Apr 2019 11:29:59 GMT</pubDate>
            <atom:updated>2019-04-29T11:29:59.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kBitnJYuFkHa-3fpaIkitg.png" /><figcaption>The upcoming Polypane website shown in Polypane</figcaption></figure><blockquote>For those that don&#39;t know Polypane: It&#39;s a browser that I&#39;m building to create websites and web apps instead of consume them. It lets you develop faster and makes your websites better. I hope you&#39;ll check it out.</blockquote><p>In a few weeks, Polypane version 1.0 will be released. In these past few months I’ve been hard at work getting everything ready for that release.</p><p>The process has very little to do with the app itself and much more with creating the infrastructure around it. I thought it would be interesting to go through this to show you what it takes.</p><p>In order to sell license subscriptions for an app, you’ll need a couple of things:</p><ul><li>A way to accept recurring invoices,</li><li>A legal entity to do so</li><li>A way to validate users and a way to let people actually manage and cancel their subscription,</li><li>Oh, and you need a decent marketing site.</li></ul><p>Here’s what it takes to launch a desktop app.</p><h3>Accepting payments</h3><p>There are a bunch of great payment processors around and they all accept money on your behalf. Depending on the payment processor, you’ll have to implement and manage more or less things yourself (like sending invoices). This is just something to figure out: decide what you want to outsource and what you want to do yourself.</p><p>There’s a worse aspect to accepting payments for me as a EU citizen and that’s VAT. You see, for some reason the EU decided that European tech companies should <strong>have a hard time competing with their international competition</strong>, so they made a bunch of stupid rules that make it difficult to just charge for a product.</p><p>Here’s how the rules work: If you’re selling a product and physically shipping it to another EU country: no worries, just charge your own countries VAT, or if you’re selling to a company, let them handle their own VAT (this is called “VAT shifted”). You need to know if your customer is a consumer or a company, and charge a different amount. Annoying, but it’s a single price and a single VAT percentage (your countries own).</p><p>If you’re selling a <em>digital service</em> however, things get Kafkaesque. If you’re selling to a company anywhere in the EU it’s the same: just let them deal with VAT.</p><p>If you’re selling to a consumer though, you have to charge them the VAT percentage <strong>of their country</strong>. That means you need to know their country, but also keep a list of the VAT percentages of all EU countries and make sure that’s up to date. Then you need to split that out in your taxes. The EU wants companies to die of bureaucracy.</p><p><em>I’m not ready to die of bureaucracy.</em></p><p>Luckily there are also companies that handle all of this for you, they act as “merchant of record” for you. They will charge more than payment providers that don&#39;t do this for you, but if you&#39;re a small company it&#39;s a good trade-of. I went with one of these, called <a href="https://paddle.com/">Paddle</a>. We’ll see how it goes.</p><h3>Managing accounts</h3><p>Great, someone has bought a license! Now how do you know they did, and how do you let them use your application?</p><p>In my case, I built a license management server that lets people manage their subscription and accounts. Anyone can download the app, but they need to authenticate with this server before being able to use it. The flow is pretty easy: In the application they fill in the email address they registered with, and they get an email with a license key unique to their computer. They fill in that license key and they can use the app. That license key is validated every time the app launches. If the subscription has expired, the app stops working and they’ll need to add a new license. Simple.</p><p>That makes sure that only subscribers can use the app, but what if those subscribers need to manage multiple accounts or want to upgrade or cancel their subscription?</p><p>That’s actually quite a bit more work and needs a ton of additional UI: You need to implement the payment API so you know when to create a new user, then generate account details for them and email those to them so they can log in. You need a way for them to change their password, or request a reset if they forget it. After they’ve logged in, they need to be able to upgrade, downgrade or cancel their subscription and if they have a multi-user subscription, they need to be able to add and remove those users and see which of these are active or not.</p><p>All of this needs to be easy to use of course, but the subscription management even more so: The alternative is a user cancelling their subscription by issuing a chargeback, and that can really eat into your revenue.</p><p>I looked around for something that would do this for me and couldn’t find anything that worked to my satisfaction so in the end I built something myself. It’s completely generic so I can very easily roll it out for other applications. If you’re interested in using it for your app, reach out and I&#39;d be happy to give you a demo.</p><h3>Legal/business stuff</h3><p>I’m keeping this short but it could be its entire own blog post. You need to set up a proper business entity and get a whole bunch of legal docs written like terms of service, privacy statement and disclaimer. Getting this all written is an absolute slog but what helped me was seeing it as a development or design problem. Terms of service become more fun when they’re a puzzle you need to solve.</p><h3>Getting the word out</h3><p>With the infrastructure of allowing people to become customers and then letting them manage their subscription in place, all that’s left is getting the word out. The <a href="https://polypane.rocks/">current site</a> has served me well but it’s pretty simple and basically just a landing page. It’s not suited to take payments and it’s lacking a ton of information, documentation and support details. A large part of the past couple of months have been spent on getting a new site up and running, that’ll be put live on launch day. It features much more previews of Polypane, documentation, a blog and of course a pricing/sign up page.</p><p>That leaves us with the planning for getting the word out. I spent a lot of time reading up on this, and one thing that helped me a lot was the <a href="https://join.megamaker.co/marketing-for-developers/6kpmf">Marketing for Developers</a> course <em>(affiliate link)</em>. I was a little further along in the process than the course starts with, but it has a lot of useful insights, planning tips and has interviews with a ton of knowledgeable people.</p><p>Between now and the release date I’ll be sharing more stuff across various channels. This post is of course part of that. Its a little different in content than you usually see and I hope that’s interesting to other app makers. I&#39;m happy to answer any questions you might have.</p><p>If you want to be kept up to date when Polypane is released and get a launch discount when it does, be sure to sign up on <a href="https://polypane.rocks/">Polypane.rocks</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20840763080c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Polypane: a browser for a responsive web development workflow]]></title>
            <link>https://medium.com/@kilianvalkhof/announcing-polypane-a-browser-for-a-responsive-web-development-workflow-702e41627ccc?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/702e41627ccc</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[responsive-design]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Tue, 16 May 2017 10:31:01 GMT</pubDate>
            <atom:updated>2017-05-16T10:31:01.787Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m working on a new browser for web developers and designers, called <a href="https://polypane.rocks/"><strong>Polypane</strong></a>. It’s cross-platform (Windows, macOS and Linux) and really really cool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Su1FoNifewyNhIO38_OMMw.png" /></figure><blockquote>Head over to <a href="https://polypane.rocks/">Polypane.rocks</a> to sign up for the beta!</blockquote><p><strong>Polypane is the browser that I as a web developer and designer want to have when I’m building a website.</strong> Developing a website and making sure it looks great on a bunch of different screen sizes is a lot of work, and current browsers don’t make it any easier.</p><p>Polypane lets you see your website in a whole range of screen sizes (you choose, including zooming) without you having to sacrifice everything else you as a developer want, like <strong>DevTools.</strong> It also includes other functionality, such as letting you export a screenshot of all screen sizes. This makes it super easy to get signoff or do some last checking.</p><h3>Sign up for the beta on <a href="https://polypane.rocks/">Polypane.rocks</a>, and you get immediate access to the private slack channel.</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBGvmiYOcsaM%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBGvmiYOcsaM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBGvmiYOcsaM%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0bc80d66a3a4985b03d381e318098604/href">https://medium.com/media/0bc80d66a3a4985b03d381e318098604/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=702e41627ccc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your chatbot should have a game loop]]></title>
            <link>https://medium.com/botpublication/your-chatbot-should-have-a-game-loop-1a491ae370b5?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a491ae370b5</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[messaging]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Mon, 17 Apr 2017 15:26:30 GMT</pubDate>
            <atom:updated>2017-04-17T15:26:30.534Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*jiIFSUUourwzi6XONq1dHA.jpeg" /></figure><p>Many of the &quot;smart&quot; chatbots with <em>Natural Language Processing</em> and <em>Artificial Intelligence</em> still have a hard time keeping a conversation going. They keep forgetting whatever it was you were talking about even if you can see it plainly <em>in the message right above!</em></p><p><strong>This is a problem if we want chatbots to succeed. </strong>While many chatbots are programmed as call-and-respond systems (also known as &quot;websites&quot;), we should be programming them like we program games: using a game loop.</p><h3>The difference between rendering a website and rendering a game</h3><p>Websites have it easy: Your server is happily doing nothing at all, up until the point a visitor comes by and requests a page. At that point, your server takes the request, finds the pages and serves it. It gets more complex if the server needs to render a page specifically for you, or needs to retrieve and combine data from a database or other sources, but it’s very much on-demand and tied to your request.</p><p>Games don’t have that luxury. If your game just stops rendering images onto the screen and waits until you <em>finally</em> press that button, they wouldn’t be very popular. They have<em> </em>to conjure up a new image at the rate of about 60 images per second, with or without the playing actively providing input. To help with this, Games have something called a &quot;game loop&quot;.</p><h3>What is a game loop?</h3><p>In order to keep this 60 fps going, games usually operate on a game loop. A game loop consist of &#39;ticks&#39; that are called 60 times per second (so about every 16ms), and they&#39;re the function(s) that take care of rendering the next increment, the next image, of the game. For this, they need to gather data, such as &quot;has the player pushed any buttons in the last 16ms&quot; and &quot;Where did the enemies move to in the last 16ms&quot;. They take this data and update the game state. From this game state, the game can then render a new image to display on screen.</p><p>This means that your game is always visible and always has the latest (or at least very recent) input for a current frame, but is not <em>dependent</em> on that input.</p><p>Another way to describe it, is that games are programmed in a way that decouples the various inputs from the eventual output.</p><h3>On to chatbots</h3><p>Because most chatbots nowadays are built by web developers, you see web development paradigms being applied to them: messages behave like a stack of web-pages with no state between them. This really shows whenever users want to carry on with information from a previous message and the chatbot no longer has the context. It leads to a very disappointing experience. This is not the fault of web developers, or a knock on people developing chatbots. The API&#39;s of different chat systems and languages we use all encourage us to think in the same way we think about websites or apps: call-response systems.</p><p>The game loop in games solves a very simple problem: it decouples the player state (input) from the rendering of game (output). Chatbots have this same problem: Whilst sending and receiving messages is the primary interaction with your user, it&#39;s not the natural place to keep the context of your chat.</p><h3>Enter player state</h3><p>Most games create a &quot;game state&quot; at the start. <strong>This game state contains all the information a game will need to determine what to render to the screen.</strong> Things like the player level, their health, how many coins they have or what items they have with them, but also what game level they&#39;re currently playing, and which baddies are on the screen right now.</p><p>With this information, the game can determine every 16ms if it needs to change something: The player buys a new sword, so we deduct a few coins. The player wins a battle so we award them with a new level, The player loses the last of their health, so we render a &#39;game over&#39; screen instead. These changes are all done in the game loop, or specifically in a &quot;tick&quot;.</p><p>Your chatbot would benefit from such a game state too. The full state of your conversation should not depend on the message you just received. Instead, <strong>Keep track of your conversation state, and update it with each new message you get.</strong></p><p>Let me give you a simple example with a weather bot that gives you the current weather or the temperature in a given location:</p><p><strong>Player: </strong>Get started<br>[Bot&#39;s introduction message gets triggered]<br><strong>Bot: </strong>Hi, how can I help you? You can ask me questions like &quot;What&#39;s the weather like in San Francisco&quot; or &quot;How many degrees is it in New York?&quot;<br><strong>Player: </strong>What&#39;s the weather in Amsterdam?<br>[Bot does some NLP and ends up with this conversation state: <em>{type:weather, location: Amsterdam, Netherlands}</em>]<br><strong>Bot:</strong> It&#39;s cloudy today with a 10% change of rain.<br><strong>Player: </strong>And the temperature?<br>[Bot again does some NLP and this time ends up with: <em>{type: temperature, location: unknown}</em> but is smart and attempts to compensate:]<br><strong>Bot: </strong>Where do you want to know the temperature?<br>[Player is now annoyed. They just typed Amsterdam!]</p><p>Now here&#39;s how decoupling the player state from the response plays out:</p><p><strong>Player: </strong>Get started<br>[Bot starts with a created player state of, lets just say: <em>{type: unknown, location:unknown}</em>, and sends the introduction message.]<br><strong>Bot: </strong>Hi, how can I help you? You can ask me questions like “What’s the weather like in San Francisco” or “How many degrees is it in New York?”<br><strong>Player: </strong>What’s the weather in Amsterdam?<br>[Bot does some NLP, updates the player state to <em>{type:weather, location: Amsterdam, Netherlands}</em> and formulates a response based on this state.]<br><strong>Bot:</strong> It’s cloudy today with a 10% change of rain.<br><strong>Player: </strong>And the temperature?<br>[Bot does some NLP and only determines that the player state should be updated by switching to temperature. The state is now <em>{type:temperature, location: Amsterdam, Netherlands}</em>]<br><strong>Bot: </strong>It&#39;s 12 degrees Celcius in Amsterdam, Netherlands.<br>[Player is ecstatic!]</p><p>The above might be a little contrived, but many chatbots operate on the first model and it leads to sub-par experiences for people that expect a conversation. Chatbot users can see the correct context right above the chatbots&#39; ignorant response!</p><h3>I&#39;m convinced! How do I get a game loop?</h3><p>Games <em>have to draw</em> something on the screen every 16ms. Chatbots don&#39;t. For the most part, only have to reply when a person sends a message first.</p><p>If we really run the game loop every 16ms for all our chatbot users, we&#39;d end up with a lot of wasted time (because you&#39;re not going to send a message for the vast majority of those ticks). So let&#39;s cheat a little and only run your tick function whenever we do get a message sent to us. (Don&#39;t tell your gamedev friends, or they might get jealous.)</p><p>When you receive a message, you have to do two things:</p><ul><li>Update your user state</li><li>Render a message out of the user state and send it</li></ul><p>The immediate effect is that, apart from parsing the message you just received and keeping some trivial user info accessible, you should have another part of your code that, for each user, keeps their conversation state. This conversation state is updated after you parsed the message, and the message you send back is based on that conversation state.</p><p>Your conversation state can be as simple as the weather example above, that just takes permutations of &quot;most recently asked type of info&quot; and &quot;most recently asked location&quot; and deals with that, but of course it can be much more complex as well. My <a href="https://m.me/amessengeradventure">Messenger Adventure</a> chatbot for example, keeps track of where in the game world you are, what places you have already visited and which items you have with you.</p><h3>How do I learn to build a game loop?</h3><p>If you want to experiment with how to program a game loop before committing to one for your chatbot, I highly recommend checking out <a href="http://phaser.io/">Phaser.io</a>, a HTML5 gaming engine that&#39;s very friendly and easy to get started with. It will introduce you to the concepts I describe in this article, and you will immediately see the results in game form, which is very satisfying.</p><h3>In closing</h3><p>Game state is easiest to keep track of in a game loop, a concept that games employ to keep their input and output decoupled. You can not depend on each single input of your chatbot to be full-context, so you similarly need to separate the input and output of your chatbot for the best results. To do this, adapt the concepts of game state and game loop to your chatbot.</p><p><strong>Your chatbot should have a game loop and a conversation state.</strong></p><p><strong><em>If you enjoyed this article, hit that ❤.</em></strong></p><h4>About the Author</h4><p><em>Kilian is a user experience developer | Creator of </em><a href="https://adventure.kilianvalkhof.com/"><em>A Messenger Adventure</em></a><em> and </em><a href="https://messenger-demo-viewer.kilianvalkhof.com/"><em>Messenger Demo Viewer</em></a><em> | Contact him on </em><a href="https://twitter.com/kilianvalkhof"><em>Twitter</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a491ae370b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/botpublication/your-chatbot-should-have-a-game-loop-1a491ae370b5">Your chatbot should have a game loop</a> was originally published in <a href="https://medium.com/botpublication">BotPublication</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demo your Messenger bot interactions without showing personal chats]]></title>
            <link>https://blog.chatbotslife.com/demo-your-messenger-bot-interactions-without-showing-personal-chats-dc44acb510ec?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc44acb510ec</guid>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[facebook-messenger]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Tue, 07 Mar 2017 14:02:01 GMT</pubDate>
            <atom:updated>2017-03-07T14:02:01.362Z</atom:updated>
            <content:encoded><![CDATA[<p>After you have made your awesome new Messenger bot, it’s time to demo it. If you made a bot for a professional client you don’t really want to give a demo with the always-present Messenger sidebar with your other personal chats visible for everyone.</p><p>Facebook Messenger always has a sidebar with all your recent chats, including a part of the last message sent, visible on the screen. This is useful for personal chats, but not something you want to show when demoing your bot interactions.</p><p>If you&#39;re a web developer, you can open your developer tools and delete the entire sidebar, but that&#39;s an arduous step and you need to do it every time. Luckily, <strong>there is a better way!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*CHCz06LTDg0rcvkVZkVHyQ.png" /></figure><h3>Introducing Messenger Demo Viewer</h3><p>Messenger Demo Viewer is a <strong>free app for macOS, Windows and Linux</strong> that helps you give professional demos by hiding the sidebar whenever you don&#39;t need it, putting all the focus on your chatbot interaction.</p><p>You can <strong>download it for free</strong> from the website: <a href="https://messenger-demo-viewer.kilianvalkhof.com/">https://messenger-demo-viewer.kilianvalkhof.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*KT6gC8nGMxpSJwwz8xs4aQ.png" /><figcaption>Messenger Demo Viewer showing my chatbot: m.me/amessengeradventure</figcaption></figure><p>It looks like Facebook Messenger (because it is) without the sidebar. If you want to switch to a different chat, you can press a shortcut (ctrl+b on Windows and Linux, cmd+b on macOS) to toggle the sidebar.</p><p>I’m eager to hear how people use this application. Please tell me your experiences on <a href="https://twitter.com/kilianvalkhof">Twitter</a> or leave a suggestion on <a href="https://github.com/Kilian/messenger-demo-viewer">Github</a>!</p><p>Messenger Demo viewer is made by <a href="https://kilianvalkhof.com/">Kilian Valkhof</a>, a chatbot builder and app developer from The Netherlands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*bQlRSzFHJEmF4Q7PyrLgng.gif" /></figure><figure><a href="https://chatbotslife.com/bot-communities-mastermind-group-d2dae9876709#.53x0py6ou"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*6XUspT9JOSq0w0Fi35HIaA.png" /></a></figure><figure><a href="https://m.me/ChatbotsLife"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*c1LDMH5vbnIz9rmAka8Hwg.png" /></a></figure><figure><a href="https://chatbotslife.com/how-to-get-a-free-chatbot-b1fb9dfe109#.z9dtp2sy0"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*D0Jf3dI6ZThtqcfwDYY7mg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc44acb510ec" width="1" height="1" alt=""><hr><p><a href="https://blog.chatbotslife.com/demo-your-messenger-bot-interactions-without-showing-personal-chats-dc44acb510ec">Demo your Messenger bot interactions without showing personal chats</a> was originally published in <a href="https://blog.chatbotslife.com/">Chatbots Life</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 must-know tips for building cross platform Electron apps]]></title>
            <link>https://medium.com/avocode-stories/4-must-know-tips-for-building-cross-platform-electron-apps-f3ae9c2bffff?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3ae9c2bffff</guid>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[electron]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Mon, 19 Sep 2016 07:00:00 GMT</pubDate>
            <atom:updated>2019-08-26T07:11:11.961Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fiCleWsMoHxGEubXLQ_6Hg.png" /></figure><p><a href="https://electron.atom.io/">Electron</a>, the technology that powers Avocode among many other apps, allows you to get a cross-platform desktop application up and running very quickly. If you don’t pay attention you will quickly end up in the uncanny valley of apps, though. Apps that don’t feel <em>quite</em> in place among your other apps.</p><p>This is a transcript of presentation I gave in May 2016 at the Electron Meetup in Amsterdam, updated to take into account API changes. Mind you, this goes into great detail and assumes some familiarity with Electron.</p><h3>First off, who am I?</h3><p>I’m Kilian Valkhof, a front-end developer/UX designer/app developer, depending on who you ask. I have over 10 years of experience creating things for the internet, and built a number of desktop apps in various environments such as GTK and Qt, and of course, in Electron.</p><p>Right now I’m building <a href="https://polypane.rocks/">Polypane</a>, the browser for responsive design.</p><p>During the development of Polypane and <a href="https://fromscratch.rocks/">FromScratch</a> (another app), I spent a lot of time making sure the app feels great on all three platforms, and finding out how to make that happen in Electron. These are the gotcha’s I encountered and how-to’s I’ve come up with.</p><p>Getting an app to feel nice and consistent in Electron is not difficult, you just have to make sure you pay attention to the details.</p><h3>1. Copy and paste on macOS</h3><p>Imagine, for a moment, you release an app. Say, a note taking app. That you tested and used heavily on your Linux machine. And then you get this friendly message on ProductHunt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a_OdGbcxWCCkvNyf." /></figure><p><em>Turns out that by default, Copy and Paste commands are not enabled in Electron on macOS!</em></p><p>The way to let people copy and paste things into and out of your application is by providing an Application Menu that contains those commands. In your main.js file, Simply adding the code below will give you glorious, full-HD copy-and-paste:</p><pre>if (process.platform === &#39;darwin&#39;) { <br>  var template = [{ <br>    label: &#39;FromScratch&#39;, <br>    submenu: [{ <br>      label: &#39;Quit&#39;, <br>      accelerator: &#39;CmdOrCtrl+Q&#39;, <br>      click: function() { <br>        app.quit(); <br>      } <br>    }] <br>  }, { <br>    label: &#39;Edit&#39;, <br>    submenu: [{ <br>      label: &#39;Undo&#39;, <br>      accelerator: &#39;CmdOrCtrl+Z&#39;, <br>      selector: &#39;undo:&#39; <br>    }, { <br>      label: &#39;Redo&#39;, <br>      accelerator: &#39;Shift+CmdOrCtrl+Z&#39;, <br>      selector: &#39;redo:&#39; <br>    }, { <br>      type: &#39;separator&#39;<br>    }, { <br>      label: &#39;Cut&#39;, <br>      accelerator: &#39;CmdOrCtrl+X&#39;, <br>      selector: &#39;cut:&#39; <br>    }, { <br>      label: &#39;Copy&#39;, <br>      accelerator: &#39;CmdOrCtrl+C&#39;, <br>      selector: &#39;copy:&#39;<br>    }, { <br>      label: &#39;Paste&#39;, <br>      accelerator: &#39;CmdOrCtrl+V&#39;, <br>      selector: &#39;paste:&#39; <br>    }, { <br>      label: &#39;Select All&#39;, <br>      accelerator: &#39;CmdOrCtrl+A&#39;, <br>      selector: &#39;selectAll:&#39; <br>    }] <br>  }];</pre><pre>  var osxMenu = menu.buildFromTemplate(template);<br>  menu.setApplicationMenu(osxMenu);<br>}</pre><p>If you already have a menu, you need to augment it to include the above cut/copy/paste commands.</p><h3>1.1 Specify an icon</h3><p>…or your app will look like this on Ubuntu:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/0*QWzS2in91YXaI_Tf." /></figure><p>Many, <em>many</em> applications get this wrong unfortunately, because on Windows and on macOS, the icon shown in the task bar or dock is the <em>application icon</em> (an .ico or .icns) and on Ubuntu, it’s your <em>window icon</em> that is shown. Adding it is super simple. in your `BrowserWindow` options, just specify an icon:</p><pre>mainWindow = new BrowserWindow({ <br>  title: &#39;ElectronApp&#39;, <br>  icon: __dirname + &#39;/app/assets/img/icon.png&#39;, <br>});</pre><p>This will also give you a small icon in the top left of your Windows app.</p><h3>1.2 UI Text is not selectable</h3><p>When you use your browser, word processing software, or any other native application, you will notice that you can’t select the text in your menus and other applications like Chrome. One of the ways an Electron app quickly jumps into the uncanny valley is by accidentally triggering a text selection or highlight on what are supposed to be UI elements.</p><p>CSS has our back here, though; for any button, menu, or</p><pre>.my-ui-text { -webkit-user-select:none; }</pre><p>And the text will simply not be selectable anymore. It will feel much more like a native application. A little tip to check this: simply press ctrl/cmd + A to select all selectable text in your app. Then you can quickly spot the items you still need to disallow selection on.</p><h3>1.3 You need three icons for three platforms</h3><p>Really, this is just super inconvenient. On Windows, you need an .ico file, on macOS you need a .icns file and on Linux you need a .png file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k4jBKVva0PRc-3uc." /></figure><p>Luckily, the same, normal png can be used to generate the other two icons. Here’s the most convenient way:</p><p>1. Start with a 1024x1024 pixel PNG. That means we’re already 1/3rd of the way done. (Linux, check!)</p><p>2. For Windows, run it through <a href="http://www.nongnu.org/icoutils/">icotools</a> in your terminal to get an .ico:</p><pre>icotool -c icon.png &gt; icon.ico</pre><p>3. For macOS, run it through <a href="https://github.com/daveish/png2icns">png2icns</a> in your terminal to get an</p><pre>png2icns icon.icns icon.png</pre><p>4. You’re done!</p><p>There are GUI tools available such as <a href="http://www.img2icnsapp.com/">img2icns</a> on macOS and <a href="https://iconverticons.com/online/">iconverticons</a> on Web, Windows and macOS but I have not used them.</p><h3>1.4 Bonus!</h3><p>electron-packager doesn’t need the extension of the icon to pick the correct one for a given platform:</p><pre>electron-packager . MyApp — icon=img/icon — platform=all — arch=all — version=0.36.0 — out=../dist/ — asar</pre><p>Of course, I only figured that one out after writing my own build script that selected the correct version of the icon. Oh well.</p><h3>2. White loading screens belong in browsers</h3><p>Nothing gives away the inherent <em>browseriness</em> of an Electron app more than a white loading screen. Luckily there are two things we can do to combat that:</p><h3>2.1 Specify a BrowserWindow background color</h3><p>If your application has a non-white background color, make sure to specify it in your BrowserWindow options. This won’t prevent the square-of-solid-color while your application loads, but at least it doesn’t also change color halfway through:</p><pre>mainWindow = new BrowserWindow({ <br>  title: &#39;ElectronApp&#39;, <br>  backgroundColor: &#39;#002b36&#39;, <br>});</pre><h3>2.2 Hide your application until your page has loaded:</h3><p>Because we’re actually in the browser, we can choose to hide the windows until we know all our resources have been loaded in. Upon starting, make sure to hide your browser window:</p><pre>var mainWindow = new BrowserWindow({ <br>  title: &#39;ElectronApp&#39;, <br>  show: false, <br>});</pre><p>Then, when everything is loaded, show the window and focus it so it pops up for the user. You can do this with the “ready-to-show” event on your `BrowserWindow`, which is recommended, or the ‘did-finish-load’ event on your webContents.</p><pre>mainWindow.on(&#39;ready-to-show&#39;, function() { <br>  mainWindow.show(); <br>  mainWindow.focus(); <br>});</pre><p>You want to focus it to make the user aware that your application has loaded.</p><h3>3. Preserve your window dimensions and position</h3><p>Now, this is one that a lot of “native” apps get wrong as well, and I find it one of the most annoying things ever. It drives me up the wall when a carefully positioned app, upon a next launch, simply resets it position and dimensions back to whatever default the app developer thought would be reasonable. Don’t do that.</p><p>Instead, save the window’s position and dimensions and restore them on each launch. Your users will thank you.</p><h3>3.1 Prebuilt solutions</h3><p>There are two prebuilt solutions that solve this for you, called <a href="https://www.npmjs.com/package/electron-window-state">electron-window-state</a> and <a href="https://www.npmjs.com/package/electron-window-state-manager">electron-window-state-manager</a>. Both of them work, have good documentation and take care of edge cases such as maximised applications. If you’re in a hurry, use these.</p><h3>3.2 Roll your own</h3><p>You can also roll your own, and that’s what I did, based on code I had already made for <a href="https://trimage.org/">Trimage</a> a few years ago. It’s not a lot of work and it gives you a lot of control. I’ll show you:</p><h4>3.2.1 Get something to save your state to</h4><p>First off, we need to be able to store the position and dimensions of our application somewhere. You can use <a href="https://github.com/nathanbuchar/electron-settings">Electron-settings</a> which does it very well, but I chose to use <a href="https://www.npmjs.com/package/node-localstorage">node-localstorage</a> because of its simplicity.</p><pre>var JSONStorage = require(&#39;node-localstorage&#39;).JSONStorage;<br>var storageLocation = app.getPath(&#39;userData&#39;);<br>global.nodeStorage = new JSONStorage(storageLocation);</pre><p>If you save your data to <em>`getPath(‘userData’);`</em> electron will store it alongside it’s own application settings, in <em>`~/.config/YOURAPPNAME`</em>, or on Windows, in the appdata folder under your user.</p><h4>3.2.2 When opening your app, try to load in your state</h4><pre>var windowState = {}; </pre><pre>try { <br>  windowState = global.nodeStorage.getItem(&#39;windowstate&#39;); <br>} catch (err) { <br>  // the file is there, but corrupt. Handle appropriately. <br>}</pre><p>Of course this will not work on first launch so you need to deal with that. Probably by providing sensible defaults. Once you have your previous state in a javascript object, just use that information to set your BrowserWindow dimensions:</p><pre>var mainWindow = new BrowserWindow({ <br>  title: &#39;ElectronApp&#39;, <br>  x: windowState.bounds &amp;&amp; windowState.bounds.x || undefined, <br>  y: windowState.bounds &amp;&amp; windowState.bounds.y || undefined,   <br>  width: windowState.bounds &amp;&amp; windowState.bounds.width || 550, <br>  height: windowState.bounds &amp;&amp; windowState.bounds.height || 450, });</pre><p>As you can see, I add the sensible default in here by providing a fallback value.</p><p>Now in Electron, it’s not possible to start a window in its maximised state, so we need to do that straight after creating our BrowserWindow.</p><pre>// Restore maximised state if it is set. <br>// not possible via options so we do it here </pre><pre>if (windowState.isMaximized) { <br>  mainWindow.maximize(); <br>}</pre><h4>3.2.3 Save your current state on move, resize and close:</h4><p>In a perfect world you will only have to save your window state when closing the application, but that will miss all the times the application is terminated for some unknown reason (such as when the power cuts out).</p><p>Getting and saving the state on every move or resize event makes sure we always restore the last known position and dimensions.</p><pre>[&#39;resize&#39;, &#39;move&#39;, &#39;close; ].forEach(function(e) { <br>  mainWindow.on(e, function() { <br>    storeWindowState(); <br>  }); <br>});</pre><p>And the storeWindowState function:</p><pre>var storeWindowState = function() { <br>  windowState.isMaximized = mainWindow.isMaximized(); </pre><pre>  if (!windowState.isMaximized) { <br>    // only update bounds if the window isn’t currently maximized    <br>    windowState.bounds = mainWindow.getBounds(); <br>  }<br> <br>  global.nodeStorage.setItem(‘windowstate’, windowState); <br>};</pre><p>The storeWindowState function has a little gotcha: If you minimise a native maximised window, it will revert to its <em>previous</em> position. This means that when the window state is maximised we want to save that fact, but we don’t then want to overwrite the previous (unmaximised) window dimensions so that if you maximise, close, re-open, and unmaximise, you will end up with the position your window had before maximising.</p><h3>4. Some quick fire tips</h3><p>Below are a couple of small, quick tips and tricks.</p><h4>4.1 Shortcuts</h4><p>In general, Windows and Linux users use Ctrl, while macOS users use Cmd for shortcuts. Instead of adding each shortcut (called an <em>Accelerator</em> in Electron) twice, use “CmdOrCtrl” to target all platforms at once.</p><h4>4.2 Use the “system font/San Francisco”</h4><p>Using the default system font means that your application can blend in with the rest of the OS. Instead of hardcoding it for each system separately, you can use the following CSS to automatically pick whatever font is the UI font on a system:</p><pre>cssbody { font: caption; }</pre><p>“caption” is a keyword in CSS that links to a platform-specified font.</p><h4>4.3 System colors</h4><p>Just like the system font, you can also choose to let the platform determine the colors of your application by using <a href="http://www.sitepoint.com/css-system-styles/">System colors</a>. These are actually deprecated in favor of not-yet-implemented Appearance value type in CSS3, but they’re not going anywhere for the foreseeable future.</p><h4>4.4 Layouting</h4><p>CSS is an immensely powerful way to lay out applications, especially when you combine flexbox with <em>`calc()`</em>, but don’t discount the work done in older GUI frameworks such as GTK, Qt or Apple Autolayout. You can create your app GUI in a similar way by using <a href="https://gss.github.io/">Grid Stylesheets</a> which is a constraint-based layout system.</p><h3>Thanks!</h3><p>Building applications in Electron is a lot of fun and very rewarding: you can get something up and running on multiple platforms in a matter of minutes. If you’ve never looked into Electron I hope this article intrigued you enough to take a look. Their<a href="http://electron.atom.io/"> website</a> has excellent documentation as well as a very cool demo app that lets you try out all the API’s on offer.</p><p>If you’re already writing Electron applications, I hope the above encourages you to think about how your app runs on all platforms.</p><p>Lastly, If you have any additional tips, please share them in the comments!</p><figure><a href="http://eepurl.com/c-EHmT"><img alt="" src="https://cdn-images-1.medium.com/max/684/1*e_WTS6socemGWmd6In8EMA.png" /></a></figure><figure><a href="http://r.avocode.com/medium-blog?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=10-2017-medium-blog"><img alt="" src="https://cdn-images-1.medium.com/max/800/1*K8IaFtjprR-h6qRyH_maQA.png" /></a></figure><p><a href="http://r.avocode.com/medium-blog?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=10-2017-medium-blog"><em>Avocode</em></a><em> is a design hand-off and inspect tool for teams which are building next-generation Web, iOS, &amp; Android projects.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3ae9c2bffff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/avocode-stories/4-must-know-tips-for-building-cross-platform-electron-apps-f3ae9c2bffff">4 must-know tips for building cross platform Electron apps</a> was originally published in <a href="https://medium.com/avocode-stories">Avocode  — From Design to Code</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FromScratch, a simple but smart note-taking app]]></title>
            <link>https://medium.com/@kilianvalkhof/fromscratch-a-simple-but-smart-note-taking-app-3bbdcab386e8?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bbdcab386e8</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Sat, 27 Feb 2016 15:07:15 GMT</pubDate>
            <atom:updated>2016-02-27T15:07:15.149Z</atom:updated>
            <content:encoded><![CDATA[<p>The way I kept TODO list no longer worked for me, so I built my own app that did: FromScratch. My ideal workflow is a rectangle I can alt-tab to, read and type in, and alt-tab away from. Anything more is too much.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*KU86e_3s78_iofVP.png" /></figure><h4>FromScratch</h4><p>FromScratch is the app that does this for me. It’s free and open source, and works on Linux, OS X and Windows. You can download it for free from the website <a href="https://fromscratch.rocks/">FromScratch.rocks</a>.</p><p>It does one thing: It gives you quick and easy access to some text. That can be a TODO, or notes, or whatever you like. Anything you type is automatically saved and text editing is made easy by some extra shortcuts for quickly ordering or removing lines and selecting your preferred text size.</p><p>It sounds simple, and as a result the app is simple to use. It works with you, not against you.</p><h4>Out with text editors</h4><p>Before FromScratch I had a todo.txt file that I always kept open in my text editor, Gedit. Gedit is awesome, because it has a native file browser in its sidebar. This makes the whole time-consuming concept of opening a “project folder” disappear. I recently switched to <a href="https://atom.io/">Atom</a> however, which doesn’t have a native file browser. It has so much more that it’s worth the switch, but it also means I have multiple Atom windows throughout the day as I switch projects.</p><p>Keeping Gedit open for just a todo.txt wasn’t working for me. It forced me to remember saving every time I quickly updated it, and Gedit’s shortcuts weren’t as useful as my newly made custom ones in Atom.</p><p>If I create something new, it should be both smart and opinionated. I took a step back to assess what I wanted out of my note-taking workflow, and what an app needed to do to accommodate me. Turns out, surprisingly little! It just needs to do the right things. Like being fast and easily accessible, allow easy ordering and it needs to make sure my changes are saved without me having to remember to save.</p><p>Also I want it to remember where it was on the screen after I reopen it. It drives me up the wall me when apps don’t even take such a small and simple thing into account. I have no idea why operating systems don’t enforce it either. In any case, FromScratch will always revert back to its last known dimensions and position on the screen.</p><h4>“Web” app</h4><p>Now the technical part. FromScratch is built to experiment with <a href="http://electron.atom.io/">Electron</a> and <a href="https://facebook.github.io/react/">React</a> and as you can see on <a href="https://github.com/kilian/fromscratch">Github</a>, it is really rather simple. I use <a href="http://codemirror.net/">Codemirror</a> to do text handling, and based the project off of the <a href="https://github.com/chentsulin/electron-react-boilerplate">Electron-react-boilerplate</a>. My needs were much simpler so I kept only a small part of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yFbzZEi5HZIf30k_LzF9bg.png" /><figcaption>The ligatures that Fira provides</figcaption></figure><p>Oh, and I’m using the very pretty <a href="https://github.com/tonsky/FiraCode">Fira Code</a> font, as it gives ligatures for arrows and other programmatic symbols.</p><p>I got stuck once with a weird React + Electron combination bug that caused all text pasted into FromScratch to be pasted twice (Atom actually has this bug as well) but <a href="https://twitter.com/bitterzoet">@bitterzoet</a>, A.K.A. Mark Mulder, helped me out by switching Electron api’s and the problem disappeared. Thanks Mark! :)</p><h3>Next up</h3><p>FromScratch 1.0.0 is the MVP that works for me, but I imagine it will expand. One obvious addition is versioning. FromScratch keeps a text file on disk so you can easily symlink it to Dropbox and have that take care of versioning, but given that it’s a single text file, FromScratch could just as easily just keep every version of it in a versioning system.</p><p>Another expansion I’d like is a nice way to have multiple lists, so I can split my professional and personal todo, or any split I’d like and still have all the benefits from the app itself.</p><p>So that’s FromScratch. I hope you <a href="https://fromscratch.rocks/">try it out</a> and let me know what you think and if it works for you. Or, if it doesn’t, how it could be improved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bbdcab386e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hocus Pocus: CSS Selectors]]></title>
            <link>https://medium.com/@kilianvalkhof/hocus-pocus-css-selectors-a908d3b9563d?source=rss-f645a60e8b9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a908d3b9563d</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kilian Valkhof]]></dc:creator>
            <pubDate>Sun, 14 Feb 2016 12:35:00 GMT</pubDate>
            <atom:updated>2016-02-14T12:35:00.313Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Two years ago, I tweeted out a lament on always having to type both :hover and :focus:</p><h3>Kilian Valkhof on Twitter</h3><p>I&#39;m tired of always having to type &#39;a:hover, a:focus {}&#39;, I therefore propose a new pseudoclass that combines them: a:hocus {}</p><p>This garnered some attention, and you can read about that on my blog over a<a href="http://kilianvalkhof.com/2014/css-xhtml/hocus-pocus-css-aliases/">t Kilianvalkhof.com</a>. I&#39;m glad to tell you it&#39;s been a year and writing :hocus is now a thing you can do …In PostCSS, and possibly in browsers in the future!</p><p>One of the replies I got on my tweet was about a new CSS specification: the <a href="https://tabatkins.github.io/specs/css-aliases/">CSS Aliases</a> spec. Back then, it wasn’t yet done (let alone implemented) and had a slightly different syntax than it does now. It contained a description of something called &quot;<a href="https://drafts.csswg.org/css-extensions/#custom-selectors">custom selectors</a>&quot;.</p><h3>Using custom selectors</h3><p>Custom selectors allows you to define your own selector as an alias for a list of other selectors. This works for any selector, so we can create a custom selector that combines :hover and :focus.</p><p>Here’s the (pretty simple) syntax:</p><pre>@custom-selector :--hocus :hover, :focus;</pre><pre>a:--hocus {<br>  /* hover and focus! */<br>  color:red;<br>}</pre><p>Isn’t that great? Apart from the fact that it’s not implemented yet. Luckily we have a solution for that!</p><h3>CSSNext</h3><p>Before explaining CSSNext, you need to know what PostCSS is: PostCSS is a system that allows you to easily transform CSS styles. PostCSS by itself does nothing, but you can add plugins to do all sorts of transformations.</p><p>CSSNext is the plugin that allows you to write CSS according to the latest specifications (if possible) so you can see what the future of CSS holds.</p><p>And one of those proposed features is <a href="http://cssnext.io/features/#custom-selectors">custom selectors</a>.</p><h3>Playground</h3><p>Setting up PostCSS and NextCSS takes some work, with choosing a &quot;runner&quot; and configuring it. There’s plenty of tutorials available online so I’m not going to attempt to help with setting it up, but for PostCSS check their <a href="https://github.com/postcss/postcss#usage">Readme</a> for a number of options and once you have that running, install and add the <a href="https://github.com/postcss/postcss#usage">postcss-cssnext</a> plugin.</p><p>If that’s all too much of a hassle and you just want to try it out (like any sane person) CSSNext has a <a href="http://cssnext.io/playground/">playground</a> that you can try out new syntax in and see what CSS it transforms into. Copy in the above CSS and see!</p><p>I’m very glad to see that CSS as a language is improving not just in features but also in ways to make it easier for developers to work with. I’m also very happy I can now use :- -hocus!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a908d3b9563d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>