<?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[enpit-developer-blog - Medium]]></title>
        <description><![CDATA[From time to time, we post about the aspects that concern, amaze and suprise our developers during their day-to-day work. - Medium]]></description>
        <link>https://medium.com/enpit-developer-blog?source=rss----428f9b75578b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>enpit-developer-blog - Medium</title>
            <link>https://medium.com/enpit-developer-blog?source=rss----428f9b75578b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 21:12:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/enpit-developer-blog" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Want to get hands-on Kubernetes? — Here we go.]]></title>
            <link>https://medium.com/enpit-developer-blog/want-to-get-hands-on-kubernetes-here-we-go-f22924a08f23?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/f22924a08f23</guid>
            <category><![CDATA[minikube]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[grafana]]></category>
            <dc:creator><![CDATA[Andreas Koop]]></dc:creator>
            <pubDate>Fri, 01 Feb 2019 22:25:11 GMT</pubDate>
            <atom:updated>2019-02-01T22:37:48.322Z</atom:updated>
            <content:encoded><![CDATA[<h3>Want to get hands-on Kubernetes? — Here we go.</h3><p><a href="https://kubernetes.io/">Kubernetes</a> is a popular container orchestration platform. This post is a short summary &amp; reference for getting hands dirty on your local machine — in my case on a macOS.</p><blockquote>Since Kubernetes is made for real world production demands there is a special distribution for local machines named <a href="https://github.com/kubernetes/minikube"><strong>Minikube</strong></a>. It runs on a single-node cluster inside a VM.</blockquote><h4>Prerequites</h4><p>Make sure you have the following developer tools installed.</p><ul><li><a href="https://www.virtualbox.org/">VirtualBox</a> (at the time of writing version 6.0 worked for me)</li><li><a href="https://brew.sh/">homebrew</a> (at the time of writing version 1.9.3)</li></ul><p>(on macOS 10.14.2)</p><h4>Install Minikube</h4><p>Installation of Minikube is easy as follows</p><pre>$ <strong>brew install kubernetes-cli</strong><br>...<br>$ <strong>kubectl version</strong><br>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;13&quot;, GitVersion:&quot;v1.13.2&quot;, GitCommit:&quot;cff46ab41ff0bb44d8584413b598ad8360ec1def&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2019-01-13T23:15:13Z&quot;, GoVersion:&quot;go1.11.4&quot;, Compiler:&quot;gc&quot;, Platform:&quot;darwin/amd64&quot;}<br>The connection to the server localhost:8080 was refused - did you specify the right host or port?</pre><pre>$ <strong>brew cask install minikube</strong><br><strong>...<br></strong>🍺  minikube was successfully installed!</pre><h4>Verify Minikube installation</h4><pre>$ <strong>minikube start</strong><br>Starting local Kubernetes v1.13.2 cluster...<br>...<br>Everything looks great. Please enjoy minikube!</pre><p>Looking into VirtualBox you should see a running VM “minikube”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y6JNu_sVAspeS6TrqR6tmw.png" /></figure><p>Next lets turn on the dashboard (Kubernetes Web UI) to get some more insights of the running single-node Kubernetes Cluster (yes I know there is not much to see.</p><pre>$ <strong>minikube dashboard<br></strong>...<br>Opening <a href="http://127.0.0.1:52015/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/">http://127.0.0.1:52015/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/</a> in your default browser...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U582t6OvGQdswWjd7TUWFg.png" /><figcaption>Kubernetes Web UI</figcaption></figure><h4><strong>Test a container deployment</strong></h4><p>Now that there is a running Kubernetes Cluster lets see how to deploy some simple (good looking 😎) stuff</p><pre>$ <strong>kubectl create deployment grafana-deployment --image=grafana/grafana</strong><br>deployment.apps/grafana-deployment created</pre><pre>$ <strong>kubectl get pods</strong><br>NAME                                  READY   STATUS    RESTARTS   AGE<br>grafana-deployment-6696c557c6-ktx4s   1/1     Running   0          30s</pre><pre>$ <strong>kubectl get deployments</strong><br>NAME                 READY   UP-TO-DATE   AVAILABLE   AGE<br>grafana-deployment   1/1     1            1           60s</pre><p>The sample container (grafana) is already running but only accessible by its internal IP address. To make it accessible from outside it must be exposed through a Kubernetes service.</p><pre>$ <strong>kubectl expose deployment grafana-deployment --type=LoadBalancer --port=3000</strong><br>service/grafana-deployment exposed</pre><pre>$ <strong>kubectl get services</strong><br>NAME                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE<br>grafana-deployment   LoadBalancer   10.111.177.171   <strong>&lt;pending&gt;</strong>     3000:30285/TCP   52s<br>kubernetes           ClusterIP      10.96.0.1        &lt;none&gt;        443/TCP          61m</pre><p>On Minikube the container deployment now simply can be accessed by</p><pre>$ <strong>minikube service grafana-deployment</strong><br>Opening kubernetes service default/grafana-deployment in default browser…</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuCONMebJWq1qfV8F-Yxvw.png" /></figure><p>With the default admin / admin you are able to start exploring Grafana. e.g. Visualizing some metrics of the TestDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pY5g0l9LTD4ZBaNnnNHI9A.png" /><figcaption>Grafana Sample Dashboard Panel</figcaption></figure><h4>Clean up</h4><p>Do not forget to free resources on your machine</p><pre><strong>$ minikube stop<br></strong>Stopping local Kubernetes cluster...<br>Machine stopped.</pre><h4>Summary</h4><p>With a handful commands a single-node Kubernetes Cluster is up and running. It is the smallest possible Kubernetes installation (Minikube) . Do not run this in production.</p><p><em>This Post is brought to you by </em><a href="https://enpit.de/"><em>enpit.de</em></a><em> from our lovely </em><a href="https://www.feelgood-workspace.com/"><em>feelgood-workspace.com</em></a><em>. Follow us on </em><a href="https://instagram.com/enpit"><em>instagram.com/enpit</em></a><em> for more cool </em>😎 <em>things.</em></p><h4>Further information</h4><ul><li><a href="https://kubernetes.io/docs/tasks/tools/install-minikube/">https://kubernetes.io/docs/tasks/tools/install-minikube/</a></li><li><a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-homebrew-on-macos">https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-homebrew-on-macos</a></li><li>Kubernetes Web UI Dashboard: <a href="https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/">https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/</a></li><li>Minikube Tutorial: <a href="https://kubernetes.io/docs/tutorials/hello-minikube/">https://kubernetes.io/docs/tutorials/hello-minikube/</a></li><li>kubectl Cheet Sheat: <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/">https://kubernetes.io/docs/reference/kubectl/cheatsheet/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f22924a08f23" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/want-to-get-hands-on-kubernetes-here-we-go-f22924a08f23">Want to get hands-on Kubernetes? — Here we go.</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup & First  Steps— React Native Mobile App Development Part 1]]></title>
            <link>https://medium.com/enpit-developer-blog/setup-first-steps-react-native-mobile-app-development-part-1-e8a0b0034898?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/e8a0b0034898</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Peter Steinberg]]></dc:creator>
            <pubDate>Fri, 11 Jan 2019 12:33:20 GMT</pubDate>
            <atom:updated>2019-01-11T11:19:18.776Z</atom:updated>
            <content:encoded><![CDATA[<h3>Setup &amp; First Steps— React Native Mobile App Development Part 1</h3><p><em>This is part 1 in a series of articles about mobile app development with React Native.</em></p><p>In this article, you will learn how to bootstrap your first React Native project. We will cover the options you have and walk through the first steps together.</p><p>In case you are wondering why you would want to use React Native in the first place, check out <a href="https://medium.com/p/b2b6e38b67a6">the 0th part of this series</a>, where some alternative technologies for mobile app development are discussed.</p><h3>Setup. Your Options</h3><p>There are two ways to go about setting up your first React Native project. The two bootstrapping tools you might want to use are create-react-native-app (CRNA)/Expo CLI and the react-native CLI. We will look at both here.</p><p>So what’s the difference? Well, CRNA and the Expo CLI used to be two different things, but <a href="https://blog.expo.io/expo-cli-2-0-released-a7a9c250e99c">have been merged into one tool by now</a>. They bootstrap a React Native project with a couple of enticing bells and whistles: A more flexible development tooling and a set of useful native components. react-native init will also setup a project for you but keeps it slightly simpler: Apart from your JavaScript source you end up with pre-configured projects for Xcode and Android Studio, which you will need to compile in order to run your app.</p><h4>CRNA / Expo</h4><p>The team at <a href="https://expo.io/">Expo</a> tries to streamline the React Native development process by providing a set of really convenient tools. If you want to take advantage of what they offer, you can start by bootstrapping a new React Native project with the Expo CLI. Expo abstracts away all of the native code that is part of a React Native project. This has some significant implications:</p><ul><li>Your project folder will not contain any native code and any app configuration is done through an expo-specific config file.</li><li>You can run your code inside the Expo Client app that is available for Android and iOS and loads the JavaScript bundle that your app consists of. This allows you e.g. to run on iOS without also having a macOS device (which otherwise would be needed to compile the iOS project).</li><li>Expo provides you with a set of APIs that expose native device capabilities like the camera to your JavaScript code. These are useful and well-maintained modules that make it easy to take advantage of native capabilities. Sadly, not every native API is already supported by Expo. As of this writing, Expo e.g. does not provide APIs for Bluetooth, WebRTC, background code execution <a href="https://docs.expo.io/versions/latest/introduction/why-not-expo">among other things</a>.</li><li>Since you don’t manage your app’s native code yourself, you can’t link native modules that you wrote yourself or that the community provides. This means that as soon as you want to do something, that Expo does not support, you are pretty much out of luck.</li><li>Expo provides a service to build application binaries in the cloud and to push updates of the JavaScript bundle to apps without going through an appstore update process. This can be really neat if you want to regularly push out updates to your users quickly.</li></ul><p>You have to decide for yourself, whether you want to take advantage of the Expo ecosystem or not. If you did set up your project using the Expo CLI and change your mind later on, you can easily opt out using expo eject, which generates iOS and Android projects for you.</p><p><strong>Getting Started</strong></p><p>Install the Expo CLI with npm i -g expo-cli and bootstrap your app using the following command:</p><pre>&gt; expo init -t blank myrnapp-expo<br>[14:48:41] Extracting project files...<br>[14:48:49] Customizing project...</pre><pre>Your project is ready at /Users/peter/myrnapp-expo<br>To get started, you can type:</pre><pre>  cd myrnapp-expo<br>  expo start</pre><p>Let’s take a look at what that command leaves us with:</p><pre>&gt; ls<br>App.js    app.json    assets    node_modules    package.json</pre><p>Expo-specific is the app.json file, which contains configuration that is usually contained in the native project files and that Expo passes along. Other than that there is not much to say: App.js contains your apps’s entry point and from there you can start writing your components (which we will get to in a bit).</p><p>To run the project you just bootstrapped, you need to install the Expo app (<a href="https://itunes.apple.com/us/app/expo-client/id982107779">iOS</a>, <a href="https://play.google.com/store/apps/details?id=host.exp.exponent">Android</a>) on your mobile device. On your computer use expo start to start the development server and then open the project in the Expo app. Under Android you can conveniently scan a QR code that the Expo CLI presents to you, while iOS users have to manually navigate to exp://X.X.X.X:19000 where X.X.X.X is the local IP address of your development machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*jNMsET7vX5kE4CYKyQwgyQ.jpeg" /><figcaption>When you see this, it means your setup works.</figcaption></figure><p>The first time, the JavaScript bundle gets create, it takes a few moments, but when it is ready, you will be greeted with a Hello-World-Screen.</p><p>Neat. We will look at the code in more detail in just a bit, but first, let us talk about the alternative setup method.</p><h4>“Native” with `react-native init`</h4><p>When you want nothing to do with Expo, their tooling and their SDK, you can initialize a traditional-style project that contains all the necessary sources that you need, in order to run an app on Android and iOS. This also means that you need the respective technology stacks available to run an app and test it out. To run on Android you need <a href="https://developer.android.com/studio/">Android Studio</a> (available for Windows, macOS and Linux) and either and Android device or an Intel CPU to run an emulator (without Intel’s HAXM software the emulator will be unbearingly slow). To test your app on iOS you need a machine with macOS and Xcode installed, and then you run the app either inside a simulator or your iOS device.</p><p>The overhead of having to compile the app yourself inside of Xcode or Android Studio and the platform limitations for testing (e.g. if you have an iPhone available but no Mac, you can not run the app on your device) might seem tedious. But at the same time you have the power of native at your fingertips: If your team includes native developers, they can make changes to the native part of the app in order to maybe solve some problems that you can not solve in JavaScript. This includes access to native capabilities: The React Native community provides a rich pool of packages that expose some native API to JavaScript and you can (more or less) easily include them in your project. On the one hand, this offers incredible flexibility in terms of the features that you can build, but on the other hand it might require some fiddling with the native projects. Assuming that your lack of native expertise brought you to React Native, this might be a turn-off.</p><p><strong>Getting Started</strong></p><p>Let’s create an app using the React Native CLI. Install the CLI using npm i -g react-native-cli and then use it to initialize a new project.</p><pre>&gt; react-native init myrnapp<br>This will walk you through creating a new React Native project in /Users/peter/myrnapp<br>Using yarn v1.9.4<br>Installing react-native…<br>yarn add v1.9.4<br>info No lockfile found.<br>[1/4] Resolving packages…<br>[2/4] Fetching packages…<br>.<br>.<br>.</pre><pre>├─ xml-name-validator@3.0.0<br>└─ yargs-parser@9.0.2<br>Done in 22.46s.<br>To run your app on iOS:<br> cd /Users/peter/myrnapp<br> react-native run-ios<br> — or -<br> Open ios\myrnapp.xcodeproj in Xcode<br> Hit the Run button<br>To run your app on Android:<br> cd /Users/peter/myrnapp<br> Have an Android emulator running (quickest way to get started), or a device connected<br> react-native run-android</pre><p>You will end up with dedicated folders containing the Xcode- and Android Studio projects respectively as well as a JavaScript file containing a Hello-World component just like in the Expo setup.</p><pre>&gt; ls<br>App.js    android    app.json    index.js    ios    node_modules    package.json    yarn.lock</pre><p>To get this running on your device requires slightly more work compared to the Expo variant: Open the project on Xcode or Android Studio (depending on your target device). You can launch the app in an emulator, but running it on a device is much more exciting and useful. For iOS you need to set up code signing with Xcode first — if you have not done that before, you may want to consult <a href="https://help.apple.com/xcode/mac/current/#/dev60b6fbbc7">Apple’s documentation.</a></p><h3>Code. At last</h3><p>Let’s finally look at the actual code that we start out with after having our project bootstrap by one of the two tools.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49aa31af297447eece546f8d2c4ebfea/href">https://medium.com/media/49aa31af297447eece546f8d2c4ebfea/href</a></iframe><p>For those of you who are familiar with React, the code will already make sense. If you have never seen React code, this might look a bit weird, but you will quickly get used to this syntax and structure.</p><p>The code above imports some basics from the react and react-native libraries, and defines a component that it then exports. This component is written as a JavaScript class that inherits from React.Component and contains a render method. As in React.js, every component needs to have a render method — you can even define you component as just that function, but we will be using classes per default.</p><p>The render method returns the UI component that is shown to the user. The return value of the render method is a <a href="https://reactjs.org/docs/introducing-jsx.html">JSX definition</a>. JSX is similar to HTML, but is written right into a JavaScript file and can include JavaScript expressions. Expressions inside JSX are written in curly braces like the value of the style attribute in the &lt;View&gt; component above.</p><p>Components are composed of other components. In the example above the structure is simple: A &lt;View&gt; (more or less corresponding to a &lt;div&gt; in the world of the web) is wrapped around a &lt;Text&gt; node — only &lt;Text&gt; components can directly include text in React Native.</p><p>Try and change the text, the component shows, and reload the app — if livereload is not already enabled you can fix that in the app’s debug menu that you open up by shaking the device or pressing CMD+R in the emulator.</p><p>The App.js file also includes some style definitions that are applied to the &lt;View&gt;. Just as in HTML, elements/components can be customized using the style attribute. React Native tries to emulate a bunch of CSS properties, but not all of them. You also have to use camel-case (compared to kebab-case in CSS) to achieve valid JavaScript syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*OPI0DPdN17tyTHPCAop7cQ.jpeg" /></figure><p>Try rendering a different text by adding a color property to the stylesheet and give it either a hex-value or a color name like &#39;pink&#39;.</p><p>React Native uses the <a href="https://yogalayout.com/">Yoga</a> layout engine to position components on the screen, which works similar to the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox">CSS</a> <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">flexbox </a><a href="https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties">model</a>. You will quickly pick up how this works in the <a href="https://facebook.github.io/react-native/docs/flexbox">related React Native layout documentation</a>.</p><p>But I am getting ahead of myself. We work with the code in the coming parts of this series.</p><h3>Summing up</h3><p>In this post you have seen how to bootstrap your first React Native project and run it on your device. You can start writing native apps now, or you can stick around for the next article in which we will build a simple master-detail kind of application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8a0b0034898" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/setup-first-steps-react-native-mobile-app-development-part-1-e8a0b0034898">Setup &amp; First  Steps— React Native Mobile App Development Part 1</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[dotJS 2018 — Retrospective]]></title>
            <link>https://medium.com/enpit-developer-blog/dotjs-2018-retrospective-c7f860a33780?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/c7f860a33780</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[paris]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[dotjs]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Peter Steinberg]]></dc:creator>
            <pubDate>Fri, 16 Nov 2018 13:07:23 GMT</pubDate>
            <atom:updated>2018-11-16T13:07:22.452Z</atom:updated>
            <content:encoded><![CDATA[<h3>dotJS 2018 — Retrospective</h3><p>Last week, <a href="https://www.dotjs.io/">dotJS</a> welcomed over 1500 JavaScript enthusiasts to Paris — <a href="https://medium.com/u/710d66df63c8">enpit</a> sent <a href="https://medium.com/u/f8d0cd2b08af">Janis Krasemann</a> and me along with them. The crowd was eager to listen to some of the industry’s most influential people talk about what we all love: JavaScript. A whole day of JS-goodness was in store for us and the dotJS team had done a fantastic job of curating a day with high-quality talks about different topics — <em>from type systems to Minecraft, from framework-hell to dancing robots.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*BLi0JLmOs7DpSNrmG1MyMw.jpeg" /><figcaption>The venue shortly before the talks began</figcaption></figure><h3>JavaScript in the field</h3><p>What are the interesting things that some of us do with JavaScript? How do we use it and what are technologies that we find intriguing?</p><p>The day started off with Sacha Greif (<a href="http://twitter.com/SachaGreif">@SachaGreif</a>) presenting the results of the 2018 edition of his <a href="https://stateofjs.com/">State of JavaScript survey</a>. The full results will be published soon, but some of the takeaways from a quick look at some of the most popular JS technologies were that:</p><p>- React is going strong with high usage numbers and high developer satisfaction, <br>- developers use Angular a lot, but are not quite so satisfied with their experience,<br>- Vue is on a great trajectory with a lot of interest from developers who are currently not yet using it, but hope to do so in the future<br>- GraphQL became more popular over the last two years, and while developers are definitely interested, it is not yet widely used</p><p>Besides the big contenders like Angular and React, new libraries and frameworks seem to pop up every day. The abundance of these has become so ridiculous that it has become a running gag in the scene. So how to actually choose a JavaScript framework? You can argue a lot about a framework’s number of stars on GitHub, available plugins, documentation, its pros and cons in various, and all of that is fine. But when talking to a couple of people from different framework camps, John Papa (<a href="http://twitter.com/john_papa">@john_papa</a>) found a common theme in their explanation of why they enjoy a certain framework: “It <em>feels</em> good”. John made the point that our productivity and enjoyment with a framework is subjective to us and we should not feel insecure about our framework of choice, when it feels right to <em>us</em>.</p><p>This question of <em>feeling</em> might very much apply to another technology — not a framework in this case — that seems to be more and more commonplace in the JS community.</p><h3>Not my type</h3><p>One of the technologies that, according to the State of JS survey, is seeing a growth in developers using it, is TypeScript.</p><blockquote>Oh, no! Another technology! Why would I need this?!</blockquote><p>Two separate talks made a strong case in favor of using TypeScript: By Lauren Tan, who approached the topic by giving a theoretical motivation for using type systems in general, and by the inventor of TypeScript himself, Anders Heijlsberg. Lauren (<a href="http://twitter.com/sugarpirate_">@sugarpirate_</a>) framed the topic in a smart way: By constraining the domain of the values in your code, you limit the possibility space for unexpected behavior. Of course it helps, that type systems correspond to algebraic models and proof theory, which provide solutions for analyzing such systems. In a sense, type annotations are propositions and code is proof, which allows algorithms to verify these propositions. The knowledge about our code that those algorithms gather, can help you and your IDE catch a lot of mistakes early, and reduce the number of ways that your program can fail.</p><p>In the JS environment there are two famous implementations of static type checking, one of them being TypeScript. Anders Heijlsberg (<a href="http://twitter.com/aheijlsberg">@aheijlsberg</a>), of Turbo Pascal- and C#-fame, created TypeScript at Microsoft and seems to work closely with the Visual Studio Code team to integrate TypeScript support into the editor. He demonstrated a bunch of things that the TypeScript compiler can do for us — even if we are not even writing TypeScript! Two of the main features, that might make TypeScript appealing even to opponents of strongly typed languages are:</p><ol><li>A strong focus on type inference, so that we don’t have to be overly verbose with our type annotations, and</li><li>structural typing, which basically means that the compiler will happily duck-type objects that are nominally of different types, but structurally compatible — that kind of flexibility is, afterall, why we enjoy writing JavaScript so much, isn’t it?</li></ol><h3>Technologies of Tomorrow?</h3><p>TypeScript is neat and all, but what is even better are fast websites! And a technology that promises to make the web faster is HTTP/2. But much to Tara Z. Manicsic’s (<a href="http://twitter.com/tzmanics">@tzmanics</a>) dismay, developers don’t seem to appreciate this new standard. Tara tried to take our fear by explaining how the implementations of HTTP/2 have matured since its initial standardization… and in which aspects they haven’t.</p><p>Maybe we software developers are just not enough server-admin types to figure this stuff out. We want nitty-gritty programming language features like top-level await. A moderately big question mark since the introduction of async/await in JavaScript has been, how that feature could ever play nice with the module system. Gladly for us, Myles Borins (<a href="http://twitter.com/MylesBorins">@MylesBorins</a>) is on the case and involved in the standardization of top-level await by TC39. He talked about the status of the proposal and explained the different semantics that are possible to resolve dependencies involving async modules.</p><h3>It’s the little things</h3><p>The regular speaking sessions were loosened up by slots for lightning talks. And while I don’t want to make this article even longer than it already is, I <em>have</em> to mention the high-quality talks featuring:</p><ul><li>Jeremias Menichelli (<a href="http://twitter.com/jeremenichelli">@jeremenichelli</a>) about asynchronously loading webfonts,</li><li>Tim Pietrusky (@TimPietrusky) about using WebUSB to talk to an Arduino,</li><li>Roy Derks (<a href="http://twitter.com/gethackteam">@gethackteam</a>) about the downsides to boilerplate,</li><li>Sam Wray (<a href="http://twitter.com/_2xAA">@_2xAA</a>) about better render performance with off-screen canvas,</li><li>Adam Weeks (<a href="http://twitter.com/AdamWeeks">@AdamWeeks</a>) about debugging JavaScript code,</li><li>Mael Nison (<a href="http://twitter.com/arcanis">@arcanis</a>) about Yarn and locating modules,</li><li>Kashyap Kondamudi (<a href="http://twitter.com/kgrz">@kgrz</a>) about composing promises,</li><li>Tejas Kumar (<a href="http://twitter.com/_TejasKumar">@_TejasKumar</a>) about WebAssembly,</li><li>Olivier Loverde (<a href="http://twitter.com/loverdeolivier">@loverdeolivier</a>) about the CQRS pattern, and finally</li><li>Joost Lubach (<a href="http://twitter.com/joostlubach">@joostlubach</a>) with an <em>incredibly </em>entertaining visualization of asynchronous program execution.</li></ul><p>So shoutout to these guys. And while we’re at it: For this awesome event we have to thank the great team behind it, including Sylvain Zimmer (@sylvinus), Ferdinand Boas (@ferdinandboas), Dorothée Hachez (@doh1313) and Vincent Zimmer (@vinczimmer), and of course the glamorous host Christophe Porteneuve (@porteneuve).</p><h3>JavaScript Everywhere</h3><p>JavaScript on the desktop has a bad rep, according to Felix Rieseberg (<a href="http://twitter.com/felixrieseberg">@felixrieseberg</a>) — and he’s right. A huge number of Electron apps, one more sluggish and memory-hogging than the last, keeps being released. But it doesn’t have to be that way! Felix gave some great tips and tricks as to how we can make our desktop JavaScript code more performant. The caveats he pointed out were to</p><ul><li><em>mind your modules</em>: Think about what the runtime has to load before the UI gets displayed. Do you really need that npm module?</li><li><em>respect the re-renders</em>: When part of your UI state changes, make sure to not repaint other components unnecessarily.</li><li><em>leverage lifecycle methods</em>: Use a component’s lifecycle methods to your advantage by properly registering — and even more importantly — <br>de-registering callbacks.</li></ul><p>If you do it right, your users won’t even notice that an application uses JavaScript. After all, nobody complained about the JavaScript in Battlefield One, although the ingame UI is rendered via React!</p><p>Speaking of games: Tobias Ahlin (<a href="http://twitter.com/tobiasahlin">@tobiasahlin</a>) from Mojang, the creators of Minecraft, shared interesting insights into their current efforts to create the future Minecraft UI using JavaScript. They use an <a href="https://coherent-labs.com/hummingbird/">optimized JS engine</a> that runs on virtually all platforms to interpret their code, so that they can deliver a performant result on all the devices that run Minecraft today. The new UI is not yet publicly released and still a work-in-progress, but according to Tobias, the convenient tooling and workflows that JS developers are used to, were a welcome surprise for the game devs. They are now able to iterate over new ideas faster — and to tap into the market of millions of JavaScript developers when it comes to hiring.</p><p>Ok, apparently you can build AAA games using JavaScript. But surely JavaScript has its limits and you couldn’t use it for, say, high-performance use-cases like a CDN. Well, yes you can. Or at least, Kurt Mackey (<a href="http://twitter.com/mrkurt">@mrkurt</a>) can. He is tweaking the V8 engine itself to get the performance necessary, that let’s his users define rules for his CDN <a href="https://fly.io/">fly.io</a> using JavaScript. This enables them to easily provide functionality on top of their application, that they can deliver as close to their customers as possible.</p><p>We write a lot of JavaScript code for the web, the desktop or for mobile. But JavaScript is truly everywhere!</p><p>And if you want to give yourself the special treat and let your robots dance to the beat of some music, you better ask Devon Lindsay (<a href="http://twitter.com/devonbl">@devonbl</a>). She not only defined dance-routines for their robot squad, but figured out how to push these routines to the bots over Bluetooth. And while JavaScript is not particularly known for its applications in real-time scenarios, the three little robots performing a choreography in sync — of course live in front of the dotJS audience — showed us: It works!</p><p>Speaking of “it works”: I gotta get back to it, so thanks for reading and happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zJS7PhQrq3dC3POBg98VFw.jpeg" /><figcaption>For sure!</figcaption></figure><p>PS: Check out <a href="https://www.flickr.com/photos/97226415@N08/sets/72157703590355895/">the official photo gallery</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7f860a33780" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/dotjs-2018-retrospective-c7f860a33780">dotJS 2018 — Retrospective</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why React Native? — Mobile App Development Part 0]]></title>
            <link>https://medium.com/enpit-developer-blog/why-react-native-mobile-app-development-part-0-b2b6e38b67a6?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/b2b6e38b67a6</guid>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Peter Steinberg]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 15:40:00 GMT</pubDate>
            <atom:updated>2018-11-28T10:47:59.803Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why React Native? — Mobile App Development Part 0</h3><p><em>This is part 0 in a series of articles about mobile app development with React Native.</em></p><p>This series of blog posts is about developing mobile applications with React Native. But before we get our hands dirty in Part 1, we should justify, why we even consider React Native and what other options there are. If that is not interesting to you, feel free to skip right ahead to Part 1.</p><p>Before we get into actually developing a mobile app using React Native, let us look at the competition and evaluate whether React Native is right for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YU9cLepGCdeX7PAJATKnYw.png" /></figure><h3>The AlterNatives</h3><p>To decide on whether React Native is right for you, you need to know what other choices you have. The alternative technologies that we will consider here, are native development, Apache Cordova, the Ionic framework, Flutter and Xamarin. Maybe one of these approaches is the right one for you because of your technological background or an existing codebase in your company.</p><h4>Native</h4><p>You probably know that you can write your native apps in Java or <a href="http://kotlinlang.org/">Kotlin </a>for Android and in Objective-C or <a href="https://swift.org/">Swift </a>for iOS. For both platforms the native APIs and workflows are simply more powerful and flexible than any cross-platform technology can ever be.</p><p>They allow you to take advantage of all the platform’s features. With cross-platform solutions you eventually will run into a problem that you cannot solve with the given technology — the power of native is endless. Not only are the technical capabilities of native superior, but the documentation is too. Google and Apple have invested into documentation and community for years and whatever problem you are facing, someone has probably already solved it. This is in particularly stark contrast to the React Native ecosystem, which is relatively young and defined by breaking changes in the library or the tooling around it.</p><p>The obvious disadvantage of native development is that you have to develop two apps in parallel: one for iOS and one for Android (unless you decide to only target one of these platforms). This not only adds huge amount of additional coding work, but also introduces an organizational overhead into your development process.</p><p>While it might be a natural thing for a seasoned Java developer to start developing Android apps, web developers will likely have a much harder time transitioning into native app development. For them, using a technology like Cordova or React Native will be much easier to pick up.</p><h4>Cordova</h4><p>Being around since 2011 as the open-sourced version of Adobe’s Phonegap, <a href="https://cordova.apache.org/">Apache Cordova</a> is a classic in the realm of cross-platform mobile development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcDyAQzCdcs2BJu-5Bd5FQ.png" /><figcaption>Cordova is a mature platform that allows developers to create mobile apps using the technologies of the web.</figcaption></figure><p>Cordova provides you with a web view in which you can run any web application. In order to interact with the platform, Cordova exposes device APIs to the JavaScript inside the web view.</p><p>Running a web application in what is basically a chromeless browser on the mobile device comes with some obvious advantages and disadvantages. It offers you a tremendous amount of freedom when it comes to choosing an application architecture. The hurdle of entry on the one hand and the scalability to support larger applications on the other hand are defined by the framework you use, not by Cordova. Existing web applications might be easily ported over to Cordova and if you want to develop an app for mobile and the web, Cordova is your friend, as it also offers <em>web</em> as a target platform.</p><p>The flexibility of the web-based platform might be scary for developers coming from other languages, but web developers will feel right at home. Since differences in browser engines have become mostly irrelevant, a Cordova based app will likely look exactly the same across iOS and Android. This can be a good thing, if consistency between the apps is a prime concern. But it can also lead to tedious conditional logic if you want to incorporate OS-specific UI concepts and best-practices.</p><p>A downside to rendering a web application instead of using native UI components is, however, that it takes special care to make the UI feel native. There are a lot of details to how native UI looks and feels, that users often only notice unconciously — unless something about UI feels <em>wrong</em>. To avoid irritating users, native behavior has be emulated perfectly. The other option would be, to create a UI that is so radically unique and different from native, that users would not apply their usual expectations for UI to the interaction with your app. If what your app does lends itself well to extremely creative UI concepts, great, but if you mostly rely on traditional ways to display and manipulate data, a web view-based technology such as Cordova might feel clunky.</p><p>Since Cordova does not come with a builtin structure for the user application nor with out-of-the-box UI components, it inspired a host of frameworks that build on top of it. Their scope, approach and success vary, but maybe you find exactly what you are looking for among these frameworks: Besides <a href="https://phonegap.com/">Adobe’s Phonegap</a>, relevant frameworks include <a href="http://framework7.io/">Framework7</a>, <a href="https://onsen.io/">Onsen UI</a> and <a href="https://ionicframework.com/">Ionic</a>.</p><p>Generally speaking, if you are a web developer venturing into mobile for the first time and you are <em>not</em> working with Angular or React already, then Cordova might be right for you, as you can probably take your favorite set of frameworks and libraries that you are using on the web with you.</p><h4>Ionic</h4><p>The <a href="https://ionicframework.com/">Ionic framework</a> builds on top of Cordova, but comes with its own complete ecosystem: It uses Angular as the framework to build the app, brings its own CLI for initializing and packaging projects, has its own marketplace of third-party components that you can use, and they offer a service that lets you build application binaries in the cloud and push updates to clients.</p><p>As Ionic uses the Cordova technology, some of the same pros and cons apply. Given that Ionic is a more complete overall solution and Angular is a relatively rigid framework, it might be a good solution for non-web developers who are looking for a mature system that provides them with a lot of structure to get started quickly. For seasoned Angular developers, choosing Ionic for their first mobile app is probably a no-brainer.</p><p>Web developers who are not fans of opinionated frameworks and like to mix-and-match smaller building blocks to create an architecture to their individual liking might not be too happy about using Angular and I definitely count myself as one of them.</p><h4>Xamarin</h4><p>The Microsoft-owned cross-platform development tool <a href="https://visualstudio.microsoft.com/xamarin/">Xamarin</a> provides you with C#- and .NET wrappers around native APIs. With Xamarin Native you will still end up with native projects for iOS and Android respectively, but a large part of your code will be written in the form of Portable Class Libraries written in C# that you can reuse across platforms.</p><p>Xamarin.Forms is a slightly different solution that has you work on <em>one</em> cross-platform code base. Apart from using C# and .NET for writing application logic, you define your UIs in XAML, a markup language reminiscent of XML that can also be used e.g. in apps for the Universal Windows Platform (UWP). But while you do have one shared codebase for both your iOS and Android, you will nonetheless end up writing a good portion (from what I hear it varies between 5% and 20%) of conditional logic to target each platform specifically.</p><p>Microsoft tries to make up for Xamarin’s relatively small online community by giving you a highly integrated development environment in the form of Visual Studio (which you <em>have</em> to use). The tooling and the SDK allow you to get started quickly with a simple app, but your mileage may vary once you start working on more complex features or those that require platform-specific code.</p><p>Xamarin Native and Xamarin Forms might be worth a look, if you feel at home in the .NET world or even if you are mainly experienced in Java development, as the conceptual leap is smaller compared to e.g. going from Java to React Native. If your company is already invested into the Microsoft ecosystem and you would like your app development to synergize well with other .NET applications your team is working on, Xamarin might be right for you. For people coming from a web development background, such as myself, I see no real benefit in diving into this unfamiliar and only <em>okay</em> environment for doing cross-platform development.</p><h3>Flutter</h3><p>A more recent contender in the realm of cross-platform development, is <a href="https://flutter.io/">Google’s Flutter</a>. It’s an interesting technology in that is bears some similarities with React Native, but differs substantially in other aspects.</p><p>Flutter uses <a href="https://www.dartlang.org/">Google’s Dart programming language</a>. It has been around for a little while but not received much attention from most of the developer community, it seems. It is mainly focused on being used with Flutter to build cross-platform mobile apps, but it can run inside of Chrome and there is a server-side implementation as well. You most likely have not used Dart before and chances are, you are not going to use it for anything in the future — except in Flutter, if that’s your pick.</p><p>Flutter takes quite the opposite approach to running code and native bindings than React Native does: The Dart code is compiled to native ARM code, which beats out React Native and any Cordova-based technology performance-wise. For its UI, though, it does not use bindings for native components, but draws its own UI using a <a href="https://skia.org/">fast and battle-tested rendering library</a>.</p><p>As a consequence, you get visual consistency across different platforms and OS-version (similar to a WebView-based approach), but you potentially lose consistency between the look-and-feel of your app and the OS its running on. Which of these types of consistency is more relevant to you, of course depends on your project.</p><p>In terms of application architecture, Flutter seems to incorporate a paradigm that’s similar to React Native: Data flows down a component hierarchy and state updates have to be manually handled via setState (it even has the same name as in React :) ).</p><p>If you don’t mind learning a new language and like the idea of having your UI consistently rendered across devices, Flutter might be worth a look.</p><p>My personal feeling is, that Flutter takes what makes working with React difficult (data flow and state management), keeps that, and adds a new language to make things more difficult. I thoroughly enjoy writing JavaScript and I am not sold on the benefits of Dart. But I definitely lack the experience here to come to a final judgement about this.</p><h3>React Native</h3><p>While all those technologies have their merits and might be right for your situation, this series is about <a href="https://facebook.github.io/react-native/">React Native</a> after all. So let’s dig into what this is all about!</p><h4>What is it?</h4><p>If you are like me, you want to keep working in JavaScript when it comes to your mobile application, but at the same time not be limited by the technological compromise that is Cordova. Or maybe you just really, really like React. Fret not, my friend: Behold React Native!</p><p>What makes React Native different from Cordova and any derived framework, is that with React Native, <em>your UI is actually a native one</em>. While your general app logic is run by a JavaScript runtime on the mobile device, the UI definitions are mapped to native components. This has the potential to give your app a more native look and feel throughout, not to speak of the better render performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGzMClxYxDjw1WGwGHCXBA.png" /><figcaption>At first glance, React Native looks just like React even though it renders a native UI instead of a WebView.</figcaption></figure><p>Developing a React Native app feels very similar to writing a web app in React: You (usually) have your <a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a> component definitions, the same lifecycle methods, you can use <a href="https://redux.js.org/">Redux</a> and <a href="https://www.styled-components.com/">styled-components</a> and all that good stuff that React developers are used to. At the same time, you can use APIs to access device capabilities like the camera or storage.</p><p>The comparison to React.js is also fitting in the sense that the library itself only comes with a view layer (very, very broadly speaking). Developers from other languages might be surprised by the lack of an MVC architecture: For structurally more complex apps you have to find your own solutions (which of course can include using additional JavaScript libraries to help you with that).</p><h4>The Community</h4><p>If you choose to build your app in React Native, you are in good company: Facebook Messenger, Instagram, Pinterest, Skype and Uber all use React Native to some degree. Several posts on large companies’ <a href="https://facebook.github.io/react-native/showcase.html">development blogs</a> reveal how React Native allowed their web developers to create a mobile app and how this app made use of shared components across web and native.</p><p>React Native comes with a couple of useful APIs and components, but quite early in your React Native app development endeavor you will notice that you require features, that the base installation of React Native does not offer. Fortunately there is an enthusiastic and productive community of developers that write and publish custom components, UI toolkits and native modules. Native modules expose some native API to JavaScript so that you can access features like the camera or contact list. A great collection of all kinds of React Native ressources can be found at <a href="http://www.awesome-react-native.com/">awesome-react-native.com</a> and a large set of UI components is assembled in <a href="https://github.com/madhavanmalolan/awesome-reactnative-ui">this GitHub repo</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O5a6o-8R4CaptIyPq2B24w.png" /><figcaption>The awesome-react-native site compiles a large number of useful articles, tutorials and components.</figcaption></figure><h4>Kinda Subjective</h4><p>Why do <em>I</em> think, that React Native is a great choice for mobile app development? It allows me to create native UIs using cross-platform code. How convenient is that?! Neither do I have to write separate applications for each platform, nor do I have to compromise on rendering inside a web view. The power of native is at the fingertips of our JavaScript-proficient hands. And while I personally don’t <em>love</em> writing React, I still like it much better than Angular. React Native allows me to use small libraries and assemble them to my liking using my own glue code and architecture, just like on the web platform. I love JavaScript for its expressive power and with React (Native) I maintain that power to a far higher degree than I would in Angular (or Xamarin for that matter).</p><h3>Summin’ it up</h3><p>You came to this blog post to read about React Native and maybe you are a bit disappointed that we didn’t immediately took a deep dive into the topic. But I think the decision of what technology to employ in a new project, has to be an informed one. Which solution is right for <em>you</em>, depends on your situation:</p><ul><li>What are the technologies that you or your team are most experienced with?</li><li>Can you afford to develop two native apps in parallel?</li><li>How much is your app going to rely on native APIs, how performance-critical is it?</li><li>Do you want to leverage code sharing between the app and the server, or between the mobile app and a web app?</li><li>Should your app adhere strictly to the look-and-feel of the native UI or are you going to build a very custom UI anyway?</li></ul><p>Think about these questions before committing to a technology — what is right for one project is not necessarily right for the next one. I hope, this article could serve as a starting point to guide you in making that decision and to maybe point you into a direction. If you decide to stick with React Native, stay tuned for part 1 of this series, where we will get started with our initial setup of React Native.</p><p>—</p><p>PS: Who said, that the technologies mentioned in this article were mutually exclusive? It is possible to combine them to try and utilize each one’s strengths.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2b6e38b67a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/why-react-native-mobile-app-development-part-0-b2b6e38b67a6">Why React Native? — Mobile App Development Part 0</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alexa — What are Slots and how to read Slot-Values?]]></title>
            <link>https://medium.com/enpit-developer-blog/alexa-what-are-slots-and-how-to-read-slot-values-ea050047df0c?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/ea050047df0c</guid>
            <category><![CDATA[amazon-echo]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[alexa-skills]]></category>
            <category><![CDATA[alexa]]></category>
            <dc:creator><![CDATA[Chris Winter]]></dc:creator>
            <pubDate>Thu, 26 Apr 2018 17:50:59 GMT</pubDate>
            <atom:updated>2018-04-26T18:00:53.794Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is about how to declare and work with slots. It will also show you the struggle which I had while working with them. Enjoy!</p><h4>Introduction to Slots</h4><p>Slots are basically <em>variables in utterances</em>. These can have predefined values but are by default empty. To define a slot you first need to create a custom Intent in your skill because you can’t use them in the built-in Intents. After that, when you need to create your sample utterances for the Intent, simply define a slot by writing it in curly brackets.</p><p>In this post we want to create a skill that returns opening hours for an office on a variable day in an also variable city. So we create an utterance that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i_mkUkvaG_A_ERksHW5xFg.png" /><figcaption>Sample utterance with slots</figcaption></figure><p>The Skill Builder will detect {City} and {Day} automatically as slots and highlights them. In our intents list we will see these two slots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*2F3D9mpGzRb5pYLxz49iBA.png" /><figcaption>the slots in the intent list</figcaption></figure><p>If we click on them, we can give them a specific type. For the city slot we choose ‘Amazon.DE_City’ which is a predefined slot-type from Amazon that can handle about 5000 city names in Germany. The day slot goes with ‘Amazon.Date’. As next we want to choose if the slot is required to fulfill the Intent. In our case booth slots are required to fulfill the intent.<br>They’re needed because we can’t give out specific opening hours without knowing the day or the city of the given office.</p><p>We also want to take a look at the Alexa speech prompts and the user utterances. To explain them we must take a look at the Alexa feature ‘Dialog.Delegate’, this feature can delegate the dialog to Alexa if the user didn’t provide all the needed values for the slots. If a user did not provide a value for a slot from our skill, we can define some speech prompts in the slot menu. Alexa will then ask the user to provide a value for the specific slot. We will ask the user in our speech prompt for the day slot: ‘You still must tell me for which day you want to know the opening hours’ and as user utterances we define ‘on {Day}’.</p><p>To further explain ‘Dialog.Delegate’ we need another example. Let’s say the user only provides our skill with the location but not with the day. This means not all the slots that are needed to fulfill the Intent are filled. That’s the point where we hand out the dialog with the user to Alexa. It then will use our predefined utterance to ask the user for the missing value of the slot. Now the user will answer for example with ‘on Friday’. Alexa will now update the slot value, and we have all values we need to work with.</p><p>By the way, a pretty nice thing is that the user can “over answer” the question and also fill another needed slot. For example ‘on Friday in Berlin’ will set the day slot value to ‘Friday’ and the city slot to ‘Berlin’.</p><blockquote>This sounds easy where is the struggle?</blockquote><p>There it is…</p><h4>Struggle &amp; Solution</h4><p>I ran into serval problems while working with slots, here are my ‘favorites’:</p><p><strong>How to get these slot values?</strong><br>So the user provides us with some values, but oh no, how do we access them? No problem, just take a look at the documentation.. Nope that’s a dead end. The documentation will only provide you with some utterance examples and some extra (useful) information for the different slot types. So there I was, searching on Stackoverflow and other various websites how to access a slot value with no solution, which also shows me another problem and cost really too much time. Finally I took a look at the ‘<strong>this.event.request.intent.slots-object</strong>’. One line of code. So if you want to access the city slot value simply put this line of code in your lambda function. Thank you, <a href="https://medium.com/u/1c53193ae89c">Peter</a> for the pointer!</p><pre>var cityName = this.event.request.intent.slots.City.value;</pre><p><strong>Why is Sunday not a valid input for the day slot?</strong></p><p>To explain this I will show you some line of code from my skill.</p><pre>const daysArr = [ “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”];</pre><pre>let d = new Date(this.event.request.intent.slots.Tag.value);<br>dayName = daysArr[d.getDay()];</pre><p>This code transforms the provided date from ‘<strong>Amazon.Date</strong>’ into a speakable day. But every time the user say ‘Sunday’ the skill returns ‘<strong>dayName</strong>’ with an incorrect output. That really drived me crazy for serval minutes until I realized that the first day of the week isn’t Monday in the states, is it Sunday and I need to rearrange my array to this:</p><pre>[ “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”];</pre><p>So always remember, even the smallest problems can break your skill!</p><h4>Conclusion</h4><p>Time to finish this post. In conclusion Alexa has some pretty nice built-in features like ‘<strong>Dialog.Delegate</strong>’, but without better explanations and code snippets these didn’t arrive in many skills which could use them to save much code and easily upgrade the user experience. Also, Alexa has multi language support, so maybe the documentation should hint to some local differences, like ‘Sunday is the first day of the week’ - thing even if it’s JavaScript specific. So please Amazon give us a better documentation and also create some mid range tutorials so the community can grow from fact-skill clones to a living and creative developer community!</p><h4>Further Information</h4><ul><li>Skills Kit Documentation: <a href="https://developer.amazon.com/alexa-skills-kit">https://developer.amazon.com/alexa-skills-kit</a></li><li>Git-Blueprints: <a href="https://github.com/alexa">https://github.com/alexa</a></li><li>New Blueprints: <a href="https://blueprints.amazon.com/">https://blueprints.amazon.com/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea050047df0c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/alexa-what-are-slots-and-how-to-read-slot-values-ea050047df0c">Alexa — What are Slots and how to read Slot-Values?</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Travelcost App — An Oracle JET Success Story]]></title>
            <link>https://medium.com/enpit-developer-blog/the-travelcost-app-an-oracle-jet-success-story-3cb5fec1cd08?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/3cb5fec1cd08</guid>
            <category><![CDATA[success-story]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[oracle-jet]]></category>
            <dc:creator><![CDATA[Janis Krasemann]]></dc:creator>
            <pubDate>Wed, 20 Dec 2017 15:33:51 GMT</pubDate>
            <atom:updated>2017-12-20T15:33:50.382Z</atom:updated>
            <content:encoded><![CDATA[<p>We at enpit are frequently on the road in order to reach our customers in all of Germany. Although traveling for work purposes can be interesting and refreshing, someone has to pay for it , which is what travel expenses are for. There is a multitude of apps in the app stores that promise to ease the burden of creating and handing in travel cost reports, but we have not been satisfied with those. Which is why we decided to create our own application for that purpose in 2016 — the <em>Travelcost</em> app was born.</p><p>In this story, we want to share a few of the key technical aspects of the app and its development process. As we are very happy with the result and how we implemented it, we even dare to call it a <em>success </em>story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MNR-rpEao83Tat-0v98tDA.png" /><figcaption>Create travel cost receipts on mobile or web — printing is optional.</figcaption></figure><h3>The Requirements</h3><p>As we were beginning to dip our toes into Oracles <a href="http://www.oracle.com/webfolder/technetwork/jet/index.html">JavaScript Extension Toolkit (JET)</a> and wanted to gather experience for bigger client projects, we decided to implement Travelcost in JET. There were three main requirements for the application:</p><ol><li>Allow the user to easily create a digital travel cost report, with as few clicks as possible and automatic travel cost calculation based on applicable law in Germany.</li><li>Give the user the possibility to create a PDF report from their travel cost report, such that it can then be sent via Email to accounting, or printed and handed in the old-fashoined way.</li><li>Optimize the web app for mobile, as it is somehow the custom at enpit to create the travel cost reports on a mobile phone at the end of the month when in the train back to Paderborn.</li></ol><h3>The Application</h3><p><a href="https://www.enpit.de/travelcost/">We invite you to use Travelcost on our enpit.de site</a> (beware it’s in german though ;) ). The app starts at the home screen which displays a few exemplary travel entries for the guest user. When using the app in production, we log in using our Google account in order to just see our own travels; the guest account is mainly for demo purposes. Tapping/clicking “Neue Reise” opens up a new form for creating a new travel, and selecting an existing entry opens up a detail view for that travel. This is where travels can be edited, deleted, printed or copied (turns out a lot of our travels regularly repeat, so we do not want to insert all the same data again).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*tMz1SCeX5JJ1Qojwq3gQ2g.png" /><figcaption>The home screen in a mobile web browser.</figcaption></figure><h4>Generating PDF Reports</h4><p>One very important feature is generating PDF reports. We chose <a href="http://pdfmake.org/#/">pdfmake</a> for rendering PDFs on the client side (we ultimately want the PDF on our <em>client</em>, and sending them over the internet wastes data, right?). Turns out this was a bad choice for two reasons:</p><ol><li>pdfmake has quite a few bugs on various mobile browsers, which resulted in frustration as the PDFs were not downloaded or not rendered correctly.</li><li>The font file that accompanies pdfmake is 1MB large and cannot be compressed further — we would have to send a lot of PDFs, which are only a few KB in size, in order to make up for that.</li></ol><p>This resulted in poor user experience due to long initial load time and unreliable rendering, which is why we decided to move PDF creation to the backend instead. This was an easy win as the client-side code that generated the PDF could be reused 1:1 (pdfmake also runs on nodejs after all). The results were extremely satisfying: Generating and downloading the PDF now takes <strong>under two seconds on 3G</strong>, and we reduced the footprint of our application by ~1.2MB. If there is a lesson to learn here, it is this:</p><blockquote>Don’t solve in your frontend what is better solved in the backend.</blockquote><p>We chose <a href="http://heroku.com/">Heroku</a> as a platform for running our backend services, which turned out to be an excellent choice. We have implemented three backend services, all in node.js, and were very pleased with the flexibility and usability of Heroku. We set our services up using the free dynos, which has the limitation that the services go into sleep mode after some inactivity, resulting in a delay of a few seconds when waking them up again by making a request. When we got serious about running the app in production, we switched to “hobby” dynos — which, to be honest, does not sound <em>that </em>serious as well. The hobby dynos do not have the sleep mode limitation any more, and can be upgraded further if need be.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*3vIJIa06SQda8QVNItXnGg.png" /><figcaption>For convenience, you can directly print a receipt for a travel upon creating or modifying it.</figcaption></figure><h4>Continuous Deployment</h4><p>As we wanted to treat the Travelcost app as a first-class project right from the beginning, we introduced linting and testing during the very early stages of the project (I blogged about how you can <a href="https://medium.com/enpit-developer-blog/power-up-your-oracle-jet-utilizing-the-full-potential-of-grunt-tasks-93080c2acb62">setup a linter in JET</a> on our enpit-publication last year). We configured a build &amp; deploy pipeline on <a href="https://www.codeship.com/">Codeship</a>, which builds the project, runs all tests and deploys the new version of the app or of the specific feature on Amazon AWS. This allows us to test each branch of our application individually — feature and bugfix branches all get their own URL with the respective feature or bugfix prefix, while the development and master branches are deployed to separate URLs. A push to master denotes a new release, so it also gets deployed automatically to <a href="https://www.enpit.de/travelcost/">enpit.de/travelcost</a>. With this setup, getting feedback on a work in progress feature is as easy as pushing the current state to the feature branch and posting the URL to Slack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*PpW5lSQBl5wLgBZXwp9OZQ.png" /><figcaption>Posting URLs to specific builds for easy testing.</figcaption></figure><p>However, automatic tests are boring if the developer who screwed the tests up is not blamed on Slack, so we setup the Codeship build notifier to report the build status. All kidding aside, this is pretty great because the whole team is kept in the loop about the development progress, and if the build fails you can get the conversation started right away in order to find a solution together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q6OpPOnKngbDsuEKfnjCBw.png" /><figcaption>The Codeship build notifier posts all results back to Slack — especially the bad ones.</figcaption></figure><h4>Going Paperless</h4><p>Although we now have a nice app that enables us to create travel report PDFs with ease, someone still has to invoice those reports. Instead of printing the reports on paper and handing them in manually 20th-century-style, we can send them via Email to <a href="https://www.fastbill.com/">Fastbill</a>. This allows our accounting people to be more efficient by setting up filters, preprocessing of emails and other magic.</p><h4>Future Plans</h4><p>Although we have a public release of Travelcost now, we still have some future plans for it. The most exciting aspects are:</p><ul><li>Releasing a Travelcost app built via Cordova on the Apple and Android app stores.</li><li>Offering multi-language support.</li><li>Implementing a Travelcost chatbot (e.g. for Slack) and a voicebot (e.g. for Alexa) which allows for even easier generation and management of travel cost reports.</li></ul><h3>The Verdict</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UDQaLPtofTh3hJHDKvE4Sw.png" /></figure><p>We are very pleased with our release and excited about the future plans for the Travelcost app. Although the road towards the release was sometimes bumpy (for example when <a href="https://medium.com/enpit-developer-blog/migrating-from-jet-v2-0-to-v4-1-a-painful-road-part-2-f4ee05db4f79">a new JET version was released</a>), JET proved to be a very well-rounded toolkit for creating such an application and we learned a great deal during development.</p><p>Again, <a href="https://www.enpit.de/travelcost/">please try the app by yourself</a> on our enpit-website and feel free to give us some feedback, preferably using the feedback button at the bottom of the app. You can visit the <a href="https://www.enpit.de/travelcost-info">Travelcost info page</a> for mor information if you speak some german. Also, make sure to visit us on <a href="https://twitter.com/enpit">Twitter</a> or our <a href="https://www.enpit.de/">website</a> for more JavaScript and IT modernization expertise!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cb5fec1cd08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/the-travelcost-app-an-oracle-jet-success-story-3cb5fec1cd08">The Travelcost App — An Oracle JET Success Story</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating from JET v2.0 to v4.1 — A painful road, Part 2]]></title>
            <link>https://medium.com/enpit-developer-blog/migrating-from-jet-v2-0-to-v4-1-a-painful-road-part-2-f4ee05db4f79?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/f4ee05db4f79</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[oracle-jet]]></category>
            <category><![CDATA[updates]]></category>
            <dc:creator><![CDATA[Janis Krasemann]]></dc:creator>
            <pubDate>Mon, 04 Dec 2017 19:52:10 GMT</pubDate>
            <atom:updated>2017-12-04T19:52:10.159Z</atom:updated>
            <content:encoded><![CDATA[<p>The road to migrating a JET v2.0 application to v4.1 continues, and although it is still challenging, great features are waiting at the finish line. In the first half of this story I will walk you through the pitfalls of updating a JET v2.3 application to v3.0 (read up on <a href="https://medium.com/enpit-developer-blog/migrating-from-jet-v2-0-to-v4-1-a-painful-road-part-1-1327dc856f10">part 1</a> to find out what the difficulties of updating to from v2.0 to v2.3 are). The third main release of JET got rid of Bower as its frontend package manager in favor of npm, so things are bound to get interesting at the very least. I decided to do the upgrade to v4.1 also in this story because — spoilers — it thankfully is rather straightforward!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*npfyiK-NRYc-NdkA.jpg" /><figcaption>The road isn’t over yet, but we’ll be fine</figcaption></figure><h3>v2.3 to v3.0</h3><p>The procedure is the same as in <a href="https://medium.com/enpit-developer-blog/migrating-from-jet-v2-0-to-v4-1-a-painful-road-part-1-1327dc856f10">part 1</a>: You can open up the <a href="https://docs.oracle.com/middleware/jet300/jet/developer/GUID-E3FF37C7-9B14-4C7F-AE4F-A25C6E394B84.htm#JETDG-GUID-E3FF37C7-9B14-4C7F-AE4F-A25C6E394B84">migration guide for v3.0</a> in a separate tab and refer to my notes for each step, if any, for additional information. Again, I did the migration for our <em>Travelcost </em>application, so switch all the paths etc. in the screenshots with your own application name.</p><p>If you are very sure that you know what you are doing and plan to directly upgrade to v4 after going for v3, I <strong>suppose</strong> you can skip all the steps that relate to fixing the Grunt builds. The reason is that JET v4 gets rid of Grunt in favor of a custom ojet build script. This could save you a lot of work, but you cannot be 100% sure that the upgrade to v3 was successful as you have no way of testing it without Grunt.</p><ul><li>Before step 1: Thankfully, we do do the upgrade in a newly scaffolded JET application (as with v2.0-&gt;v2.3), so you can just create a new branch in your versioning system right from the start.</li><li>Step 1: You can safely skip this if you are on npm v5 and above (which I highly recommend, you can read up on the new npm5 features <a href="http://blog.npmjs.org/post/161081169345/v500">on their blog</a>).</li><li>Steps 2–6: I absolutely <strong>hate</strong> the fact that I manually have to update the version numbers in main.js and main-release-paths.json <strong>every time</strong> a major update comes along. It feels like this should not be necessary because I already updated the oraclejet version in package.json, yet it is also mandatory for upgrading to v4 so I guess I am overlooking something. Apart from some confusion about this on my part, thankfully steps 2–6 are pretty straightforward.</li><li>Before step 7: I tweeted about it back when v3 was released, an essential step is still missing from the guide:</li></ul><h3>Janis Krasemann on Twitter</h3><p>If you upgrade to @OracleJET v3 dont forget to copy the new generator files to your project, it&#39;s missing in the guide currently //cc @enpit</p><ul><li>Still before step 7: Again, I may be overlooking something, but when I did the upgrade I still had to run the Yeoman generator again and create a temporary v3.0 JET application (my intuition would be that this script could instead be shipped via some npm dependency?). So, in order to get access to the new Grunt scripts that are mandatory for building the app, cd out of your application and run yo oraclejet tmp — feel free to abort the library installation as soon as you get the “Oracle JET: Your app structure is generated” message in order to save some time. Then, copy the two scripts from scripts/grunt/config into your existing application.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7upxgGB0ARgcqCkGEnNtjQ.png" /><figcaption>Missing from the guide: Run the generator to get the missing Grunt scripts.</figcaption></figure><ul><li>Still before step 7: The oraclejetconfig.json also changed a bit from v2.3 to v3.0, so copy that over to your application as well.</li><li>Step 7: If you have any additional Bower dependencies, just try to npm install them and hope for the best — chances are the package is also available on npm. Then add a corresponding entry to the copyCustomLibsToStaging config section of the scripts/grunt/config/oraclejet-build.js file (which we conveniently created before step 7). After that, remove the bower.json and scripts/grunt/config/bowercopy.jsfiles as well as the bower_components/ folder. If you did not succeed in getting rid of all the Bower dependencies or do not want to, leave these files in place.</li><li>Step 8: You can also remove the scripts/grunt/common/versions.js file if you got rid of Bower in step 7.</li></ul><p>And that’s it! Again, there was some pain involved in the update process, but one of the sources of that pain (Bower) is now gone, so that is a good thing I suppose. Also good: Upgrading from v3 to v4 is not that complicated, so I will handle it in this story instead of writing a part 3.</p><h3>v3.0 to v4.1</h3><p>Again, open up the <a href="https://docs.oracle.com/middleware/jet410/jet/developer/GUID-F4E07884-1C35-4B7C-84E3-60F6D949D344.htm#JETDG-GUID-C7EAD833-88A5-48BB-95A6-857F59FD22C4">Oracle docs for the JET migration to v4.1</a> in a separate tab and read my remarks for additional wisdom ;)</p><ul><li>Step 1: “Same procedure as every year, James”: If you are on npm v5 skip this step as you will get an error message otherwise.</li><li>Step 7: Do not panic if your app does not build when you run ojet build . If you do not have QUnit installed in your node modules (e.g. do not use QUnit for testing, like me) you will get an error message saying that the qunit-reporter-junit is not installed. This is because the npmCopyConfig.js file of the oraclejet-tooling module wants to copy references to said QUnit and its reporter plugin to your libs folder, but cannot do this because it is not listed as a dependency in the module’s package.jsonand thus was not installed. The quick fix is to just install the missing dependencies via npm install qunit qunit-reportr-junit . I filed an issue on the <a href="https://github.com/oracle/oraclejet-tooling/issues/1">oracjet-tooling GitHub repository</a>, so hopefully this will be fixed in a future version. In the meantime, if you run ojet build and ojet serve again after manually installing the dependencies everything should work just fine.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-LJlVbJMiyJ0tUniUR2duQ.png" /><figcaption>Don’t panic if you get a message like this.</figcaption></figure><ul><li>Step 8: If you still use Grunt in your project, e.g. for linting or testing, you should cleanup its Gruntfile.js in order to kill off the warnings that you get due to the now-missing grunt-oraclejet module. Just delete everything that references grunt-oraclejet or oraclejet-* and you should be fine. You can also delete the JET related Grunt config files in scripts/grunt/config .</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*NWZIgIliM7uCuveoUFnN4g.png" /><figcaption>Cleanup your Gruntfile if you still use it.</figcaption></figure><p>After these steps, you are good to go! Apart from the issue with the implicit QUnit dependency, the tooling feels much more stable now, and the new data-binding syntax is great. Our app also feels more snappier on v4.1, but that obviously depends on the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*ndATIwuhYV0453Mb.jpg" /><figcaption>We have finally arrived at JET v4.1!</figcaption></figure><p>I hope these posts helped you avoid some of the pitfalls when upgrading your Oracle JET application. If you still experience some issues, just shout for help on Twitter and mention me (<a href="https://medium.com/u/f8d0cd2b08af">Janis Krasemann</a>) and/or the official <a href="https://medium.com/u/aad0b2fd174b">Oracle JET</a> account, or join our <a href="https://gitter.im/oracle-jet-community/Lobby">JET community on Gitter</a>! Also, visit <a href="https://www.enpit.de/">enpit.de</a> for more JavaScript and IT modernization expertise.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4ee05db4f79" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/migrating-from-jet-v2-0-to-v4-1-a-painful-road-part-2-f4ee05db4f79">Migrating from JET v2.0 to v4.1 — A painful road, Part 2</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating from JET v2.0 to v4.1 — A painful road, Part 1]]></title>
            <link>https://medium.com/enpit-developer-blog/migrating-from-jet-v2-0-to-v4-1-a-painful-road-part-1-1327dc856f10?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/1327dc856f10</guid>
            <category><![CDATA[updates]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[oracle-jet]]></category>
            <dc:creator><![CDATA[Janis Krasemann]]></dc:creator>
            <pubDate>Wed, 29 Nov 2017 22:13:48 GMT</pubDate>
            <atom:updated>2017-12-01T12:06:26.255Z</atom:updated>
            <content:encoded><![CDATA[<p>Quite a lot happened over the past year in Oracle’s <a href="http://www.oracle.com/webfolder/technetwork/jet/index.html">JavaScript Extension Toolkit</a>. We are now at Version 4.1 which, compared to v2.0, got rid of Bower (yay!) and introduced a more concise syntax for data bindings. There are a lot more reasons for upgrading, especially if you are still at v2.x, but the downside is: It is rather painful, and error-prone. Which is why I documented the numerous pitfalls that you may encounter until you arrive at the promised land, i.e. the newest JET version. I sure hope upgrading gets easier after that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*Gh5IaEmtiEWeYA6Y.jpg" /><figcaption>Upgrading JET from v2.0 to v4.1 is not as painless as you would think…</figcaption></figure><p>I wanted to wrap this all up in one post, but turns out it is more complicated than I thought. This post thus only explains the pitfalls when upgrading from v2.0 to v2.3, and one or two separate posts will treat upgrading to v3 and v4, respectively.</p><h3>v2.0 to v2.3</h3><p>For some reason, you can only upgrade to v3 if you are at v2.3, so the first step is to upgrade the &lt;v2.3 application to v2.3. Thankfully, there is a <a href="https://docs.oracle.com/middleware/jet300/jet/developer/GUID-BB5C0640-953F-4CA8-8730-4CB3AC1D74B3.htm#JETDG-GUID-BB5C0640-953F-4CA8-8730-4CB3AC1D74B3">migration guide</a> available. Just follow the steps from that guide, and refer to my following notes for each step (if any) for more information. I did the migration for our internal <em>Travelcost</em> application, so if you encounter this name, substitute it for your own apps name.</p><ul><li>Step 1: When running npm cache clean you get an error as pictured below if you are on npm v5. Just ignore it and move on, npm got smarter since the migration guide was written.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*rGX0LBd5qvRQSV-U7hU6zQ.png" /><figcaption>Ignore this message if you encounter it.</figcaption></figure><ul><li>Step 3: To keep everything nice and clean, move your v2.0 application to a <em>*_v2–0</em> folder before you run the generator. Then generate the v2.3 application under your application name, as we will be moving our existing source files into the newly generated v2.3 application (weird, but whatever…).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*smcGf5e6N4fx-OCw31L55Q.png" /><figcaption>Name your app folder correctly if you don’t want to get confused…</figcaption></figure><ul><li>After step 3: If you take your application seriously, you have it under version control. This is a good point in the upgrade process to do so for the new v2.3 application. Just git add . everything and commit it and don’t worry about files that you may not need in your final v2.3 app — you can tidy up everything later. Commit your work at least after the migration is completed, possibly even more often.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*tSvJ4BsF2RGxucDQ9ixj2Q.png" /><figcaption>Safety first.</figcaption></figure><ul><li>After step 8: The migration guide assumes you do not have any custom Grunt scripts. In our case we have scripts for running ESLint and Karma tests — obviously, copy them over to the v2.3 application as well. Same goes for additional config files, like a .eslintrcor karma.conf.js. If you have custom Grunt scripts, you probably also have edited your Gruntfile, so copy the relevant lines over to your new Gruntfile as well.</li><li>I had some troubles with the oraclejet bower package not being installed in the correct version. This is probably an issue with the npm cache and may or may not occur anymore in npm v5. To make sure you have the correct version, run cat bower_components/oraclejet/bower.json and verify that the version is 2.3.0 .</li><li>The guide also forgets to mention that you should edit the bowercopy.js file if you have any additional Bower dependencies, like fontawesome for example. Manually copy the relevant stuff from your old bowercopy.js — hopefully only a few lines at the end of the file.</li></ul><p>That’s it! Check if all works by running npm install bower install grunt build and then grunt serve ! Also make sure all your tests are still passing — if you have any, which I sure hope you do ;)</p><p>As the last step, you want to merge your changes into the main codebase. If you just wanted to upgrade to v2.3, you can just merge into master. If you plan to continue down the road to v4.1, just merge your master branch into the update-branch (in my case ‘upgrade_v2.3&#39;) to make sure everything is in the right place and then continue the migration. Git may refuse to merge unrelated histories, but a <a href="https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories#37938036">wise man on Stackoverflow says</a> you can use the --allow-unrelated-histories flag when doing the merge to force the merge (which indeed works as expected, at least for me).</p><p>Let’s hope moving from v2.3 to v3 will be easier, but as v3 gets rid of Bower, it is bound to get interesting again! I plan to publish that post later this week.</p><p>Visit us at <a href="https://www.enpit.de/">enpit.de</a> for more JavaScript expertise!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1327dc856f10" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/migrating-from-jet-v2-0-to-v4-1-a-painful-road-part-1-1327dc856f10">Migrating from JET v2.0 to v4.1 — A painful road, Part 1</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Skillful Development for Amazon Alexa]]></title>
            <link>https://medium.com/enpit-developer-blog/skillful-development-for-amazon-alexa-a59a40c7240b?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/a59a40c7240b</guid>
            <category><![CDATA[voice-assistant]]></category>
            <category><![CDATA[alexa-skills]]></category>
            <category><![CDATA[amazon-echo]]></category>
            <category><![CDATA[alexa]]></category>
            <dc:creator><![CDATA[Peter Steinberg]]></dc:creator>
            <pubDate>Fri, 27 Oct 2017 12:27:55 GMT</pubDate>
            <atom:updated>2017-10-26T13:38:52.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwTKrURV6DHB1C2z6_3pRQ.png" /></figure><p>In this post I want to share some of what we learned when developing our first skill for Amazon’s Alexa voice-assistant platform. This is not a tutorial. I rather want you to get a sense for what challenges are involved in developing Alexa skills.</p><p>If you have played around with Alexa skill development before, I would be curious to hear from you, about what <em>your</em> experiences are!</p><h3>Amazon’s little helpers</h3><p>There are multiple ways to write code for an Alexa skill. For all that Amazon themselves care, you just need to provide a REST endpoint and setup your skill to point to that endpoint. As long as your API sends Alexa valid responses, it doesn’t matter in which language or with what kind of framework you wrote this API.</p><p>One option for hosting your skill’s API is of course Amazon’s own AWS cloud and that seems to be kind of a good fit. When you develop an Alexa skill you are dependent on Amazon anyway, so why not go all the way?! Now you can start implementing your skill by simply defining handlers for specific events such as onIntent for when Alexa sends you a user intent.</p><p>Because this approach was likely to include writing some amount of boilerplate code over and over again, we opted to use Amazon’s own JavaScript SDK. The SDK — or what it’s mostly called by Amazon themselves: the Alexa Skills Kit (ASK) — lets you define intent handlers directly instead of reacting to individual events. It also gives you a couple of default response methods (like :tell and :ask) and some (rudimentary) form of state management. This all seems nice.</p><p>In our skill we ask the user a bunch of questions and use the answers to compute a result value. When we started to implement this, we were initially not happy with what the SDK gave us. For every step in the conversation we would need to set the state, define intents and slots and then check the state in the actual handler code. As we were not sure, how tedious this might get — turns out, it’s actually not that tedious once you understood how all of this works — we looked for a library or something, that could help us with that. And lo and behold: Amazon themselves provide a special mode for a skill that is specifically designed to support developers in situations like ours, where we wanted our skill to collect some information from the user. This special mode is the “<a href="https://developer.amazon.com/docs/custom-skills/dialog-interface-reference.html">Dialog Model</a>” and the way it works is, that your code basically passes off the control flow to this model and it will then ask the questions you defined in the skill-builder. I will talk more about the drawbacks of using the skill-builder in a moment, but what specifically sucks about the dialog model, are limitations like that when you use it in your skill, you <strong>can no longer ask the user yes- or no questions at all!</strong> But our skill consists of more than <em>just</em> this one dialog and there were features for which we do want to ask the user yes/no questions. Just not possible. This meant we could not use the dialog model and had to implement the conversation flow ourselves. This is not a big deal in and of itself, but why even have this dialog model at all, if it restricts skills so much?!</p><h3>Do-it-your-state</h3><p>Once we realized, we couldn’t make our skill work without using yes/no questions, we needed to give up on the dialog model and build the conversation flow logic ourselves. The state management that the SDK gives you is fairly minimal and would have required us to write a somewhat verbose and unfocused style of code.</p><p>Because wewanted to have state management with enough syntax-sugar to no longer need to furiously copy-and-paste code together when adding states or individual intents, we decided to write <a href="https://github.com/enpit/echo-state">a small helper library</a> that offered exactly that. The main achievement of this library is that it allows you to create state hierarchies (which will not necessarily be reflected in the user’s interaction with the skill, but just in the code), where states can inherit intent handlers from their parents or choose to override them.</p><p>This is not to advertise our specific solution. I just have the feeling that if you want to be somewhat serious about Alexa skill development, you will end up writing similar utility functions yourself.</p><p>But enough about the technology. The most fundamental <em>conceptual</em> challenge in creating our skill has been, how to strucuture the user interaction. This is maybe due to our lack of experience in designing voice interfaces. But there are some really interesting issues that come up:</p><p>Conversations inherently progress over time and thus it is tempting to focus strongly on a specific sequence of questions and answers when designing a conversational interface. Turns out, this is not the best experience for the user — at least based on my experience, talking to our own skill.</p><p>I have not spend too much time researching the topic of VUI design so take the following thoughts with a grain of salt, but I came up with the following guidelines:</p><ul><li>You don’t want to restrict the user to saying or asking stuff in a specific order. Not only does the user potentially want to use a different order, but this makes it really feel like you are not talking to an intelligent thing, but to a script. You rather want to allow the user to jump around all the different statements or questions that you are prepared to deal with.</li><li>You don’t want to tell the user exactly what he is supposed to say. This makes your skill feel like a glorified phone answering machine. <em>”For more information, press ‘1’”.</em></li><li>You don’t want to structure your skill in a strictly hierarchical way. Compared to a graphical interface where the user can look at the menu structure in order to understand the information hierarchy of a site or app, voice interfaces seem to be not really discoverable. If you don’t want to dictate to the user what he is supposed to say, he will have to guess sometimes. A conversational interface feels smart, if the developer anticipated correctly, what the user will say.</li></ul><p>Designing a skill that does these things is not easy. One conclusion might be, that maybe Alexa skills just should not be “large” enough to be affected by these issues, but rather focused on doing <em>one </em>thing. But maybe not. Mabye it is just about figuring this stuff out. This can be a really exciting time where developers (and/or UX designers?) have to learn about a whole new way of interacting with the user.</p><h3>code &gt; web</h3><p>Probably my biggest pet peeve with the current development workflow for Alexa skills is the dependence on Amazon’s web-interface. While deploying the actual code for your skill works just fine using Amazon AWS Lambda, not everything concerning your skill is contained inside the code. Specifically: You have to build the interaction model, specifying all your skill’s intents and slots, using this web-interface. And not only is this site kind of slow and the interface a bit confusing, but more importantly: You can not automate anything about interacting with this skill builder and that there is no way around that!</p><p>You will typically have your code in git and deployable to Lambda via a script, <em>but</em></p><ul><li>it is not possible to version your interaction model,</li><li>it is not possible to keep a history of past revisions of your interaction model,</li><li>it is not possible to automatically deploy your interaction model from a piece of code and</li><li>it is thus not possible to keep the code and the interaction model in sync.</li></ul><p>Everything you do to achieve these things is basically you manually copy-pasting stuff from one place to another. This is not how you efficiently develop <em>anything</em>. I seriously do not know, why Amazon does this and — at least for me — this is a very big turn-off.</p><p>The same goes for testing. Amazon does not offer any library for unit-testing skills. The way we tested our skill was either by directly talking to Alexa, which can get annoying pretty quickly and does not give you any meaningful information in case something goes wrong. Or we used Amazon’s web-interface again. The Alexa developer portal includes a text-input based skill tester, where you write what you would say to Alexa, it generates a proper JSON object with your request, sends that to your endpoint and then presents you with the JSON response. This is not bad, but when the endpoint fails, you will just see a generic error message. In order to debug the code you need to go to where the code itself is executed: In our case, AWS Lambda. In Lambda, you can create test events for your functions that consist of a JSON request object that gets sent to the function. What we ended up doing in order to debug our code, was to copy the request we wanted from the Alexa testing form and paste it into the Lambda test event configuration. This process is annoying as hell.</p><p>Ideally, I would like to do two things locally, on my machine:</p><p>While developing a new feature, things may not initially work and I want to create requests in order to specifically trigger the failing case in order to get an insight into what is wrong. For that I would need a local way (without using the testing form on the website) to generate compatible JSON requests.<br>And when changing something internally in the code without affecting the user-interface (i.e. the conversation itself: the speech samples, responses or the conversation flow) I want to run a suite of test cases against my skill in order to verify, I didn’t inadvertantly break anything. In both cases I would need a way to locally send requests to my skill and receive a response.</p><p>Now this <em>is</em> possible — I guess — if you build it yourself. But I expected more help from Amazon’s side. As it stands now, because of these issues, developing a skill for Alexa is kind of a pain!</p><h3>The ugly truth</h3><p>Apart from the limitations in the way Amazon wants you to create your skill in general, there were some major (more unintended) inconveniences that cost us time and a lot of nerves.</p><p>I just said that testing Alexa skills is a pain because you are forced to use the testing interface on their website. But to make it even worse, this interface occasionally just wouldn’t work. Sometimes it responded to a request with something like “The remote endpoint did not respond.” although testing the Lambda-function directly showed that it was working just fine and returned proper Alexa responses. And sometimes it could not even generate a request for the text input provided to it. These outages did not usually last very long, but it suffices to decrease your confidence in your own skill actually working.</p><p>Speaking of outages: One weekend, the skill-builder broke skills, so that when you rebuilt the interaction model, your skill just would not work. It took Amazon around three days to fix that. This does not feel like a productive environment.</p><p>Above I talked about how using the dialog model prohibits you from using yes/no questions with the AMAZON.YesIntent and AMAZON.NoIntent. Well, I tried to do it anyway, just to see what would happen. And guess what: <strong><em>It permanently destroyed our skill!</em></strong> Not only did the skill not work with the AMAZON.YesIntent or AMAZON.NoIntent in place (which would not have been unexpected, because after all that’s what they say in their documentation), but even after removing these intents again, the skill remained broken and was unfixable. We had to setup a new skill and re-enter the whole interaction model in the skill builder. And if our skill had already been in production we maybe would have had to submit it to Amazon’s certification process again. Seriously, Amazon?!</p><h3>In the end, it doesn’t even matter…</h3><p>After having complained quite a lot, I do have to say though, that after all the hassle that we went through, we did manage to build the skill and publish it to the store. And as we <em>do</em> see value in voice assistants, we will continue to work on our skill.</p><p>Personally, I would like for the technology and workflow to mature until I consider working with it again. And I do not say that lightly, as I usually see more value in a technology’s innovations, that in my eyes outweigh many of the immaturaties of an ecosystem in its early stages. But with Alexa I just can not come to any other conclusion as dreading the time I spend working on it.</p><p>But: I also think that the fate and future of the whole area of voice assistants will not be driven or even decided by developers. What it really comes down to is, whether these interfaces provide value to the user and if users embrace them as a preferred interface (even if just for select use-cases). And if the user’s demand for more and higher quality voice assisted interfaces grows, so will the pressure on developers as well as on platform owners like Amazon to deliver. I am optimistic that Amazon will improve the developer experience, but in the end, only time will :tell.</p><p><strong>UPDATE</strong>: Since the writing of this article, Amazon has published the <a href="https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html">ASK CLI</a>, that will potentially solve a lot of the issues I complained about.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a59a40c7240b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/skillful-development-for-amazon-alexa-a59a40c7240b">Skillful Development for Amazon Alexa</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image recognition for custom categories with TensorFlow]]></title>
            <link>https://medium.com/enpit-developer-blog/image-recognition-for-custom-categories-with-tensorflow-68196e589efa?source=rss----428f9b75578b---4</link>
            <guid isPermaLink="false">https://medium.com/p/68196e589efa</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[image-recognition]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Andreas Koop]]></dc:creator>
            <pubDate>Wed, 25 Oct 2017 21:40:56 GMT</pubDate>
            <atom:updated>2017-10-25T21:40:08.905Z</atom:updated>
            <content:encoded><![CDATA[<p>One key area for Machine Learning is image recognition / object detection. In this post I want to show how to make use of Tensorflow pre-trained model (Inception v3) for image recognition with a retrained layer for custom categories. The approach is based on <a href="https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/#0">TensorFlow for Poets</a> tutorial.</p><h4>Use Case / Idea</h4><p>Having an unordered heap of Lego bricks it would be nice to have a machine that is able to automatically categorize and count those bricks to answer questions like “Which Lego projects can be build?” or “Are there enough / the right bricks to build project X?”. So the first essential step to bring the idea someday to life is image detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6Q4M-ClBiGe7f5gF6uwsQ.png" /></figure><h4>Environment and Source Code</h4><ul><li>macOS 10.12.6 (not optimal for machine learning, anyway)</li><li>Tensorflow 1.2.1</li><li>ffmpeg</li></ul><p>See Sourcecode: <a href="https://github.com/enpit/tensorflow-for-lego">https://github.com/enpit/tensorflow-for-lego</a></p><h4>Outline</h4><p>Next the following typical steps have to be performed</p><ul><li>Create and prepare training data</li><li>Choose and train a machine learning model</li><li>Evaluate trained model with new input data</li></ul><h4>Create Training Data</h4><p>In Preparation for training data I am going to make some videos from different perspectives per brick and use ffmpeg to generate training images. BTW: Installing ffmpeg with brew is easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*b5SRIpZ7uU_v1iuiCUyLfA.gif" /><figcaption>Sample video to obtain training data</figcaption></figure><pre>$ <strong>brew install ffmpeg</strong><br>...<br>$ ffmpeg -version<br><strong>ffmpeg version 3.3.3</strong> Copyright (c) 2000-2017 the FFmpeg developers<br>built with Apple LLVM version 8.1.0 (clang-802.0.42)<br>...</pre><p>The overall process is summarized in the following figure. Taking the movies as input for ffmpeg I generated for this use case about 50 images per brick category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vKgi6hbzYVzGhi3gZvyFw.png" /><figcaption>Preparing training data</figcaption></figure><pre>$ cd training-data/brick2x2<br>$ <strong>ffmpeg -i brick2x2.mov -vf fps=3 img%03d.jpg</strong><br>..</pre><h4>Choosing and training the model</h4><p>One of the suitable machine learning models is <a href="https://github.com/tensorflow/models/tree/master/research/inception">Inception</a> . It is a pre-trained model on the <a href="http://www.image-net.org/">ImageNet</a>. TensorFlow offers a retrain script which enhances this pre-trained model by a final layer that represents our own image data set. That makes the training process pretty easy:</p><pre>$ python <strong>retrain.py</strong> \<br>  --bottleneck_dir=bottlenecks \<br>  --how_many_training_steps=250 \<br>  --model_dir=inception \<br>  --summaries_dir=training_summaries/basic \<br>  --output_graph=retrained_graph.pb \<br>  --output_labels=retrained_labels.txt \<br>  --image_dir=<strong>training-data</strong></pre><p>After ca 90 Iterations the training accuracy reaches 1.0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xipxN6SjzhnCJbrQLcS9Xg.png" /></figure><h4>Evaluate trained model</h4><p>To evaluate the trained model on new data TensorFlow provides a convenient script “<a href="https://github.com/enpit/tensorflow-for-lego/blob/master/label_image.py">label_image.py</a>” Using it on new sample images I got the following results. The probability is not very good (due to small training set I guess) but at least it classifies correctly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XQNS8n5-d0PzMV0bYsdd9A.png" /><figcaption>Evaluation on new images of brick categories that have been trained</figcaption></figure><p>Using sample images of bricks that have not been trained, the model classifies no one category &gt; 50 %.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1gyCAxqE9XDe4tujH6lssw.png" /><figcaption>Evaluation on new images of brick categories that have NOT been trained</figcaption></figure><h4>Summary</h4><p>I am quite impressed. There is a lot of complexity and research hidden in the available models like Inception, ResNet etc. Being able to attach a layer makes it easy to apply for custom data sets.</p><p>Sample Code: <a href="https://github.com/enpit/tensorflow-for-lego">https://github.com/enpit/tensorflow-for-lego</a></p><h4>Slides from DOAG BigData Days</h4><p>For more background information and theory on machine learning checkout the slides (in german) from Slideshare <a href="https://www.slideshare.net/enpit/mit-legosteinen-maschinelles-lernen-lernen">https://www.slideshare.net/enpit/mit-legosteinen-maschinelles-lernen-lernen</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R0J2TelsvAlWTV0OJ1TkZg.png" /></figure><h4>Ressources</h4><ul><li><a href="https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/#0">Tutorial “Tensorflow for Poets”</a></li><li><a href="https://www.tensorflow.org/get_started/mnist/beginners">MNIST Beginners Tutorial</a></li><li><a href="https://www.tensorflow.org/tutorials/">Tensorflow Tutorials</a></li><li><a href="https://github.com/tensorflow/models/tree/master/object_detection">Object Detection API</a></li><li><a href="https://blog.altoros.com/enabling-tensorflow-to-recognize-images-via-a-mobile-device.html">Enabling TensorFlow to Recognize Images via a Mobile Device</a></li><li><a href="http://playground.tensorflow.org/">Playground Tensorflow</a></li><li><a href="https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video">ffmpeg doc: Create images from video</a></li><li><a href="https://youtu.be/EnFyneRScQ8?t=4m17s">Candy Sorter Demo</a></li><li><a href="http://colah.github.io/posts/2015-08-Backprop/">Backpropagation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68196e589efa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/image-recognition-for-custom-categories-with-tensorflow-68196e589efa">Image recognition for custom categories with TensorFlow</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>