<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

 <channel>
    <title>Christian Engvall</title>
    <atom:link href="https://www.christianengvall.se/feed.xml" rel="self" type="application/rss+xml" />
    <link>https://www.christianengvall.se</link>
    <description>Posts about software development in languages like Objective-C, PHP, C#, Ruby, Javascript. And software like Git, drupal, Phonegap, wordpress.</description>
    <lastBuildDate>Wed, 11 Mar 2026 21:05:00 +0100</lastBuildDate>
    <language>en-GB</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
  	<sy:updateFrequency>1</sy:updateFrequency>

    <image>
	     <url>https://www.christianengvall.se/wp-content/uploads/2015/11/cropped-Terminal-32x32.png</url>
	     <title> Christian Engvall</title>
       <link>https://www.christianengvall.se</link>
	     <width>32</width>
	     <height>32</height>
    </image>

    
      
        <item>
          <title>Setting up Cypress for a React application</title>
          <link>https://www.christianengvall.se/setting-up-cypress-for-a-react-application/</link>
          <comments>https://www.christianengvall.se/setting-up-cypress-for-a-react-application/#respond</comments>
          <description>&lt;p&gt;I took the lead on setting up &lt;a href=&quot;https://www.cypress.io/&quot; title=&quot;Cypress&quot;&gt;Cypress&lt;/a&gt; for end-to-end testing in a React + Vite + TypeScript application. The app is a shipping logistics portal and the test suite now covers 31 test files across the application. Here is how I approached the setup.&lt;/p&gt;

&lt;h2 id=&quot;installing-cypress&quot;&gt;Installing Cypress&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;pnpm add &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; cypress&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then add scripts to &lt;strong&gt;package.json&lt;/strong&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cy:open&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cypress open&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cy:open:frontend&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cypress open --env CYPRESS_BASE=frontend&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cy:open:localhost&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cypress open --env CYPRESS_BASE=localhost&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cy:run&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cypress run&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cy:run:frontend&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cypress run --env CYPRESS_BASE=frontend&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This gives us different commands for different environments - more on that below.&lt;/p&gt;

&lt;h2 id=&quot;multi-environment-configuration&quot;&gt;Multi-environment configuration&lt;/h2&gt;

&lt;p&gt;One of the first things I wanted to get right was being able to run the same tests against multiple environments. In &lt;strong&gt;cypress.config.ts&lt;/strong&gt; I set up a function that returns the correct base URL and API URL depending on an environment variable:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;defineConfig&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;cypress&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getBaseUrls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;frontend&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;baseUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;https://frontend.example.se:3000/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;apiUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;https://frontend.api.example.se/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;localhost&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;baseUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;https://localhost:3000/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;apiUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;https://localhost:44367/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;baseUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;http://dev.portal.example.se/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;apiUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;https://dev.api.example.se/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CYPRESS_BASE&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;dev&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;urls&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getBaseUrls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;defineConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;projectId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;your-project-id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;e2e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;baseUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;urls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;baseUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;setupNodeEvents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;apiUrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;urls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;apiUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;CYPRESS_BASE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;defaultCommandTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;40000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;requestTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;40000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;retries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;experimentalStudio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;experimentalMemoryManagement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;experimentalRunAllSpecs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now running &lt;code class=&quot;highlighter-rouge&quot;&gt;pnpm cy:open&lt;/code&gt; opens Cypress against the dev environment, while &lt;code class=&quot;highlighter-rouge&quot;&gt;pnpm cy:open:frontend&lt;/code&gt; targets the frontend staging environment.&lt;/p&gt;

&lt;h2 id=&quot;custom-commands&quot;&gt;Custom commands&lt;/h2&gt;

&lt;p&gt;I created reusable custom commands in &lt;strong&gt;cypress/support/commands.ts&lt;/strong&gt; to avoid repeating common actions across tests.&lt;/p&gt;

&lt;h3 id=&quot;login-commands&quot;&gt;Login commands&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;Cypress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Commands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;loginAsSuperAdmin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;username&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;test-admin@example.se&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;password&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;testpassword&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;login-button&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;Cypress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Commands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;loginAsSupplier&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;username&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;test-supplier@example.se&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;password&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;supplierpass&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;login-button&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;test-data-reset&quot;&gt;Test data reset&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;Cypress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Commands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;resetTests&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Cypress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;apiUrl&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;api/v2/test/reset-tests&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Reset status: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This calls an API endpoint to reset the test data before test runs, keeping things isolated.&lt;/p&gt;

&lt;h3 id=&quot;reusable-ui-interactions&quot;&gt;Reusable UI interactions&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;Cypress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Commands&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;selectLocation&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;locationName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;locationId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`[data-cy=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Location&quot;] input`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;locationName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wait&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`[data-cy=&quot;location-&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;locationId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;]`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Don’t forget to add type definitions in &lt;strong&gt;commands.d.ts&lt;/strong&gt; so TypeScript is happy:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;kr&quot;&gt;declare&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Cypress&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kr&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Chainable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;loginAsSuperAdmin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Chainable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;loginAsSupplier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;visit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Chainable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;resetTests&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Chainable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;selectLocation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;locationName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;locationId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Chainable&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;using-data-cy-attributes&quot;&gt;Using data-cy attributes&lt;/h2&gt;

&lt;p&gt;We use &lt;code class=&quot;highlighter-rouge&quot;&gt;data-cy&lt;/code&gt; attributes on React components to make selectors resilient to styling and markup changes:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// In the React component&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;TextField&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// In the test&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;username&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;user@example.se&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is one of &lt;a href=&quot;https://docs.cypress.io/app/core-concepts/best-practices#Selecting-Elements&quot; title=&quot;Cypress best practices for selecting elements&quot;&gt;Cypress best practices&lt;/a&gt; and saves a lot of headaches when the UI is redesigned.&lt;/p&gt;

&lt;h2 id=&quot;api-interception&quot;&gt;API interception&lt;/h2&gt;

&lt;p&gt;One of the most useful Cypress features for us is &lt;code class=&quot;highlighter-rouge&quot;&gt;cy.intercept()&lt;/code&gt;. We use it heavily to wait for API calls and assert on responses:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;intercept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/api/v2/search?query=&amp;amp;key=dashboard&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;dashboardRequest&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// trigger the action that makes the API call&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;[data-cy=&quot;search-button&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;cy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wait&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@dashboardRequest&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;interception&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;interception&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;equal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is much more reliable than using fixed &lt;code class=&quot;highlighter-rouge&quot;&gt;cy.wait(3000)&lt;/code&gt; calls since the test waits for the actual network request to complete.&lt;/p&gt;

&lt;h2 id=&quot;ci-integration-with-github-actions&quot;&gt;CI integration with GitHub Actions&lt;/h2&gt;

&lt;p&gt;I set up a GitHub Actions workflow that runs the Cypress suite on every push to develop:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Cypress Tests&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;branches&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;develop&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;cypress-run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Checkout&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v4&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;submodules&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;

      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Setup pnpm&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;pnpm/action-setup@v2&lt;/span&gt;

      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Install dependencies&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;pnpm install --no-frozen-lockfile&lt;/span&gt;

      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Cypress run&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;cypress-io/github-action@v6&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;CYPRESS_RECORD_KEY&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We also connected it to &lt;a href=&quot;https://www.cypress.io/cloud&quot; title=&quot;Cypress Cloud&quot;&gt;Cypress Cloud&lt;/a&gt; for test recording, which gives us screenshots and video on failures plus historical trends.&lt;/p&gt;

&lt;h2 id=&quot;lessons-learned&quot;&gt;Lessons learned&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Start with data-cy attributes early.&lt;/strong&gt; Adding them retroactively to a large codebase takes time.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Use cy.intercept() over cy.wait().&lt;/strong&gt; Waiting for network requests is more reliable than arbitrary timeouts.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Multi-environment support from day one.&lt;/strong&gt; Being able to run the same tests against dev, staging and localhost has been very useful.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Keep custom commands small and focused.&lt;/strong&gt; A few well-designed commands go a long way.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Enable retries.&lt;/strong&gt; Setting &lt;code class=&quot;highlighter-rouge&quot;&gt;retries: 2&lt;/code&gt; in the config helps with flaky tests while you work on making them more stable.&lt;/li&gt;
&lt;/ul&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/setting-up-cypress-for-a-react-application/">https://www.christianengvall.se/setting-up-cypress-for-a-react-application/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 11 Mar 2026 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/setting-up-cypress-for-a-react-application/</guid>
        </item>
      
    
      
        <item>
          <title>Update pihole running in a Docker container</title>
          <link>https://www.christianengvall.se/update-pihole-docker/</link>
          <comments>https://www.christianengvall.se/update-pihole-docker/#respond</comments>
          <description>&lt;p&gt;The Pihole web interface tells you to run &lt;code class=&quot;highlighter-rouge&quot;&gt;pihole -up&lt;/code&gt; to get the latest version. But if you are running &lt;a href=&quot;https://github.com/pi-hole/docker-pi-hole#upgrading-persistence-and-customizations&quot; title=&quot;Pihole docker documentation&quot;&gt;pihole as a docker container we need to do it a little bit different.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To update pihole; Open a terminal and do the following:&lt;/p&gt;

&lt;p&gt;Stop the container:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;docker stop pihole&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Pull the latest Pihole&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;docker pull pihole/pihole&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Remove your existing pihole container&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;docker &lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; pihole&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Start container&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;c&quot;&gt;#Depending on how you set it up you might run&lt;/span&gt;
./docker-run.sh

&lt;span class=&quot;c&quot;&gt;#or&lt;/span&gt;

docker run pihole/pihole&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After updating this the custom blacklist was still intact.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/update-pihole-docker/">https://www.christianengvall.se/update-pihole-docker/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 03 Jul 2022 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/update-pihole-docker/</guid>
        </item>
      
    
      
        <item>
          <title>Setting up NGROK to work with Litium apps</title>
          <link>https://www.christianengvall.se/setting-up-ngrok-to-work-with-litium-apps/</link>
          <comments>https://www.christianengvall.se/setting-up-ngrok-to-work-with-litium-apps/#respond</comments>
          <description>&lt;p&gt;To be able to place orders locally using a payment app it needs to be able to communicate with the outside world. Lets have a look how to get that working with &lt;a href=&quot;https://ngrok.com/&quot; title=&quot;ngrok&quot;&gt;ngrok&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;1-download-and-register-ngrok&quot;&gt;1. Download and register ngrok&lt;/h2&gt;
&lt;p&gt;Download &lt;a href=&quot;https://ngrok.com/&quot; title=&quot;ngrok&quot;&gt;ngrok&lt;/a&gt; and sign up free account. We will need that to use https. After you have signed up you will get an authtoken. Fire up you ngrok-terminal and type:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ngrok authtoken &amp;lt;my-token&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;use ngrok.exe if you are using windows.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ngrok.exe authtoken &amp;lt;my-token&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-exposing-a-server&quot;&gt;2. Exposing a server&lt;/h2&gt;
&lt;p&gt;Open up your &lt;strong&gt;docker-compose.yaml&lt;/strong&gt;-file and scroll down to the &lt;strong&gt;ports&lt;/strong&gt; section of the desired app. Shown below is the direct-payment example, in which we are interested in knowing that it uses port &lt;strong&gt;10011&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The direct-payment app doesn’t need ngrok to work. But since it is present in the default installation of Litium we will use it as an example. You are probably doing this for a payment app such as Svea or Klarna.&lt;/em&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;  &lt;span class=&quot;na&quot;&gt;direct-payment&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;ports&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;10010:80&quot;&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;10011:443&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now go back to your terminal and run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ngrok http https://localhost:10011&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Or this in Windows:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ngrok.exe http https://localhost:10011&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You will now see something looking like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ngrok by @inconshreveable                                                                                                                   &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Ctrl+C to quit&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;                                                                                                                                                            Session Status                online                                                                                                                        Account                       My name &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Plan: Free&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;                                                                                                Version                       2.3.666                                                                                                                        Region                        United States &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;us&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;                                                                                                            Web Interface                 http://127.0.0.1:4040                                                                                                         Forwarding                    http://61c5-1515-4-97kh-88.ngrok.io -&amp;gt; https://localhost:14001                                                                  Forwarding                    https://61c5-1515-4-97kh-88.ngrok.io -&amp;gt; https://localhost:14001                                                                                                                                                                                                                             Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                                 0       0       0.00    0.00    0.00    0.00                                                                                  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Copy the ngrok-url using https and lets continue.&lt;/p&gt;

&lt;h2 id=&quot;3-using-the-ngrok-url&quot;&gt;3. Using the ngrok url&lt;/h2&gt;
&lt;p&gt;Go back to your &lt;strong&gt;docker-compose.yaml&lt;/strong&gt;-file and set the &lt;strong&gt;AppMetadata__AppUrl&lt;/strong&gt; to your ngrok url.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;  direct-payment:
    ports:
    - &lt;span class=&quot;s2&quot;&gt;&quot;10010:80&quot;&lt;/span&gt;
    - &lt;span class=&quot;s2&quot;&gt;&quot;10011:443&quot;&lt;/span&gt;
    environment:
    - &lt;span class=&quot;nv&quot;&gt;AppMetadata__AppUrl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://61c5-1515-4-97kh-88.ngrok.io&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-docker-time&quot;&gt;4. Docker time&lt;/h2&gt;
&lt;p&gt;Now stop your applications in docker and then run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;docker-compose up&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And that is it. Thanks to Nils at Litium support!&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/setting-up-ngrok-to-work-with-litium-apps/">https://www.christianengvall.se/setting-up-ngrok-to-work-with-litium-apps/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 06 Apr 2022 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/setting-up-ngrok-to-work-with-litium-apps/</guid>
        </item>
      
    
      
        <item>
          <title>Client secret validation failed for client</title>
          <link>https://www.christianengvall.se/litium-app-client-secret-validation-falied-for-client/</link>
          <comments>https://www.christianengvall.se/litium-app-client-secret-validation-falied-for-client/#respond</comments>
          <description>
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;fail: IdentityServer4.Validation.ClientSecretValidator[0]
      Client secret validation failed &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;client:&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I got the error &lt;strong&gt;Client secret validation failed for client&lt;/strong&gt; when using a Litium app one day. The reason was that Litium apps are not built to be used in a multiple development environment scenario and another developer has reinstalled an app on his machine.
That way the app got new service account-credentials, that my environment did not know about.&lt;/p&gt;

&lt;p&gt;To fix this you need to uninstall the app in question and remove the folder containing the app information as explained in the &lt;a href=&quot;https://github.com/LitiumAB/Education/blob/87958b301e82481baf20bb838d97e77583b73d95/Developer%20Education/Tasks/Payment%20and%20shipping/README.md#payment-and-shipping&quot; title=&quot;payment and shipping docs&quot;&gt;Payment and shipping documentation&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;em&gt;Litium apps are single install only, when you have installed your app once that apps install-link will not work again. If needed just follow the steps below to clear the app for re-installation:&lt;/em&gt;&lt;/p&gt;

  &lt;p&gt;&lt;em&gt;Stop the container of the app you want to clear&lt;/em&gt;&lt;/p&gt;

  &lt;p&gt;&lt;em&gt;Open the folder where you keep the docker-compose.yaml file from the docker-task&lt;/em&gt;&lt;/p&gt;

  &lt;p&gt;&lt;em&gt;In the /data-subfolder of that folder you will find a direct-payment and a direct-shipment folder, delete the one you want to clear&lt;/em&gt;&lt;/p&gt;

  &lt;p&gt;&lt;em&gt;Start the container again and the install link will work&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thanks to Nils at the Litium support for pointing this out to me.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/litium-app-client-secret-validation-falied-for-client/">https://www.christianengvall.se/litium-app-client-secret-validation-falied-for-client/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 31 Mar 2022 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/litium-app-client-secret-validation-falied-for-client/</guid>
        </item>
      
    
      
        <item>
          <title>Litium fileshares when switching from IIS to Kestrel</title>
          <link>https://www.christianengvall.se/litium-fileshares-when-switching-from-iis-to-kestrel/</link>
          <comments>https://www.christianengvall.se/litium-fileshares-when-switching-from-iis-to-kestrel/#respond</comments>
          <description>&lt;p&gt;One way to access the &lt;strong&gt;shared files&lt;/strong&gt; folder that is used in some projects is to let the IIS application pool use the identity of the user that has access to that shared folder. That won’t work now when we are using the Kestrel web server.&lt;/p&gt;

&lt;p&gt;Instead you can map that shared folder as a &lt;strong&gt;Network drive&lt;/strong&gt; and reference that in &lt;strong&gt;appsettings.json&lt;/strong&gt;.
In &lt;strong&gt;Windows&lt;/strong&gt; you right click in the explorer and select &lt;strong&gt;Add network location&lt;/strong&gt;, on the mac you open &lt;strong&gt;Finder&lt;/strong&gt;, select &lt;strong&gt;Go&lt;/strong&gt; in the menu and click on &lt;strong&gt;Connect to server&lt;/strong&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Folder&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Local&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;..&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Files&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Shared&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;network.path&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sharedfiles&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;customer&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Files&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/litium-fileshares-when-switching-from-iis-to-kestrel/">https://www.christianengvall.se/litium-fileshares-when-switching-from-iis-to-kestrel/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 09 Mar 2022 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/litium-fileshares-when-switching-from-iis-to-kestrel/</guid>
        </item>
      
    
      
        <item>
          <title>Configuring webpack to generate two or more css files</title>
          <link>https://www.christianengvall.se/configuring-webpack-to-generate-two-or-more-css-files/</link>
          <comments>https://www.christianengvall.se/configuring-webpack-to-generate-two-or-more-css-files/#respond</comments>
          <description>&lt;p&gt;If you are going to use a multi-site setup where the sites should look a bit different to each other you need to change the default webpack configuration that is delivered with the Accelerator.&lt;/p&gt;

&lt;p&gt;This is tested with the first version of the Litium 8 accelerator. Previous and later versions may differ.&lt;/p&gt;

&lt;h3 id=&quot;1-change-entries&quot;&gt;1. Change entries&lt;/h3&gt;
&lt;p&gt;Add a new &lt;strong&gt;.scss&lt;/strong&gt; file at &lt;strong&gt;Litium.Accelerator.Mvc/Client/Styles&lt;/strong&gt; that we call &lt;strong&gt;secondsite.scss&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The existing &lt;strong&gt;site.scss&lt;/strong&gt; has been renamed to &lt;strong&gt;firstsite.scss&lt;/strong&gt; in this example.&lt;/p&gt;

&lt;p&gt;Open up &lt;strong&gt;Litium.Accelerator.Mvc/Client/webpack/webpack.es6.js&lt;/strong&gt; and find the entry points.
At the time when I’m writing this post the entries looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JS_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;index.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CSS_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;site.scss&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now lets split that up to add a second entry:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;entry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JS_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;index.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;firstsite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CSS_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;firstsite.scss&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;secondsite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CSS_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;secondsite.scss&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;2-update-the-minicssextractplugin&quot;&gt;2. Update the MiniCssExtractPlugin&lt;/h3&gt;
&lt;p&gt;Scroll down to the &lt;strong&gt;MiniCssExtractPlugin&lt;/strong&gt; settings in the same file as above. Right now it looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;RemovePlugin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;BUILD_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MiniCssExtractPlugin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../css/site.min.css&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// new BundleAnalyzerPlugin(),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Update this section to look like this instead:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;RemovePlugin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;before&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;BUILD_DIR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MiniCssExtractPlugin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../css/[name].min.css&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// new BundleAnalyzerPlugin(),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you have &lt;strong&gt;yarn run build:w&lt;/strong&gt; running you should restart it.
This will generate two separate .css-files in the output directory.&lt;/p&gt;

&lt;h3 id=&quot;3reference-the-correct-file&quot;&gt;3.Reference the correct file&lt;/h3&gt;
&lt;p&gt;This is out of scope of the post so I leave this up to you. But you must reference the correct css-file in &lt;strong&gt;Litium.Accelerator.Mvc/Views/Framework/Head.cshtml&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;4-read-more&quot;&gt;4. Read more&lt;/h3&gt;
&lt;p&gt;You can read more about &lt;a href=&quot;https://webpack.js.org/concepts/entry-points/&quot; title=&quot;Webpack entry points documentation&quot;&gt;Webpack Entry points in the official docs&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/configuring-webpack-to-generate-two-or-more-css-files/">https://www.christianengvall.se/configuring-webpack-to-generate-two-or-more-css-files/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 09 Mar 2022 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/configuring-webpack-to-generate-two-or-more-css-files/</guid>
        </item>
      
    
      
        <item>
          <title>Free gift campaign based on content in cart</title>
          <link>https://www.christianengvall.se/litium-free-gift-campaign-based-on-content-in-cart/</link>
          <comments>https://www.christianengvall.se/litium-free-gift-campaign-based-on-content-in-cart/#respond</comments>
          <description>&lt;p&gt;The criteria for which product that needs to be present in the cart needs to be created as a target group. Then we need to create a campaign using that target group. Lets have a look at how to set it up.&lt;/p&gt;

&lt;h2 id=&quot;1-creating-the-target-group&quot;&gt;1. Creating the target group&lt;/h2&gt;
&lt;p&gt;Go to &lt;strong&gt;Customers -&amp;gt; Target groups&lt;/strong&gt; and add a new &lt;strong&gt;target group&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2022/02/litium-target-groups.png&quot; aria-label=&quot;Litium target groups&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2022/02/litium-target-groups.png&quot; alt=&quot;Litium target groups&quot; width=&quot;1967&quot; height=&quot;318&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2022/02/litium-target-groups.png&quot; alt=&quot;Litium target groups&quot; width=&quot;1967&quot; height=&quot;318&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Litium target groups&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Then create a &lt;strong&gt;Has product in cart&lt;/strong&gt; filter condition and select the product that must exist in the cart to make the campaign valid.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2022/02/litium-target-groups-condition.png&quot; aria-label=&quot;Litium target groups condition&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2022/02/litium-target-groups-condition.png&quot; alt=&quot;Litium target groups condition&quot; width=&quot;765&quot; height=&quot;356&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2022/02/litium-target-groups-condition.png&quot; alt=&quot;Litium target groups condition&quot; width=&quot;765&quot; height=&quot;356&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Litium target groups condition&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;2-creating-the-campaign&quot;&gt;2. Creating the campaign&lt;/h2&gt;
&lt;p&gt;Head over to &lt;strong&gt;Sales -&amp;gt; Campaigns&lt;/strong&gt;. Pick a descriptive &lt;strong&gt;Name&lt;/strong&gt;, select &lt;strong&gt;Markets and channels&lt;/strong&gt; where the campaign should be active and then select a &lt;strong&gt;Start date&lt;/strong&gt; and an &lt;strong&gt;End date&lt;/strong&gt; before saving.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2022/02/litium-campaigns.png&quot; aria-label=&quot;Litium campaign&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2022/02/litium-campaigns.png&quot; alt=&quot;Litium campaign&quot; width=&quot;1156&quot; height=&quot;726&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2022/02/litium-campaigns.png&quot; alt=&quot;Litium campaign&quot; width=&quot;1156&quot; height=&quot;726&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Litium campaign&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;3-add-the-discount&quot;&gt;3. Add the discount&lt;/h2&gt;
&lt;p&gt;Click on the green &lt;strong&gt;Add discount&lt;/strong&gt; button and select &lt;strong&gt;Free gift&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2022/02/litium-campaign-add-discount.png&quot; aria-label=&quot;Add campaign discount&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2022/02/litium-campaign-add-discount.png&quot; alt=&quot;Add campaign discount&quot; width=&quot;1008&quot; height=&quot;577&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2022/02/litium-campaign-add-discount.png&quot; alt=&quot;Add campaign discount&quot; width=&quot;1008&quot; height=&quot;577&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Add campaign discount&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;4-setting-target-groups-and-selecting-free-product&quot;&gt;4. Setting target groups and selecting free product&lt;/h2&gt;
&lt;p&gt;In the modal that shows up you select our newly created target group in the field &lt;strong&gt;Target groups&lt;/strong&gt;. Then in the field &lt;strong&gt;Free product&lt;/strong&gt; you select the product you want to give away. Then click &lt;strong&gt;save&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2022/02/litium-campaigns-free-gift.png&quot; aria-label=&quot;Add free gifts&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2022/02/litium-campaigns-free-gift.png&quot; alt=&quot;Add free gifts&quot; width=&quot;1242&quot; height=&quot;1051&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2022/02/litium-campaigns-free-gift.png&quot; alt=&quot;Add free gifts&quot; width=&quot;1242&quot; height=&quot;1051&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Add free gifts&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;5-active-the-campaign&quot;&gt;5. Active the campaign&lt;/h2&gt;
&lt;p&gt;Don’t forget to activate the campaign in the top right corner. It’s easy to forget that step in the process.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2022/02/litium-campaign-activate.png&quot; aria-label=&quot;Add free gifts&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2022/02/litium-campaign-activate.png&quot; alt=&quot;Add free gifts&quot; width=&quot;1008&quot; height=&quot;606&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2022/02/litium-campaign-activate.png&quot; alt=&quot;Add free gifts&quot; width=&quot;1008&quot; height=&quot;606&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Add free gifts&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/litium-free-gift-campaign-based-on-content-in-cart/">https://www.christianengvall.se/litium-free-gift-campaign-based-on-content-in-cart/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 23 Feb 2022 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/litium-free-gift-campaign-based-on-content-in-cart/</guid>
        </item>
      
    
      
        <item>
          <title>SveaPayment app - Unable to obtain configuration from System.String</title>
          <link>https://www.christianengvall.se/sveapaymentapp-unable-to-obtain-configuration-from-system-string-error/</link>
          <comments>https://www.christianengvall.se/sveapaymentapp-unable-to-obtain-configuration-from-system-string-error/#respond</comments>
          <description>&lt;p&gt;When setting up an existing dev site I got this error for the SveaPayment-app:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c#&quot; data-lang=&quot;c#&quot;&gt;&lt;span class=&quot;m&quot;&gt;2022&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;02&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;17&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;44.1039&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;01&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;916919702&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a6a8343af56f989db5df72b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Connection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;An&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unhandled&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exception&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;was&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;thrown&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InvalidOperationException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IDX20803&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Unable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obtain&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;configuration&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IOException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IDX20807&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Unable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;retrieve&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;document&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpResponseMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpResponseMessage&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpResponseMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IdentityModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocols&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpDocumentRetriever&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetDocumentAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IdentityModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocols&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OpenIdConnect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OpenIdConnectConfigurationRetriever&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IDocumentRetriever&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;retriever&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IdentityModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocols&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ConfigurationManager&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetConfigurationAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;---&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inner&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exception&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;trace&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;---&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IdentityModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocols&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ConfigurationManager&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetConfigurationAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Authentication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;JwtBearer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;JwtBearerHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;HandleAuthenticateAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Authentication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;JwtBearer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;JwtBearerHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;HandleAuthenticateAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Authentication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AuthenticationHandler&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AuthenticateAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Authentication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AuthenticationService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AuthenticateAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scheme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Authorization&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PolicyEvaluator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AuthenticateAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AuthorizationPolicy&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Authorization&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AuthorizationMiddleware&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Invoke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Authentication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AuthenticationMiddleware&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Invoke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Core&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Internal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpProtocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ProcessRequests&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHttpApplication&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This app was installed on another machine before mine. So there is a credential missmatch in the configuration files of the app.&lt;/p&gt;

&lt;p&gt;The solution is to uninstall the app. Then reinstall it again and add the configuration again in the &lt;strong&gt;Svea Payment Configuration&lt;/strong&gt; field.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/sveapaymentapp-unable-to-obtain-configuration-from-system-string-error/">https://www.christianengvall.se/sveapaymentapp-unable-to-obtain-configuration-from-system-string-error/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 17 Feb 2022 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/sveapaymentapp-unable-to-obtain-configuration-from-system-string-error/</guid>
        </item>
      
    
      
        <item>
          <title>SveaPayment app BIO_new_file:no such file error</title>
          <link>https://www.christianengvall.se/svea-payment-app-bio-new-file-no-such-file/</link>
          <comments>https://www.christianengvall.se/svea-payment-app-bio-new-file-no-such-file/#respond</comments>
          <description>&lt;p&gt;I noticed that the SveaPayment app container kept restarting in docker. And at least I thought that I had set up my local dev certs the correct way, but this message showed up in the logs of the app:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c#&quot; data-lang=&quot;c#&quot;&gt;&lt;span class=&quot;n&quot;&gt;Unhandled&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exception&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Interop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Crypto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OpenSslCryptographicException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2006D080&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BIO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;routines&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BIO_new_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;no&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;such&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Interop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Crypto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CheckValidOpenSslHandle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SafeHandle&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;handle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Internal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cryptography&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Pal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OpenSslX509CertificateReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;FromFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SafePasswordHandle&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;X509KeyStorageFlags&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyStorageFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Security&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cryptography&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X509Certificates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X509Certificate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ctor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;X509KeyStorageFlags&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyStorageFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Security&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cryptography&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X509Certificates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X509Certificate2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ctor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Core&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Internal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Certificates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CertificateConfigLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;LoadCertificate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CertificateConfig&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;certInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;endpointName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;KestrelConfigurationLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;LoadDefaultCert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;KestrelConfigurationLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Reload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;KestrelConfigurationLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Load&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Core&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;KestrelServerImpl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BindAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancellationToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kestrel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Core&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;KestrelServerImpl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StartAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHttpApplication&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancellationToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AspNetCore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Hosting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GenericWebHostService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;StartAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancellationToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Extensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Hosting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Internal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;StartAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cancellationToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Extensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Hosting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HostingAbstractionsHostExtensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;RunAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHost&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Extensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Hosting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HostingAbstractionsHostExtensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;RunAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHost&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CancellationToken&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Microsoft&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Extensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Hosting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HostingAbstractionsHostExtensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IHost&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Litium&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Apps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SveaPayment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Program&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Litium&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Apps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SveaPayment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Program&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;23&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The solution was to generate a new one with the command below, in the same path as your docker-compose file, and then restart the containers. Thanks Anton Marklars for the solution.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;dotnet dev-certs https &lt;span class=&quot;nt&quot;&gt;-ep&lt;/span&gt; ./data/https/localhost.pfx &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; PasswordThatShouldBeChanged
&lt;span class=&quot;c&quot;&gt;#...Then followed a message about an already existing certificate that could be ignored.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Read more at Mårten Wahlunds Github-repo &lt;a href=&quot;https://github.com/LitiumAB/Education/tree/main/Developer%20Education/Tasks/Docker&quot;&gt;About Litium, dev-certs and Docker&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/svea-payment-app-bio-new-file-no-such-file/">https://www.christianengvall.se/svea-payment-app-bio-new-file-no-such-file/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 17 Feb 2022 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/svea-payment-app-bio-new-file-no-such-file/</guid>
        </item>
      
    
      
        <item>
          <title>A collection of Litium posts</title>
          <link>https://www.christianengvall.se/litium/</link>
          <comments>https://www.christianengvall.se/litium/#respond</comments>
          <description>&lt;p&gt;This post contains all posts targeting Litium in one place.&lt;/p&gt;

&lt;h2 id=&quot;litium-8&quot;&gt;Litium 8&lt;/h2&gt;
&lt;p&gt;Posts written for Litium 8&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apps&lt;/strong&gt;  &lt;br /&gt;
&lt;a href=&quot;/svea-payment-app-bio-new-file-no-such-file/&quot;&gt;SveaPayment app BIO_new_file:no such file error&lt;/a&gt;  &lt;br /&gt;
&lt;a href=&quot;/sveapaymentapp-unable-to-obtain-configuration-from-system-string-error/&quot;&gt;SveaPayment app - Unable to obtain configuration from System.String&lt;/a&gt;  &lt;br /&gt;
&lt;a href=&quot;/litium-app-client-secret-validation-falied-for-client/&quot;&gt;Client secret validation failed for client&lt;/a&gt;  &lt;br /&gt;
&lt;a href=&quot;/setting-up-ngrok-to-work-with-litium-apps/&quot;&gt;Setting up NGROK to work with Litium apps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Campaigns&lt;/strong&gt;  &lt;br /&gt;
&lt;a href=&quot;/litium-free-gift-campaign-based-on-content-in-cart/&quot;&gt;Free gift campaign based on content in cart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clientside&lt;/strong&gt; &lt;br /&gt;
&lt;a href=&quot;/configuring-webpack-to-generate-two-or-more-css-files/&quot;&gt;Configuring webpack to generate two or more css files&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Globalization&lt;/strong&gt;  &lt;br /&gt;
&lt;a href=&quot;/cultureinfo-currentuiculture-and-cultureinfo-currentculture-in-litium/&quot;&gt;CurrentUICulture and CurrentCulture in Litium&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;br /&gt;
&lt;a href=&quot;/litium-fileshares-when-switching-from-iis-to-kestrel/&quot;&gt;Fileshares then switching from IIS to Kestrel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Litium CLI&lt;/strong&gt;  &lt;br /&gt;
&lt;a href=&quot;/add-an-admin-user-to-database-using-litium-cli/&quot;&gt;Add an admin user to database&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;litium-7&quot;&gt;Litium 7&lt;/h2&gt;
&lt;p&gt;Posts written for Litium 7&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;  &lt;br /&gt;
&lt;a href=&quot;/litium-filesdirectory-and-commonfilesdirectory/&quot;&gt;Litium filesDirectory and commonFilesDirectory&lt;/a&gt;  &lt;br /&gt;
&lt;a href=&quot;/installing-litium-accelerator/&quot;&gt;Installing Litium Accelerator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Misc&lt;/strong&gt;  &lt;br /&gt;
&lt;a href=&quot;/using-middlewares-with-litium/&quot;&gt;Using middlewares with Litium&lt;/a&gt;  &lt;br /&gt;
&lt;a href=&quot;/using-papercut-and-stateserver/&quot;&gt;Using Papercut and StateServer&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/litium/">https://www.christianengvall.se/litium/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 16 Feb 2022 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/litium/</guid>
        </item>
      
    
      
        <item>
          <title>Add an admin user to database using Litium CLI</title>
          <link>https://www.christianengvall.se/add-an-admin-user-to-database-using-litium-cli/</link>
          <comments>https://www.christianengvall.se/add-an-admin-user-to-database-using-litium-cli/#respond</comments>
          <description>&lt;p&gt;Add an admin user to database using Litium CLI with the &lt;strong&gt;litium-db&lt;/strong&gt; command.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;dotnet litium-db user &lt;span class=&quot;nt&quot;&gt;--file&lt;/span&gt; .&lt;span class=&quot;se&quot;&gt;\L&lt;/span&gt;itium.Accelerator.Mvc&lt;span class=&quot;se&quot;&gt;\a&lt;/span&gt;ppsettings.Development.json  &lt;span class=&quot;nt&quot;&gt;--login&lt;/span&gt; agoodusername &lt;span class=&quot;nt&quot;&gt;--password&lt;/span&gt; anevenbetterpassword&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ul&gt;
  &lt;li&gt;By supplying &lt;em&gt;–file&lt;/em&gt; the command picks up the connection string for us.&lt;/li&gt;
  &lt;li&gt;Don’t forget to change &lt;em&gt;agoodusername&lt;/em&gt; and &lt;em&gt;anevenbetterpassword&lt;/em&gt; to something else.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read more about &lt;a href=&quot;https://docs.litium.com/documentation/get-started/database-management&quot; title=&quot;Litium database management&quot;&gt;Database management at Litium docs&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/add-an-admin-user-to-database-using-litium-cli/">https://www.christianengvall.se/add-an-admin-user-to-database-using-litium-cli/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 16 Feb 2022 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/add-an-admin-user-to-database-using-litium-cli/</guid>
        </item>
      
    
      
        <item>
          <title>CurrentUICulture and CurrentCulture in Litium</title>
          <link>https://www.christianengvall.se/cultureinfo-currentuiculture-and-cultureinfo-currentculture-in-litium/</link>
          <comments>https://www.christianengvall.se/cultureinfo-currentuiculture-and-cultureinfo-currentculture-in-litium/#respond</comments>
          <description>&lt;p&gt;You see a lot of &lt;strong&gt;CultureInfo.CurrentUICulture&lt;/strong&gt; and &lt;strong&gt;CultureInfo.CurrentCulture&lt;/strong&gt; references in the Accelerator. Those are connected to two channel fields called &lt;strong&gt;Language for pages and block&lt;/strong&gt; and &lt;strong&gt;Language for products&lt;/strong&gt;. Lets have a look at when to use which!&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2021/11/litium-market-language-for-pages-and-blocks-language-for-products.png&quot; aria-label=&quot;Language for pages and blocks and language for products on a channel&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2021/11/litium-market-language-for-pages-and-blocks-language-for-products.png&quot; alt=&quot;Language for pages and blocks and language for products on a channel&quot; width=&quot;1437&quot; height=&quot;737&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2021/11/litium-market-language-for-pages-and-blocks-language-for-products.png&quot; alt=&quot;Language for pages and blocks and language for products on a channel&quot; width=&quot;1437&quot; height=&quot;737&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Language for pages and blocks and language for products on a channel&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Language for pages and block&lt;/strong&gt; sets the value for &lt;strong&gt;CultureInfo.CurrentUICulture&lt;/strong&gt;. &lt;strong&gt;Language for products&lt;/strong&gt; sets the value for &lt;strong&gt;CultureInfo.CurrentCulture&lt;/strong&gt;. This means you can do like this when getting a value for a field that is multiculture for proucts:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;baseProductFieldValue&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;baseProduct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fields&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;FieldId&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CultureInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CurrentCulture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And for blocks and pages you instead get field values like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pageFieldValue&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fields&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;FieldId&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CultureInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CurrentUICulture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;In the Litium projects I’ve worked these fields mentioned above are almost always pointing to the same language. So it often times won’t make much difference. However, if you only use &lt;strong&gt;CultureInfo.CurrentCulture&lt;/strong&gt; when working with &lt;strong&gt;products&lt;/strong&gt; and &lt;strong&gt;CultureInfo.CurrentUICulture&lt;/strong&gt; when working with pages and blocks you’ll be future proof if an editor decides to change those fields.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/cultureinfo-currentuiculture-and-cultureinfo-currentculture-in-litium/">https://www.christianengvall.se/cultureinfo-currentuiculture-and-cultureinfo-currentculture-in-litium/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 30 Nov 2021 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/cultureinfo-currentuiculture-and-cultureinfo-currentculture-in-litium/</guid>
        </item>
      
    
      
        <item>
          <title>Using middlewares with Litium</title>
          <link>https://www.christianengvall.se/using-middlewares-with-litium/</link>
          <comments>https://www.christianengvall.se/using-middlewares-with-litium/#respond</comments>
          <description>&lt;p&gt;To use a &lt;strong&gt;Middleware&lt;/strong&gt; with Litium we can create a startup class that inherits
the &lt;a href=&quot;https://docs.litium.com/api-reference/api?product=Litium&amp;amp;version=7.4&amp;amp;xref=Litium.Owin.Lifecycle.IOwinStartupConfiguration&quot; title=&quot;IOwinStartupConfiguration&quot;&gt;IOwinStartupConfiguration&lt;/a&gt;
interface and use it to insert a middleware into the OWIN pipeline.&lt;/p&gt;

&lt;p&gt;A middleware is, put simply, a piece of code which can read information about the current request and add information to the response. And it’s a good place to put code that doesn’t really fit into controllers or services where we need to examine every request.&lt;/p&gt;

&lt;p&gt;The example below will examine every request that comes into a Litium site. We are looking for a specific querystring and we want to store its value as a cookie. This is a real life example, but it has been modified and simplified.&lt;/p&gt;

&lt;p&gt;This is tested with Litium 5 and 7 but probably works in more versions.   &lt;br /&gt;
For the sake of simplicity this post will not take any project standards into consideration. But feel free to use the comments to suggest changes or improvements.&lt;/p&gt;

&lt;h2 id=&quot;1-creating-a-startup-class&quot;&gt;1. Creating a startup class&lt;/h2&gt;
&lt;p&gt;Since I’m using a fresh install of the Accelerator for demonstration purposes and not doing this in a
customer project I’m just going to put this class in the &lt;strong&gt;Litium.Accelerator.Mvc&lt;/strong&gt; root folder.
Your project structure will probably be different depending on your project standards.&lt;/p&gt;

&lt;p&gt;Start by adding a new class called &lt;strong&gt;Startup.cs&lt;/strong&gt; and let this class inherit and implement &lt;a href=&quot;https://docs.litium.com/api-reference/api?product=Litium&amp;amp;version=7.4&amp;amp;xref=Litium.Owin.Lifecycle.IOwinStartupConfiguration&quot; title=&quot;IOwinStartupConfiguration&quot;&gt;IOwinStartupConfiguration&lt;/a&gt;.
Then we would have a class that looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Litium.Owin.Lifecycle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Owin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Litium.Accelerator.Mvc&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Startup&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IOwinStartupConfiguration&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IAppBuilder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;NotImplementedException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-creating-a-middleware&quot;&gt;2. Creating a middleware&lt;/h2&gt;
&lt;p&gt;Create a new folder in the &lt;strong&gt;Litium.Accelerator&lt;/strong&gt; project called &lt;strong&gt;Middleware&lt;/strong&gt; and create a class called &lt;strong&gt;UtmCampaign.cs&lt;/strong&gt;.
Let this class inherit from &lt;strong&gt;OwinMiddleWare&lt;/strong&gt; and implement that abstract class. (You need to install the &lt;strong&gt;nuget package Microsoft.Owin&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;UtmCampaign.cs&lt;/strong&gt; class will now look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System.Threading.Tasks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Microsoft.Owin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Litium.Accelerator.Middleware&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UtmCampaign&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;OwinMiddleware&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UtmCampaign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OwinMiddleware&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Task&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Invoke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IOwinContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;NotImplementedException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-adding-logic-to-the-middleware&quot;&gt;3. Adding logic to the middleware&lt;/h2&gt;
&lt;p&gt;For this example I want to save the campaign name sent by different &lt;a href=&quot;https://support.google.com/analytics/answer/1033863?hl=en&quot; title=&quot;ad campaigns&quot;&gt;ad campaigns&lt;/a&gt; into a cookie. (I could then use this value when communicating with other third party services, which I have done for some customers, but we won’t cover that in this tutorial).&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;UtmCapaign.cs&lt;/strong&gt; middleware will now look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System.Threading.Tasks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Microsoft.Owin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Litium.Accelerator.Middleware&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UtmCampaign&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;OwinMiddleware&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;readonly&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;OwinMiddleware&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UtmCampaign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OwinMiddleware&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;_next&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Task&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Invoke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IOwinContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Query&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;IsNullOrEmpty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;utm_campaign&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;nf&quot;&gt;AppendCookieToResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Invoke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;AppendCookieToResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IOwinContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cookies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Campaign&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;utm_campaign&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CookieOptions&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;HttpOnly&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Secure&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-adding-the-middleware-to-the-owin-pipline&quot;&gt;4. Adding the middleware to the owin pipline&lt;/h2&gt;
&lt;p&gt;Lets go back to &lt;strong&gt;Startup.cs&lt;/strong&gt; and add the middleware we just created to the owin pipeline like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Litium.Accelerator.Middleware&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Litium.Owin.Lifecycle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Owin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Litium.Accelerator.Mvc&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Startup&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IOwinStartupConfiguration&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IAppBuilder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UtmCampaign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And if I now browse to &lt;strong&gt;http://accelerator.localtest.me/?utm_campaign=asdf&lt;/strong&gt; I can see that my middleware is put to use and has created a cookie for me:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2020/04/litiummiddlewareresult.png&quot; aria-label=&quot;Litium middleware result&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2020/04/litiummiddlewareresult.png&quot; alt=&quot;Litium middleware result&quot; width=&quot;706&quot; height=&quot;334&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2020/04/litiummiddlewareresult.png&quot; alt=&quot;Litium middleware result&quot; width=&quot;706&quot; height=&quot;334&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Litium middleware result&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;5-other-uses-of-iowinstartupconfiguration&quot;&gt;5. Other uses of IOwinStartupConfiguration&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;IOwinStartupConfiguration&lt;/strong&gt; class isn’t only to used register your own middlewares. You can also use it to, for example, setup &lt;strong&gt;signalR&lt;/strong&gt; if you want to use that on your Litium site.&lt;/p&gt;

&lt;p&gt;You can also use it to configure &lt;a href=&quot;https://docs.litium.com/documentation/architecture/external-login-providers&quot; title=&quot;External login providers&quot;&gt;external login providers&lt;/a&gt; such as facebook or Google&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/using-middlewares-with-litium/">https://www.christianengvall.se/using-middlewares-with-litium/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 26 Apr 2020 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/using-middlewares-with-litium/</guid>
        </item>
      
    
      
        <item>
          <title>Litium filesDirectory and commonFilesDirectory</title>
          <link>https://www.christianengvall.se/litium-filesdirectory-and-commonfilesdirectory/</link>
          <comments>https://www.christianengvall.se/litium-filesdirectory-and-commonfilesdirectory/#respond</comments>
          <description>&lt;p&gt;There are two folders where Litium stores files. The &lt;strong&gt;Files Directory&lt;/strong&gt; and the &lt;strong&gt;Common Files directory&lt;/strong&gt;.
Both contains uploaded images, thumbnails, and search indices etc. But the Common files directory is used in multiserver environments, and it stores information that servers would share.&lt;/p&gt;

&lt;h3 id=&quot;filesdirectory&quot;&gt;filesDirectory&lt;/h3&gt;
&lt;p&gt;You can set these paths in web.config. By default the Accelerator v 7.2.3 has the filesDirectory set to &lt;strong&gt;..\Files&lt;/strong&gt;. I do not want it in the project folder but somewhere else on my disk. It is up to you where you want to put it. Do not forget to add it to your .gitignore(or exclude it from your version control) if you keep it in the default folder.&lt;/p&gt;

&lt;p&gt;Lets change this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;  &lt;span class=&quot;nt&quot;&gt;&amp;lt;filesDirectory&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;..\Files&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To this:
D:\filefolders\accelerator&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;  &lt;span class=&quot;nt&quot;&gt;&amp;lt;filesDirectory&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;D:\filefolders\accelerator&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;(Don’t forget to set permissions to allow the site to save files to it)&lt;/p&gt;

&lt;h3 id=&quot;commonfilesdirectory&quot;&gt;commonFilesDirectory&lt;/h3&gt;
&lt;p&gt;To set a commonfilesDirectory you can add it below the &lt;strong&gt;filesDirectory&lt;/strong&gt; in web.config&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;  &lt;span class=&quot;nt&quot;&gt;&amp;lt;commonFilesDirectory&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\\myserver\filefolders\customer\Files&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can read more about these directories at the &lt;a href=&quot;https://docs.litium.com/documentation/get-started/web_config&quot; title=&quot;Files and commonfilesdrectory at Litium docs&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/litium-filesdirectory-and-commonfilesdirectory/">https://www.christianengvall.se/litium-filesdirectory-and-commonfilesdirectory/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 23 Aug 2019 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/litium-filesdirectory-and-commonfilesdirectory/</guid>
        </item>
      
    
      
        <item>
          <title>Using Papercut and StateServer</title>
          <link>https://www.christianengvall.se/using-papercut-and-stateserver/</link>
          <comments>https://www.christianengvall.se/using-papercut-and-stateserver/#respond</comments>
          <description>&lt;p&gt;Lets take a look at using &lt;a href=&quot;https://github.com/ChangemakerStudios/Papercut&quot; title=&quot;Papercut&quot;&gt;Papercut&lt;/a&gt; as SMTP-server during web site development. We’ll also take a look at StateServer. These tools works for any ASP.NET MVC-project but this post is a continuation of the &lt;a href=&quot;https://www.christianengvall.se/installing-litium-accelerator/&quot; title=&quot;Installing Litium Accelerator&quot;&gt;Installing Litium Accelerator post&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;1-papercut&quot;&gt;1. Papercut&lt;/h3&gt;
&lt;p&gt;Papercut will act as an SMTP-server and will display every email sent from the website we are building. This is how the creators of Papercut explain it:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Papercut is a 2-in-1 quick email viewer AND built-in SMTP server (designed to receive messages only). Not only does it not enforce any restrictions how you prepare your email, but it allows you to view the whole email-chilada: body, html, headers, attachment down right down to the naughty raw encoded bits. Papercut can be configured to run on startup and sit quietly (minimized in the tray) only providing a notification when a new message has arrived.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/ChangemakerStudios/Papercut/releases&quot; title=&quot;Papercut releases&quot;&gt;Download and install the latest release of papercut&lt;/a&gt; and start it.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/08/papercut.png&quot; aria-label=&quot;Papercut&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/08/papercut.png&quot; alt=&quot;Papercut&quot; width=&quot;700&quot; height=&quot;454&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/08/papercut.png&quot; alt=&quot;Papercut&quot; width=&quot;700&quot; height=&quot;454&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Papercut&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now open up web.config of your project and change this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;smtpServer&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;username=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;password=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;enableSsl=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;false&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;smtpServer&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;127.0.0.1&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;username=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;password=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;enableSsl=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;false&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next start your site (mine is accelerator.localtest.me) and log in to Litium. Once logged in go to &lt;strong&gt;Settings -&amp;gt; Websites -&amp;gt; Websites&lt;/strong&gt;. Then edit your site and update the &lt;strong&gt;Sender email address&lt;/strong&gt; to an address of your choice.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/08/litium-sender-email-address.png&quot; aria-label=&quot;Litium - Sender email address&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/08/litium-sender-email-address.png&quot; alt=&quot;Litium - Sender email address&quot; width=&quot;1245&quot; height=&quot;859&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/08/litium-sender-email-address.png&quot; alt=&quot;Litium - Sender email address&quot; width=&quot;1245&quot; height=&quot;859&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Litium - Sender email address&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Save the settings and &lt;strong&gt;order something from the accelerator&lt;/strong&gt; and you will see an order confirmation email show up in Papercut.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/08/litium-accelerator-order.png&quot; aria-label=&quot;Litium - Sender email address&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/08/litium-accelerator-order.png&quot; alt=&quot;Litium - Sender email address&quot; width=&quot;1212&quot; height=&quot;1181&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/08/litium-accelerator-order.png&quot; alt=&quot;Litium - Sender email address&quot; width=&quot;1212&quot; height=&quot;1181&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Litium - Sender email address&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;2-using-stateserver-sessionstate&quot;&gt;2. Using StateServer sessionstate&lt;/h3&gt;
&lt;p&gt;By default the site is setup to use &lt;strong&gt;InProc&lt;/strong&gt; mode. This is fine, But every time the site gets restarted the sessiondata will be lost and we loose information about the cart for example. If we change this to &lt;strong&gt;StateServer&lt;/strong&gt; we save some time every time we rebuild the project since the cart will be saved in our StateServer instead.&lt;/p&gt;

&lt;p&gt;Open web.config and change this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;sessionState&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;mode=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;InProc&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stateConnectionString=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tcpip=127.0.0.1:42424&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;sessionState&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;mode=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;StateServer&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stateConnectionString=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tcpip=127.0.0.1:42424&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then start the services app and start the &lt;strong&gt;ASP.NET State Service&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/08/services.png&quot; aria-label=&quot;Services&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/08/services.png&quot; alt=&quot;Services&quot; width=&quot;806&quot; height=&quot;409&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/08/services.png&quot; alt=&quot;Services&quot; width=&quot;806&quot; height=&quot;409&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Services&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;If you do not you will get this error:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/08/stateserver-error.png&quot; aria-label=&quot;State server error&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/08/stateserver-error.png&quot; alt=&quot;State server error&quot; width=&quot;1273&quot; height=&quot;358&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/08/stateserver-error.png&quot; alt=&quot;State server error&quot; width=&quot;1273&quot; height=&quot;358&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;State server error&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/using-papercut-and-stateserver/">https://www.christianengvall.se/using-papercut-and-stateserver/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 05 Aug 2019 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/using-papercut-and-stateserver/</guid>
        </item>
      
    
      
        <item>
          <title>Installing Litium Accelerator</title>
          <link>https://www.christianengvall.se/installing-litium-accelerator/</link>
          <comments>https://www.christianengvall.se/installing-litium-accelerator/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;https://www.litium.com/&quot; title=&quot;Litium website&quot;&gt;Litium&lt;/a&gt; is installed via a Nuget feed in Visual studio. You can install Litium
without the Accelerator but in this tutorial we’ll take a look at installing Litium and Litium Accelerator.&lt;/p&gt;

&lt;h3 id=&quot;litium-accelerator&quot;&gt;Litium Accelerator&lt;/h3&gt;
&lt;p&gt;The Litium Accelerator is a pre-packaged Litium site which speeds up the development
when starting new projects. It is delivered as source-code and you have the possibility to change what you need.&lt;/p&gt;

&lt;h3 id=&quot;system-requirements&quot;&gt;System Requirements&lt;/h3&gt;
&lt;p&gt;When this post is written the latest version of Litium is 7. The development environment system requirements are at the time:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Visual Studio 2017 running with elevated permissions (other versions may work but have not been tested. I’m using VS2019).&lt;/li&gt;
  &lt;li&gt;IIS 7 or later with the Web Sockets protocol enabled.&lt;/li&gt;
  &lt;li&gt;.NET Framework 4.7.2 Developer Pack.&lt;/li&gt;
  &lt;li&gt;Access to Litium NuGet feed. To get access you need an account at &lt;a href=&quot;https://docs.litium.com/download/litium-nuget-feed&quot; title=&quot;Litium docs&quot;&gt;Litium Docs&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Microsoft SQL Server 2016 or later with database compatibility level 130.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This and more information can be found at the &lt;a href=&quot;https://docs.litium.com/documentation/get-started/system-requirements&quot; title=&quot;Litium documentation System requirements&quot;&gt;System requirements of the Litium docs&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;1-downloading-litium-accelerator&quot;&gt;1. Downloading Litium Accelerator&lt;/h3&gt;
&lt;p&gt;At this point I assume you’ve installed the IIS and the .NET framework, the nuget feed, and has created an account that has got download rights for the accelerator. (Linked to in the System Requirements above).&lt;/p&gt;

&lt;p&gt;Go to &lt;a href=&quot;https://docs.litium.com/download&quot; title=&quot;Litium docs - download&quot;&gt;Litium docs - Download&lt;/a&gt; and download the accelerator. If you have access to it the package will show up at the top at &lt;strong&gt;Latest accelerators&lt;/strong&gt;. At the time the latest version is Litium Accelerator 7.2.3.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/07/download-accelerator.png&quot; aria-label=&quot;Downloading Accelerator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/07/download-accelerator.png&quot; alt=&quot;Downloading Accelerator&quot; width=&quot;1255&quot; height=&quot;452&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/07/download-accelerator.png&quot; alt=&quot;Downloading Accelerator&quot; width=&quot;1255&quot; height=&quot;452&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Downloading Accelerator&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Extract the .zip into a folder where you want to work with the solution.&lt;/p&gt;

&lt;h3 id=&quot;2-install-via-visual-studio&quot;&gt;2. Install via Visual Studio&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Open &lt;strong&gt;Accelerator.sln&lt;/strong&gt; after extracting the package.&lt;/li&gt;
  &lt;li&gt;Go to  &lt;strong&gt;View -&amp;gt; Other Windows -&amp;gt; Package Manager Console&lt;/strong&gt; and run the command &lt;strong&gt;Update-Package -ReInstall&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Wait for install to complete (This took around 3 minutes for me).&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/07/accelerator-package-manager-console.png&quot; aria-label=&quot;Running Update-Package -ReInstall&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/07/accelerator-package-manager-console.png&quot; alt=&quot;Running Update-Package -ReInstall&quot; width=&quot;1713&quot; height=&quot;298&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/07/accelerator-package-manager-console.png&quot; alt=&quot;Running Update-Package -ReInstall&quot; width=&quot;1713&quot; height=&quot;298&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Running Update-Package -ReInstall&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;If you, like me, got an error saying: &lt;strong&gt;“Update-Package : Some NuGet packages are missing from the solution. The packages need to be restored in order to build the dependency graph. Restore the packages before performing any operations”&lt;/strong&gt; Make sure you’ve &lt;a href=&quot;https://docs.litium.com/download/litium-nuget-feed&quot; title=&quot;Nuget-feed&quot;&gt;set up the nuget feed&lt;/a&gt; correctly and click the &lt;strong&gt;restore button&lt;/strong&gt; that has shown up at the top of the package manager console. (I had recently changed passwords to my account and needed to update it to get it to work)&lt;/p&gt;

&lt;h3 id=&quot;3-configuring-the-accelerator&quot;&gt;3. Configuring the Accelerator&lt;/h3&gt;
&lt;p&gt;Now right click on the &lt;strong&gt;Litium.Accelerator.Mvc&lt;/strong&gt;-project in the Solution Explorer and click on &lt;strong&gt;Set as startup project&lt;/strong&gt; and run the project.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/07/litium-accelerator-run-project.png&quot; aria-label=&quot;First run of Litium Accelerator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/07/litium-accelerator-run-project.png&quot; alt=&quot;First run of Litium Accelerator&quot; width=&quot;1298&quot; height=&quot;763&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/07/litium-accelerator-run-project.png&quot; alt=&quot;First run of Litium Accelerator&quot; width=&quot;1298&quot; height=&quot;763&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;First run of Litium Accelerator&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;When the site has started we are redirected to the login page. Login with your windows account (ex: DOMAIN\Guybrush@organization.com or .\Crille)&lt;/p&gt;

&lt;p&gt;Then click on the &lt;strong&gt;Cogwheel (top right) -&amp;gt; Deployment -&amp;gt; Accelerator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Select a name and a domain name for the site. I’m using accelerator.localtest.me in this case. By &lt;a href=&quot;https://weblogs.asp.net/owscott/introducing-testing-domain-localtest-me&quot; title=&quot;localtest.me&quot;&gt;choosing a localtest.me-domain&lt;/a&gt; I do not need to add anything to the hosts-file.&lt;/p&gt;

&lt;p&gt;Check the &lt;strong&gt;Create a set of example products and categories&lt;/strong&gt; checkbox and the click &lt;strong&gt;Import&lt;/strong&gt;.
This will give us some example data.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/07/litium-accelerator-deployment.png&quot; aria-label=&quot;Deploy accelerator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/07/litium-accelerator-deployment.png&quot; alt=&quot;Deploy accelerator&quot; width=&quot;1280&quot; height=&quot;585&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/07/litium-accelerator-deployment.png&quot; alt=&quot;Deploy accelerator&quot; width=&quot;1280&quot; height=&quot;585&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Deploy accelerator&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;4-moving-database-to-sql-server&quot;&gt;4. Moving database to Sql Server&lt;/h3&gt;
&lt;p&gt;By default the accelerator uses a LocalDb instance. Lets move that db to a MSSQLServer instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open Microsoft SQL Server Management Studio as an administrator&lt;/strong&gt; then right click on &lt;strong&gt;Databases&lt;/strong&gt; and select &lt;strong&gt;Attach…&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/07/attach-db.png&quot; aria-label=&quot;Attaching database&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/07/attach-db.png&quot; alt=&quot;Attaching database&quot; width=&quot;554&quot; height=&quot;339&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/07/attach-db.png&quot; alt=&quot;Attaching database&quot; width=&quot;554&quot; height=&quot;339&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Attaching database&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Then click on &lt;strong&gt;Add…&lt;/strong&gt; and select the .mdf -file that is located in the &lt;strong&gt;Litium.Accelerator.Mvc/App_Data&lt;/strong&gt; folder.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/07/attach-db-mdf.png&quot; aria-label=&quot;Attaching mdf&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/07/attach-db-mdf.png&quot; alt=&quot;Attaching mdf&quot; width=&quot;817&quot; height=&quot;886&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/07/attach-db-mdf.png&quot; alt=&quot;Attaching mdf&quot; width=&quot;817&quot; height=&quot;886&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Attaching mdf&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Then click ok and attach the database.&lt;/p&gt;

&lt;p&gt;When this is done you need to update the &lt;strong&gt;FoundationConnectionString&lt;/strong&gt; in &lt;strong&gt;web.config&lt;/strong&gt; to point to your MSSQL-Instance instead (Not covered here).&lt;/p&gt;

&lt;h3 id=&quot;5-adding-an-iis-site&quot;&gt;5. Adding an IIS site&lt;/h3&gt;
&lt;p&gt;Next fire up the IIS and right click on &lt;strong&gt;Sites&lt;/strong&gt; and then on &lt;strong&gt;Add Website…&lt;/strong&gt; and select a name.&lt;/p&gt;

&lt;p&gt;Point the Physical path to &lt;strong&gt;\Src\Litium.Accelerator.Mvc&lt;/strong&gt; and add the hostname you selected. (in my case http://accelerator.localtest.me/)&lt;/p&gt;

&lt;p&gt;You might need to run the Application pool as your local user to get access to the database. But I’ll leave the iis-configuration up to you.&lt;/p&gt;

&lt;p&gt;Now browse to the site and you should end up with something like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/07/litium-accelerator.png&quot; aria-label=&quot;Litium Accelerator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/07/litium-accelerator.png&quot; alt=&quot;Litium Accelerator&quot; width=&quot;1280&quot; height=&quot;1400&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/07/litium-accelerator.png&quot; alt=&quot;Litium Accelerator&quot; width=&quot;1280&quot; height=&quot;1400&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Litium Accelerator&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/installing-litium-accelerator/">https://www.christianengvall.se/installing-litium-accelerator/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 31 Jul 2019 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/installing-litium-accelerator/</guid>
        </item>
      
    
      
        <item>
          <title>Updated Electron tutorial app to use Electron v5.0.8</title>
          <link>https://www.christianengvall.se/updated-electron-tutorial-app-to-use-electron-v508/</link>
          <comments>https://www.christianengvall.se/updated-electron-tutorial-app-to-use-electron-v508/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app&quot;&gt;The Electron tutorial app&lt;/a&gt; is now working with Electron version 5.0.8. After &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/archive/6b27c85c1afbbc09df4c5060b75c0bc24e1d14e9.zip&quot; title=&quot;Electron tutorial app with v5.0.8 support&quot;&gt;downloading&lt;/a&gt; the new version make sure to run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install
&lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; electron@5.0.8&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The biggest difference in this version is enabling nodeIntegration:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;webPreferences: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  nodeIntegration: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can see the code on &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/blob/6b27c85c1afbbc09df4c5060b75c0bc24e1d14e9/main.js#L34&quot; title=&quot;nodeIntegration&quot;&gt;Github&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/updated-electron-tutorial-app-to-use-electron-v508/">https://www.christianengvall.se/updated-electron-tutorial-app-to-use-electron-v508/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 30 Jul 2019 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/updated-electron-tutorial-app-to-use-electron-v508/</guid>
        </item>
      
    
      
        <item>
          <title>Installing Visual Studio Code and ASP.NET Core on Linux Mint</title>
          <link>https://www.christianengvall.se/visual-studio-code-asp-net-core-linux-mint/</link>
          <comments>https://www.christianengvall.se/visual-studio-code-asp-net-core-linux-mint/#respond</comments>
          <description>&lt;p&gt;In this post we’ll take a look at installing ASP.NET core and Visual Studio code on Linux Mint.&lt;/p&gt;

&lt;h3 id=&quot;1-installing-net-core&quot;&gt;1. Installing .NET CORE&lt;/h3&gt;
&lt;p&gt;To install .NET Core I &lt;a href=&quot;https://dotnet.microsoft.com/download&quot; title=&quot;.NET Core&quot;&gt;downloaded&lt;/a&gt; the X64 Binary and ran these commands in a console:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;Downloads
&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/dotnet &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;zxf dotnet-sdk-2.2.202-linux-x64.tar.gz &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/dotnet
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DOTNET_ROOT&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/dotnet
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PATH&lt;/span&gt;:&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;/dotnet&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After that to verify the installation you can type &lt;code class=&quot;highlighter-rouge&quot;&gt;dotnet&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;dotnet &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
2.2.202&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;2-install-visual-studio-code&quot;&gt;2. Install Visual Studio Code&lt;/h3&gt;
&lt;p&gt;Go to &lt;a href=&quot;https://code.visualstudio.com/&quot; title=&quot;Visual Studio Code&quot;&gt;https://code.visualstudio.com/&lt;/a&gt; and select the .deb package for installation.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/04/installing-vs-code-debian-package.png&quot; aria-label=&quot;Click on Install Package - Visual studio Code debian package&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/04/installing-vs-code-debian-package.png&quot; alt=&quot;Click on Install Package - Visual studio Code debian package&quot; width=&quot;550&quot; height=&quot;428&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/04/installing-vs-code-debian-package.png&quot; alt=&quot;Click on Install Package - Visual studio Code debian package&quot; width=&quot;550&quot; height=&quot;428&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Click on Install Package - Visual studio Code debian package&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;After installing the package Visual Studio code will show up in the menu:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/04/visual-studio-code-menu.png&quot; aria-label=&quot;Visual studio code in the menu&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/04/visual-studio-code-menu.png&quot; alt=&quot;Visual studio code in the menu&quot; width=&quot;1280&quot; height=&quot;1411&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/04/visual-studio-code-menu.png&quot; alt=&quot;Visual studio code in the menu&quot; width=&quot;1280&quot; height=&quot;1411&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Visual studio code in the menu&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;3-install-the-c-extension&quot;&gt;3. Install the C# Extension&lt;/h3&gt;
&lt;p&gt;Click on the extensions icon to the left and search for &lt;code class=&quot;highlighter-rouge&quot;&gt;C#&lt;/code&gt;. Then click install.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/04/install-csharp-extension.png&quot; aria-label=&quot;Visual studio csharp extension&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/04/install-csharp-extension.png&quot; alt=&quot;Visual studio csharp extension&quot; width=&quot;1279&quot; height=&quot;1410&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/04/install-csharp-extension.png&quot; alt=&quot;Visual studio csharp extension&quot; width=&quot;1279&quot; height=&quot;1410&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Visual studio csharp extension&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;4-creating-an-aspnet-core-project&quot;&gt;4. Creating an ASP.NET Core Project&lt;/h3&gt;
&lt;p&gt;Now its time to create an ASP.NET MVC project from the terminal. These commands are copied from &lt;a href=&quot;https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-2.2&amp;amp;tabs=visual-studio-code&quot; title=&quot;ms documentation&quot;&gt;the Microsoft documentation&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;dotnet new mvc &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; MvcMovie&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This creates a new mvc project in a folder called MvcMovie.&lt;/p&gt;

&lt;p&gt;We can use the command line to open the newly created project in VS Code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;code &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; MvcMovie&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And to run the application run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;dotnet run &lt;span class=&quot;nt&quot;&gt;--project&lt;/span&gt;  MvcMovie/

... omitted text from &lt;span class=&quot;nb&quot;&gt;command

&lt;/span&gt;Hosting environment: Development
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2019/04/mvcmovie.png&quot; aria-label=&quot;Running asp.net mvc project&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2019/04/mvcmovie.png&quot; alt=&quot;Running asp.net mvc project&quot; width=&quot;1280&quot; height=&quot;1065&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2019/04/mvcmovie.png&quot; alt=&quot;Running asp.net mvc project&quot; width=&quot;1280&quot; height=&quot;1065&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Running asp.net mvc project&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/visual-studio-code-asp-net-core-linux-mint/">https://www.christianengvall.se/visual-studio-code-asp-net-core-linux-mint/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 16 May 2019 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/visual-studio-code-asp-net-core-linux-mint/</guid>
        </item>
      
    
      
        <item>
          <title>Electron showSaveDialog tutorial</title>
          <link>https://www.christianengvall.se/electron-showsavedialog-tutorial/</link>
          <comments>https://www.christianengvall.se/electron-showsavedialog-tutorial/#respond</comments>
          <description>&lt;p&gt;In this tutorial we’ll look at how to use Electron showSaveDialog.
The save dialog will return a string containing a path which the user selected.&lt;/p&gt;

&lt;p&gt;To only display a save dialog this is what is needed as a minimum:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;savePath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showSaveDialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;savePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;But as with the other &lt;a href=&quot;https://www.christianengvall.se/electron-dialog-tutorial/&quot; title=&quot;Electron dialogs&quot;&gt;dialogs&lt;/a&gt; we can do more with it:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;defaultPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;documents&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/electron-tutorial-app.pdf&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showSaveDialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The code above proposes a path and a filename to the user when opening the save dialog with &lt;code class=&quot;highlighter-rouge&quot;&gt;defaultPath&lt;/code&gt;. It uses &lt;a href=&quot;https://electronjs.org/docs/api/app#appgetpathname&quot; title=&quot;electron app docs&quot;&gt;app.getPath&lt;/a&gt; to get the path to our users document folder and then appends a filename.pdf&lt;/p&gt;

&lt;p&gt;I’ve also changed so that the callback method is used which gives us the path.
I’d recommend to look at the &lt;a href=&quot;https://electronjs.org/docs/api/dialog#dialogshowsavedialogbrowserwindow-options-callback&quot; title=&quot;showSaveDialog electron docs&quot;&gt;showSaveDialog documentation&lt;/a&gt; to see what more options you can use.&lt;/p&gt;

&lt;p&gt;This code is added to &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app&quot;&gt;Electron tutorial app&lt;/a&gt; and you can take a look at the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/blob/04c4d63daf636651ddb6dc0cff45f8e1d97bd495/dialog/dialog.js#L42&quot; title=&quot;dialog.js&quot;&gt;dialog.js&lt;/a&gt; file to see this code.&lt;/p&gt;

&lt;p&gt;In the next tutorial we’ll continue from here and save the pdf. But that post is coming soon.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-showsavedialog-tutorial/">https://www.christianengvall.se/electron-showsavedialog-tutorial/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 03 Nov 2018 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-showsavedialog-tutorial/</guid>
        </item>
      
    
      
        <item>
          <title>Electron showMessageBox tutorial</title>
          <link>https://www.christianengvall.se/electron-show-messagebox/</link>
          <comments>https://www.christianengvall.se/electron-show-messagebox/#respond</comments>
          <description>&lt;p&gt;With showMessageBox we can display a message with our without a set of buttons from which the user can choose from.&lt;/p&gt;

&lt;p&gt;The minimum required code to show a message box is:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showMessageBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;But that would only display a box with no info and an OK-button. The dialog would return a response which contains the index of the button the user clicked.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/11/empty-show-message-box.png&quot; aria-label=&quot;An empty showMessageBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/11/empty-show-message-box.png&quot; alt=&quot;An empty showMessageBox&quot; width=&quot;1064&quot; height=&quot;526&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/11/empty-show-message-box.png&quot; alt=&quot;An empty showMessageBox&quot; width=&quot;1064&quot; height=&quot;526&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;An empty showMessageBox&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adding-more-info-to-the-message-box&quot;&gt;Adding more info to the message box&lt;/h3&gt;
&lt;p&gt;Lets add more info the the box, A question and two buttons and use the callback method as well.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;question&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;buttons&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Cancel&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Yes, please&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;No, thanks&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;defaultId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Question&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Do you want to do this?&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;detail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;It does not really matter&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;checkboxLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Remember my answer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;checkboxChecked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showMessageBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;checkboxChecked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;checkboxChecked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The code above would produce a message box looking like this:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/11/show-message-box.png&quot; aria-label=&quot;Show message box&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/11/show-message-box.png&quot; alt=&quot;Show message box&quot; width=&quot;1172&quot; height=&quot;550&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/11/show-message-box.png&quot; alt=&quot;Show message box&quot; width=&quot;1172&quot; height=&quot;550&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Show message box&lt;/p&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;type&lt;/code&gt; displays different icons in the messagebox.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;buttons&lt;/code&gt; is an array of strings that will be displayed as buttons.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;defaultId&lt;/code&gt; sets which of the buttons should be selected when opening the box.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;title&lt;/code&gt; displays a title on some platforms.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;message&lt;/code&gt; displays a message.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;detail&lt;/code&gt; displays more text below the message.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;checkboxLabel&lt;/code&gt; the box can display a checkbox as well. this is the label for it.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;checkboxChecked&lt;/code&gt; the initial value of the checkbox.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Checkout the &lt;a href=&quot;https://electronjs.org/docs/api/dialog#dialogshowmessageboxbrowserwindow-options-callback&quot; title=&quot;dialog electron documentaion&quot;&gt;dialog documentation&lt;/a&gt; to get more info and what values you can set for the different settings.&lt;/p&gt;

&lt;p&gt;This code example is added to the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/blob/master/dialog/dialog.js&quot; title=&quot;electron tutorial app dialog&quot;&gt;electron tutorial app dialog on github&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-show-messagebox/">https://www.christianengvall.se/electron-show-messagebox/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 02 Nov 2018 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-show-messagebox/</guid>
        </item>
      
    
      
        <item>
          <title>Electron showErrorBox tutorial</title>
          <link>https://www.christianengvall.se/electron-showerrorbox-tutorial/</link>
          <comments>https://www.christianengvall.se/electron-showerrorbox-tutorial/#respond</comments>
          <description>&lt;p&gt;Use the Electron dialog &lt;a href=&quot;https://electronjs.org/docs/api/dialog#dialogshowerrorboxtitle-content&quot; title=&quot;showErrorbox docs&quot;&gt;showErrorBox&lt;/a&gt; to display an error message to the user.
Not much to it:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Call it on the main process.&lt;/li&gt;
  &lt;li&gt;Require dialog.&lt;/li&gt;
  &lt;li&gt;Call showErrorBox() with a title and a message.&lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showErrorBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Oops! Something went wrong!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Help us improve your experience by sending an error report&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is what the message will look like on macOS in &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app&quot;&gt;Electorn tutorial app&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/10/electron-error-message.png&quot; aria-label=&quot;Electron error message&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/10/electron-error-message.png&quot; alt=&quot;Electron error message&quot; width=&quot;1282&quot; height=&quot;803&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/10/electron-error-message.png&quot; alt=&quot;Electron error message&quot; width=&quot;1282&quot; height=&quot;803&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron error message&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The file is called &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/blob/master/dialog/dialog.js&quot; title=&quot;dialog.js&quot;&gt;dialog.js&lt;/a&gt; in the github repo if you want to look at the code.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-showerrorbox-tutorial/">https://www.christianengvall.se/electron-showerrorbox-tutorial/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 21 Oct 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-showerrorbox-tutorial/</guid>
        </item>
      
    
      
        <item>
          <title>Electron dark mode with electron packager tutorial</title>
          <link>https://www.christianengvall.se/electron-js-dark-mode-with-packager/</link>
          <comments>https://www.christianengvall.se/electron-js-dark-mode-with-packager/#respond</comments>
          <description>&lt;p&gt;At the time of writing this tutorial there is no support for dark mode in electron. But it’s on its way. Before it’s released we can use &lt;a href=&quot;https://github.com/electron-userland/electron-packager&quot; title=&quot;Electron packager&quot;&gt;Electron-packager&lt;/a&gt; for any electron app we want dark mode support for.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app&quot;&gt;Electron tutorial app&lt;/a&gt; already uses Electron packager. If your app doesn’t you can check out the &lt;a href=&quot;http://www.christianengvall.se/electron-packager-tutorial/&quot; title=&quot;Electron packager tutorial&quot;&gt;electorn-packager tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However we first need to update the packager version to &lt;a href=&quot;https://github.com/electron-userland/electron-packager/releases/tag/v12.2.0&quot; title=&quot;Electron packager version 12.2.0&quot;&gt;12.2.0&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;1-updating-to-version-1220-of-electron-packager&quot;&gt;1. Updating to version 12.2.0 of Electron packager&lt;/h2&gt;
&lt;p&gt;open up &lt;code class=&quot;highlighter-rouge&quot;&gt;package.json&lt;/code&gt; and change:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron-packager&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^8.1.0&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;^12.2.0&quot;&lt;/span&gt;,&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and run&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and to upgrade the global package use(when writing this it will give you v12.2.0):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm update electron-packager &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-update-packager-script-to-enable-dark-mode&quot;&gt;2. Update packager script to enable dark mode&lt;/h2&gt;
&lt;p&gt;Now all we need to do is add a new option to our build script in package.json. That option is called &lt;code class=&quot;highlighter-rouge&quot;&gt;darwinDarkModeSupport&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;currently the packager script for mac looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And when adding darwinDarkModeSupport it looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds --darwinDarkModeSupport=true&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-package-app&quot;&gt;3. Package app&lt;/h2&gt;
&lt;p&gt;To see the darkmode in action we need to package the app.
use&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run package-mac&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;to create the package and then start the app.&lt;/p&gt;

&lt;h2 id=&quot;4-switch-to-dark-mode&quot;&gt;4. Switch to dark mode&lt;/h2&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/10/darkmode.gif&quot; aria-label=&quot;Darkmode&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/10/darkmode.gif&quot; alt=&quot;Darkmode&quot; width=&quot;1996&quot; height=&quot;822&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/10/darkmode.gif&quot; alt=&quot;Darkmode&quot; width=&quot;1996&quot; height=&quot;822&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Darkmode&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-js-dark-mode-with-packager/">https://www.christianengvall.se/electron-js-dark-mode-with-packager/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 21 Oct 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-js-dark-mode-with-packager/</guid>
        </item>
      
    
      
        <item>
          <title>Update to latest Electron version</title>
          <link>https://www.christianengvall.se/update-to-latest-electron-version/</link>
          <comments>https://www.christianengvall.se/update-to-latest-electron-version/#respond</comments>
          <description>&lt;p&gt;The electron tutorial app has not been updated to the latest version of electron. Lets take a look at how to do that.&lt;/p&gt;

&lt;p&gt;At the time of writing the latest stable version is electron v3.0.5.&lt;/p&gt;

&lt;h2 id=&quot;1-updating-the-version-used-in-packagejson&quot;&gt;1. Updating the version used in package.json&lt;/h2&gt;
&lt;p&gt;Start a terminal and run this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;electron@latest&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will give me the currently latest stable version of electron. And I can see that by opening package.json and looking at the electron version which is now:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;nl&quot;&gt;&quot;devDependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^3.0.5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron-installer-dmg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^0.1.2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron-packager&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^8.7.2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron-winstaller&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^2.4.1&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-updating-the-global-electron-version&quot;&gt;2. Updating the global electron version&lt;/h2&gt;
&lt;p&gt;I use the CLI a lot. So I also want to update the globally installed electron package.
This can be done by adding the -g parameter to the install command.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;electron@latest &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When this is finished you can check the version by running this in a terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
v3.0.5&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-test-your-app&quot;&gt;3. Test your app&lt;/h2&gt;
&lt;p&gt;Now it’s time to test that your app still does what it is supposed to be doing on all three platforms. But that is up to you. Maybe you need to update more packages to their latest version. The &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app&quot;&gt;electron tutorial app&lt;/a&gt; only has three more packages, electron-installer-dmg, electron-packager and electron-winstaller. So I’ll update those.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/update-to-latest-electron-version/">https://www.christianengvall.se/update-to-latest-electron-version/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 20 Oct 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/update-to-latest-electron-version/</guid>
        </item>
      
    
      
        <item>
          <title>Electron showOpenDialog tutorial</title>
          <link>https://www.christianengvall.se/electron-showopendialog-tutorial/</link>
          <comments>https://www.christianengvall.se/electron-showopendialog-tutorial/#respond</comments>
          <description>&lt;p&gt;With the &lt;a href=&quot;https://electronjs.org/docs/api/dialog#dialogshowopendialogbrowserwindow-options-callback&quot; title=&quot;showOpenDialog&quot;&gt;showOpenDialog&lt;/a&gt; you can open files or folders. To show an open dialog all you need to do is:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;selectedPaths&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showOpenDialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectedPaths&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;the showOpenDialog returns an array of strings with the paths chosen by the user. If you instead decide to use the callback method it will return &lt;code class=&quot;highlighter-rouge&quot;&gt;undefined&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There are more options to showOpenDialog to use. Take a look at the &lt;a href=&quot;https://electronjs.org/docs/api/dialog#dialogshowopendialogbrowserwindow-options-callback&quot; title=&quot;showOpenDialog&quot;&gt;docs&lt;/a&gt; to se what the options are.&lt;/p&gt;

&lt;p&gt;In the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app&quot;&gt;electron-tutorial-app&lt;/a&gt; this code is used to display a showOpenDialog. It also uses ipc to communicate between the main and renderer process:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ipcMain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;ipcMain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;show-open-dialog&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//title: 'Open a file or folder',&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//defaultPath: '/path/to/something/',&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//buttonLabel: 'Do it',&lt;/span&gt;
      &lt;span class=&quot;cm&quot;&gt;/*filters: [
        { name: 'xml', extensions: ['xml'] }
      ],*/&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//properties: ['showHiddenFiles'],&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//message: 'This message will only be shown on macOS'&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showOpenDialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;filePaths&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;open-dialog-paths-selected&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filePaths&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;As you can see above some ipc-stuff is used. Take a look at the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/blob/master/assets/js/dialog.js&quot; title=&quot;dialog.js&quot;&gt;dialog.js&lt;/a&gt; to see how the message is sent and how the response is handled.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-showopendialog-tutorial/">https://www.christianengvall.se/electron-showopendialog-tutorial/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 20 Oct 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-showopendialog-tutorial/</guid>
        </item>
      
    
      
        <item>
          <title>Electron dialog tutorials</title>
          <link>https://www.christianengvall.se/electron-dialog-tutorial/</link>
          <comments>https://www.christianengvall.se/electron-dialog-tutorial/#respond</comments>
          <description>&lt;p&gt;In this Electron dialog tutorial we’ll take a look at using the different dialogs electron provides. With the &lt;a href=&quot;https://electronjs.org/docs/api/dialog&quot; title=&quot;dialog api&quot;&gt;dialog&lt;/a&gt; we can display native system dialogs for opening and saving files, alerting, etc.&lt;/p&gt;

&lt;p&gt;Each dialog has its own post to make them easier to read.&lt;/p&gt;

&lt;h2 id=&quot;using-showopendialog&quot;&gt;Using showOpenDialog&lt;/h2&gt;
&lt;p&gt;With the showOpenDialog you can let the user select one or more files or folders. The selected paths are returned as an array of strings.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.christianengvall.se/electron-showopendialog-tutorial/&quot; title=&quot;Electron showOpenDialog tutorial&quot;&gt;Electron showOpenDialog tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;using-showsavedialog&quot;&gt;Using showSaveDialog&lt;/h2&gt;
&lt;p&gt;The save dialog displays a dialog to the user and returns a path containing the path selected.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.christianengvall.se/electron-showsavedialog-tutorial/&quot; title=&quot;showSaveDialog tutorial&quot;&gt;Electron showSaveDialog tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;using-showmessagebox&quot;&gt;using showMessageBox&lt;/h2&gt;
&lt;p&gt;showMessageBox could be used to display a question to the user, and depending of the answer do something.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.christianengvall.se/electron-show-messagebox/&quot; title=&quot;showMessageBox tutorial&quot;&gt;Electron showMessageBox tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;using-showerrorbox&quot;&gt;using showErrorBox&lt;/h2&gt;
&lt;p&gt;showErrorBox is used to display an error to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.christianengvall.se/electron-showerrorbox-tutorial/&quot; title=&quot;Electron showErrorBox tutorial&quot;&gt;Electron showErrorBox tutorial&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-dialog-tutorial/">https://www.christianengvall.se/electron-dialog-tutorial/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 20 Oct 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-dialog-tutorial/</guid>
        </item>
      
    
      
        <item>
          <title>Git cherry pick from another branch</title>
          <link>https://www.christianengvall.se/git-cherry-pick/</link>
          <comments>https://www.christianengvall.se/git-cherry-pick/#respond</comments>
          <description>&lt;p&gt;This post takes a look at &lt;a href=&quot;https://git-scm.com/docs/git-cherry-pick&quot; title=&quot;Git cherry pick&quot;&gt;Git cherry-pick&lt;/a&gt;. We’ll cherry pick a commit from one branch to another.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://git-scm.com/docs/git-cherry-pick&quot; title=&quot;Git cherry pick&quot;&gt;Git cherry-pick&lt;/a&gt; documentation explains cherry picking as:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Apply changes introduced by some existing commits.&lt;/p&gt;

  &lt;p&gt;Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no modifications from the HEAD commit).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;1-git-cherry-pick&quot;&gt;1. Git cherry-pick&lt;/h1&gt;
&lt;p&gt;Lets start with a cherry pick. I have a branch called &lt;code class=&quot;highlighter-rouge&quot;&gt;feature/my-feature&lt;/code&gt; in a repo called &lt;a href=&quot;https://github.com/crilleengvall/a-repo-for-testpurposes/commits/feature/my-feature&quot; title=&quot;a repo for test purposes&quot;&gt;a-repo-for-testpurposes&lt;/a&gt;. In that branch I have two commits called &lt;code class=&quot;highlighter-rouge&quot;&gt;the second change&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;the first change&lt;/code&gt;. I want to cherry pick the commit called &lt;code class=&quot;highlighter-rouge&quot;&gt;the first change&lt;/code&gt; into &lt;code class=&quot;highlighter-rouge&quot;&gt;master&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/07/git-cherry-pick-feature-branch.png&quot; aria-label=&quot;git cherry-pick - feature branch&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/07/git-cherry-pick-feature-branch.png&quot; alt=&quot;git cherry-pick - feature branch&quot; width=&quot;1872&quot; height=&quot;680&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/07/git-cherry-pick-feature-branch.png&quot; alt=&quot;git cherry-pick - feature branch&quot; width=&quot;1872&quot; height=&quot;680&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;git cherry-pick - feature branch&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The commit hash of &lt;code class=&quot;highlighter-rouge&quot;&gt;the first change&lt;/code&gt; is &lt;code class=&quot;highlighter-rouge&quot;&gt;ea6128347797b9c268d95257ef17cb6ac0baaaab&lt;/code&gt; (you can find it by using &lt;code class=&quot;highlighter-rouge&quot;&gt;git log&lt;/code&gt;). I’ve checked out master and ready to cherry pick by using this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git cherry-pick &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; ea6128347797b9c268d95257ef17cb6ac0baaaab&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;By providing &lt;a href=&quot;https://git-scm.com/docs/git-cherry-pick#git-cherry-pick--x&quot; title=&quot;-x cherry pick&quot;&gt;-x&lt;/a&gt; we get a message appended to the commit that says this commit was cherry picked:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;cherry picked from commit ea61283&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This creates a new commit with the changes from the cherry picked commit. If the changes introduced a merge conflict you must fix that first.&lt;/p&gt;

&lt;h1 id=&quot;2-merging-the-branch-containing-already-cherry-picked-commits&quot;&gt;2. Merging the branch containing already cherry picked commits&lt;/h1&gt;
&lt;p&gt;Since the cherry pick above is a new commit, and not a merged commit from our feature-branch. We could get a conflict when merging the whole branch back to master. Which needs to be fixed before the merge can complete.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git checkout master
git merge feature/my-feature
Auto-merging code/my code.txt
CONFLICT &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;content&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: Merge conflict &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;code/my code.txt
Automatic merge failed&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; fix conflicts and &lt;span class=&quot;k&quot;&gt;then &lt;/span&gt;commit the result.&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;sources&quot;&gt;Sources&lt;/h1&gt;
&lt;div&gt;The plant icon used in the post image was made by &lt;a href=&quot;https://www.flaticon.com/authors/pixel-perfect&quot; title=&quot;Pixel perfect&quot;&gt;Pixel perfect&lt;/a&gt; from &lt;a href=&quot;https://www.flaticon.com/&quot; title=&quot;Flaticon&quot;&gt;www.flaticon.com&lt;/a&gt; is licensed by &lt;a href=&quot;http://creativecommons.org/licenses/by/3.0/&quot; title=&quot;Creative Commons BY 3.0&quot; target=&quot;_blank&quot;&gt;CC 3.0 BY&lt;/a&gt;&lt;/div&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/git-cherry-pick/">https://www.christianengvall.se/git-cherry-pick/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 11 Jul 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/git-cherry-pick/</guid>
        </item>
      
    
      
        <item>
          <title>Check for changes on remote origin Git repository in shell script</title>
          <link>https://www.christianengvall.se/check-for-changes-on-remote-origin-git-repository/</link>
          <comments>https://www.christianengvall.se/check-for-changes-on-remote-origin-git-repository/#respond</comments>
          <description>&lt;p&gt;In a build shell script I use I needed to check for changes on the remote of a git repo to make sure I’m deploying the latest version. To do that I use &lt;a href=&quot;https://git-scm.com/docs/git-rev-parse&quot; title=&quot;Git rev-parse&quot;&gt;Git rev-parse&lt;/a&gt;. You could probably do this better and in some other way. But this worked for me.&lt;/p&gt;

&lt;p&gt;To be more specific: I need to check if there are more changes/commits on the origin master than I have on my local machine. This is all done in a shell-script.&lt;/p&gt;

&lt;p&gt;The script I’m adding this to is the one found in the &lt;a href=&quot;https://www.christianengvall.se/switching-to-jekyll/&quot; title=&quot;Switching to Jekyll&quot;&gt;switching to Jekyll post&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;1-check-if-on-master&quot;&gt;1. Check if on master&lt;/h3&gt;
&lt;p&gt;Before starting I want to check so that I have the master branch checked out. Since thats the branch i want to deploy from. You could do this with &lt;a href=&quot;https://git-scm.com/docs/git-rev-parse#git-rev-parse---abbrev-refstrictloose&quot; title=&quot;git rev-parse --abbrev-ref&quot;&gt;rev-parse –abbrev-ref head&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git rev-parse &lt;span class=&quot;nt&quot;&gt;--abbrev-ref&lt;/span&gt; HEAD&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This would return &lt;code class=&quot;highlighter-rouge&quot;&gt;master&lt;/code&gt; if on master branch. I could do a &lt;code class=&quot;highlighter-rouge&quot;&gt;git branch&lt;/code&gt; but that would return a list of branches with the currently selected marked with a &lt;code class=&quot;highlighter-rouge&quot;&gt;*&lt;/code&gt;. So this saves me from string manipulations.&lt;/p&gt;

&lt;p&gt;Putting together a shell script that checks if you have master branch checked out could look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt; &lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
 &lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[1;90m'&lt;/span&gt;
 &lt;span class=&quot;nv&quot;&gt;FINISHED&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[1;96m'&lt;/span&gt;
 &lt;span class=&quot;nv&quot;&gt;READY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[1;92m'&lt;/span&gt;
 &lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[0m'&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# No Color&lt;/span&gt;
 &lt;span class=&quot;nv&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[0;31m'&lt;/span&gt;

 &lt;span class=&quot;nb&quot;&gt;echo
 echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Checking Git repo
 &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=======================&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;nv&quot;&gt;BRANCH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;git rev-parse &lt;span class=&quot;nt&quot;&gt;--abbrev-ref&lt;/span&gt; HEAD&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$BRANCH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;master&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;then
   &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Not on master. Aborting. &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
   &lt;span class=&quot;nb&quot;&gt;echo
   exit &lt;/span&gt;0
 &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
 &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3&gt; 2. Git fetch &lt;/h3&gt;
&lt;p&gt;Now it is time to do a &lt;code class=&quot;highlighter-rouge&quot;&gt;git fetch&lt;/code&gt; to download objects and refs from our remote master without merging anything to our local branch.&lt;/p&gt;

&lt;p&gt;After that we can get the latest commit hash from our branch by running &lt;code class=&quot;highlighter-rouge&quot;&gt;git rev-parse HEAD&lt;/code&gt;. Then to get the latest commit hash from the origin we run &lt;code class=&quot;highlighter-rouge&quot;&gt;git rev-parse master@{upstream}&lt;/code&gt; and compare these two. If they do not match there is either changes in the origin master, or you haven’t pushed the latest local commit to origin master.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt; &lt;span class=&quot;c&quot;&gt;#color variables here...&lt;/span&gt;

 git fetch
 &lt;span class=&quot;nv&quot;&gt;HEADHASH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;git rev-parse HEAD&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nv&quot;&gt;UPSTREAMHASH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;git rev-parse master@&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;upstream&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HEADHASH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$UPSTREAMHASH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;then
   &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Not up to &lt;span class=&quot;nb&quot;&gt;date &lt;/span&gt;with origin. Aborting.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
   &lt;span class=&quot;nb&quot;&gt;echo
   exit &lt;/span&gt;0
 &lt;span class=&quot;k&quot;&gt;else
   &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FINISHED&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Current branch is up to &lt;span class=&quot;nb&quot;&gt;date &lt;/span&gt;with origin/master.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
 &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3&gt;3. Using ls-remote instead&lt;/h3&gt;
&lt;p&gt;If you have a large repo you could probably use &lt;a href=&quot;https://git-scm.com/docs/git-ls-remote.html&quot; title=&quot;git ls-remote&quot;&gt;ls-remote&lt;/a&gt; like this &lt;code class=&quot;highlighter-rouge&quot;&gt;git ls-remote origin -h refs/heads/master&lt;/code&gt; which would return something like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;fc94529726cf4c06039815bs447496b6768a6b94        refs/heads/master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;But you would need to remove everything after the hash some way, not covered here, but hopefully you can continue yourself if you want to use it.&lt;/p&gt;

&lt;h3&gt;4. Thanks&lt;/h3&gt;
&lt;p&gt;Thanks to multiple Stack overflow threads for helping out. The Git documentation is hard to understand sometimes.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/check-for-changes-on-remote-origin-git-repository/">https://www.christianengvall.se/check-for-changes-on-remote-origin-git-repository/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 25 Jun 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/check-for-changes-on-remote-origin-git-repository/</guid>
        </item>
      
    
      
        <item>
          <title>Update to latest Jekyll version</title>
          <link>https://www.christianengvall.se/upgrade-to-latest-jekyll-version/</link>
          <comments>https://www.christianengvall.se/upgrade-to-latest-jekyll-version/#respond</comments>
          <description>&lt;p&gt;Every now and then a new version of &lt;a href=&quot;https://jekyllrb.com/&quot; title=&quot;Jekyll&quot;&gt;Jekyll&lt;/a&gt; is released. How do you go about to update to that version?&lt;/p&gt;

&lt;p&gt;I found information in the &lt;a href=&quot;https://jekyllrb.com/docs/upgrading/&quot; title=&quot;Jekyll docs&quot;&gt;Jekyll docs&lt;/a&gt; about it. This post covers minor updates. There is information about major versions in the link above as well. This might break your site so make sure to take actions so you won’t lose anything.&lt;/p&gt;

&lt;h3 id=&quot;minor-version-update&quot;&gt;Minor version update&lt;/h3&gt;
&lt;p&gt;I needed to upgrade from 3.5.2 to the currently latest version which is 3.8.0. According to the docs i could open up a terminal and run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;bundle update jekyll&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Most of the dependencies seemed to update when I ran this command. However this message was added just before the update was done:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;......
Using minima 2.1.0
Bundler attempted to update jekyll but its version stayed the same
Bundle updated!&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After a quick Google session &lt;a href=&quot;http://talk.jekyllrb.com/t/updating-jekyll-to-3-6-everything-fails/1009/2&quot; title=&quot;jekyllrb&quot;&gt;ashmaroli&lt;/a&gt; told me how to fix it.&lt;/p&gt;

&lt;h3 id=&quot;update-version-in-gemfile&quot;&gt;Update version in Gemfile&lt;/h3&gt;
&lt;p&gt;Ashmarolis solution was to open up the Gemfile and change the line &lt;code class=&quot;highlighter-rouge&quot;&gt;gem &quot;jekyll&quot;, &quot;3.5.2&quot;&lt;/code&gt; to the version you want (3.8.0 for me).&lt;/p&gt;

&lt;p&gt;Then run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;bundle update&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This worked for me. However i couldn’t run &lt;code class=&quot;highlighter-rouge&quot;&gt;bundle exec jekyll serve&lt;/code&gt; after. This was because a plugin had updated its syntax. Maybe this was why Jekyll wouldn’t update on the first try? For those interested it was &lt;a href=&quot;https://github.com/envygeeks/jekyll-assets#migrating-from-earlier-versions&quot; title=&quot;Jekyll-assets&quot;&gt;jekyll-assets&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/upgrade-to-latest-jekyll-version/">https://www.christianengvall.se/upgrade-to-latest-jekyll-version/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 26 Apr 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/upgrade-to-latest-jekyll-version/</guid>
        </item>
      
    
      
        <item>
          <title>Guest post about Knex, Bookshelf and PostgreSQL at Proposales</title>
          <link>https://www.christianengvall.se/guest-post-about-knex-bookshelf-postgresql-proposales/</link>
          <comments>https://www.christianengvall.se/guest-post-about-knex-bookshelf-postgresql-proposales/#respond</comments>
          <description>&lt;p&gt;I’m currently helping &lt;a href=&quot;https://proposales.com/&quot; title=&quot;Proposales&quot;&gt;Proposales&lt;/a&gt; to develop their platform and a while back I posted a guest post over at their blog. It’s about &lt;a href=&quot;https://blog.proposales.com/knex-migration-bookshelf-orm-postgresql-and-boolean-13f3d7b602cc&quot; title=&quot;Knex migration, Bookshelf ORM and PostgreSQL&quot;&gt;Knex migration, Bookshelf ORM, PostgreSQL and Boolean&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/guest-post-about-knex-bookshelf-postgresql-proposales/">https://www.christianengvall.se/guest-post-about-knex-bookshelf-postgresql-proposales/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 26 Apr 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/guest-post-about-knex-bookshelf-postgresql-proposales/</guid>
        </item>
      
    
      
        <item>
          <title>Git reset origin to commit</title>
          <link>https://www.christianengvall.se/git-reset-origin-master-to-commit/</link>
          <comments>https://www.christianengvall.se/git-reset-origin-master-to-commit/#respond</comments>
          <description>&lt;p&gt;How do you reset a Git repository to a certain commit? This example will delete the commits made after the commit you want to reset to, and then we’ll push it to origin.&lt;/p&gt;

&lt;p&gt;This is what my latest commit looks like on a testrepo, but lets say I want the &lt;code class=&quot;highlighter-rouge&quot;&gt;signs?&lt;/code&gt; commit to be the latest commit.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/04/repo-before-reset-image.png&quot; aria-label=&quot;repository before reset&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/04/repo-before-reset-image.png&quot; alt=&quot;repository before reset&quot; width=&quot;1005&quot; height=&quot;504&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/04/repo-before-reset-image.png&quot; alt=&quot;repository before reset&quot; width=&quot;1005&quot; height=&quot;504&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;repository before reset&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;git-reset&quot;&gt;Git reset&lt;/h2&gt;
&lt;p&gt;Make sure you are on the branch where the commit is. I’m doing this on master.&lt;/p&gt;

&lt;p&gt;Then use git reset –&lt;a href=&quot;https://git-scm.com/docs/git-reset#git-reset---hard&quot; title=&quot;git-reset hard&quot;&gt;hard&lt;/a&gt; &amp;lt;commit-hash&amp;gt; to set the current branch HEAD to the commit you want.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt; cedc856
git push &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt; origin master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When we push the change to origin when need to use  &lt;a href=&quot;https://git-scm.com/docs/git-push#git-push---force&quot; title=&quot;git push --force&quot;&gt;force&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how the commits looks on my testrepo origin now:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/04/repo-after-reset.png&quot; aria-label=&quot;repository after reset&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/04/repo-after-reset.png&quot; alt=&quot;repository after reset&quot; width=&quot;995&quot; height=&quot;349&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/04/repo-after-reset.png&quot; alt=&quot;repository after reset&quot; width=&quot;995&quot; height=&quot;349&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;repository after reset&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;background-and-source&quot;&gt;Background and source&lt;/h2&gt;
&lt;p&gt;A colleague asked me how to set the HEAD of a branch to an older commit. I thought of using &lt;a href=&quot;https://git-scm.com/docs/git-revert&quot; title=&quot;git revert&quot;&gt;revert&lt;/a&gt;. But that would save the changes in a revert-commit, which was not desired this time. So I didn’t know how. My colleague found a &lt;a href=&quot;https://stackoverflow.com/questions/17667023/git-how-to-reset-origin-master-to-a-commit/17667057&quot; title=&quot;stack overflow&quot;&gt;stack overflow thread&lt;/a&gt; containing the answer that we tried and was successful with.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/git-reset-origin-master-to-commit/">https://www.christianengvall.se/git-reset-origin-master-to-commit/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 11 Apr 2018 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/git-reset-origin-master-to-commit/</guid>
        </item>
      
    
      
        <item>
          <title>Screenbar released on Mac app store</title>
          <link>https://www.christianengvall.se/screenbar-released-on-mac-app-store/</link>
          <comments>https://www.christianengvall.se/screenbar-released-on-mac-app-store/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar on mac app store&quot;&gt;Screenbar&lt;/a&gt; is an application that takes screenshots for you when you need your hands to do something else, like playing a game. It has now been released on the Mac App store. It was also shipped with a new design.&lt;/p&gt;

&lt;h3 id=&quot;download-and-install&quot;&gt;Download and install&lt;/h3&gt;
&lt;p&gt;You can download and install it from the &lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar on mac app store&quot;&gt;Mac app store&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;the-new-stuff&quot;&gt;The new stuff&lt;/h3&gt;
&lt;p&gt;This version comes with two changes. It is sandboxed and has a new design.&lt;/p&gt;

&lt;h4 id=&quot;sandboxed&quot;&gt;Sandboxed&lt;/h4&gt;
&lt;p&gt;This version is &lt;a href=&quot;https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AboutAppSandbox/AboutAppSandbox.html&quot; title=&quot;About app sandbox&quot;&gt;Sandboxed&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;App Sandbox is an access control technology provided in macOS, enforced at the kernel level. It is designed to contain damage to the system and the user’s data if an app becomes compromised. - Apple&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This means the screenshots will be saved in the users &lt;strong&gt;Picture&lt;/strong&gt; folder. The folder name needs to be called &lt;strong&gt;com.honkbarkstudios.screenbar&lt;/strong&gt;.&lt;/p&gt;

&lt;h4 id=&quot;design-change&quot;&gt;Design change&lt;/h4&gt;
&lt;p&gt;The design changed to use a dark theme. Other devs might recognize it as &lt;strong&gt;vibrantDark&lt;/strong&gt;. The two menus are also merged into one.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/01/screenbar-screenshot.png&quot; aria-label=&quot;Screenbar screenshot&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/01/screenbar-screenshot.png&quot; alt=&quot;Screenbar screenshot&quot; width=&quot;541&quot; height=&quot;225&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/01/screenbar-screenshot.png&quot; alt=&quot;Screenbar screenshot&quot; width=&quot;541&quot; height=&quot;225&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar screenshot&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/screenbar-released-on-mac-app-store/">https://www.christianengvall.se/screenbar-released-on-mac-app-store/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 08 Jan 2018 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/screenbar-released-on-mac-app-store/</guid>
        </item>
      
    
      
        <item>
          <title>Klarna CSCOE wrong url</title>
          <link>https://www.christianengvall.se/klarna-cscoe-wrong-url/</link>
          <comments>https://www.christianengvall.se/klarna-cscoe-wrong-url/#respond</comments>
          <description>&lt;p&gt;On a project I’m working on there is an integration to the payment provider &lt;a href=&quot;https://www.klarna.com/se/&quot; title=&quot;Klarna&quot;&gt;Klarna&lt;/a&gt;.
I was having trouble to get it to work on my local development environment.&lt;/p&gt;

&lt;p&gt;Everytime a purchase was made the visitor(me) was supposed to get redirected back to the dev-environment. I was… but to the wrong url: &lt;strong&gt;https://local-dev-env-url/+CSCOE+/wrong_url.html&lt;/strong&gt;
In my case this was connected to the &lt;code class=&quot;highlighter-rouge&quot;&gt;validation_uri&lt;/code&gt; setting.&lt;/p&gt;

&lt;h3 id=&quot;validation-uri&quot;&gt;Validation uri&lt;/h3&gt;
&lt;p&gt;What is the validation_uri ?&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;“This checkout function will allow you to validate the information provided by the consumer in the Klarna Checkout iframe before the purchase is completed.”  &lt;br /&gt;
– &lt;cite&gt;Klarna&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can read more about it and the use cases in the &lt;a href=&quot;https://developers.klarna.com/en/se/kco-v2/checkout/use-cases#validate-checkout-order&quot; title=&quot;Klarna use cases&quot;&gt;Klarna documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is an example of what is sent to Klarna in my local environment, and you can see the validation_uri at the bottom.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;nl&quot;&gt;&quot;merchant&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;terms_uri&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://local-dev-env-url/terms&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;checkout_uri&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://local-dev-env-url/checkout&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;confirmation_uri&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://local-dev-env-url/checkout?confirmed=true&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;push_uri&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://local-dev-env-url/checkout?push=true&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;validation_uri&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://local-dev-env-url/checkout?validate=true&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Since I’m running this code locally the Klarna API can’t reach my validation uri. That was what was causing my problem. For debugging purposes you can skip to send the validation_uri since it is an &lt;a href=&quot;https://developers.klarna.com/en/se/kco-v2/checkout-api&quot; title=&quot;Checkout api&quot;&gt;optional setting according to the documentation&lt;/a&gt;. To also debug the validation logic you need to make sure the Klarna API can reach that url.&lt;/p&gt;

&lt;p&gt;Hopefully this helps someone else in the same situation as I was. But I have a feeling you can encounter the same error but it’s being caused by something else.&lt;/p&gt;

&lt;p&gt;A big thanks to the Klarna support for helping out with this!&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/klarna-cscoe-wrong-url/">https://www.christianengvall.se/klarna-cscoe-wrong-url/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 31 Oct 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/klarna-cscoe-wrong-url/</guid>
        </item>
      
    
      
        <item>
          <title>Decrypt Bitlocker encrypted partition on Linux and macOS</title>
          <link>https://www.christianengvall.se/decrypt-bitlocker-encrypted-partition-on-linux-and-macos/</link>
          <comments>https://www.christianengvall.se/decrypt-bitlocker-encrypted-partition-on-linux-and-macos/#respond</comments>
          <description>&lt;p&gt;By using &lt;a href=&quot;https://github.com/Aorimn/dislocker&quot; title=&quot;Dislocker&quot;&gt;Dislocker&lt;/a&gt; we can decrypt a &lt;a href=&quot;https://docs.microsoft.com/en-us/windows/device-security/bitlocker/bitlocker-overview&quot; title=&quot;BitLocker&quot;&gt;Bitlocker&lt;/a&gt; encrypted partition on Linux and macOS. In this post we’ll be doing this on macOS.&lt;/p&gt;

&lt;h3 id=&quot;1-installing-dislocker-and-fuse-for-macos&quot;&gt;1. Installing Dislocker and FUSE for macOS&lt;/h3&gt;
&lt;p&gt;Start by &lt;a href=&quot;https://github.com/Aorimn/dislocker/archive/master.zip&quot; title=&quot;Download dislocker&quot;&gt;downloading Dislocker&lt;/a&gt; and extract the package.
Then we can install Dislocker and &lt;a href=&quot;https://osxfuse.github.io/&quot; title=&quot;osxfuse&quot;&gt;FUSE for mac OS&lt;/a&gt; (which is a needed for dislocker) using &lt;a href=&quot;https://brew.sh/&quot; title=&quot;Homebrew&quot;&gt;Homebrew&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Enter the following commands in a terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;brew update
brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;Caskroom/cask/osxfuse
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /Downloads/dislocker-master/src
brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;dislocker.rb&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When I ran the last command to install dislocker this error showed up:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;Last 15 lines from /Library/Logs/Homebrew/dislocker/02.make:
In file included from /tmp/dislocker-20171015-14904-gzgqvz/dislocker-0.7/src/config.c:30:
In file included from /tmp/dislocker-20171015-14904-gzgqvz/dislocker-0.7/include/dislocker/dislocker.priv.h:31:
/tmp/dislocker-20171015-14904-gzgqvz/dislocker-0.7/include/dislocker/metadata/metadata.priv.h:296:20: error: unknown &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;name &lt;span class=&quot;s1&quot;&gt;'VALUE'&lt;/span&gt;
void Init_metadata&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;VALUE rb_mDislocker&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                   ^
make[2]: &lt;span class=&quot;k&quot;&gt;***&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;src/CMakeFiles/dislocker.dir/dislocker.c.o] Error 1
make[2]: &lt;span class=&quot;k&quot;&gt;***&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;src/CMakeFiles/dislocker_bundle.dir/dislocker.c.o] Error 1
13 errors generated.
...
make[2]: &lt;span class=&quot;k&quot;&gt;***&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;src/CMakeFiles/dislocker.dir/config.c.o] Error 1
make[1]: &lt;span class=&quot;k&quot;&gt;***&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;src/CMakeFiles/dislocker.dir/all] Error 2
make[1]: &lt;span class=&quot;k&quot;&gt;***&lt;/span&gt; Waiting &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;unfinished jobs....
make[1]: &lt;span class=&quot;k&quot;&gt;***&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;src/CMakeFiles/dislocker_bundle.dir/all] Error 2
make: &lt;span class=&quot;k&quot;&gt;***&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;all] Error 2&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;By unlinking ruby as explained by &lt;a href=&quot;https://github.com/Aorimn/dislocker/issues/105#issuecomment-295381699&quot; title=&quot;Unlink Ruby&quot;&gt;jricks92 on Github&lt;/a&gt; the install went through with no errors:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt; brew &lt;span class=&quot;nb&quot;&gt;unlink &lt;/span&gt;ruby
 brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;dislocker.rb
 brew &lt;span class=&quot;nb&quot;&gt;link &lt;/span&gt;ruby&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;2-drive-identifier&quot;&gt;2. Drive identifier&lt;/h3&gt;
&lt;p&gt;Now we need to know the identifier of the bitlocker encrypted disk. In the terminal we’ll run the command &lt;code class=&quot;highlighter-rouge&quot;&gt;diskutil list&lt;/code&gt; (on macOS).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;diskutil list

/dev/disk2 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;external, physical&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:
   &lt;span class=&quot;c&quot;&gt;#:      TYPE NAME                    SIZE        IDENTIFIER&lt;/span&gt;
   0:      GUID_partition_scheme        &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;500.1 GB   disk2
   1:      Microsoft Basic Data         500.1 GB    disk2s1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The identifier i’m interested in here is called &lt;strong&gt;disk2s1&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;3-encrypt-with-dislocker&quot;&gt;3. Encrypt with dislocker&lt;/h3&gt;
&lt;p&gt;First we need to create a folder where a virtual NTFS partition called dislocker-file will be created. I’ll call mine externalhdd and i’ll create it in the mnt folder.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo mkdir&lt;/span&gt; /mnt/externalhdd&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now it’s time to use Dislocker to decrypt the disk.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;dislocker &lt;span class=&quot;nt&quot;&gt;-V&lt;/span&gt; /dev/disk2s1 &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; /mnt/externalhdd/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-V /dev/disk2s1&lt;/code&gt; tells dislocker what disk to decrypt.  &lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;-u&lt;/code&gt; tells dislockers to ask the user for the password the disk is encrypted with.
&lt;code class=&quot;highlighter-rouge&quot;&gt;-- /mnt/externalhdd&lt;/code&gt; passes the path to the folder we created to store the virtual ntfs-partition.&lt;/p&gt;

&lt;h3 id=&quot;4-create-a-block-device&quot;&gt;4. Create a block device&lt;/h3&gt;
&lt;p&gt;Now we need to create a block device before mounting the disk.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;hdiutil attach &lt;span class=&quot;nt&quot;&gt;-imagekey&lt;/span&gt; diskimage-class&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;CRawDiskImage &lt;span class=&quot;nt&quot;&gt;-nomount&lt;/span&gt; /mnt/externalhdd/dislocker-file
....
/dev/disk3&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;hdiutil&lt;/code&gt; - manipulate disk images (attach, verify, create, etc)  &lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;attach&lt;/code&gt; - Attach a disk image as a device  &lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;imagekey&lt;/code&gt; - specify a key/value pair for the disk image recognition system. I can’t find information on what the diskimageclass=creatdiskimage means in the man pages of hdiutil.  &lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;nomount&lt;/code&gt; - indicate whether filesystems in the image should be mounted or not.&lt;/p&gt;

&lt;p&gt;After running this command i got the line /dev/disk3 printed in the console. Now we’ll use that to mount the drive.&lt;/p&gt;

&lt;h3 id=&quot;5-mount&quot;&gt;5. Mount&lt;/h3&gt;
&lt;p&gt;Start by creating a folder where the drive will be mounted&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo mkdir&lt;/span&gt; /Volumes/ExternalHDD&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then we run this command to mount it (only readable):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mount &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; ntfs /dev/disk3 /Volumes/ExternalHDD/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And by now, if you haven’t encountered any errors, you should see the disk in Finder.&lt;/p&gt;

&lt;h3 id=&quot;documentation&quot;&gt;Documentation&lt;/h3&gt;
&lt;p&gt;There are more to dislocker than this post shows, take a look at the man pages to get more info:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;man dislocker&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/decrypt-bitlocker-encrypted-partition-on-linux-and-macos/">https://www.christianengvall.se/decrypt-bitlocker-encrypted-partition-on-linux-and-macos/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 16 Oct 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/decrypt-bitlocker-encrypted-partition-on-linux-and-macos/</guid>
        </item>
      
    
      
        <item>
          <title>Electron installer debian package</title>
          <link>https://www.christianengvall.se/electron-installer-debian-package/</link>
          <comments>https://www.christianengvall.se/electron-installer-debian-package/#respond</comments>
          <description>&lt;p&gt;In this tutorial we will be using the &lt;a href=&quot;https://github.com/unindented/electron-installer-debian&quot; title=&quot;Electron installer debian&quot;&gt;Electron installer debian package&lt;/a&gt; to create a debian package.
This tutorial expects you to have packaged your app already. If you haven’t, you can check out the &lt;a href=&quot;https://www.christianengvall.se/electron-packager-tutorial/&quot; title=&quot;Electron packager tutorial&quot;&gt;Electron packager tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;1-installing-the-package&quot;&gt;1. Installing the package&lt;/h3&gt;
&lt;p&gt;Start by installing electron-installer-debian package:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; electron-installer-debian&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;2-create-config-file&quot;&gt;2. Create config file&lt;/h3&gt;
&lt;p&gt;Then create a new file called debian.json that will contain settings we need to create the package.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dest&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;release-builds/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;icon&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;assets/icons/png/1024x1024.png&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;categories&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Utility&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lintianOverrides&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;changelog-file-missing-in-native-package&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;With &lt;code class=&quot;highlighter-rouge&quot;&gt;dest&lt;/code&gt; we set where the .deb package will be saved.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;icon&lt;/code&gt; options points to an icon the app will get.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;categories&lt;/code&gt; sets the category where the application will be seen in menus. I’ve choosen Utility for this app since there is no real good place for it. You can take a look at the &lt;a href=&quot;https://standards.freedesktop.org/menu-spec/latest/apa.html&quot; title=&quot;available categories&quot;&gt;available categories&lt;/a&gt; for your app.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;lintianOverrides&lt;/code&gt; is used to quieten &lt;a href=&quot;https://lintian.debian.org/manual/&quot; title=&quot;Lintian&quot;&gt;Lintian&lt;/a&gt;, which is a debian package checker.&lt;/p&gt;

&lt;p&gt;There are a lot of other &lt;a href=&quot;https://github.com/unindented/electron-installer-debian#options&quot; title=&quot;options&quot;&gt;options&lt;/a&gt; you can set. You might want to check how to set for example dependencies. But this will currently be enough for the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app&quot;&gt;Electron tutorial app&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;3-package-the-app&quot;&gt;3. Package the app&lt;/h3&gt;
&lt;p&gt;Now we need to make sure we have a packaged app. First I need to make an update to the packager script since I’ve missed a setting there. Thank you &lt;a href=&quot;https://github.com/fcastilloec&quot; title=&quot;Felipe Castillo&quot;&gt;Felipe Castillo&lt;/a&gt; for the help!&lt;/p&gt;

&lt;p&gt;The package script called &lt;code class=&quot;highlighter-rouge&quot;&gt;package-linux&lt;/code&gt; in &lt;code class=&quot;highlighter-rouge&quot;&gt;package.json&lt;/code&gt; that currently looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&quot;package-linux&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Needs to be updated with a setting called &lt;a href=&quot;https://github.com/electron-userland/electron-packager#from-the-command-line&quot; title=&quot;appname&quot;&gt;appname&lt;/a&gt;. So it will now look like this instead:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&quot;package-linux&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;electron-packager .  electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds&quot;&lt;/span&gt;,&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we can run the package script:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run package-linux&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;4-creating-the-debian-package&quot;&gt;4. Creating the debian package&lt;/h3&gt;
&lt;p&gt;When the electron-packager is finished, we can run the electron-installer-debian to create a .deb package.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron-installer-debian &lt;span class=&quot;nt&quot;&gt;--src&lt;/span&gt; release-builds/electron-tutorial-app-linux-x64/ &lt;span class=&quot;nt&quot;&gt;--arch&lt;/span&gt; amd64 &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt; debian.json&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;src&lt;/code&gt; points to the folder where the packager saved the app.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;arch&lt;/code&gt; tells electron-installer-debian which architecture to build for.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;config&lt;/code&gt; points to the file containing the settings we defined in step 2.&lt;/p&gt;

&lt;h3 id=&quot;5-adding-script-to-packagejson&quot;&gt;5. Adding script to package.json&lt;/h3&gt;
&lt;p&gt;So that we don’t need to remember the electron-installer-debian command everytime we can add it to package.json below &lt;code class=&quot;highlighter-rouge&quot;&gt;create-installer-win&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;create-installer-win&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;node installers/windows/createinstaller.js&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;create-debian-installer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-installer-debian --src release-builds/electron-tutorial-app-linux-x64/ --arch amd64 --config debian.json&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we can run&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run create-debian-installer&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is what the package-installer looks like in Mint Linux when opening &lt;code class=&quot;highlighter-rouge&quot;&gt;release-builds/electron-tutorial-app_0.1.0_amd64.deb&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/10/electron-tutorial-app-debian-package-installer.png&quot; aria-label=&quot;Electron tutorial app - debian package installer&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/10/electron-tutorial-app-debian-package-installer.png&quot; alt=&quot;Electron tutorial app - debian package installer&quot; width=&quot;550&quot; height=&quot;427&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/10/electron-tutorial-app-debian-package-installer.png&quot; alt=&quot;Electron tutorial app - debian package installer&quot; width=&quot;550&quot; height=&quot;427&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron tutorial app - debian package installer&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-installer-debian-package/">https://www.christianengvall.se/electron-installer-debian-package/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 04 Oct 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-installer-debian-package/</guid>
        </item>
      
    
      
        <item>
          <title>Install Electron tutorial app</title>
          <link>https://www.christianengvall.se/install-electron-tutorial-app/</link>
          <comments>https://www.christianengvall.se/install-electron-tutorial-app/#respond</comments>
          <description>&lt;p&gt;How do you install and run the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot; title=&quot;Electron tutorial app on Github&quot;&gt;Electron tutorial app?&lt;/a&gt;. This is a quick guide to get it running.&lt;/p&gt;

&lt;h3 id=&quot;1-install-nodejs-and-electron&quot;&gt;1. Install Node.JS and Electron&lt;/h3&gt;
&lt;p&gt;First you need to install &lt;a href=&quot;https://nodejs.org/en/&quot; title=&quot;NodeJS&quot;&gt;Node.JS&lt;/a&gt; if you haven’t done that already.&lt;/p&gt;

&lt;p&gt;Then run the following command to install electron globally.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; electron&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;2-clone-or-download-the-repo-from-github&quot;&gt;2. Clone or download the repo from Github.&lt;/h3&gt;
&lt;p&gt;Clone the Github repo by running this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git clone git@github.com:crilleengvall/electron-tutorial-app.git&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Or &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/archive/master.zip&quot; title=&quot;Download Electron tutorial app from Github&quot;&gt;download&lt;/a&gt; the repo and extract the archive.&lt;/p&gt;

&lt;p&gt;After cloning or downloading and extracting the application run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;electron-tutorial-app/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;3-install-dependencies&quot;&gt;3. Install dependencies&lt;/h3&gt;
&lt;p&gt;Now we need to install dependencies, such as the electron winstaller or the packager. Do this by running:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;4-run-electron-tutorial-app&quot;&gt;4. Run Electron tutorial app&lt;/h3&gt;
&lt;p&gt;When the &lt;code class=&quot;highlighter-rouge&quot;&gt;npm install&lt;/code&gt; is done you need to start the app by running:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will start an application looking like this on Linux Mint, but it will work on Windows and macOS as well:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/08/electron-tutorial-app-linux-mint.png&quot; aria-label=&quot;Electron tutorial app on Linux mint&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/08/electron-tutorial-app-linux-mint.png&quot; alt=&quot;Electron tutorial app on Linux mint&quot; width=&quot;1281&quot; height=&quot;852&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/08/electron-tutorial-app-linux-mint.png&quot; alt=&quot;Electron tutorial app on Linux mint&quot; width=&quot;1281&quot; height=&quot;852&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron tutorial app on Linux mint&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/install-electron-tutorial-app/">https://www.christianengvall.se/install-electron-tutorial-app/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 28 Aug 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/install-electron-tutorial-app/</guid>
        </item>
      
    
      
        <item>
          <title>React Native No Bundle Url Present</title>
          <link>https://www.christianengvall.se/react-native-no-bundle-url-present/</link>
          <comments>https://www.christianengvall.se/react-native-no-bundle-url-present/#respond</comments>
          <description>&lt;p&gt;In the latest post about &lt;a href=&quot;https://www.christianengvall.se/react-native-build-for-ios-app-store/&quot; title=&quot;Build react native for iOS deploy&quot;&gt;React native - build for iOS App store deploy&lt;/a&gt; there was a step about removing NSExceptionAllowsInsecureHTTPLoads before publishing to the App store.&lt;/p&gt;

&lt;p&gt;After doing that step I was happy and tired and didn’t add that key into the info.plist again before going on vacation. Bad move. I spent an hour figuring out why my app wouldn’t start when running &lt;code class=&quot;highlighter-rouge&quot;&gt;react-native run-ios&lt;/code&gt;. Instead i got the error &lt;strong&gt;No bundle URL Present.&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 id=&quot;infoplist&quot;&gt;Info.plist&lt;/h3&gt;
&lt;p&gt;By adding the following to &lt;code class=&quot;highlighter-rouge&quot;&gt;info.plist&lt;/code&gt; it started to work again:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;NSAppTransportSecurity&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;NSExceptionDomains&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;localhost&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;NSExceptionAllowsInsecureHTTPLoads&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;true/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;However this is not the only thing that could produce this error. Checkout this &lt;a href=&quot;https://github.com/facebook/react-native/issues/12754&quot; title=&quot;Github issue&quot;&gt;Github issue&lt;/a&gt; if the solution above does not help.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/react-native-no-bundle-url-present/">https://www.christianengvall.se/react-native-no-bundle-url-present/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 24 Jul 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/react-native-no-bundle-url-present/</guid>
        </item>
      
    
      
        <item>
          <title>React Native - Build for iOS App store deploy</title>
          <link>https://www.christianengvall.se/react-native-build-for-ios-app-store/</link>
          <comments>https://www.christianengvall.se/react-native-build-for-ios-app-store/#respond</comments>
          <description>&lt;p&gt;There are some steps that need to be taken in order to publish a React Native app to the iOS App Store.
But first you need to know how to submit a native app to the app store. That is out of scope for this tutorial since there is a tutorial at &lt;a href=&quot;https://www.raywenderlich.com/127936/submit-an-app-part-1&quot; title=&quot;Submit an app&quot;&gt;Ray Wenderlich&lt;/a&gt; that covers that whole process. It helps you with setting up a developer account, create certificates and profiles and so on. After finishing those steps you can continue reading below.&lt;/p&gt;

&lt;h3 id=&quot;1-remove-localhost-from-infoplist&quot;&gt;1. Remove localhost from info.plist&lt;/h3&gt;
&lt;p&gt;First we need to remove the localhost exception from info.plist. By default all traffic over HTTP is rejected since iOS 9 with App Transport Security. React Native has added an exception to localhost to make development easier.&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;info.plist&lt;/strong&gt; and expand the &lt;strong&gt;App Transport Security settings&lt;/strong&gt; and &lt;strong&gt;Exception Domains&lt;/strong&gt;. Under there you’ll find the &lt;strong&gt;localhost&lt;/strong&gt; entry. Remove it.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/06/infoplist-app-transport-security-settings.png&quot; aria-label=&quot;Info plist - App Transport Security settings&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/06/infoplist-app-transport-security-settings.png&quot; alt=&quot;Info plist - App Transport Security settings&quot; width=&quot;958&quot; height=&quot;465&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/06/infoplist-app-transport-security-settings.png&quot; alt=&quot;Info plist - App Transport Security settings&quot; width=&quot;958&quot; height=&quot;465&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Info plist - App Transport Security settings&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;2-create-a-release-scheme&quot;&gt;2. Create a release scheme&lt;/h3&gt;
&lt;p&gt;When building an app for release the React Native Developer Menu will be disabled.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/06/react-native-developer-menu.png&quot; aria-label=&quot;React Native Developer menu - borrowed from official docs&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/06/react-native-developer-menu.png&quot; alt=&quot;React Native Developer menu - borrowed from official docs&quot; width=&quot;300&quot; height=&quot;416&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/06/react-native-developer-menu.png&quot; alt=&quot;React Native Developer menu - borrowed from official docs&quot; width=&quot;300&quot; height=&quot;416&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;React Native Developer menu - borrowed from official docs&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The Javascript files we’ve created for our app will be bundled and put locally in the app so we can test it without being connected to a computer.&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;Product -&amp;gt; Scheme -&amp;gt; Edit Scheme&lt;/strong&gt; in XCode. Select &lt;strong&gt;Run&lt;/strong&gt; tab and set the Build Configuration dropdown to Release.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/06/release-scheme.png&quot; aria-label=&quot;XCode release scheme&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/06/release-scheme.png&quot; alt=&quot;XCode release scheme&quot; width=&quot;898&quot; height=&quot;504&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/06/release-scheme.png&quot; alt=&quot;XCode release scheme&quot; width=&quot;898&quot; height=&quot;504&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;XCode release scheme&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;3-build-app-with-release-scheme&quot;&gt;3. Build app with release scheme&lt;/h3&gt;
&lt;p&gt;Select &lt;strong&gt;Product -&amp;gt; Build&lt;/strong&gt; from &lt;strong&gt;XCode&lt;/strong&gt; or build the app from the command line using this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;react-native run-ios &lt;span class=&quot;nt&quot;&gt;--configuration&lt;/span&gt; Release&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;4-documentation&quot;&gt;4. Documentation&lt;/h3&gt;
&lt;p&gt;To get to know more about this you can take a look at the &lt;a href=&quot;https://facebook.github.io/react-native/docs/running-on-device.html&quot; title=&quot;React Native documentation&quot;&gt;React Native Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;off-topic-on-react-native-google-maps&quot;&gt;Off topic on React native google maps&lt;/h3&gt;
&lt;p&gt;If you are using React native google maps in your app you might run in to problems when building an archive to publish on the app store.&lt;/p&gt;

&lt;p&gt;I got an error “duplicate symbols for architecture…” and a friendly Github:er called se1exin posted a &lt;a href=&quot;https://github.com/airbnb/react-native-maps/issues/718#issuecomment-295585410&quot; title=&quot;google map problems&quot;&gt;solution to the problem.&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/react-native-build-for-ios-app-store/">https://www.christianengvall.se/react-native-build-for-ios-app-store/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 26 Jun 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/react-native-build-for-ios-app-store/</guid>
        </item>
      
    
      
        <item>
          <title>Install React Native</title>
          <link>https://www.christianengvall.se/install-react-native/</link>
          <comments>https://www.christianengvall.se/install-react-native/#respond</comments>
          <description>&lt;p&gt;I’m interested in trying React native instead of Ionic for &lt;a href=&quot;https://www.dogwalkmap.com&quot; title=&quot;Dogwalk&quot;&gt;Dogwalk&lt;/a&gt;. And when doing this i’ll be writing the steps I take if someone else is interested in learning this as well. Now we’ll take a look on how to install &lt;a href=&quot;https://facebook.github.io/react-native/&quot; title=&quot;React Native&quot;&gt;React Native&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For React Native we need &lt;a href=&quot;https://nodejs.org/en/&quot; title=&quot;node&quot;&gt;node&lt;/a&gt;, &lt;a href=&quot;https://facebook.github.io/watchman/&quot; title=&quot;Watchman&quot;&gt;Watchman&lt;/a&gt;, React Native CLI and &lt;a href=&quot;https://developer.apple.com/xcode/&quot; title=&quot;Xcode&quot;&gt;Xcode&lt;/a&gt;.
Watchman is a service for watching changes in files and trigger actions when that happens. Reactive CLI is the command interface for React Native. Xcode is Apples IDE.&lt;/p&gt;

&lt;h3 id=&quot;1-install-node-and-watchman&quot;&gt;1. Install node and Watchman&lt;/h3&gt;
&lt;p&gt;Install node and watchman with &lt;a href=&quot;https://brew.sh/index_se.html&quot; title=&quot;Homebrew&quot;&gt;Homebrew&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;node
brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;watchman&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;2-install-react-native-cli&quot;&gt;2. Install React Native CLI&lt;/h3&gt;
&lt;p&gt;And then install React Native CLI with npm&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; react-native-cli&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;3-install-xcode--and-the-xcode-command-line-tools&quot;&gt;3. Install Xcode  and the Xcode Command line tools&lt;/h3&gt;
&lt;p&gt;Install &lt;a href=&quot;https://itunes.apple.com/us/app/xcode/id497799835?mt=12&quot; title=&quot;Xcode in mac app store&quot;&gt;Xcode from the Mac app store&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Then open the preferences of Xcode and install Command line tools.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/06/XcodeCommandLineTools.png&quot; aria-label=&quot;Command line tools - Image borrowed from React native&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/06/XcodeCommandLineTools.png&quot; alt=&quot;Command line tools - Image borrowed from React native&quot; width=&quot;1724&quot; height=&quot;1158&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/06/XcodeCommandLineTools.png&quot; alt=&quot;Command line tools - Image borrowed from React native&quot; width=&quot;1724&quot; height=&quot;1158&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Command line tools - Image borrowed from React native&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;4-creating-a-react-native-project&quot;&gt;4. Creating a React Native project&lt;/h3&gt;
&lt;p&gt;Run these commands in a terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;react-native init MyNewProject
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;MyNewProject
react-native run-ios&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And we’ll end up with a screen like this:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/06/React-native-ios.png&quot; aria-label=&quot;React native start screen&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/06/React-native-ios.png&quot; alt=&quot;React native start screen&quot; width=&quot;675&quot; height=&quot;1135&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/06/React-native-ios.png&quot; alt=&quot;React native start screen&quot; width=&quot;675&quot; height=&quot;1135&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;React native start screen&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;react-native-documentation&quot;&gt;React Native documentation&lt;/h3&gt;
&lt;p&gt;To continue to explore React Native take a look at the &lt;a href=&quot;https://facebook.github.io/react-native/docs/tutorial.html&quot; title=&quot;Learn react basics&quot;&gt;Learn the basics&lt;/a&gt; in the documentation.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/install-react-native/">https://www.christianengvall.se/install-react-native/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 03 Jun 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/install-react-native/</guid>
        </item>
      
    
      
        <item>
          <title>Git rebase</title>
          <link>https://www.christianengvall.se/git-rebase/</link>
          <comments>https://www.christianengvall.se/git-rebase/#respond</comments>
          <description>&lt;p&gt;When running &lt;code class=&quot;highlighter-rouge&quot;&gt;git rebase&lt;/code&gt; you reapply commits on top of another base tip. Ok, nice what does that mean?
The &lt;a href=&quot;https://git-scm.com/docs/git-rebase&quot; title=&quot;Git rebase documentation&quot;&gt;official git docs&lt;/a&gt; provides a good explanation of this.&lt;/p&gt;

&lt;p&gt;If we have a feature branch called topic created from master at commit E. And if master has new commits before our branches can look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;      A---B---C topic
     /
D---E---F---G master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To rebase this branch with master we would use this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git rebase master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Our branches would then look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;              A'--B'--C' topic
             /
D---E---F---G master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;git-rebase-interactive&quot;&gt;Git rebase interactive&lt;/h3&gt;
&lt;p&gt;We can also use rebase to, for example, &lt;code class=&quot;highlighter-rouge&quot;&gt;squash&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;fixup&lt;/code&gt; commits that that fits better into an already made commit. This would come in handy after a code review is done and there are changes that fit in other commits.&lt;/p&gt;

&lt;p&gt;Say i have this line added to my new feature branch:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-txt&quot; data-lang=&quot;txt&quot;&gt;the first commit of this new feature&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And this line was commited with the message &lt;code class=&quot;highlighter-rouge&quot;&gt;First commit of this new feature&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After a code review a new line was added to that file, and a new commit was created&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-txt&quot; data-lang=&quot;txt&quot;&gt;the first commit of this new feature
- This is a line that should have been in the first commit but was discovered missing in a code review&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This commit got the message &lt;code class=&quot;highlighter-rouge&quot;&gt;Fixing a code review&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To keep the branch nice and tidy you can squash or fixup these two commits into one.&lt;/p&gt;

&lt;p&gt;when running:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git rebase &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I would get the following view in my terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;pick c7ffd6a First commit of this new feature
pick cfa6850 Fixing a code review
&lt;span class=&quot;c&quot;&gt;# Rebase cedc856..cfa6850 onto cedc856 (2 commands)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Commands:&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# p, pick = use commit&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# r, reword = use commit, but edit the commit message&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# e, edit = use commit, but stop for amending&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# s, squash = use commit, but meld into previous commit&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# f, fixup = like &quot;squash&quot;, but discard this commit's log message&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# x, exec = run command (the rest of the line) using shell&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# d, drop = remove commit&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# These lines can be re-ordered; they are executed from top to bottom.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# If you remove a line here THAT COMMIT WILL BE LOST.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# However, if you remove everything, the rebase will be aborted.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Note that empty commits are commented out&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When typing fixup before the code review commit and saving, the commit will meld into the previous commit.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;pick c7ffd6a First commit of this new feature
fixup cfa6850 Fixing a code review&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;do-git-rebase-sqash-and-fixups-with-a-gui&quot;&gt;Do git rebase, sqash and fixups with a GUI&lt;/h3&gt;
&lt;p&gt;You do not need to do this in the terminal if you do not want to. You can use for example &lt;a href=&quot;http://gitup.co/&quot; title=&quot;GitUp&quot;&gt;GitUp&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/05/GitUp.png&quot; aria-label=&quot;GitUp Squash and fixups&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/05/GitUp.png&quot; alt=&quot;GitUp Squash and fixups&quot; width=&quot;1003&quot; height=&quot;792&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/05/GitUp.png&quot; alt=&quot;GitUp Squash and fixups&quot; width=&quot;1003&quot; height=&quot;792&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;GitUp Squash and fixups&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;If you right-click on a commit you get a lot of options for example &lt;code class=&quot;highlighter-rouge&quot;&gt;Fixup with Parent&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;Squash with parent&lt;/code&gt;. But you also have the oiption to &lt;code class=&quot;highlighter-rouge&quot;&gt;Swap with parent (Move down)&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;Swap with Child (Move up)&lt;/code&gt; which you can use before squashing or fixuping if there are other commits between the ones you want to combine.&lt;/p&gt;

&lt;p&gt;To complement GitUp you can use the &lt;a href=&quot;https://desktop.github.com/&quot; title=&quot;GitHub Desktop&quot;&gt;GitHub desktop app&lt;/a&gt; to see what your commits contains and which ones should be melded together.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/05/GithubDesktop.png&quot; aria-label=&quot;Github Desktop&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/05/GithubDesktop.png&quot; alt=&quot;Github Desktop&quot; width=&quot;1819&quot; height=&quot;1054&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/05/GithubDesktop.png&quot; alt=&quot;Github Desktop&quot; width=&quot;1819&quot; height=&quot;1054&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Github Desktop&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;push-and-pull-after-rebase&quot;&gt;push and pull after rebase&lt;/h3&gt;
&lt;p&gt;I work with github as an origin to this repo. To push the repo now when you have done a rebase you need to force the push:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git push origin a-feature-branch &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For other users that now want to continue to work on this branch they now need to do a:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git reset &lt;span class=&quot;nt&quot;&gt;--hard&lt;/span&gt; origin/a-feature-branch&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/git-rebase/">https://www.christianengvall.se/git-rebase/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 28 May 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/git-rebase/</guid>
        </item>
      
    
      
        <item>
          <title>Error Missing binding node in Visual Studio 2017</title>
          <link>https://www.christianengvall.se/error-missing-binding-node-visual-studio-2017/</link>
          <comments>https://www.christianengvall.se/error-missing-binding-node-visual-studio-2017/#respond</comments>
          <description>&lt;p&gt;When working in a Visual Studio 2017 solution I started to get this problem when running sass.js task via task runner explorer.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; File &lt;span class=&quot;s2&quot;&gt;&quot;ui&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;checkout.scss&quot;&lt;/span&gt; changed.
Loading &lt;span class=&quot;s2&quot;&gt;&quot;sass.js&quot;&lt;/span&gt; tasks...ERROR
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; Error: Missing binding C:&amp;lt;path&amp;gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;ode_modules&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;ode-sass&lt;span class=&quot;se&quot;&gt;\v&lt;/span&gt;endor&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;in32-x64-46&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;inding.node
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; Node Sass could not find a binding &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;your current environment: Windows 64-bit with Node.js 4.x
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; Found bindings &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;the following environments:
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;   - Windows 64-bit with Node.js 5.x
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; This usually happens because your environment has changed since running &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; Run &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;npm rebuild node-sass &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; to build the binding &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;your current environment.
Warning: Task &lt;span class=&quot;s2&quot;&gt;&quot;sass:dist&quot;&lt;/span&gt; not found. Use &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt; to &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Aborted due to warnings.
Completed &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;0.796s at Tue Mar 28 2017 13:44:11 GMT+0200 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Central Europe Summer Time&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; - Waiting...&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When googling this problem I found this nice &lt;a href=&quot;https://ryanhayes.net/synchronize-node-js-install-version-with-visual-studio-2015/&quot; title=&quot;Node Visual studio 2015&quot;&gt;explanation by Ryan Hayes&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;However I ran into an issue today in which I updated Node.JS outside of Visual Studio, but since VS uses its own install that is separate from any outside installation, you can potentially run into a node_modules package dependency issue where one version of npm installs a package (which makes it rely on that version of Node/npm), and then you can’t run commands in the other version (they break).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Running  npm install or npm rebuild node-sass –force, as the error message says, did not help.&lt;/p&gt;

&lt;h3 id=&quot;how-to-solve-it&quot;&gt;How to solve it&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Open &lt;strong&gt;Visual Studio 2017&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Go to &lt;strong&gt;Tools -&amp;gt; Options…&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Go to &lt;strong&gt;Projects and Solutions -&amp;gt; Web Package Management&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;move $(PATH)&lt;/strong&gt; to the top of that list and close that window.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/04/web-package-management.png&quot; aria-label=&quot;Web package management - Visual Studio 2017&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/04/web-package-management.png&quot; alt=&quot;Web package management - Visual Studio 2017&quot; width=&quot;1064&quot; height=&quot;723&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/04/web-package-management.png&quot; alt=&quot;Web package management - Visual Studio 2017&quot; width=&quot;1064&quot; height=&quot;723&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Web package management - Visual Studio 2017&lt;/p&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Now &lt;strong&gt;close all running tasks&lt;/strong&gt; (if any)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Restart&lt;/strong&gt; Visual Studio&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/04/task-runner-explorer.png&quot; aria-label=&quot;Task runner explorer&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/04/task-runner-explorer.png&quot; alt=&quot;Task runner explorer&quot; width=&quot;315&quot; height=&quot;615&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/04/task-runner-explorer.png&quot; alt=&quot;Task runner explorer&quot; width=&quot;315&quot; height=&quot;615&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Task runner explorer&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/error-missing-binding-node-visual-studio-2017/">https://www.christianengvall.se/error-missing-binding-node-visual-studio-2017/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 01 Apr 2017 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/error-missing-binding-node-visual-studio-2017/</guid>
        </item>
      
    
      
        <item>
          <title>What is Redis</title>
          <link>https://www.christianengvall.se/what-is-redis/</link>
          <comments>https://www.christianengvall.se/what-is-redis/#respond</comments>
          <description>&lt;p&gt;What is Redis and what is it used for? I’ve come across it in two of the projects I’ve been working on, but never had to do anything else than start it. It seems to be used along side a persistence database.&lt;/p&gt;

&lt;p&gt;This is the first post in the &lt;a href=&quot;/category/what-is/&quot; title=&quot;What is&quot;&gt;What is&lt;/a&gt; series where I’m aiming to answer questions I’m thinking about but never take the time to answer. I got this idea from another Swedish developer, who I cant remember the name of right now. Inez or Ines maybe? If you know who i’m looking for, please let me know in the comments :)&lt;/p&gt;

&lt;h3 id=&quot;how-does-redis-explain-itself&quot;&gt;How does redis explain itself&lt;/h3&gt;
&lt;blockquote&gt;
  &lt;p&gt;Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster. -&lt;a href=&quot;https://redis.io/&quot; title=&quot;Redis&quot;&gt;Redis.io&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ok, so I guess it can be used as a database itself, and i do not need to have another one in my application, such as postgres, mysql or any other database.&lt;/p&gt;

&lt;p&gt;It seems to be some kind of cache as well. Have to look into that.&lt;/p&gt;

&lt;h3 id=&quot;is-it-a-cache-database-or-both&quot;&gt;Is it a cache, database or both?&lt;/h3&gt;
&lt;p&gt;After going through the &lt;a href=&quot;https://redis.io/topics/faq&quot; title=&quot;Redis FAQ&quot;&gt;FAQ&lt;/a&gt; I learned that using Redis together with an on-disk database is a good idea and a common design pattern that is used. Use Redis for write heavy small data and store big blobs of data into an sql on disk database.&lt;/p&gt;

&lt;p&gt;But you can use redis as a stand alone database that keeps data in memory and eventually saves it to disk.&lt;/p&gt;

&lt;p&gt;But what do they mean by using it as a cache? Well, since Redis keeps data in memory you can load data into it that is used and displayed often without getting the data from disk everytime, for example loading product data from an sql-database, making it very quick.&lt;/p&gt;

&lt;h3 id=&quot;installing-redis&quot;&gt;Installing redis&lt;/h3&gt;
&lt;p&gt;I used this guide to &lt;a href=&quot;https://medium.com/@petehouston/install-and-config-redis-on-mac-os-x-via-homebrew-eb8df9a4f298#.rpdwlu6js&quot; title=&quot;Install redis&quot;&gt;install Redis&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;redis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And then when it’s installed i ran this command to launch Redis when my computer starts.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sfv&lt;/span&gt; /usr/local/opt/redis/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.plist ~/Library/LaunchAgents&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To check if redis is running you can run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;redis-cli ping&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This should reply pong if it’s running, else it says&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;Could not connect to Redis at 127.0.0.1:6379: Connection refused&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then you need to run this command in a terminal to start it:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;redis-server&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/what-is-redis/">https://www.christianengvall.se/what-is-redis/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 26 Mar 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/what-is-redis/</guid>
        </item>
      
    
      
        <item>
          <title>Screenbar version 0.3 released</title>
          <link>https://www.christianengvall.se/screenbar-version-0.3-released/</link>
          <comments>https://www.christianengvall.se/screenbar-version-0.3-released/#respond</comments>
          <description>&lt;p&gt;Screenbar version 0.3 adds a feature to enable and disable sound while taking automated screenshots.&lt;/p&gt;

&lt;h2 id=&quot;update&quot;&gt;Update&lt;/h2&gt;
&lt;p&gt;Screenbar is now available for download on the &lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar on mac App store&quot;&gt;Mac app Store&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-new-in-version-03&quot;&gt;What is new in version 0.3&lt;/h2&gt;
&lt;p&gt;A user called btecu &lt;a href=&quot;https://github.com/crilleengvall/Screenbar/issues/10&quot; title=&quot;Disable sound&quot;&gt;opened an issue on Github&lt;/a&gt; asking for a feature to disable the sound in Screenbar. I thought that sounded like a nice feature to have in the app.&lt;/p&gt;

&lt;p&gt;This is what the setting looks like:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/03/screenbar-disable-and-enable-sound.png&quot; aria-label=&quot;Play sound when taking screenshot&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/03/screenbar-disable-and-enable-sound.png&quot; alt=&quot;Play sound when taking screenshot&quot; width=&quot;1006&quot; height=&quot;418&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/03/screenbar-disable-and-enable-sound.png&quot; alt=&quot;Play sound when taking screenshot&quot; width=&quot;1006&quot; height=&quot;418&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Play sound when taking screenshot&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;upcoming-features&quot;&gt;Upcoming features&lt;/h3&gt;
&lt;p&gt;In the next version the GUI will be reworked. As it is now it’s not looking very good. It has got a menu and a setting screen, but I think these will work better when merged together.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/screenbar-version-0.3-released/">https://www.christianengvall.se/screenbar-version-0.3-released/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 11 Mar 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/screenbar-version-0.3-released/</guid>
        </item>
      
    
      
        <item>
          <title>Proposales Electron app - My first freelance assignment</title>
          <link>https://www.christianengvall.se/proposales-electron-first-freelance-assignment/</link>
          <comments>https://www.christianengvall.se/proposales-electron-first-freelance-assignment/#respond</comments>
          <description>&lt;p&gt;In recent days &lt;a href=&quot;https://www.proposales.com/&quot; title=&quot;Proposales&quot;&gt;Proposales&lt;/a&gt; released a new version. And with that version came an &lt;a href=&quot;http://help.proposales.com/downloads/mac&quot; title=&quot;Proposales electron app&quot;&gt;Electron app&lt;/a&gt; which I was hired to develop.&lt;/p&gt;

&lt;h3 id=&quot;proposales&quot;&gt;Proposales&lt;/h3&gt;
&lt;p&gt;Proposales is an &lt;a href=&quot;https://www.proposales.com/about&quot; title=&quot;Proposales awards&quot;&gt;award-winning&lt;/a&gt; startup by Joakim Green that helps you to create, deliver and monitor business proposals online.&lt;/p&gt;

&lt;p&gt;This is how Proposales explain their business:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Replaces the traditional PDF proposal. Proposales is a new standard for interactive and mobile-friendly business proposals that is presented for the recipient via a webpage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;electron&quot;&gt;Electron&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://electron.atom.io/&quot; title=&quot;Electron&quot;&gt;Electron&lt;/a&gt; is a cross platform tool for creating desktop apps with Javascript, HTML5 and CSS3. You’ve got access to the platform that the user is running on through an API that takes care of doing platform specific things. In the background Electron is running a Node.JS app in one or more Chromium browsers.&lt;/p&gt;

&lt;h3 id=&quot;proposales-electron-app&quot;&gt;Proposales electron app&lt;/h3&gt;
&lt;p&gt;Proposales is testing a new alternative to support old browsers. Instead of supporting outdated browsers they offer this &lt;a href=&quot;https://www.christianengvall.se/projects/proposales-electron-app/&quot; title=&quot;Proposales electron desktop app&quot;&gt;desktop app&lt;/a&gt;. But it’s also available for all their users so that they can keep it in the dock or start menu to be able to start sending proposals without starting a browser.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/proposales-electron-first-freelance-assignment/">https://www.christianengvall.se/proposales-electron-first-freelance-assignment/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 02 Mar 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/proposales-electron-first-freelance-assignment/</guid>
        </item>
      
    
      
        <item>
          <title>Google map marker InfoWindow - Ionic</title>
          <link>https://www.christianengvall.se/google-map-marker-infowindow/</link>
          <comments>https://www.christianengvall.se/google-map-marker-infowindow/#respond</comments>
          <description>&lt;p&gt;This tutorial walks you through how to add an info window when a user clicks or taps on a Google map marker. The tutorial starts where the &lt;a href=&quot;https://www.christianengvall.se/ionic2-google-maps-markers/&quot; title=&quot;Ionic 2 Google map markers&quot;&gt;Ionic 2 Google map markers&lt;/a&gt; left off.&lt;/p&gt;

&lt;p&gt;Open up &lt;code class=&quot;highlighter-rouge&quot;&gt;src/pages/home/home.ts&lt;/code&gt; and add a new method in that class called &lt;code class=&quot;highlighter-rouge&quot;&gt;addInfoWindowToMarker&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;addInfoWindowToMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infoWindowContent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;div id=&quot;content&quot;&amp;gt;&amp;lt;h1 id=&quot;firstHeading&quot; class=&quot;firstHeading&quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/h1&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infoWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;InfoWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infoWindowContent&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addListener&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;infoWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;An info windows displays HTML of our choice. I add the title of the marker wrapped around some divs in the &lt;code class=&quot;highlighter-rouge&quot;&gt;infoWindowContent&lt;/code&gt; variable. Then assign variable to the infoWindows content property.&lt;/p&gt;

&lt;p&gt;This method also adds an eventlistener that listens for user taps och clicks, and when this happens a call to the infowindows method open is called.&lt;/p&gt;

&lt;p&gt;We’ll call this method from the &lt;code class=&quot;highlighter-rouge&quot;&gt;addMarkersToMap&lt;/code&gt; method which we created in the &lt;a href=&quot;https://www.christianengvall.se/ionic2-google-maps-markers/&quot; title=&quot;Google map markers&quot;&gt;markers tutorial&lt;/a&gt; Now it looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;position&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;latitude&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;longitude&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dogwalkMarker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets/images/marker.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;dogwalkMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addInfoWindowToMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dogwalkMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now when running the app this is how the infoWindow looks:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/infowindow-google-map-marker.png&quot; aria-label=&quot;InfoWindow Google map marker&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/infowindow-google-map-marker.png&quot; alt=&quot;InfoWindow Google map marker&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/infowindow-google-map-marker.png&quot; alt=&quot;InfoWindow Google map marker&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;InfoWindow Google map marker&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;closing-other-info-windows-when-opening-a-new-one&quot;&gt;Closing other info windows when opening a new one&lt;/h3&gt;
&lt;p&gt;To close an InfoWindow we need to call its close() method. To do that we also need to keep a reference to our windows.&lt;/p&gt;

&lt;p&gt;Add a property called infoWindows in &lt;code class=&quot;highlighter-rouge&quot;&gt;home.ts&lt;/code&gt;, and initialize it as an array in the constructor.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;HomePage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;ViewChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ElementRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;infoWindows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;navCtrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;NavController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;infoWindows&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll use this property to store references to infoWindows.
Right before closing the &lt;code class=&quot;highlighter-rouge&quot;&gt;addInfoWindowToMarker&lt;/code&gt; we’ll push an infoWindow to the new array. We’ll also call a new method called &lt;code class=&quot;highlighter-rouge&quot;&gt;closeAllInfoWindows()&lt;/code&gt; in marker.addListener.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;addInfoWindowToMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infoWindowContent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;div id=&quot;content&quot;&amp;gt;&amp;lt;h1 id=&quot;firstHeading&quot; class=&quot;firstHeading&quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/h1&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infoWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;InfoWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infoWindowContent&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addListener&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;closeAllInfoWindows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;infoWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;infoWindows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;infoWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is what the &lt;code class=&quot;highlighter-rouge&quot;&gt;closeAllInfoWindows&lt;/code&gt; method looks like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;closeAllInfoWindows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;infoWindows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now when clicking on another marker all other infoWindows will be closed. Read more about the &lt;a href=&quot;https://developers.google.com/maps/documentation/javascript/infowindows&quot; title=&quot;infowindow docs&quot;&gt;InfoWindow at the official docs&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/google-map-marker-infowindow/">https://www.christianengvall.se/google-map-marker-infowindow/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 06 Feb 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/google-map-marker-infowindow/</guid>
        </item>
      
    
      
        <item>
          <title>rsync example - ssh</title>
          <link>https://www.christianengvall.se/rsync-ssh-example/</link>
          <comments>https://www.christianengvall.se/rsync-ssh-example/#respond</comments>
          <description>&lt;p&gt;This rsync example sends folder contents to a remote server using ssh. It also shows how to exclude multiple files or folders.&lt;/p&gt;

&lt;p&gt;I recently &lt;a href=&quot;https://www.christianengvall.se/switching-to-jekyll/&quot; title=&quot;Switched from wordpress to jekyll&quot;&gt;switched to jekyll&lt;/a&gt;. And in that switch i created my own deploy-script using secure copy. It seemed to work well but I recently discovered that some of my files wasn’t being deployed at all. Not sure why, possibly because of a crappy folder exclude technique I was using. Knowing that many recommend rsync I decided to switch to it.This blog post explains the command I use to deploy my &lt;a href=&quot;https://jekyllrb.com/&quot; title=&quot;Jekyll&quot;&gt;Jekyll&lt;/a&gt; site.&lt;/p&gt;

&lt;h3 id=&quot;rsync&quot;&gt;rsync&lt;/h3&gt;
&lt;p&gt;What is &lt;a href=&quot;https://linux.die.net/man/1/rsync&quot; title=&quot;rsync&quot;&gt;rsync&lt;/a&gt;? This is how the creators themselves explains it:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;rsync-ssh-example-that-excludes-multiple-folders&quot;&gt;rsync ssh example that excludes multiple folders&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;rsync &lt;span class=&quot;nt&quot;&gt;-avzuh&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; ssh folder-to-copy/ username@host:remote-target-folder/ &lt;span class=&quot;nt&quot;&gt;--progress&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.git'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--exclude&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.DS_Store'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;What does those -avzuh -e options do?&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-a&lt;/code&gt;, archive: it is the short alternative for all these options: rlptgoD&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-v&lt;/code&gt;, verbose: Displays more information about what is happening when running the command.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-z&lt;/code&gt;, compress: Compresses the files during transfer.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-u&lt;/code&gt;, update: Skip files that haven’t changed.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-h&lt;/code&gt;, human readable: Output numbers in a human readable format.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-e&lt;/code&gt;, rsh: specify the remote shell to use.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;--progress&lt;/code&gt; : Shows progress during the transfer.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;--exclude&lt;/code&gt;: Folder or file to be excluded.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are a lot &lt;a href=&quot;https://linux.die.net/man/1/rsync&quot; title=&quot;rsync options&quot;&gt;more options&lt;/a&gt; to use.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/rsync-ssh-example/">https://www.christianengvall.se/rsync-ssh-example/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 05 Feb 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/rsync-ssh-example/</guid>
        </item>
      
    
      
        <item>
          <title>Dogwalk app released</title>
          <link>https://www.christianengvall.se/dogwalk-app-released/</link>
          <comments>https://www.christianengvall.se/dogwalk-app-released/#respond</comments>
          <description>&lt;p&gt;Dogwalk app has been &lt;a href=&quot;https://play.google.com/store/apps/details?id=se.christianengvall.dogwalk&quot; title=&quot;Dogwalk android&quot;&gt;released for Android&lt;/a&gt; and &lt;a href=&quot;https://itunes.apple.com/us/app/dogwalk/id1195900439?l=sv&amp;amp;ls=1&amp;amp;mt=8&quot; title=&quot;Dogwalk App store&quot;&gt;iOS Devices&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;what-does-it-do&quot;&gt;What does it do?&lt;/h3&gt;
&lt;p&gt;This summer I got a &lt;a href=&quot;https://www.google.se/search?q=bernese+mountain+dog&amp;amp;source=lnms&amp;amp;tbm=isch&amp;amp;sa=X&amp;amp;ved=0ahUKEwjv74GpoNvRAhXHlSwKHRmmAwMQ_AUICCgB&amp;amp;biw=960&amp;amp;bih=1098&amp;amp;dpr=2&quot; title=&quot;Bernese mountain dog images&quot;&gt;Bernese mountain dog&lt;/a&gt;. About now both him and me got tired and bored of the places we went for walks. So I got online and found new spots. This app collects these spots on a map and hopefully you can find some new places to go from it.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/dogwalk-screenshot.png&quot; aria-label=&quot;Dogwalk screenshot&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/dogwalk-screenshot.png&quot; alt=&quot;Dogwalk screenshot&quot; width=&quot;311&quot; height=&quot;552&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/dogwalk-screenshot.png&quot; alt=&quot;Dogwalk screenshot&quot; width=&quot;311&quot; height=&quot;552&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Dogwalk screenshot&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;minimum-viable-product&quot;&gt;Minimum viable product&lt;/h3&gt;
&lt;p&gt;The version released is a minimum viable product of an app that helps dog owners find new places to walk their dog. This means it is as simple as it can be at the moment. Right now there are 5 spots on the map and all are located in and around Jönköping.&lt;/p&gt;

&lt;h3 id=&quot;upcoming-features&quot;&gt;Upcoming features&lt;/h3&gt;
&lt;p&gt;Before I’ll start marketing the app i want to add more features. Every time I’ve got a new feature added to the app it will be released. Big or small. The list below are things I think about adding to the app:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;More spots&lt;/li&gt;
  &lt;li&gt;Rating system&lt;/li&gt;
  &lt;li&gt;User added spots&lt;/li&gt;
  &lt;li&gt;Is the spot an illuminated track&lt;/li&gt;
  &lt;li&gt;Are there more than one track to walk at the spot and how long are they?&lt;/li&gt;
  &lt;li&gt;is it a fenced area?&lt;/li&gt;
  &lt;li&gt;Sort by type of spot&lt;/li&gt;
  &lt;li&gt;Switch from Ionic to React native&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By spring/summer it might be an app worth marketing to new and old dog owners.&lt;/p&gt;

&lt;h3 id=&quot;built-with-ionic&quot;&gt;Built with Ionic&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.dogwalkmap.com/&quot; title=&quot;Dogwalk app&quot;&gt;Dogwalk&lt;/a&gt; is built with &lt;a href=&quot;https://ionicframework.com/&quot; title=&quot;Ionic framework&quot;&gt;Ionic&lt;/a&gt; which is a crossplatform framework. This makes it possible for me to write one codebase for the two platforms i target which is Android and iOS.&lt;/p&gt;

&lt;h3 id=&quot;i-want-some-of-that-internet-money&quot;&gt;I want some of that internet money&lt;/h3&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/RcU2QH7-Jj0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;p&gt;In my last app project I tried ads as an income source. I wasn’t really happy about myself creating an app with such an abomination in it :) This time I added a price tag to the app instead. So no ads this time.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/dogwalk-app-released/">https://www.christianengvall.se/dogwalk-app-released/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 27 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/dogwalk-app-released/</guid>
        </item>
      
    
      
        <item>
          <title>The snippet to create all snippets in Atom editor</title>
          <link>https://www.christianengvall.se/the-snippet-to-create-all-snippets-in-atom/</link>
          <comments>https://www.christianengvall.se/the-snippet-to-create-all-snippets-in-atom/#respond</comments>
          <description>&lt;p&gt;After switching from Wordpress to Jekyll I got a lot faster load times. But I also got to type more to get a post published. This can be eased by using snippets in the &lt;a href=&quot;https://atom.io/&quot; title=&quot;Atom editor&quot;&gt;Atom editor&lt;/a&gt; in which i write my posts.&lt;/p&gt;

&lt;p&gt;A snippet is a small region of code that you use often. In Atom and many other editors these can be inserted by typing a few words and then let the editor fill in the rest by pushing tab.&lt;/p&gt;

&lt;h3 id=&quot;jekyll-example&quot;&gt;Jekyll example&lt;/h3&gt;
&lt;p&gt;In Jekyll you start all posts with defining a few variables in front matter. This posts front matter look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-markdown&quot; data-lang=&quot;markdown&quot;&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;post&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;The snippet to create all snippets in Atom editor&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;categories&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Miscellaneous&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/wp-content/uploads/2017/01/the-snippet-to-create-all-snippets-in-atom-editor.png&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1200&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;627&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;excerpt&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;You can use a snippet to create snippets in Atom Editor. It's useful for long expressions you use often.&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Instead of typing that every time I create a post I can create a snippet that automatically finishes all that text after i type &lt;code class=&quot;highlighter-rouge&quot;&gt;---&lt;/code&gt; and push tab.&lt;/p&gt;

&lt;h3 id=&quot;creating-a-snippet-in-atom&quot;&gt;Creating a snippet in Atom&lt;/h3&gt;
&lt;p&gt;Open up the &lt;code class=&quot;highlighter-rouge&quot;&gt;snippets.cson&lt;/code&gt; file by clicking &lt;code class=&quot;highlighter-rouge&quot;&gt;Atom-&amp;gt;Snippets...&lt;/code&gt; in the menu.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/atom-snippets-menu.png&quot; aria-label=&quot;Atom snippets menu&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/atom-snippets-menu.png&quot; alt=&quot;Atom snippets menu&quot; width=&quot;516&quot; height=&quot;814&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/atom-snippets-menu.png&quot; alt=&quot;Atom snippets menu&quot; width=&quot;516&quot; height=&quot;814&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Atom snippets menu&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now type &lt;code class=&quot;highlighter-rouge&quot;&gt;snip&lt;/code&gt; and push tab to get a scaffold for creating your own snippet. When first pushing tab this is what we’ll get:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yml&quot; data-lang=&quot;yml&quot;&gt;&lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.source.js'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Snippet&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Name'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;prefix'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Snippet&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Trigger'&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;body'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;World!'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ol&gt;
  &lt;li&gt;the .source.js is setting in which files the snippet will be active. In this case javascript files.&lt;/li&gt;
  &lt;li&gt;‘Snippet Name’ is the name of the snippet.&lt;/li&gt;
  &lt;li&gt;Prefix is what will trigger the snippet.&lt;/li&gt;
  &lt;li&gt;Body is what the trigger will be replaced with.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is an example of a snippet that works in markdown files to add front matter variables:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yml&quot; data-lang=&quot;yml&quot;&gt;&lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.source.gfm'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;front&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;matter'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;prefix'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;---'&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;body'&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;---&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;layout:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;post&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;title:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Proposales&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Electron&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;My&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;freelance&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;assignment&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;categories:&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Miscellaneous&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;image:&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;source:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/wp-content/uploads/2017/01/proposales-electron-app-first-freelance.png&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;width:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1200&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;height:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;627&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;excerpt:&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;---&lt;/span&gt;
      &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;a-snippet-with-tab-stops&quot;&gt;A snippet with tab stops&lt;/h3&gt;
&lt;p&gt;In this blog i also use a lot of code highlighting. To highlight code with Jekyll you type something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{% highlight javascript %}    
  let variable = &quot;text&quot;;     
{% endhighlight %}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;instead of always adding a javascript snippet i can add a tab stop to this snippet so that i always get to type what language i am highlighting. That snippet would look like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;'.source.gfm':
  'highlight':
    'prefix': 'high'
    'body' : &quot;&quot;&quot;{% highlight $1 %}
    $2
    {% endhighlight %}&quot;&quot;&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That was a quick introduction to snippets in Atom. Check out the &lt;a href=&quot;http://flight-manual.atom.io/using-atom/sections/snippets/#platform-mac&quot; title=&quot;Atom snippet documentation&quot;&gt;documentation&lt;/a&gt; to learn more.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/the-snippet-to-create-all-snippets-in-atom/">https://www.christianengvall.se/the-snippet-to-create-all-snippets-in-atom/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 24 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/the-snippet-to-create-all-snippets-in-atom/</guid>
        </item>
      
    
      
        <item>
          <title>Add android platform in Ionic 2</title>
          <link>https://www.christianengvall.se/add-android-platform-in-ionic-2/</link>
          <comments>https://www.christianengvall.se/add-android-platform-in-ionic-2/#respond</comments>
          <description>&lt;p&gt;When I used the &lt;a href=&quot;https://ionicframework.com/docs/v2/cli/&quot; title=&quot;Ionic CLI&quot;&gt;Ionic CLI&lt;/a&gt; to create the &lt;a href=&quot;https://www.dogwalkmap.com/&quot; title=&quot;Dogwalk&quot;&gt;Dogwalk project&lt;/a&gt; it came with an iOS project. Now it’s time to add the Android platform.&lt;/p&gt;

&lt;p&gt;These are the steps i took to install the Android SDK and add the Android Platform. I ran into errors, maybe you’ll get them as well, so even though this was not a smooth install maybe it helps!&lt;/p&gt;

&lt;h3 id=&quot;ionic-add-platform-android&quot;&gt;Ionic add platform Android&lt;/h3&gt;
&lt;p&gt;To add the android platform to your app you run the following command in a terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ionic platform add android&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Since I already had the Android SDK installed from when building another project I figured I could run it directly. But i got this error:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;Error: Failed to find &lt;span class=&quot;s1&quot;&gt;'ANDROID_HOME'&lt;/span&gt; environment variable. Try setting setting it manually.
Failed to find &lt;span class=&quot;s1&quot;&gt;'android'&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;command &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;your &lt;span class=&quot;s1&quot;&gt;'PATH'&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; Try update your &lt;span class=&quot;s1&quot;&gt;'PATH'&lt;/span&gt; to include path to valid SDK directory.&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The solution according to stack overflow was to do this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ANDROID_HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/&amp;lt;installation location&amp;gt;/android-sdk-macosx
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;:&lt;span class=&quot;nv&quot;&gt;$ANDROID_HOME&lt;/span&gt;/tools:&lt;span class=&quot;nv&quot;&gt;$ANDROID_HOME&lt;/span&gt;/platform-tools&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;But that didn’t work. So I installed &lt;a href=&quot;https://developer.android.com/studio/index.html&quot; title=&quot;Android Studio&quot;&gt;Android Studio&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;android-studio&quot;&gt;Android Studio&lt;/h3&gt;
&lt;p&gt;After installing Android Studio I got a few questions to update and install SDK-components I didn’t have. I accepted them all.&lt;/p&gt;

&lt;p&gt;After that i opened the &lt;code class=&quot;highlighter-rouge&quot;&gt;platforms/android&lt;/code&gt; project in android studio and tried to run it in a Simulator. And in this step Android Studio wanted to install a simulator. So it did install the &lt;code class=&quot;highlighter-rouge&quot;&gt;Android_Accelerated_X86&lt;/code&gt;. If you choose the other one it will be slow and not be able to start the ionic app. At least I got the error message that it couldnt find the folder android_asset.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/android-studio-run-app.png&quot; aria-label=&quot;Android Studio run app&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/android-studio-run-app.png&quot; alt=&quot;Android Studio run app&quot; width=&quot;3024&quot; height=&quot;2224&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/android-studio-run-app.png&quot; alt=&quot;Android Studio run app&quot; width=&quot;3024&quot; height=&quot;2224&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Android Studio run app&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;But the simulator couldn’t open the app. At this point I figured I should delete the ionic android project and add it again. So close Android studio.&lt;/p&gt;

&lt;h3 id=&quot;delete-an-ionic-platform&quot;&gt;Delete an Ionic platform&lt;/h3&gt;
&lt;p&gt;To remove a platform run this command in a terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ionic platform &lt;span class=&quot;nb&quot;&gt;rm &lt;/span&gt;android&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The next step was to make sure i’ve got the latest Ionic and Cordova version.&lt;/p&gt;

&lt;h3 id=&quot;updating-ionic-and-cordova&quot;&gt;Updating Ionic and Cordova&lt;/h3&gt;
&lt;p&gt;Run this terminal in a terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm update &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; ionic cordova&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adding-and-building-android-platform-again&quot;&gt;Adding and building Android platform again&lt;/h3&gt;
&lt;p&gt;Once again run some commands in the terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ionic platform add android
ionic build android&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;No errors this time. Awesome!&lt;/p&gt;

&lt;p&gt;So lets run the app in the emulator:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ionic build android&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And this time it was successful!&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/android-emulator-ionic-dogwalk.png&quot; aria-label=&quot;Ionic 2 dogwalk android simulator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/android-emulator-ionic-dogwalk.png&quot; alt=&quot;Ionic 2 dogwalk android simulator&quot; width=&quot;1202&quot; height=&quot;1898&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/android-emulator-ionic-dogwalk.png&quot; alt=&quot;Ionic 2 dogwalk android simulator&quot; width=&quot;1202&quot; height=&quot;1898&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Ionic 2 dogwalk android simulator&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/add-android-platform-in-ionic-2/">https://www.christianengvall.se/add-android-platform-in-ionic-2/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 23 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/add-android-platform-in-ionic-2/</guid>
        </item>
      
    
      
        <item>
          <title>Ionic 2 splash screen and icon</title>
          <link>https://www.christianengvall.se/ionic2-splash-screen-and-icon/</link>
          <comments>https://www.christianengvall.se/ionic2-splash-screen-and-icon/#respond</comments>
          <description>&lt;p&gt;Ionic &lt;a href=&quot;http://ionicframework.com/docs/cli/icon-splashscreen.html&quot; title=&quot;ionic cli resources&quot;&gt;CLI comes with a command to automatically generate splashscreen and icon&lt;/a&gt; with correct dimensions.&lt;/p&gt;

&lt;h3 id=&quot;splash-screen-and-icon-resources&quot;&gt;Splash screen and icon resources&lt;/h3&gt;
&lt;p&gt;Open the file &lt;code class=&quot;highlighter-rouge&quot;&gt;resources/splash.png&lt;/code&gt; and edit it as you wish. The dimensions are &lt;code class=&quot;highlighter-rouge&quot;&gt;2208x2208&lt;/code&gt; pixels. The icon is called.. you guessed it.. &lt;code class=&quot;highlighter-rouge&quot;&gt;icon.png&lt;/code&gt; and is located in the same folder. The dimensions for the icon is &lt;code class=&quot;highlighter-rouge&quot;&gt;1024x1024&lt;/code&gt; pixels.&lt;/p&gt;

&lt;p&gt;I’m aiming to release &lt;a href=&quot;https://www.dogwalkmap.com/&quot; title=&quot;Dogwalk&quot;&gt;Dogwalk&lt;/a&gt; quickly, and then update the app functions and look after the app is already published. So I put little effort into the design of the icon and splash screen. They turned out like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/Ionic-dogwalk-icon.png&quot; aria-label=&quot;Ionic 2 dogwalk icon&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/Ionic-dogwalk-icon.png&quot; alt=&quot;Ionic 2 dogwalk icon&quot; width=&quot;1024&quot; height=&quot;1024&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/Ionic-dogwalk-icon.png&quot; alt=&quot;Ionic 2 dogwalk icon&quot; width=&quot;1024&quot; height=&quot;1024&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Ionic 2 dogwalk icon&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/ionic-dogwalk-splashscreen.png&quot; aria-label=&quot;Ionic 2 dogwalk splash screen&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/ionic-dogwalk-splashscreen.png&quot; alt=&quot;Ionic 2 dogwalk splash screen&quot; width=&quot;2208&quot; height=&quot;2208&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/ionic-dogwalk-splashscreen.png&quot; alt=&quot;Ionic 2 dogwalk splash screen&quot; width=&quot;2208&quot; height=&quot;2208&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Ionic 2 dogwalk splash screen&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now when the following command is executed Ionic will take care of generating the correct dimensions for the splash screen and icon.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ionic resources&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you run that command without having created a splash screen and icon yourself Ionic will use the default ones.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/ionic2-splash-screen-and-icon/">https://www.christianengvall.se/ionic2-splash-screen-and-icon/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 22 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/ionic2-splash-screen-and-icon/</guid>
        </item>
      
    
      
        <item>
          <title>Ionic2 Google maps markers</title>
          <link>https://www.christianengvall.se/ionic2-google-maps-markers/</link>
          <comments>https://www.christianengvall.se/ionic2-google-maps-markers/#respond</comments>
          <description>&lt;p&gt;This tutorial covers how to add markers on a Google map in an Ionic 2 app. We’ll continue where we left of the last with a &lt;a href=&quot;https://www.christianengvall.se/ionic2-google-maps/&quot; title=&quot;Google map Ionic 2&quot;&gt;Google map that is displayed&lt;/a&gt; in our app. If you haven’t already got that take a look at that tutorial first.&lt;/p&gt;

&lt;h3 id=&quot;1-markers-json&quot;&gt;1. Markers JSON&lt;/h3&gt;
&lt;p&gt;To keep it simple we’ll store the marker information in a json file. Add a file called &lt;code class=&quot;highlighter-rouge&quot;&gt;markers.json&lt;/code&gt; in the folder &lt;code class=&quot;highlighter-rouge&quot;&gt;src/assets/data/&lt;/code&gt; (create the folder data since it is not created by default).&lt;/p&gt;

&lt;p&gt;The data we need at this point for a marker is, &lt;code class=&quot;highlighter-rouge&quot;&gt;latitude&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;longitude&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;name&lt;/code&gt;. If you need help to find the latitude and longitude for your markers you can use &lt;a href=&quot;http://www.mapcoordinates.net/en&quot; title=&quot;Map coordinates&quot;&gt;maapcoordinates.net&lt;/a&gt;. My markers.json looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;latitude&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;57.77504388&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;longitude&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;14.18557048&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Kålgårdens rastgård&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;latitude&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;57.77474066&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;longitude&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;14.25457835&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Öxnegården&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;latitude&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;57.7630705&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;longitude&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;14.0808624&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Västersjön&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;2-loading-json-in-ionic-2-and-angular-2&quot;&gt;2. Loading JSON in Ionic 2 and Angular 2&lt;/h3&gt;
&lt;p&gt;To load our .JSON file we’ll be using &lt;code class=&quot;highlighter-rouge&quot;&gt;angular http&lt;/code&gt; and something called an Observable which we’ll map with &lt;code class=&quot;highlighter-rouge&quot;&gt;rxjs/add/operator/map&lt;/code&gt;. You can read more about these classes in the &lt;a href=&quot;https://angular.io/docs/ts/latest/api/http/index/Http-class.html&quot; title=&quot;Http class Angular 2&quot;&gt;Http class documentation of Angular 2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Start by importing these into &lt;code class=&quot;highlighter-rouge&quot;&gt;src/pages/home/home.ts&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@angular/http&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;rxjs/add/operator/map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then we also need to add Http to our constructor:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;navCtrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;NavController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now create a method called getMarkers in &lt;code class=&quot;highlighter-rouge&quot;&gt;home.ts&lt;/code&gt;. In that method we’ll load the json file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;getMarkers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets/data/markers.json&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We are subscribing to an observable to get the markers. And in the subscribe method we will use the marker data to display them on the map.&lt;/p&gt;

&lt;h3 id=&quot;3-displaying-markers-on-a-google-map&quot;&gt;3. Displaying markers on a Google map&lt;/h3&gt;
&lt;p&gt;Create a method called addMarkersToMap() in home.ts. In that method the markers will be looped through and added to the map.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;position&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;latitude&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;longitude&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dogwalkMarker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;dogwalkMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we need to call this method from the subscribe callback of getMarkers():&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;getMarkers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets/data/markers.json&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;That is all that is needed to display a marker on a Google map in Ionic 2 with Angular 2.&lt;/p&gt;

&lt;p&gt;The finished home.ts looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-typescript&quot; data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ViewChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ElementRef&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@angular/core&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;NavController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ionic-angular&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@angular/http&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;rxjs/add/operator/map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;declare&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;page-home&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;templateUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;home.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;HomePage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;ViewChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ElementRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;navCtrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;NavController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;ionViewWillEnter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;displayGoogleMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getMarkers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;displayGoogleMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latLng&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;57.8127004&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;14.2106225&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapOptions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;disableDefaultUI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;zoom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;mapTypeId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;MapTypeId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ROADMAP&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;nativeElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;getMarkers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets/data/markers.json&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;markers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;position&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;latitude&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;longitude&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dogwalkMarker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;dogwalkMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;4-result&quot;&gt;4. Result&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.dogwalkmap.com/&quot; title=&quot;Dogwalk map&quot;&gt;Dogwalk app&lt;/a&gt; will now look like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/ionic2-google-maps-markers-ios-dogwalk.png&quot; aria-label=&quot;Ionic2 Google maps markers - iOS Simulator displaying dogwalk app with markers&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/ionic2-google-maps-markers-ios-dogwalk.png&quot; alt=&quot;Ionic2 Google maps markers - iOS Simulator displaying dogwalk app with markers&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/ionic2-google-maps-markers-ios-dogwalk.png&quot; alt=&quot;Ionic2 Google maps markers - iOS Simulator displaying dogwalk app with markers&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Ionic2 Google maps markers - iOS Simulator displaying dogwalk app with markers&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;In the next tutorial we look at &lt;a href=&quot;https://www.christianengvall.se/ionic2-splash-screen-and-icon/&quot; title=&quot;Ionic splash screen and icon&quot;&gt;Ionic splash screen and icon&lt;/a&gt;. Or check this tutorial out if you are looking to add an &lt;a href=&quot;https://www.christianengvall.se/google-map-marker-infowindow/&quot; title=&quot;Google map infoWindow ionic&quot;&gt;infoWindow&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/ionic2-google-maps-markers/">https://www.christianengvall.se/ionic2-google-maps-markers/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 21 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/ionic2-google-maps-markers/</guid>
        </item>
      
    
      
        <item>
          <title>Ionic2 Google maps</title>
          <link>https://www.christianengvall.se/ionic2-google-maps/</link>
          <comments>https://www.christianengvall.se/ionic2-google-maps/#respond</comments>
          <description>&lt;p&gt;In this post we will look at implementing Google maps in an Ionic 2 app. The app I’m building is called &lt;a href=&quot;http://www.dogwalkmap.com/&quot; title=&quot;Dogwalk google maps&quot;&gt;Dogwalk&lt;/a&gt;. It’s going to display markers on a map where it’s a nice area to walk your dog.&lt;/p&gt;

&lt;p&gt;This is a continuation of the &lt;a href=&quot;https://www.christianengvall.se/installing-ionic/&quot; title=&quot;Installing Ionic&quot;&gt;Installing Ionic&lt;/a&gt; post, so start there if you haven’t already got an app to add the map to.&lt;/p&gt;

&lt;h3 id=&quot;adding-google-maps-api&quot;&gt;Adding Google maps API&lt;/h3&gt;
&lt;p&gt;Open up the &lt;code class=&quot;highlighter-rouge&quot;&gt;src/index.html&lt;/code&gt; file and add a script reference to the Google maps API. Read the google docs to get an &lt;a href=&quot;https://developers.google.com/maps/documentation/javascript/get-api-key&quot; title=&quot;Google map API key&quot;&gt;API key&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://maps.google.com/maps/api/js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then open up &lt;code class=&quot;highlighter-rouge&quot;&gt;src/pages/home/home.html&lt;/code&gt; and add a div which will contain the map so that the full .html file looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;ion-header&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;ion-navbar&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;color=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;secondary&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;ion-title&amp;gt;&lt;/span&gt;
      Dogwalk
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ion-title&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ion-navbar&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ion-header&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;ion-content&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;ion-content&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;#mapContainer&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;map&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ion-content&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ion-content&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;editing-the-home-component-to-show-maps&quot;&gt;Editing the home component to show maps&lt;/h3&gt;

&lt;p&gt;edit &lt;code class=&quot;highlighter-rouge&quot;&gt;src/page/home/home.ts&lt;/code&gt; to look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ViewChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ElementRef&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@angular/core&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;NavController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ionic-angular&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;declare&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;page-home&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;templateUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;home.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;HomePage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;ViewChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ElementRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;navCtrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;NavController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;ionViewWillEnter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;displayGoogleMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;displayGoogleMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latLng&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;57.8127004&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;14.2106225&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapOptions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;disableDefaultUI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;zoom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;mapTypeId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;MapTypeId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ROADMAP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;styles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;labels.text.fill&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;saturation&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#333333&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;labels.text.stroke&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#ffffff&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;labels.icon&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;administrative&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;administrative&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.fill&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#fefefe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;administrative&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.stroke&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#fefefe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;weight&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;landscape&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#ececec&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;landscape.man_made&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#f0f0ef&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;landscape.man_made&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.fill&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#f0f0ef&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;landscape.man_made&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.stroke&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#d4d4d4&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;landscape.natural&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#ececec&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.fill&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#d4d4d4&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;labels.text.fill&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#303030&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;labels.icon&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;saturation&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-100&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.attraction&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.business&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.government&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.medical&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.park&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.park&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#dedede&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.place_of_worship&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.school&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.school&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.stroke&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-61&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;gamma&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;0.00&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;poi.sports_complex&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;road.highway&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.fill&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#ffffff&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;road.highway&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry.stroke&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#ffffff&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;29&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;weight&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;road.arterial&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#ffffff&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;road.local&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#ffffff&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;transit&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#f2f2f2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;featureType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;water&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;elementType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;geometry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#dadada&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lightness&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]}]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mapContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;nativeElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I got this from &lt;a href=&quot;https://www.joshmorony.com/ionic-2-how-to-use-google-maps-geolocation-video-tutorial/&quot; title=&quot;Josh Morony google maps&quot;&gt;Josh Morony&lt;/a&gt;. But I changed the ionViewLoaded event to ionViewWillEnter (which i couldn’t get to work, and isn’t &lt;a href=&quot;https://ionicframework.com/docs/v2/api/navigation/NavController/&quot; title=&quot;NavController&quot;&gt;documented&lt;/a&gt;). I also added a custom style to the map.&lt;/p&gt;

&lt;p&gt;If you do not want the style just remove styles from the map options array. Or if you would like another look on your map take a look at &lt;a href=&quot;https://snazzymaps.com/&quot; title=&quot;Snazzy maps&quot;&gt;Snazzy maps&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Then edit the &lt;code class=&quot;highlighter-rouge&quot;&gt;src/pages/home/home.scss&lt;/code&gt; to look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nt&quot;&gt;page-home&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;.scroll-content&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nf&quot;&gt;#map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;That will get the google map to work.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/Ionic2-google-maps-dogwalk.png&quot; aria-label=&quot;Ionic2 Google maps - iOS Simulator displaying dogwalk app&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/Ionic2-google-maps-dogwalk.png&quot; alt=&quot;Ionic2 Google maps - iOS Simulator displaying dogwalk app&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/Ionic2-google-maps-dogwalk.png&quot; alt=&quot;Ionic2 Google maps - iOS Simulator displaying dogwalk app&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Ionic2 Google maps - iOS Simulator displaying dogwalk app&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Next time we’ll look at how to &lt;a href=&quot;https://www.christianengvall.se/ionic2-google-maps-markers/&quot; title=&quot;Add markers to google map&quot;&gt;add markers to your google map&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/ionic2-google-maps/">https://www.christianengvall.se/ionic2-google-maps/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 20 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/ionic2-google-maps/</guid>
        </item>
      
    
      
        <item>
          <title>Installing Ionic</title>
          <link>https://www.christianengvall.se/installing-ionic/</link>
          <comments>https://www.christianengvall.se/installing-ionic/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;https://ionicframework.com/&quot; title=&quot;Ionic&quot;&gt;Ionic&lt;/a&gt; is a cross platform tool to create mobile apps for iOS, Android and Windows Phones. Lets take a look at installing Ionic.&lt;/p&gt;

&lt;p&gt;I thought I’d build an app called &lt;a href=&quot;http://dogwalkmap.com/&quot; title=&quot;Dogwalk&quot;&gt;Dogwalk&lt;/a&gt;. I wanted it to run on both Android and iOS phones so I decided to learn Ionic. I also thought I’d blog about all the steps I take to create it. You will get to know more about the app as we go along.&lt;/p&gt;

&lt;h3 id=&quot;installing&quot;&gt;Installing&lt;/h3&gt;
&lt;p&gt;Start by &lt;a href=&quot;https://nodejs.org/en/&quot; title=&quot;Install Node.js&quot;&gt;installing Node.js&lt;/a&gt;. After that open up a terminal and use npm to install cordova and ionic:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; cordova ionic&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;creating-an-app&quot;&gt;Creating an app&lt;/h3&gt;
&lt;p&gt;To create an app using Ionic there are three templates you can start with, &lt;code class=&quot;highlighter-rouge&quot;&gt;blank&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;tabs&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;sidemenu&lt;/code&gt;. The name of the templates kind of explains themselves.&lt;/p&gt;

&lt;p&gt;For dogwalk I’d like to start with the blank template by typing this in the terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ionic start &lt;span class=&quot;nt&quot;&gt;--v2&lt;/span&gt; dogwalk blank&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When this is done you can run an almost empty app in the iOS simulator or in your browser. Running it in the browser is a great way to speed up development since you do not have to wait for the simulator to start every time.&lt;/p&gt;

&lt;p&gt;Command to run it in your browser:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;dogwalk
ionic serve&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To run the app in ios simulator: (make sure you have it installed)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;dogwalk
ionic run ios&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;That’s it!&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/ionic-blank-template-ios-simulator.png&quot; aria-label=&quot;Ionic blank template in ios simulator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/ionic-blank-template-ios-simulator.png&quot; alt=&quot;Ionic blank template in ios simulator&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/ionic-blank-template-ios-simulator.png&quot; alt=&quot;Ionic blank template in ios simulator&quot; width=&quot;864&quot; height=&quot;1404&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Ionic blank template in ios simulator&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/installing-ionic/">https://www.christianengvall.se/installing-ionic/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 19 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/installing-ionic/</guid>
        </item>
      
    
      
        <item>
          <title>Debug javascript in Android browser</title>
          <link>https://www.christianengvall.se/debug-javascript-in-android-browser/</link>
          <comments>https://www.christianengvall.se/debug-javascript-in-android-browser/#respond</comments>
          <description>&lt;p&gt;How to debug javascript in Android browser? The built in Android browser is very limited but this is how I solved the problem.&lt;/p&gt;

&lt;p&gt;I had a javascript problem showing up on an old Android phone when using the old built in browser. When googling the problem i got a lot of answers that explained remote debugging with chrome. Which didn’t work out since no problem showed up in chrome.&lt;/p&gt;

&lt;p&gt;There was also a few apps that I could install on my Android phone which provided an error console to the old browser or was a browser with a console on their own. But those didn’t work either.&lt;/p&gt;

&lt;h3 id=&quot;chromium&quot;&gt;Chromium&lt;/h3&gt;
&lt;p&gt;The Android browser is built on &lt;a href=&quot;https://www.chromium.org/getting-involved/download-chromium&quot; title=&quot;Chromium browser&quot;&gt;Chromium&lt;/a&gt;. If you type &lt;code class=&quot;highlighter-rouge&quot;&gt;chrome:version&lt;/code&gt; into the address field you get to know what version of Chromium it is running.&lt;/p&gt;

&lt;p&gt;This is what mine looked like:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/chromium-version-android.png&quot; aria-label=&quot;Chromium version - android&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/chromium-version-android.png&quot; alt=&quot;Chromium version - android&quot; width=&quot;540&quot; height=&quot;960&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/chromium-version-android.png&quot; alt=&quot;Chromium version - android&quot; width=&quot;540&quot; height=&quot;960&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Chromium version - android&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;So at this point I figured I wasn’t going to debug it in the Android browser at all. If you look at the screenshot above you can see i have a Chromium version from 2013 installed.&lt;/p&gt;

&lt;p&gt;So I headed over to the &lt;a href=&quot;https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html&quot; title=&quot;All chromium versions&quot;&gt;Chromium site&lt;/a&gt; with all the releases of Chromium, downloaded an old one from 2013 for Windows, started it on my laptop and the same error as on the phone occurred. But this time i had a javascript console which logged the error and its stack trace for me.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/debug-javascript-in-android-browser/">https://www.christianengvall.se/debug-javascript-in-android-browser/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 15 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/debug-javascript-in-android-browser/</guid>
        </item>
      
    
      
        <item>
          <title>Yotpo initWidgets</title>
          <link>https://www.christianengvall.se/yotpo-initwidgets/</link>
          <comments>https://www.christianengvall.se/yotpo-initwidgets/#respond</comments>
          <description>&lt;p&gt;You can use initWidgets to reinitialize ratings and reviews from &lt;a href=&quot;https://www.yotpo.com/&quot; title=&quot;Yotpo&quot;&gt;Yotpo&lt;/a&gt; if you use javascript/ajax to load new content.&lt;/p&gt;

&lt;p&gt;If you for example use javascript/ajax to display more products to the user you probably want to reinitialize Yotpo star- and review ratings as well.&lt;/p&gt;

&lt;p&gt;Out of the box Yotpo only supports loading them on the first page load. But there is an undocumented method called initWidgets() that you can invoke instead of reloading the page.&lt;/p&gt;

&lt;h3 id=&quot;javascript&quot;&gt;javascript&lt;/h3&gt;

&lt;p&gt;You can invoke initWidgets() like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;yotpo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;initWidgets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;A big thanks to Richy who also had &lt;a href=&quot;http://stackoverflow.com/questions/36423866/integrating-widget-into-a-angular-app-using-a-directive&quot; title=&quot;Yotpo trouble&quot;&gt;this problem&lt;/a&gt;, found a solution to it and went back to stack overflow to tell others how to solve it.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/yotpo-initwidgets/">https://www.christianengvall.se/yotpo-initwidgets/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 09 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/yotpo-initwidgets/</guid>
        </item>
      
    
      
        <item>
          <title>Jekyll sitemaps</title>
          <link>https://www.christianengvall.se/jekyll-sitemaps/</link>
          <comments>https://www.christianengvall.se/jekyll-sitemaps/#respond</comments>
          <description>&lt;p&gt;This plugin extends Jekyll sitemaps and adds support for pages, posts, archives/categories, collections and images.&lt;/p&gt;

&lt;p&gt;Before i switched to &lt;a href=&quot;https://jekyllrb.com/&quot; title=&quot;Jekyll&quot;&gt;Jekyll&lt;/a&gt; I’ve been spoiled by the sitemaps of the &lt;a href=&quot;https://sv.wordpress.org/plugins/wordpress-seo/&quot; title=&quot;Yoast SEO Wordpress plugin&quot;&gt;Yoast SEO plugin&lt;/a&gt;. So I decided to try to get the same functionality from Jekyll. The goal was also to make it available for people who host their Jekyll sites on &lt;a href=&quot;https://pages.github.com/&quot; title=&quot;Github Pages&quot;&gt;Github Pages&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;jekyll-sitemaps-example&quot;&gt;Jekyll Sitemaps example&lt;/h3&gt;
&lt;p&gt;You can take a look at the &lt;a href=&quot;https://www.christianengvall.se/sitemap.xml&quot; title=&quot;Sitemaps&quot;&gt;sitemap for this site&lt;/a&gt; to see it in action.&lt;/p&gt;

&lt;h3 id=&quot;installation&quot;&gt;Installation&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;Start by downloading &lt;a href=&quot;https://github.com/crilleengvall/jekyll-sitemaps/archive/master.zip&quot; title=&quot;Download Jekyll sitemaps&quot;&gt;Jekyll Sitemaps&lt;/a&gt; from Github.&lt;/li&gt;
  &lt;li&gt;Copy &lt;code class=&quot;highlighter-rouge&quot;&gt;category-sitemap.xml&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;page-sitemap.xml&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;post-sitemap.xml&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;project-sitemap.xml&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;sitemap.xml&lt;/code&gt; to your root folder.&lt;/li&gt;
  &lt;li&gt;Copy &lt;code class=&quot;highlighter-rouge&quot;&gt;_includes/single-post-sitemap.html&lt;/code&gt; to your &lt;code class=&quot;highlighter-rouge&quot;&gt;_includes&lt;/code&gt; folder.&lt;/li&gt;
  &lt;li&gt;Edit images in &lt;code class=&quot;highlighter-rouge&quot;&gt;single-post-sitemap.xml&lt;/code&gt; as described under Images below.&lt;/li&gt;
  &lt;li&gt;If you do not use jekyll-archives plugin disable that as described under Categories below.&lt;/li&gt;
  &lt;li&gt;Edit or remove collections sitemap as described under Collections below.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;images&quot;&gt;Images&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://support.google.com/webmasters/answer/178636?hl=en&quot; title=&quot;Sitemap images&quot;&gt;Google supports adding images&lt;/a&gt; to the sitemap. You need to edit the image url of your post(if any) on line 5 in &lt;code class=&quot;highlighter-rouge&quot;&gt;single-post-sitemap.html&lt;/code&gt;.  &lt;br /&gt;
If you do not use images you can remove lines 4 to 8.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;image:image&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;image:loc&amp;gt;&amp;lt;/image:loc&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;image:title&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;![CDATA[]]&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/image:title&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;image:caption&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;![CDATA[]]&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/image:caption&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/image:image&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;categories&quot;&gt;Categories&lt;/h3&gt;
&lt;p&gt;This plugin supports jekyll-archives. This sitemap is created with the category-sitemap.xml file. If you do not use the jekyll archives plugin you should delete category-sitemap.xml and remove the following from sitemap.xml:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;sitemap&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;loc&amp;gt;&lt;/span&gt;https://www.christianengvall.se/category-sitemap.xml&lt;span class=&quot;nt&quot;&gt;&amp;lt;/loc&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;lastmod&amp;gt;&lt;/span&gt;2026-03-11T21:05:00+01:00&lt;span class=&quot;nt&quot;&gt;&amp;lt;/lastmod&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sitemap&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;collections&quot;&gt;Collections&lt;/h3&gt;
&lt;p&gt;Since collections are dynamic only an example is added with jekyll-sitemaps.
If you do not use collections you can delete project-sitemap.xml and the following from sitemap.xml:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;sitemap&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;loc&amp;gt;&lt;/span&gt;https://www.christianengvall.se/project-sitemap.xml&lt;span class=&quot;nt&quot;&gt;&amp;lt;/loc&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;lastmod&amp;gt;&lt;/span&gt;2026-03-11T21:05:00+01:00&lt;span class=&quot;nt&quot;&gt;&amp;lt;/lastmod&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sitemap&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you do use collections you need to change this:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Change &lt;code class=&quot;highlighter-rouge&quot;&gt;site.projects&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;site.&amp;lt;name-of-collection&amp;gt;&lt;/code&gt; in project-sitemap.xml    &lt;/li&gt;
  &lt;li&gt;Change filename of &lt;code class=&quot;highlighter-rouge&quot;&gt;project-sitemap.xml&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;name-of-collection&amp;gt;-sitemap.xml&lt;/code&gt;    &lt;/li&gt;
  &lt;li&gt;Change the reference from &lt;code class=&quot;highlighter-rouge&quot;&gt;project-sitemap.xml&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;name-of-collection&amp;gt;-sitemap.xml&lt;/code&gt; in sitemap.xml:    &lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;sitemap&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;loc&amp;gt;&lt;/span&gt;https://www.christianengvall.se/&lt;span class=&quot;nt&quot;&gt;&amp;lt;name-of-collection&amp;gt;&lt;/span&gt;-sitemap.xml&lt;span class=&quot;nt&quot;&gt;&amp;lt;/loc&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nt&quot;&gt;&amp;lt;lastmod&amp;gt;&lt;/span&gt;2026-03-11T21:05:00+01:00&lt;span class=&quot;nt&quot;&gt;&amp;lt;/lastmod&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/sitemap&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;contribute-to-jekyll-sitemaps&quot;&gt;Contribute to Jekyll Sitemaps&lt;/h3&gt;
&lt;p&gt;Jekyll sitemaps are &lt;a href=&quot;https://github.com/crilleengvall/jekyll-sitemaps&quot; title=&quot;Open source&quot;&gt;open source&lt;/a&gt; and if you find a bug or something else to improve you are welcome to send pull requests.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/jekyll-sitemaps/">https://www.christianengvall.se/jekyll-sitemaps/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 07 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/jekyll-sitemaps/</guid>
        </item>
      
    
      
        <item>
          <title>Switching from Wordpress to Jekyll</title>
          <link>https://www.christianengvall.se/Switching-to-jekyll/</link>
          <comments>https://www.christianengvall.se/Switching-to-jekyll/#respond</comments>
          <description>&lt;p&gt;I’m trying to get this site to load as fast as possible. One thing I wanted to try was to use &lt;a href=&quot;https://jekyllrb.com/&quot; title=&quot;Jekyll&quot;&gt;Jekyll&lt;/a&gt; instead of Wordpress to achieve this.&lt;/p&gt;

&lt;p&gt;I’ve finally made the switch now. The page loads are faster since the site does not go through the Wordpress loop anymore. Jekyll creates static HTML-files that are then uploaded to the web server.&lt;/p&gt;

&lt;h2 id=&quot;page-loads-before-and-after&quot;&gt;Page loads before and after&lt;/h2&gt;
&lt;p&gt;Below you can see screenshots of the network tab in Chrome where &lt;a href=&quot;https://www.christianengvall.se&quot; title=&quot;Christianengvall.se&quot;&gt;Christianengvall.se&lt;/a&gt; is loaded while being served with Wordpress and with static files created by Jekyll.&lt;/p&gt;

&lt;p&gt;You can see that the load time is marked in red. That is because i use &lt;a href=&quot;https://chrome.google.com/webstore/detail/ghostery/mlomiejdfkolichcflejclcbmpeaniij?hl=sv&quot; title=&quot;Ghostery&quot;&gt;Ghostery&lt;/a&gt;) to block trackers like Clicky and Google analytics and so on.&lt;/p&gt;

&lt;p&gt;This is only two page loads. A better test would be to load it lots of times and compare the average load time. But this is enough to see that a nice change for the better has been accomplished.&lt;/p&gt;

&lt;p&gt;Load times Wordpress:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/Pageloads-wordpress.png&quot; aria-label=&quot;Page load with wordpress&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/Pageloads-wordpress.png&quot; alt=&quot;Page load with wordpress&quot; width=&quot;1390&quot; height=&quot;1524&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/Pageloads-wordpress.png&quot; alt=&quot;Page load with wordpress&quot; width=&quot;1390&quot; height=&quot;1524&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Page load with wordpress&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;And load times with static files created by Jekyll:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2017/01/Pageloads-static-page-with-jekyll.png&quot; aria-label=&quot;Page load static page with Jekyll&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2017/01/Pageloads-static-page-with-jekyll.png&quot; alt=&quot;Page load static page with Jekyll&quot; width=&quot;1319&quot; height=&quot;1218&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2017/01/Pageloads-static-page-with-jekyll.png&quot; alt=&quot;Page load static page with Jekyll&quot; width=&quot;1319&quot; height=&quot;1218&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Page load static page with Jekyll&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The load time went from &lt;strong&gt;2,04 seconds&lt;/strong&gt; to &lt;strong&gt;452 ms&lt;/strong&gt;.
It probably loads a bit slower if you do not block trackers.&lt;/p&gt;

&lt;p&gt;When then switch to Jekyll was made I’ve also started to delete some Wordpress leftovers in the HTML-markup.&lt;/p&gt;

&lt;p&gt;I also skipped the implementation of share buttons for the new site, i’ve never been a fan of their loading times so now I’m skipping them as a test.&lt;/p&gt;

&lt;p&gt;I now also use an &lt;a href=&quot;https://github.com/verlok/lazyload&quot; title=&quot;Lazy load&quot;&gt;image lazy loader&lt;/a&gt; that is only using vanilla javascript, making it unnecessary to include jQuery or any other framework. That generates fewer bytes to download for the visitor.&lt;/p&gt;

&lt;h2 id=&quot;migration-tool&quot;&gt;Migration tool&lt;/h2&gt;
&lt;p&gt;I tried using the &lt;a href=&quot;https://import.jekyllrb.com/docs/wordpress/&quot; title=&quot;Migrate from wordpress&quot;&gt;official tools&lt;/a&gt; to migrate posts and pages from Wordpress to Jekyll. That however left me with a lot of html-fixes to do in every post on the site. I ended up using &lt;a href=&quot;https://github.com/thomasf/exitwp&quot; title=&quot;Exitwp&quot;&gt;exitwp&lt;/a&gt; instead. Still got to do some fixes, but a lot less of them.&lt;/p&gt;

&lt;h2 id=&quot;deploy&quot;&gt;Deploy&lt;/h2&gt;
&lt;p&gt;You can use Github pages to host your jekyll site. A lot of people do this. But i decided to stay with my current host and got the opportunity to write my own deploy script :)&lt;/p&gt;

&lt;p&gt;I thought I’d share it with you if you want to build your own from this template. It uses secure copy to upload the files to the server.&lt;/p&gt;

&lt;p&gt;It also gzips every html, js and css asset before deploying.
I got the script from &lt;a href=&quot;http://domwatson.codes/2011/09/adding-gzip-to-my-jeyll-setup.html&quot; title=&quot;Dominic watson&quot;&gt;Dominic Watson&lt;/a&gt; But changed it a bit to fit my site.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[1;90m'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;FINISHED&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[1;96m'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;READY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[1;92m'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\033[0m'&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo
echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Removing _site folder
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=======================&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rf&lt;/span&gt; _site/
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FINISHED&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Done.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo

echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Building site
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=======================&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo
&lt;/span&gt;jekyll build &lt;span class=&quot;nv&quot;&gt;JEKYLL_ENV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;production
&lt;span class=&quot;nb&quot;&gt;echo
echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FINISHED&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Done.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo
echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Compressing all Html, css and js with GZIP
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=======================&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
find _site/ &lt;span class=&quot;nt&quot;&gt;-iname&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'*.html'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt; +
find _site/ &lt;span class=&quot;nt&quot;&gt;-iname&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'*.js'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt; +
find _site/ &lt;span class=&quot;nt&quot;&gt;-iname&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'*.css'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-exec&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;gzip&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt; +
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FINISHED&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Done.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo
echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Transfering files to host
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=======================&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo
&lt;/span&gt;scp &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; _site/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[!&lt;/span&gt;wp-content] user@host:/path/to/send/site/
&lt;span class=&quot;nb&quot;&gt;echo
echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FINISHED&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Done.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo
echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;READY&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;Site deployed.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NOCOLOR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo

exit &lt;/span&gt;0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;em&gt;scp -r _site/*[!wp-content] user@host:/path/to/send/site/&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This line takes care of sending the files to the host. The [!wp-content] excludes that folder so that i won’t upload all the images every time.&lt;/p&gt;

&lt;p&gt;Update: I now use &lt;a href=&quot;/rsync-ssh-example/&quot; title=&quot;rsync&quot;&gt;rsync to transfer&lt;/a&gt; the files instead of scp.&lt;/p&gt;

&lt;h2 id=&quot;other-tools&quot;&gt;Other tools&lt;/h2&gt;
&lt;p&gt;To minify css and javascript i use the &lt;a href=&quot;https://github.com/jekyll/jekyll-assets&quot; title=&quot;Jekyll assets&quot;&gt;Jekyll assets&lt;/a&gt; plugin. And to minify the html i use the &lt;a href=&quot;http://jch.penibelst.de/,&quot; title=&quot;Compress html&quot;&gt;compress html layout&lt;/a&gt; by Anatol Broder.&lt;/p&gt;

&lt;h2 id=&quot;ssl&quot;&gt;ssl&lt;/h2&gt;
&lt;p&gt;I now also use &lt;a href=&quot;https://www.cloudflare.com/&quot; title=&quot;Cloudflare&quot;&gt;Cloudflare&lt;/a&gt; to get hands on a free ssl-certificate that they also take care of renewing. All to get that marginal boost in the SERP.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/Switching-to-jekyll/">https://www.christianengvall.se/Switching-to-jekyll/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 04 Jan 2017 00:00:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/Switching-to-jekyll/</guid>
        </item>
      
    
      
        <item>
          <title>Wordpress developer project portfolio plugin</title>
          <link>https://www.christianengvall.se/wordpress-developer-project-portfolio-plugin/</link>
          <comments>https://www.christianengvall.se/wordpress-developer-project-portfolio-plugin/#respond</comments>
          <description>&lt;p&gt;Last week i put together a &lt;a href=&quot;https://wordpress.org/plugins/developer-project-portfolio/&quot;&gt;Wordpress developer project portfolio plugin&lt;/a&gt;. The target audience is developers and it’s open source and responsive.&lt;/p&gt;

&lt;h2 id=&quot;example&quot;&gt;Example&lt;/h2&gt;
&lt;p&gt;I use the &lt;a href=&quot;/projects/&quot;&gt;developer project portfolio plugin&lt;/a&gt; on this site to display my portfolio.&lt;/p&gt;

&lt;h2 id=&quot;what-it-does&quot;&gt;What it does&lt;/h2&gt;
&lt;p&gt;This plugin adds a custom post type called Project. That post type has the following fields attached to it:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Name&lt;/li&gt;
  &lt;li&gt;Description&lt;/li&gt;
  &lt;li&gt;Project image&lt;/li&gt;
  &lt;li&gt;Project url&lt;/li&gt;
  &lt;li&gt;Short description&lt;/li&gt;
  &lt;li&gt;Customer/category&lt;/li&gt;
  &lt;li&gt;Programming languages&lt;/li&gt;
  &lt;li&gt;Tools &amp;amp; Technologies&lt;/li&gt;
  &lt;li&gt;Platforms&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-admin.png&quot; aria-label=&quot;WordPress developer project plugin – project admin&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-admin-1024x586.png&quot; alt=&quot;WordPress developer project plugin – project admin&quot; width=&quot;1024&quot; height=&quot;586&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-admin-1024x586.png&quot; alt=&quot;WordPress developer project plugin – project admin&quot; width=&quot;1024&quot; height=&quot;586&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;WordPress developer project plugin – project admin&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The plugin also adds an editor plugin that makes it easy to add a list of projects to a page.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-editor-plugin.png&quot; aria-label=&quot;Wordpress developer project plugin - editor plugin&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-editor-plugin-1024x613.png&quot; alt=&quot;Wordpress developer project plugin - editor plugin&quot; width=&quot;1024&quot; height=&quot;613&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-editor-plugin-1024x613.png&quot; alt=&quot;Wordpress developer project plugin - editor plugin&quot; width=&quot;1024&quot; height=&quot;613&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Wordpress developer project plugin - editor plugin&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The project list looks like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-list.png&quot; aria-label=&quot;wordpress developer project plugin - project list&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-list-1024x648.png&quot; alt=&quot;wordpress developer project plugin - project list&quot; width=&quot;1024&quot; height=&quot;648&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-list-1024x648.png&quot; alt=&quot;wordpress developer project plugin - project list&quot; width=&quot;1024&quot; height=&quot;648&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;wordpress developer project plugin - project list&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;And the detail view of a project looks like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-detail-view.png&quot; aria-label=&quot;Wordpress developer project plugin - project detail view&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-detail-view-1024x648.png&quot; alt=&quot;Wordpress developer project plugin - project detail view&quot; width=&quot;1024&quot; height=&quot;648&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/12/Wordpress-developer-project-plugin-project-detail-view-1024x648.png&quot; alt=&quot;Wordpress developer project plugin - project detail view&quot; width=&quot;1024&quot; height=&quot;648&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Wordpress developer project plugin - project detail view&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;contribute&quot;&gt;Contribute&lt;/h2&gt;

&lt;p&gt;I use &lt;a href=&quot;https://github.com/crilleengvall/Wordpress-developer-project-portfolio&quot;&gt;github to host the repository&lt;/a&gt; and i’m very happy to receive pull request of bug fixes and new features from you.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Icons made by &lt;a href=&quot;http://www.flaticon.com/authors/freepik&quot;&gt;Freepik&lt;/a&gt; from &lt;a href=&quot;http://www.flaticon.com/&quot;&gt;www.flaticon.com&lt;/a&gt; is licensed by &lt;a href=&quot;http://creativecommons.org/licenses/by/3.0/&quot;&gt;CC 3.0 BY&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/wordpress-developer-project-portfolio-plugin/">https://www.christianengvall.se/wordpress-developer-project-portfolio-plugin/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 02 Dec 2016 14:44:24 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/wordpress-developer-project-portfolio-plugin/</guid>
        </item>
      
    
      
        <item>
          <title>Electron Windows installer tutorial</title>
          <link>https://www.christianengvall.se/electron-windows-installer/</link>
          <comments>https://www.christianengvall.se/electron-windows-installer/#respond</comments>
          <description>&lt;p&gt;Last time we created a &lt;a href=&quot;/dmg-installer-electron-app/&quot;&gt;dmg installer for macOS&lt;/a&gt;. Now it’s time to look at an Electron Windows installer with &lt;a href=&quot;https://github.com/electron/windows-installer&quot;&gt;Electron-winstaller&lt;/a&gt;.
This tutorial expects you to build the installer on Windows.&lt;/p&gt;

&lt;p&gt;This code will be added to the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app on Github&lt;/a&gt;. Before going through this tutorial you need to make sure you know &lt;a href=&quot;/electron-packager-tutorial/&quot;&gt;how to package your app&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;adding-description&quot;&gt;Adding description&lt;/h2&gt;
&lt;p&gt;Since i haven’t added it before now i needed to add a description of the app in package.json.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-tutorial-app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;productName&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Electron tutorial app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Application for electron tutorials&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;installing-package&quot;&gt;Installing package&lt;/h2&gt;
&lt;p&gt;Run this command in your terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--save-dev&lt;/span&gt; electron-winstaller&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;setting-up-installer-script&quot;&gt;Setting up installer script&lt;/h2&gt;
&lt;p&gt;Create a new file called &lt;strong&gt;createinstaller.js&lt;/strong&gt; in &lt;strong&gt;installers/windows/&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createWindowsInstaller&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron-winstaller&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createWindowsInstaller&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;getInstallerConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createWindowsInstaller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getInstallerConfig&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;creating windows installer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rootPath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;outPath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rootPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;release-builds&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;appDirectory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;outPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Electron-tutorial-app-win32-ia32/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;authors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Christian Engvall&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;noMsi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;outputDirectory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;outPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;windows-installer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;exe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron-tutorial-app.exe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;setupExe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ElectronTutorialAppInstaller.exe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;setupIcon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rootPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;icons&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;win&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;icon.ico&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The interesting thing here is the settings:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;appDirectory: Tells the installer where to look for the packaged app.&lt;/li&gt;
  &lt;li&gt;authors: Who created the app.&lt;/li&gt;
  &lt;li&gt;noMsi: should we use an msi installer?&lt;/li&gt;
  &lt;li&gt;outputDirectory: where should the installer be saved?&lt;/li&gt;
  &lt;li&gt;exe: the name of the packaged exe file in the app directory&lt;/li&gt;
  &lt;li&gt;setupExe: the name of the installer exe&lt;/li&gt;
  &lt;li&gt;setupIcon: the iconf or the installer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find a complete list of settings &lt;a href=&quot;https://github.com/electron/windows-installer#usage&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Running this with the following command would create an installer for us in &lt;strong&gt;release-builds/windows-installer.&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;node installers/windows/createinstaller.js&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you get an error complaining about to long path names, have a look at the &lt;a href=&quot;/electron-asar/&quot;&gt;asar tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;handling-squirrel-install-events&quot;&gt;Handling squirrel install events&lt;/h2&gt;
&lt;p&gt;Now the &lt;a href=&quot;https://github.com/electron/windows-installer#handling-squirrel-events&quot;&gt;readme of electron-winstaller&lt;/a&gt; tells us to handle squirrel events inside our app. This will help us with the installation and also create shortcuts for us. The script below is copied directly from that readme. I’ve just wrapped it in module.exports so that we can require it from main.js&lt;/p&gt;

&lt;p&gt;Start by creating a file called &lt;strong&gt;setupEvents.js&lt;/strong&gt; in the folder &lt;strong&gt;installers/&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;handleSquirrelEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ChildProcess&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;child_process&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;appFolder&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rootAtomFolder&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appFolder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;updateDotExe&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rootAtomFolder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Update.exe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;exeName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;spawn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;spawnedProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

 &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;spawnedProcess&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ChildProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;spawn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;detached&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;

 &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;spawnedProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;spawnUpdate&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;spawn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;updateDotExe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;squirrelEvent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;squirrelEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;--squirrel-install&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;--squirrel-updated&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// Optionally do things such as:&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// - Add your .exe to the PATH&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// - Write to the registry for things like file associations and&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// explorer context menus&lt;/span&gt;

 &lt;span class=&quot;c1&quot;&gt;// Install desktop and start menu shortcuts&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;spawnUpdate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;--createShortcut&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;exeName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

 &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;--squirrel-uninstall&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// Undo anything you did in the --squirrel-install and&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// --squirrel-updated handlers&lt;/span&gt;

 &lt;span class=&quot;c1&quot;&gt;// Remove desktop and start menu shortcuts&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;spawnUpdate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;--removeShortcut&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;exeName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

 &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;--squirrel-obsolete&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// This is called on the outgoing version of your app before&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// we update to the new version - it's the opposite of&lt;/span&gt;
 &lt;span class=&quot;c1&quot;&gt;// --squirrel-updated&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And in main js we’ll require this file at the beginning:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;c1&quot;&gt;//handle setupevents as quickly as possible&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;setupEvents&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./installers/setupEvents&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setupEvents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;handleSquirrelEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// squirrel event handled and app will exit in 1000ms, so don't do anything else&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Module to control application life.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipcMain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;adding-script-shortcuts&quot;&gt;Adding script shortcuts&lt;/h2&gt;
&lt;p&gt;As we have done with the packager and dmg installer scripts we will add a script shortcut to the Windows installer script in package.json:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-win&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Electron Tutorial App&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-linux&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;create-installer-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-installer-dmg ./release-builds/Electron&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; tutorial&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; app-darwin-x64/Electron&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; tutorial&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; app.app electron-tutorial-app --out=release-builds --overwrite --icon=assets/icons/mac/icon.icns&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;create-installer-win&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;node installers/windows/createinstaller.js&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now you can run the following to create a Windows installer:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run package-win
npm run create-installer-win&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;signing-installer&quot;&gt;Signing installer&lt;/h2&gt;
&lt;p&gt;The readme of electron-winstaller tells you to sign your installer. &lt;a href=&quot;https://github.com/electron/windows-installer#sign-your-installer-or-else-bad-things-will-happen&quot;&gt;Read more about why&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-windows-installer/">https://www.christianengvall.se/electron-windows-installer/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 12 Nov 2016 14:57:11 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-windows-installer/</guid>
        </item>
      
    
      
        <item>
          <title>DMG installer for electron app</title>
          <link>https://www.christianengvall.se/dmg-installer-electron-app/</link>
          <comments>https://www.christianengvall.se/dmg-installer-electron-app/#respond</comments>
          <description>&lt;p&gt;To create a DMG installer for our Electron app we can use the &lt;a href=&quot;https://github.com/mongodb-js/electron-installer-dmg&quot;&gt;electron-installer-dmg &lt;/a&gt;package.&lt;/p&gt;

&lt;p&gt;In this tutorial we’ll create a DMG installer for the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app&lt;/a&gt;. To create a DMG installer you first need to &lt;a href=&quot;/electron-packager-tutorial/&quot;&gt;package the app&lt;/a&gt;. Read that tutorial first if you haven’t already.&lt;/p&gt;

&lt;h2 id=&quot;1-installing-package&quot;&gt;1. Installing package&lt;/h2&gt;
&lt;p&gt;Open up a terminal and run these commands:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;c&quot;&gt;# For use in npm scripts&lt;/span&gt;
npm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;electron-installer-dmg &lt;span class=&quot;nt&quot;&gt;--save-dev&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# For use from cli&lt;/span&gt;
npm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;electron-installer-dmg &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-creating-the-dmg-installer&quot;&gt;2. Creating the DMG installer&lt;/h2&gt;
&lt;p&gt;This is the basics that we need to create the DMG. First run the package-mac script that we created to create a package for the mac in the &lt;a href=&quot;/electron-packager-tutorial/&quot;&gt;electron packager tutorial&lt;/a&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run package-mac&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will create a package for us in the release-builds folder. So now we can create the DMG with this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron-installer-dmg ./release-builds/Electron&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;tutorial&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;app-darwin-x64/Electron&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;tutorial&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;app.app electron-tutorial-app&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will create a file called electron-tutorial-app.dmg in the root folder of the application. The dmg will use default settings. In the next step we’ll look at what settings we can do to it.&lt;/p&gt;

&lt;h2 id=&quot;3-usage&quot;&gt;3. Usage&lt;/h2&gt;
&lt;p&gt;If we look at the file &lt;a href=&quot;https://github.com/mongodb-js/electron-installer-dmg/blob/master/usage.txt&quot;&gt;usage.txt&lt;/a&gt; we can see that we have some options to make when it comes to the installer:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;Usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;installer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dmg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;Create&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DMG&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;installers&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;your&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;apps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;Usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;installer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dmg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;FooBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;darwin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x64&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;FooBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;FooBar&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;Options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;         &lt;span class=&quot;nx&quot;&gt;The&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;directory&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;put&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DMG&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;into&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`process.cwd()`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;        &lt;span class=&quot;nx&quot;&gt;Path&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;icon&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;that&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;will&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;be&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;icon&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DMG&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;     &lt;span class=&quot;nx&quot;&gt;How&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;big&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;icon&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DMG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`80`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;Path&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PNG&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;background&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DMG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;debug&lt;/span&gt;              &lt;span class=&quot;nx&quot;&gt;Enable&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;debug&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;overwrite&lt;/span&gt;          &lt;span class=&quot;nx&quot;&gt;Overwrite&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;any&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;existing&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DMG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;help&lt;/span&gt;            &lt;span class=&quot;nx&quot;&gt;Show&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;screen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;version&lt;/span&gt;            &lt;span class=&quot;nx&quot;&gt;Show&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;As you see above we can set the &lt;strong&gt;out&lt;/strong&gt; path of the .dmg file that is generated. We can set an icon that the dmg-window will use (By default this was the electron icon when i tried). We can set the &lt;strong&gt;icon size&lt;/strong&gt; and custom &lt;strong&gt;background&lt;/strong&gt; for the window.&lt;/p&gt;

&lt;p&gt;Since the packages are created in the &lt;strong&gt;release-builds&lt;/strong&gt; folder we’ll create the installers there as well. We also already have the icon created for the application (this is done in the &lt;a href=&quot;/electron-app-icons/&quot;&gt;icon tutorial&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;The command to run now looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron-installer-dmg ./release-builds/Electron&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;tutorial&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;app-darwin-x64/Electron&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;tutorial&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;app.app electron-tutorial-app &lt;span class=&quot;nt&quot;&gt;--out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;release-builds &lt;span class=&quot;nt&quot;&gt;--overwrite&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--icon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;assets/icons/mac/icon.icns&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-creating-a-script&quot;&gt;4. Creating a script&lt;/h2&gt;
&lt;p&gt;I am one of those that won’t be able to memorize that string. So we can add it to our scripts package.json:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-win&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/windows/icon.ico --prune=true --out=release-builds --version-string.CompanyName='CE' --version-string.FileDescription='CE' --version-string.ProductName='ElectronTutorialApp'&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-linux&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;create-installer-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-installer-dmg ./release-builds/Electron&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; tutorial&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; app-darwin-x64/Electron&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; tutorial&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; app.app electron-tutorial-app --out=release-builds --overwrite --icon=assets/icons/mac/icon.icns&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And now you can run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run create-installer-mac&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next post in this tutorial covers &lt;a href=&quot;/electron-windows-installer/&quot;&gt;how to create a Windows installer.&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/dmg-installer-electron-app/">https://www.christianengvall.se/dmg-installer-electron-app/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 08 Nov 2016 20:22:35 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/dmg-installer-electron-app/</guid>
        </item>
      
    
      
        <item>
          <title>Electron asar</title>
          <link>https://www.christianengvall.se/electron-asar/</link>
          <comments>https://www.christianengvall.se/electron-asar/#respond</comments>
          <description>&lt;p&gt;Packaging your app into an asar archive speeds up requires a bit, it conceals the source code and helps to avoid long path names on Windows. Asar is an archive format that concatenates files together without compression.&lt;/p&gt;

&lt;p&gt;I got this error when building a Windows installer for an electron app with electron winstaller:&lt;/p&gt;

&lt;blockquote&gt;&quot;The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.&quot;&lt;/blockquote&gt;

&lt;p&gt;This was because of a package in node_modules that created very long paths.This did however work on Linux and MacOS. The solution was to package my app with asar before creating the installer.&lt;/p&gt;

&lt;h2 id=&quot;asar-and-electron-packager&quot;&gt;Asar and electron packager&lt;/h2&gt;
&lt;p&gt;Install the asar package globally:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; asar&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app&lt;/a&gt; we use electron packager. To the build script we can pass &lt;strong&gt;–asar=true&lt;/strong&gt; in package.json:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-win&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/windows/icon.ico --prune=true --out=release-builds --version-string.CompanyName='CE' --version-string.FileDescription='Electron tutorial app' --version-string.ProductName='Electron tutorial app'&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-linux&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So now when we do a npm run package-mac our app will have a file called app.asar in it instead.&lt;/p&gt;

&lt;p&gt;You can also do this without electron packager with this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;asar pack your-app app.asar&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Read the &lt;a href=&quot;http://electron.atom.io/docs/tutorial/application-packaging/&quot;&gt;official docs about electron and asar&lt;/a&gt; to get to know more.&lt;/p&gt;

&lt;p&gt;Next tutorial shows you how to create a &lt;a href=&quot;/dmg-installer-electron-app/&quot;&gt;dmg-installer for macOS&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-asar/">https://www.christianengvall.se/electron-asar/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 03 Nov 2016 15:57:21 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-asar/</guid>
        </item>
      
    
      
        <item>
          <title>IPCMain and IPCRenderer</title>
          <link>https://www.christianengvall.se/ipcmain-and-ipcrenderer/</link>
          <comments>https://www.christianengvall.se/ipcmain-and-ipcrenderer/#respond</comments>
          <description>&lt;p&gt;Lets look at IPCMain and IPCRenderer in Electron. We can use it to send messages between &lt;a href=&quot;/main-and-renderer-process-in-electron/&quot;&gt;main and renderer processes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Over at the &lt;a href=&quot;https://discuss.atom.io/c/electron&quot;&gt;forums&lt;/a&gt; there was a developer who needed to open a second app window &lt;strong&gt;from the main process&lt;/strong&gt; when the user had done something in &lt;strong&gt;the renderer process&lt;/strong&gt;. So I thought we could look at a real world example. So in this tutorial we’ll wait for the user to click a button. Then we’ll send a message to the main process which in turn opens a new window.&lt;/p&gt;

&lt;h2 id=&quot;1-setting-up-a-new-window-in-mainjs&quot;&gt;1. Setting up a new window in main.js&lt;/h2&gt;
&lt;p&gt;Fire up the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app&lt;/a&gt; or your own app, and open main.js. The additions are highlighted in bold.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Module to control application life.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Module to create native browser window.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//Adds the main Menu to our app&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Keep a global reference of the window object, if you don't, the window will&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// be closed automatically when the JavaScript object is garbage collected.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;secondWindow&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createWindow&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Create the browser window.&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;titleBarStyle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;backgroundColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#312450&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets/icons/png/64x64.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;....&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;secondWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;backgroundColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#312450&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets/icons/png/64x64.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;parent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;secondWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`file://&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/windows/secondWindowcontent.html`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./menu/mainmenu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We create a new variable to hold our second window with &lt;strong&gt;let secondWindow&lt;/strong&gt; and by now you know how to create a &lt;strong&gt;new BrowserWindow.&lt;/strong&gt; But this time the size of the window has changed. And we also don’t show a frame, so we set that to &lt;strong&gt;frame:false&lt;/strong&gt;. This is because we close the window from a button that we create ourselves instead of using the standard os-buttons. If the user closes the new window with the built in close button they wont be able to open it again because it’s not initialized anymore.&lt;/p&gt;

&lt;p&gt;We also set mainWindow as parent so that secondWindow will stay on top of the parent window. There are some &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/#parent-and-child-windows&quot;&gt;platform specific&lt;/a&gt; handling to the parent setting:&lt;/p&gt;

&lt;blockquote&gt;
 	&lt;p&gt;On macOS the child windows will keep the relative position to parent window when parent window moves, while on Windows and Linux child windows will not move.&lt;/p&gt;

 	&lt;p&gt;On Windows it is not supported to change parent window dynamically.&lt;/p&gt;  

 	&lt;p&gt;On Linux the type of modal windows will be changed to dialog.&lt;/p&gt;    

 	&lt;p&gt;On Linux many desktop environments do not support hiding a modal window&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The secondWindow also loads another .html file called &lt;strong&gt;ipcwindow.html&lt;/strong&gt; that is located in a folder called windows. Lets look at that next.&lt;/p&gt;

&lt;h2 id=&quot;2-ipcwindow-content&quot;&gt;2. IPCWindow content&lt;/h2&gt;
&lt;p&gt;Create a new folder called &lt;strong&gt;windows&lt;/strong&gt;. In that folder you create &lt;strong&gt;ipcwindow.html&lt;/strong&gt;. Add this content to the html file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE HTML&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--
 Hyperspace by HTML5 UP
 html5up.net | @ajlkn
 Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
--&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Electron tutorial app - ipc&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;utf-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;../assets/css/main.css&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Sidebar --&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sidebar&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
             &lt;span class=&quot;nt&quot;&gt;&amp;lt;nav&amp;gt;&lt;/span&gt;
                 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
                 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
             &lt;span class=&quot;nt&quot;&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Wrapper --&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style1 fullscreen intro&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Yes this is the second window!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#one&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;close-me-button&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button scrolly&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Close me&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

   &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Footer --&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;footer&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;footer&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style1-alt&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
           &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;menu&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
               &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
           &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;/footer&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Scripts --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../assets/js/jquery.min.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../translations/i18n&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;../assets/js/jquery.scrollex.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;../assets/js/jquery.scrolly.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;../assets/js/skel.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;../assets/js/util.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;../assets/js/main.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../assets/js/translations&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-changes-in-navigation-menu-and-who-we-aresection&quot;&gt;3. Changes in navigation menu and who we are section&lt;/h2&gt;
&lt;p&gt;When this tutorial is being written the navigation menu and who we are section looks like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/11/who-we-are.png&quot; aria-label=&quot;Navigation menu - who we are&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/11/who-we-are-1024x670.png&quot; alt=&quot;Navigation menu - who we are&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/11/who-we-are-1024x670.png&quot; alt=&quot;Navigation menu - who we are&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Navigation menu - who we are&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Change the name of the menu-item to IPC/Remote in the &lt;strong&gt;en.js and sv.js&lt;/strong&gt; translations&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;....&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Who we are&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;IPC/Remote&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;....&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Also rename sections/whoweare.html to ipcremote.html. Then update link=rel and the sidebar menu in &lt;strong&gt;index.html&lt;/strong&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;....
&lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;import&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sections/ipcremote.html&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
....
&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome-menu&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Welcome&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;whoweare-menu&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ipcremote&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Who we are&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;whatwedo-menu&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;whatwedo&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;What we do&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getintouch-menu&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getintouch&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Get in touch&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In ipcremote.html we also need to update the id of the section to ipcremote and adding some information about what will happen if we click the button:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-template&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ipcremote&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style2 spotlights&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;IPCRenderer and IPCMain&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Click the button below to send a message that is picked up in the main process and open a new window&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;open-secondwindow-button&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Open Window&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
                    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-ipcrenderer&quot;&gt;4. IPCRenderer&lt;/h2&gt;
&lt;p&gt;Now we’ve got our app set up and it’s finally time to move on to sending and receiving messages with IPC. This will be done asynchronous.&lt;/p&gt;

&lt;p&gt;Create a file called &lt;strong&gt;ipc.js&lt;/strong&gt; in assets/js/. To start with you can add this content to it:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipcRenderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{},&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;messaging&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;sendOpenSecondWindowEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ipcRenderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;open-second-window&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;an-argument&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

    &lt;span class=&quot;na&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#open-secondwindow-button&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
             &lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;messaging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sendOpenSecondWindowEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;messaging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;init() is called on documentready. That in turn hooks up an onclick event on the button in the ipc section with id &lt;strong&gt;#open-secondwindow-button.&lt;/strong&gt; Now to the ipc stuff. When that button is clicked ipcRenderer.send is invoked like this: &lt;strong&gt;ipcRenderer.send(‘open-second-window’, ‘an-argument’)&lt;/strong&gt; The first value sent as a parameter is the name of the event. The second one is an argument of your own choice.&lt;/p&gt;

&lt;p&gt;and add a require statement to the file in index.html:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/menu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/translations&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/ipc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;5-ipcmain&quot;&gt;5. IPCMain&lt;/h2&gt;
&lt;p&gt;Now it is time to listen for this event in main.js. Start by adding a require statement for ipcMain at the top of the file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipcMain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;....&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And to listen to the event and showing the second window just add this code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;ipcMain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;open-second-window&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;secondWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// This method will be called when Electron has finished&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// initialization and is ready to create browser windows.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Some APIs can only be used after this event occurs.&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And at this point the tutorial on ipc main and renderer is over. But we’ll do it once more just to be able to close the secondwindow again.&lt;/p&gt;

&lt;h2 id=&quot;6-closing-a-browserwindow&quot;&gt;6. Closing a BrowserWindow&lt;/h2&gt;
&lt;p&gt;Open up ipc.js again and add another on click event that sends a closing message to main:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipcRenderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{},&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;messaging&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

         &lt;span class=&quot;na&quot;&gt;sendOpenSecondWindowEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
             &lt;span class=&quot;nx&quot;&gt;ipcRenderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;open-second-window&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;an-argument&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

         &lt;span class=&quot;na&quot;&gt;sendCloseSecondWindowEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
             &lt;span class=&quot;nx&quot;&gt;ipcRenderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;close-second-window&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;an-argument&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

        &lt;span class=&quot;na&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#open-secondwindow-button&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;messaging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sendOpenSecondWindowEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#close-me-button&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;messaging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sendCloseSecondWindowEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;ipc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;messaging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And in main we add another event listener:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;p&quot;&gt;....&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ipcMain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;open-second-window&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;secondWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;ipcMain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;close-second-window&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;secondWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;....&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Ipc also needs to be required from ipcwindow.html:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../assets/js/translations&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../assets/js/ipc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/script&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/body&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;That’s it for this tutorial. Check out the official documentation on &lt;a href=&quot;http://electron.atom.io/docs/api/ipc-main/&quot;&gt;IPCMain&lt;/a&gt; and &lt;a href=&quot;http://electron.atom.io/docs/api/ipc-renderer/&quot;&gt;IPCRenderer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next tutorial we look at &lt;a href=&quot;/electron-asar/&quot;&gt;electron asar&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/ipcmain-and-ipcrenderer/">https://www.christianengvall.se/ipcmain-and-ipcrenderer/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 02 Nov 2016 22:44:52 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/ipcmain-and-ipcrenderer/</guid>
        </item>
      
    
      
        <item>
          <title>Main process and Renderer process in Electron</title>
          <link>https://www.christianengvall.se/main-and-renderer-process-in-electron/</link>
          <comments>https://www.christianengvall.se/main-and-renderer-process-in-electron/#respond</comments>
          <description>&lt;p&gt;You might have come across the main process and renderer process in Electron. This is a simple explanation of them.&lt;/p&gt;

&lt;h2 id=&quot;main-process&quot;&gt;Main process&lt;/h2&gt;
&lt;p&gt;The main process takes care of starting and running your app. In the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;electron tutorial app&lt;/a&gt; you can see this line in package.json:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;main.js&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is the primary entry point to an electron app. And this is running in the main process. All the files you require from this file will be running in the main process as well.&lt;/p&gt;

&lt;p&gt;If we would call &lt;a href=&quot;http://electron.atom.io/docs/api/process/#processtype&quot;&gt;process.type&lt;/a&gt; and log it with &lt;strong&gt;console.log()&lt;/strong&gt; the word &lt;strong&gt;“browser”&lt;/strong&gt; would turn up in the terminal running the app.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/console-log-main-process.png&quot; aria-label=&quot;console log in main process&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/console-log-main-process-1024x480.png&quot; alt=&quot;console log in main process&quot; width=&quot;1024&quot; height=&quot;480&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/console-log-main-process-1024x480.png&quot; alt=&quot;console log in main process&quot; width=&quot;1024&quot; height=&quot;480&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;console log in main process&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;renderer-process&quot;&gt;Renderer process&lt;/h2&gt;
&lt;p&gt;The renderer process takes care of showing your app in the Chromium browser. When the app is ready to show the electron tutorial app runs this command in main.js:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`file://&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/index.html`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The javascript files you include from index.html or any other html-document is running in the renderer process. If we would run the same &lt;strong&gt;console.log()&lt;/strong&gt; call as above, the word &lt;strong&gt;“renderer”&lt;/strong&gt; would show up. But this time in the &lt;strong&gt;developer tools&lt;/strong&gt; of chromium:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/console-log-renderer-process.png&quot; aria-label=&quot;console log in renderer process&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/console-log-renderer-process-1024x584.png&quot; alt=&quot;console log in renderer process&quot; width=&quot;1024&quot; height=&quot;584&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/console-log-renderer-process-1024x584.png&quot; alt=&quot;console log in renderer process&quot; width=&quot;1024&quot; height=&quot;584&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;console log in renderer process&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;documentation&quot;&gt;Documentation&lt;/h2&gt;
&lt;p&gt;So what API calls can we do from the different processes? The &lt;a href=&quot;http://electron.atom.io/docs/&quot;&gt;official documents&lt;/a&gt; are kind to us and list them under &lt;strong&gt;Main Process&lt;/strong&gt; and &lt;strong&gt;Renderer process&lt;/strong&gt;. But there are also api-calls that work in &lt;strong&gt;both processes&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;communicating-between-the-processes&quot;&gt;Communicating between the processes&lt;/h2&gt;
&lt;p&gt;The api allows us to communicate between the processes. You can do that with &lt;a href=&quot;http://electron.atom.io/docs/api/remote/&quot;&gt;remote&lt;/a&gt; which provides a simple way to do inter-process communication between renderer and the main process.&lt;/p&gt;

&lt;h3 id=&quot;ipcrenderer-and-ipcmain&quot;&gt;IPCRenderer and IPCMain&lt;/h3&gt;
&lt;p&gt;The api also allows us to use &lt;a href=&quot;/ipcmain-and-ipcrenderer/&quot;&gt;ipcRenderer and ipcMain&lt;/a&gt; to help us send events between the different processes. We can then listen to these events and implement the functionality we need.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/main-and-renderer-process-in-electron/">https://www.christianengvall.se/main-and-renderer-process-in-electron/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 29 Oct 2016 11:29:06 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/main-and-renderer-process-in-electron/</guid>
        </item>
      
    
      
        <item>
          <title>Electron localization</title>
          <link>https://www.christianengvall.se/electron-localization/</link>
          <comments>https://www.christianengvall.se/electron-localization/#respond</comments>
          <description>&lt;p&gt;Let us add localization to the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;electron tutorial app&lt;/a&gt;. We will look at translating both in the main and renderer process.&lt;/p&gt;

&lt;p&gt;I tried some of the already existing npm-packages that helps with translating your app. They were good but didn’t feel 100% right to me. Some of them used .po-files, some of them were too advanced. So I decided to write a simpler one on my own. This is just a matter of taste. If you find another way that suits you better you should do it like that instead.&lt;/p&gt;

&lt;p&gt;The localization script will store translations in .js files with a json-structure. It will use english as a fallback language, and try to use the users language by default. If no translation is found the original phrase will be sent back to be used.&lt;/p&gt;

&lt;h2 id=&quot;1adding-the-script&quot;&gt;1.Adding the script&lt;/h2&gt;
&lt;p&gt;Create a new folder in the project called translations. Create a new .js file and copy the contents below and save the file as i18n.js (&lt;a href=&quot;https://en.wikipedia.org/wiki/Internationalization_and_localization&quot;&gt;why i18n?&lt;/a&gt;)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;loadedLanguage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;existsSync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getLocale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;loadedLanguage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;readFileSync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getLocale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;loadedLanguage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;readFileSync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;en.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;utf8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;phrase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;translation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;loadedLanguage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;phrase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;translation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;translation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;phrase&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;translation&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In the i18n &lt;strong&gt;constructor&lt;/strong&gt; the script first checks if a language file for the current users locale exists. If it does that file is loaded. If the file does not exist the script loads the fallback language in en.js.&lt;/p&gt;

&lt;p&gt;the &lt;strong&gt;__&lt;/strong&gt; function takes a phrase as an argument and checks if that is translated in the loadedLanguage. If it’s not it returns the phrase sent to the function.&lt;/p&gt;

&lt;p&gt;This line takes care of loading app from either the main(mainmenu.js) or renderer(from index.html) process.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2adding-translation-files&quot;&gt;2.Adding translation files&lt;/h2&gt;
&lt;p&gt;Since i am from Sweden I will locate the tutorial app into Swedish. So I will create en.js and sv.js in the translations folder. To know what you should name your file so that the i18n script will find it and load it you can add this to main.js which will log the locale to the terminal(just add .js to it):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getLocale&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is how the structure in the translation files should look. This is what &lt;strong&gt;en.js&lt;/strong&gt; will look like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Edit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Edit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Undo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Undo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Redo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Redo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Cut&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Cut&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Copy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Copy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Paste&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Paste&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Delete&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Delete&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Select all&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Select all&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;View&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;View&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Speech&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Speech&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Start speaking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Start speaking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Stop speaking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Stop speaking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Actual size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Actual size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Zoom in&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Zoom in&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Zoom out&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Zoom out&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Toggle fullscreen&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Toggle fullscreen&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Window&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Window&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Minimize&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Minimize&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Close&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Close&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Help&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Help&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Learn more&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Learn more&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;About&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;About&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Services&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Services&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Hide&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hide&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Hide others&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hide others&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Unhide&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Unhide&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Quit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Quit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Zoom&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Zoom&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Bring all to front&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Bring all to front&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And this is what my &lt;strong&gt;sv.js&lt;/strong&gt; looks like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Edit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Redigera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Undo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Ångra&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Redo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Gör om&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Cut&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Klipp ut&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Copy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Kopiera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Paste&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Klistra in&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Delete&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Radera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Select all&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Markera allt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Speech&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Tal&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Start speaking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Börja tala&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Stop speaking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Sluta tala&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;View&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Visa&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Actual size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Faktisk storlek&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Zoom in&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Zooma in&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Zoom out&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Zooma ut&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Zoom&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Zooma&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Toggle fullscreen&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Helskärmsläge&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Window&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Fönster&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Minimize&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Minimera&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Close&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Stäng&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Help&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hjälp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Learn more&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Läs mer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;About&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Om&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Services&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Tjänster&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Hide&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Göm&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Hide others&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Göm övriga&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Unhide&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Visa alla&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Quit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Avsluta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Bring all to front&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Flytta fram alla&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3translating-the-menu-main-process&quot;&gt;3.Translating the menu (Main process)&lt;/h2&gt;
&lt;p&gt;As you might have guessed when reading the translation they look like menu items. So let us translate the &lt;a href=&quot;/electron-menu/&quot;&gt;menu&lt;/a&gt; that was added in the last tutorial.&lt;/p&gt;

&lt;p&gt;Open up &lt;strong&gt;mainmenu.js&lt;/strong&gt; that is located in the menu folder and add this require statement to the top of the file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../translations/i18n&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now all we need to do is call i18n.__() for every menu item. These are what the first three looks like, here is the fully &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/blob/154ec39afe55ab46d1867bb8d83359d23d719fd7/menu/mainmenu.js&quot;&gt;translated menu file&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;../translations/i18n&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Edit&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;undo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Undo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;redo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Redo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;....&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;What you do is add the &lt;strong&gt;label:&lt;/strong&gt; attribute to the menu item, which gets the translated value from i18n__().&lt;/p&gt;

&lt;h2 id=&quot;4translating-navigation-menu-in-indexjs-renderer-process&quot;&gt;4.Translating navigation menu in index.js (Renderer process)&lt;/h2&gt;
&lt;p&gt;Create a new file in assets/js/ called &lt;strong&gt;translations.js&lt;/strong&gt;. In this one we’ll use jquery to set the translated strings to our html-markup.&lt;/p&gt;

&lt;p&gt;Open index.html and add i18n int the list of scripts.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt; &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Scripts --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/jquery.min.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./translations/i18n&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/jquery.scrollex.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/jquery.scrolly.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/skel.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/util.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/main.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/menu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/translations&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In translations.js it’s plain jquery to set the text of the elements that you wish to translate:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;localization&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;localization&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{},&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;localization&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;translate&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

     &lt;span class=&quot;na&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#welcome-menu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Welcome&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

   &lt;span class=&quot;na&quot;&gt;welcome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
       &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#welcome .inner p&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i18n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Hopefully this helps someone to get up to speed with electron.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

   &lt;span class=&quot;na&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;welcome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
         &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;localization&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;translate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is just two translations that are added. You can see the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/blob/154ec39afe55ab46d1867bb8d83359d23d719fd7/assets/js/translations.js&quot;&gt;full file here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The app now looks like this when running it on an os set to Swedish language:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/Electron-tutorial-app-windows-translated-swedish.png&quot; aria-label=&quot;electron tutorial app windows - translated to swedish&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/Electron-tutorial-app-windows-translated-swedish-1024x565.png&quot; alt=&quot;electron tutorial app windows - translated to swedish&quot; width=&quot;1024&quot; height=&quot;564&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/Electron-tutorial-app-windows-translated-swedish-1024x565.png&quot; alt=&quot;electron tutorial app windows - translated to swedish&quot; width=&quot;1024&quot; height=&quot;564&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;electron tutorial app windows - translated to swedish&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://www.freepik.com/free-vector/cute-globe-icon_820866.htm&quot;&gt;Designed by Freepik&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-localization/">https://www.christianengvall.se/electron-localization/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 27 Oct 2016 13:24:14 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-localization/</guid>
        </item>
      
    
      
        <item>
          <title>Electron menu</title>
          <link>https://www.christianengvall.se/electron-menu/</link>
          <comments>https://www.christianengvall.se/electron-menu/#respond</comments>
          <description>&lt;p&gt;This tutorial shows you how to add an Electron menu to your app. It will also make standard keyboard shortcuts, like copy and paste, work on MacOS.&lt;/p&gt;

&lt;p&gt;We’ve actually got our work pretty much done for us thanks to the &lt;a href=&quot;http://electron.atom.io/docs/api/menu/&quot;&gt;Electron documentation&lt;/a&gt; giving us a good template to use. We just need to implement and do some changes to it (If you want to that is). As always this tutorial uses &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app&lt;/a&gt; as a canvas so you can download and/or look at the code on github.&lt;/p&gt;

&lt;h2 id=&quot;1adding-the-menu&quot;&gt;1.Adding the menu&lt;/h2&gt;
&lt;p&gt;Open up a new file and paste this menu definition to it (this is the code from the documentation, with minor adjustments):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Edit&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;undo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;redo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;cut&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;copy&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;paste&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;pasteandmatchstyle&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;selectall&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;View&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Reload&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;accelerator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;CmdOrCtrl+R&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;focusedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;focusedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;focusedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Toggle Developer Tools&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;accelerator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;platform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;darwin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alt+Command+I&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Ctrl+Shift+I&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;focusedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;focusedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;focusedWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;webContents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toggleDevTools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;resetzoom&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;zoomin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;zoomout&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;togglefullscreen&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;minimize&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;help&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Learn More&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;openExternal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://electron.atom.io&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;platform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;darwin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;unshift&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;about&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hideothers&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;unhide&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;quit&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// Edit menu.&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Speech&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;submenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;startspeaking&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;stopspeaking&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// Window menu.&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;submenu&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;accelerator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;CmdOrCtrl+W&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Minimize&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;accelerator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;CmdOrCtrl+M&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;minimize&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Zoom&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;zoom&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;separator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bring All to Front&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;front&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buildFromTemplate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;Menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setApplicationMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Save this in a new folder called menu, and why not name the file mainmenu.js&lt;/p&gt;

&lt;p&gt;If you take a look at the two last lines in mainmenu.js you see two calls, one to &lt;a href=&quot;http://electron.atom.io/docs/api/menu/#menubuildfromtemplatetemplate&quot;&gt;buildFromTemplate()&lt;/a&gt;, which basically takes the array defined above, and creates a menu from it. Then we pass the menu to &lt;a href=&quot;http://electron.atom.io/docs/api/menu/#menusetapplicationmenumenu&quot;&gt;setApplicationMenu()&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;2showingthe-menu-in-the-app&quot;&gt;2. Showing the menu in the app&lt;/h2&gt;
&lt;p&gt;Now open up main.js and add require(‘./menu/mainmenu’) after creating the window. In the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app&lt;/a&gt; it is added to line 45, right before closing the &lt;strong&gt;createWindow&lt;/strong&gt; function. We add it there because the call to setApplicationMenu needs to been done after the ready event is fired. Which it has in createWindow.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createWindow&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// Emitted when the window is closed.&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;closed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
       &lt;span class=&quot;c1&quot;&gt;// Dereference the window object, usually you would store windows&lt;/span&gt;
       &lt;span class=&quot;c1&quot;&gt;// in an array if your app supports multi windows, this is the time&lt;/span&gt;
       &lt;span class=&quot;c1&quot;&gt;// when you should delete the corresponding element.&lt;/span&gt;
       &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./menu/mainmenu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you start the app now, you can see that you have a different menu already.&lt;/p&gt;

&lt;h2 id=&quot;3-menu-items&quot;&gt;3. Menu items&lt;/h2&gt;
&lt;p&gt;Let us look at what the mainmenu.js contains. It’s an array that defines &lt;a href=&quot;http://electron.atom.io/docs/api/menu-item/&quot;&gt;MenuItems&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;label&quot;&gt;Label&lt;/h3&gt;
&lt;p&gt;Labels are what the menu item will say when it is displayed. It is required to set when you are defining a menu item that does not use Role(which we will look at soon). You can use this when localizing your menu items.&lt;/p&gt;

&lt;h3 id=&quot;submenu&quot;&gt;Submenu&lt;/h3&gt;
&lt;p&gt;A submenu is what you think it is. It is an array containing menuitems for a submenu.&lt;/p&gt;

&lt;h3 id=&quot;role&quot;&gt;Role&lt;/h3&gt;
&lt;p&gt;Electron provides us with roles that are predefined for Platform specific menu items such as undo, redo and those standard functions. The existing roles are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;undo&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;redo&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;cut&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;copy&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;paste&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;pasteandmatchstyle&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;selectall&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;delete&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;minimize&lt;/code&gt; - Minimize current window&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;close&lt;/code&gt; - Close current window&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;quit&lt;/code&gt; - Quit the application&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;togglefullscreen&lt;/code&gt; - Toggle full screen mode on the current window&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;resetzoom&lt;/code&gt; - Reset the focused page’s zoom level to the original size&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;zoomin&lt;/code&gt; - Zoom in the focused page by 10%&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;zoomout&lt;/code&gt; - Zoom out the focused page by 10%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On macOS role can also have following additional values:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;about&lt;/code&gt; - Map to the orderFrontStandardAboutPanel action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;hide&lt;/code&gt; - Map to the hide action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;hideothers&lt;/code&gt; - Map to the hideOtherApplications action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;unhide&lt;/code&gt; - Map to the unhideAllApplications action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;startspeaking&lt;/code&gt; - Map to the startSpeaking action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;stopspeaking&lt;/code&gt; - Map to the stopSpeaking action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;front&lt;/code&gt; - Map to the arrangeInFront action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;zoom&lt;/code&gt; - Map to the performZoom action&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;window&lt;/code&gt; - The submenu is a “Window” menu&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;help&lt;/code&gt; - The submenu is a “Help” menu&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;services&lt;/code&gt; - The submenu is a “Services” menu&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When specifying role on macOS, label and accelerator are the only options that will affect the MenuItem. All other options will be ignored.&lt;/p&gt;

&lt;h3 id=&quot;accelerator&quot;&gt;Accelerator&lt;/h3&gt;
&lt;p&gt;If you scroll down a bit in mainmenu.js to line 43 you can see something called &lt;a href=&quot;http://electron.atom.io/docs/api/accelerator/&quot;&gt;accelerator&lt;/a&gt;. With the accelerator you can add keyboard shortcuts to your menu item. Built in accelerators are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Command&lt;/code&gt; (or Cmd for short)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Control&lt;/code&gt; (or Ctrl for short)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;CommandOrControl&lt;/code&gt; (or CmdOrCtrl for short)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Alt&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Option&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;AltGr&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Shift&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;Super&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One interesting accelerator to look at is the CommandOrControl. It uses the command button on macs, but on windows it maps to control instead since Windows doesn’t use the command button.&lt;/p&gt;

&lt;h3 id=&quot;click&quot;&gt;click&lt;/h3&gt;
&lt;p&gt;When a menuItem is clicked you can define what code will be executed by defining a &lt;a href=&quot;http://electron.atom.io/docs/api/menu-item/#new-menuitemoptions&quot;&gt;click&lt;/a&gt; event.&lt;/p&gt;

&lt;h3 id=&quot;type&quot;&gt;Type&lt;/h3&gt;
&lt;p&gt;You can se a type to a menuitem, a type can for example be a separator. If you look at line 56 in mainmenu.js you can see it being used. But there are more types defined:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;type String - Can be normal, separator, submenu, checkbox or radio.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;read-more&quot;&gt;Read more&lt;/h2&gt;
&lt;p&gt;To learn more about this topic you can read about &lt;a href=&quot;http://electron.atom.io/docs/api/menu/&quot;&gt;Menu&lt;/a&gt; and &lt;a href=&quot;http://electron.atom.io/docs/api/menu-item/&quot;&gt;MenuItem&lt;/a&gt; in the official docs. You can also take a look at the implemented menu on the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app repository on github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next step in this tutorial series walks you through how to &lt;a href=&quot;/electron-localization/&quot;&gt;translate the menu and the rest of your electron app&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-menu/">https://www.christianengvall.se/electron-menu/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 24 Oct 2016 13:19:35 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-menu/</guid>
        </item>
      
    
      
        <item>
          <title>Electron packager tutorial</title>
          <link>https://www.christianengvall.se/electron-packager-tutorial/</link>
          <comments>https://www.christianengvall.se/electron-packager-tutorial/#respond</comments>
          <description>&lt;p&gt;In this &lt;a href=&quot;https://github.com/electron-userland/electron-packager&quot;&gt;electron packager&lt;/a&gt; tutorial we will look at how to create MacOS, Windows and Linux executables with an app icon. This is also a continuation of the &lt;a href=&quot;/electron-app-icons/&quot;&gt;Electron app icon&lt;/a&gt; post, so start there if you haven’t read it (It’s short, i promise).&lt;/p&gt;

&lt;p&gt;I add this code to the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app on github&lt;/a&gt;. Just look at that repo if you want to see all the code.&lt;/p&gt;

&lt;p&gt;In this tutorial I package the application on Windows, macOS and Ubuntu Linux. There are some information about building Windows apps from non-Windows platforms in the &lt;a href=&quot;https://github.com/electron-userland/electron-packager#building-windows-apps-from-non-windows-platforms&quot; title=&quot;Electron packager readme&quot;&gt;Electron packager readme&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;1-install-electron-packager&quot;&gt;1. Install Electron packager&lt;/h2&gt;
&lt;p&gt;Electron packager is created by &lt;a href=&quot;https://github.com/electron-userland&quot;&gt;electron-userland&lt;/a&gt; and this is what they say about it:&lt;/p&gt;

&lt;blockquote&gt;&quot;Electron Packager is a command line tool and Node.js library that bundles Electron-based application source code with a renamed Electron executable and supporting files into folders ready for distribution.&quot;&lt;/blockquote&gt;

&lt;p&gt;So lets go ahead and install it. Run these commands in the terminal in the app folder:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;c&quot;&gt;# for use in npm scripts&lt;/span&gt;
npm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;electron-packager &lt;span class=&quot;nt&quot;&gt;--save-dev&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# for use from cli&lt;/span&gt;
npm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;electron-packager &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-setting-productname-and-electron-version&quot;&gt;2. Setting productname and electron version&lt;/h2&gt;
&lt;p&gt;Electron packager looks for a product name in package.json, so lets go ahead and add one. We also need to add what version of electron to package the app with.&lt;/p&gt;

&lt;p&gt;Lets begin with the electron version. We’ll add that from the terminal with this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--save-dev&lt;/span&gt; electron&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now when that is done open up package.json and add a productname:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-tutorial-app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;productName&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Electron tutorial app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;main.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;devDependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^1.4.3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron-packager&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^8.1.0&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-building-macos-windows-and-linux-package-from-the-terminal&quot;&gt;3. Building MacOS, Windows and Linux package from the terminal&lt;/h2&gt;
&lt;p&gt;To get to know what all these flags do, and what more flags exists you can read the &lt;a href=&quot;https://github.com/electron-userland/electron-packager/blob/master/docs/api.md&quot;&gt;electron-packager api&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;macos&quot;&gt;MacOS&lt;/h3&gt;
&lt;p&gt;Now you can run this command from the terminal to build a package for mac:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron-packager &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--overwrite&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--platform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;darwin &lt;span class=&quot;nt&quot;&gt;--arch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;x64 &lt;span class=&quot;nt&quot;&gt;--icon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;assets/icons/mac/icon.icns &lt;span class=&quot;nt&quot;&gt;--prune&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;release-builds&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/Electron-packager-mac.png&quot; aria-label=&quot;Electron packager mac&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/Electron-packager-mac-1024x676.png&quot; alt=&quot;Electron packager mac&quot; width=&quot;1024&quot; height=&quot;676&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/Electron-packager-mac-1024x676.png&quot; alt=&quot;Electron packager mac&quot; width=&quot;1024&quot; height=&quot;676&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron packager mac&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;windows&quot;&gt;Windows&lt;/h3&gt;

&lt;p&gt;And to build for Windows you can run this from the git bash:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron-packager &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; electron-tutorial-app &lt;span class=&quot;nt&quot;&gt;--overwrite&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--asar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--platform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;win32 &lt;span class=&quot;nt&quot;&gt;--arch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;ia32 &lt;span class=&quot;nt&quot;&gt;--icon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;assets/icons/win/icon.ico &lt;span class=&quot;nt&quot;&gt;--prune&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;release-builds &lt;span class=&quot;nt&quot;&gt;--version-string&lt;/span&gt;.CompanyName&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;CE &lt;span class=&quot;nt&quot;&gt;--version-string&lt;/span&gt;.FileDescription&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;CE &lt;span class=&quot;nt&quot;&gt;--version-string&lt;/span&gt;.ProductName&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Electron Tutorial App&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/Electron-packager-windows.png&quot; aria-label=&quot;Electron packager windows&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/Electron-packager-windows-1024x593.png&quot; alt=&quot;Electron packager windows&quot; width=&quot;1024&quot; height=&quot;593&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/Electron-packager-windows-1024x593.png&quot; alt=&quot;Electron packager windows&quot; width=&quot;1024&quot; height=&quot;593&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron packager windows&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux&quot;&gt;Linux&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron-packager &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; electron-tutorial-app &lt;span class=&quot;nt&quot;&gt;--overwrite&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--asar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--platform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;linux &lt;span class=&quot;nt&quot;&gt;--arch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;x64 &lt;span class=&quot;nt&quot;&gt;--icon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;assets/icons/png/1024x1024.png &lt;span class=&quot;nt&quot;&gt;--prune&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;release-builds&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/Electron-packager-ubuntu-linux.png&quot; aria-label=&quot;Electron packager ubuntu linux&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/Electron-packager-ubuntu-linux-1024x698.png&quot; alt=&quot;Electron packager ubuntu linux&quot; width=&quot;1024&quot; height=&quot;698&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/Electron-packager-ubuntu-linux-1024x698.png&quot; alt=&quot;Electron packager ubuntu linux&quot; width=&quot;1024&quot; height=&quot;698&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron packager ubuntu linux&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;overwrite&lt;/strong&gt;: replaces any existing output directory when packaging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;platform&lt;/strong&gt;: The target platform to build for&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;arch&lt;/strong&gt;: the architecture to build for&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;icon&lt;/strong&gt;: sets the icon for the app&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;prune&lt;/strong&gt;: runs npm prune –production before packaging the app. It removes unnecesary packages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;out&lt;/strong&gt;: the name of the directory where the packages are created.&lt;/p&gt;

&lt;h2 id=&quot;4-shortcuts&quot;&gt;4. Shortcuts&lt;/h2&gt;
&lt;p&gt;To make it easier to create new builds we can create scripts in package.json so that we don’t have to remember all these settings. Add the scripts below, making your package.json look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-tutorial-app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;productName&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Electron tutorial app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;main.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;devDependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^1.4.3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;electron-packager&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^8.1.0&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-win&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . electron-tutorial-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Electron Tutorial App&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    
&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;package-linux&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now you can run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run package-mac&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run package-win&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;npm run package-linux&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;installer-tutorials&quot;&gt;Installer tutorials&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.christianengvall.se/dmg-installer-electron-app/&quot; title=&quot;GM Installer for electron app&quot;&gt;DMG installer for macOS tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.christianengvall.se/electron-windows-installer/&quot; title=&quot;Windows installer tutorial&quot;&gt;Windows installer tutorial.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.christianengvall.se/electron-installer-debian-package/&quot; title=&quot;Debian package installer tutorial&quot;&gt;Debian package installer tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coming soon: Red-hat package.&lt;/p&gt;

&lt;h2 id=&quot;next-tutorial&quot;&gt;Next tutorial&lt;/h2&gt;

&lt;p&gt;The next tutorial in this series is &lt;a href=&quot;/electron-menu/&quot;&gt;Electron menu&lt;/a&gt;. It explains how to add a menu to your app.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-packager-tutorial/">https://www.christianengvall.se/electron-packager-tutorial/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 18 Oct 2016 14:13:32 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-packager-tutorial/</guid>
        </item>
      
    
      
        <item>
          <title>Electron app icons</title>
          <link>https://www.christianengvall.se/electron-app-icons/</link>
          <comments>https://www.christianengvall.se/electron-app-icons/#respond</comments>
          <description>&lt;p&gt;It’s time to add Electron app icons to the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app&lt;/a&gt;. For this we need a png-icon, a .icns for macs and a .ico for windows. For Linux we only need the pngs.&lt;/p&gt;

&lt;p&gt;This code is added to the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Electron tutorial app on github&lt;/a&gt;. Have a look at that repository if you would like to see all the source code.&lt;/p&gt;

&lt;p&gt;The icons need to be set when creating a new BrowserWindow. But they need also be set when packaging the app. So by setting it in the code won’t make any difference when debugging your app with &lt;strong&gt;electron .&lt;/strong&gt; That’s why we’ll first take a look at the code. Then we’ll take a look at packaging our app with electron-packager. But don’t worry, it’s an easy task.&lt;/p&gt;

&lt;h2 id=&quot;1-creating-our-icns-and-ico-files&quot;&gt;1. Creating our icns and ico-files&lt;/h2&gt;
&lt;p&gt;First we need an icon that is 1024x1024 pixels large and saved in PNG. I’ve got one looking like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/icon.png&quot; aria-label=&quot;Electron tutorial app icon&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/icon.png&quot; alt=&quot;Electron tutorial app icon&quot; width=&quot;1024&quot; height=&quot;1024&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/icon.png&quot; alt=&quot;Electron tutorial app icon&quot; width=&quot;1024&quot; height=&quot;1024&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron tutorial app icon&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now go to &lt;a href=&quot;https://iconverticons.com/online/&quot;&gt;ICONVERT ICONS&lt;/a&gt; and upload the PNG and the service will take care of creating the other icon-formats.&lt;/p&gt;

&lt;h2 id=&quot;2-folder-structure&quot;&gt;2. Folder structure&lt;/h2&gt;
&lt;p&gt;Now create a folder structure that looks like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/Electron-icon-folder-structure-.png&quot; aria-label=&quot;electron icon folder structure&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/Electron-icon-folder-structure-.png&quot; alt=&quot;electron icon folder structure&quot; width=&quot;1109&quot; height=&quot;543&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/Electron-icon-folder-structure-.png&quot; alt=&quot;electron icon folder structure&quot; width=&quot;1109&quot; height=&quot;543&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;electron icon folder structure&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Create a folder called icons in the assets folder. And in that folder create one folder called mac, one called png and one called win. Put the .icns-file into the mac folder, the pngs in the png folder and the .ico file in the win folder.&lt;/p&gt;

&lt;h2 id=&quot;3-updating-mainjs-with-path-to-icon&quot;&gt;3. Updating main.js with path to icon&lt;/h2&gt;
&lt;p&gt;Open main.js and add &lt;code class=&quot;highlighter-rouge&quot;&gt;icon: path.join(__dirname, 'assets/icons/png/64x64.png')&lt;/code&gt; when instantiating the BrowserWindow. But also var path = require(‘path’) at the top of the main.js.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;titleBarStyle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;backgroundColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#312450&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;assets/icons/png/64x64.png&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;At this point you can see the icon when running the app in Ubuntu. (Read how to get going with &lt;a href=&quot;/testing-electron-app-on-ubuntu-linux/&quot;&gt;electron in ubuntu&lt;/a&gt;).&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/10/Electron-icon-ubuntu-1024x611.png &quot; aria-label=&quot;Electron icon ubuntu&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/10/Electron-icon-ubuntu-1024x611.png &quot; alt=&quot;Electron icon ubuntu&quot; width=&quot;1024&quot; height=&quot;611&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/10/Electron-icon-ubuntu-1024x611.png &quot; alt=&quot;Electron icon ubuntu&quot; width=&quot;1024&quot; height=&quot;611&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron icon ubuntu&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The next step is to create an executable for MacOS and Windows with the icon we need to package the app. This next step is covered in &lt;a href=&quot;/electron-packager-tutorial/&quot;&gt;Electron packager tutorial&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-app-icons/">https://www.christianengvall.se/electron-app-icons/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 18 Oct 2016 14:12:15 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-app-icons/</guid>
        </item>
      
    
      
        <item>
          <title>Electron white screen app startup</title>
          <link>https://www.christianengvall.se/electron-white-screen-app-startup/</link>
          <comments>https://www.christianengvall.se/electron-white-screen-app-startup/#respond</comments>
          <description>&lt;p&gt;This post will cover how to fix the electron white screen app startup. If you start the &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;electron tutorial app&lt;/a&gt; you can see it flashes white and then loads the css setting the correct color. The electron API currently allows two ways of fixing this.&lt;/p&gt;

&lt;p&gt;This is what the the tutorial app looks like when it starts before applying this fix.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/09/electron-flashing-white.gif&quot; aria-label=&quot;Electron - flashing white on startup&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/09/electron-flashing-white.gif&quot; alt=&quot;Electron - flashing white on startup&quot; width=&quot;1384&quot; height=&quot;865&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/09/electron-flashing-white.gif&quot; alt=&quot;Electron - flashing white on startup&quot; width=&quot;1384&quot; height=&quot;865&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron - flashing white on startup&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;setting-backgroundcolor&quot;&gt;Setting backgroundColor&lt;/h2&gt;
&lt;p&gt;One way is to let the app flash before load, but setting the white color to something else. In this case it would be #312450. This is a setting on the BrowserWindow and in our tutorial app we set it on line 13 in main.js.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;titleBarStyle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;backgroundColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#312450&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If this works well with your app this is a good alternative because it will appear to load your app faster than the other one we will look at now. If your app has more than one background color, like the tutorial app does (the menu background and the main container background), setting the startup background color is not enough. But this is a matter of taste, there is no right or wrong. This is what the official docs say:&lt;/p&gt;

&lt;blockquote&gt;&quot;Note that even for apps that use ready-to-show event, it is still recommended to set backgroundColor to make app feel more native.&quot;&lt;/blockquote&gt;

&lt;h2 id=&quot;ready-to-show-event&quot;&gt;ready-to-show event&lt;/h2&gt;
&lt;p&gt;This technique waits for the event ready-to-show to fire. When that happens we take care of showing the window. But before doing that we need to tell the mainWindow to not show when we init a new BrowserWindow.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;titleBarStyle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;backgroundColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#312450&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
     &lt;span class=&quot;na&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we need to tell it to show on the ready-to-show event. Put these lines in the function createWindow in main.js.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;once&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ready-to-show&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now the app looks like this when starting&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/09/electron-ready-to-show.gif&quot; aria-label=&quot;electron - using ready-to-show event&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/09/electron-ready-to-show.gif&quot; alt=&quot;electron - using ready-to-show event&quot; width=&quot;1384&quot; height=&quot;865&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/09/electron-ready-to-show.gif&quot; alt=&quot;electron - using ready-to-show event&quot; width=&quot;1384&quot; height=&quot;865&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;electron - using ready-to-show event&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;You can read more about this in the &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/#showing-window-gracefully&quot;&gt;official docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next tutorial is about &lt;a href=&quot;/electron-app-icons/&quot;&gt;Electron app icons&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-white-screen-app-startup/">https://www.christianengvall.se/electron-white-screen-app-startup/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 09 Sep 2016 12:14:27 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-white-screen-app-startup/</guid>
        </item>
      
    
      
        <item>
          <title>Midi from Reason to Logic</title>
          <link>https://www.christianengvall.se/midi-reason-logic/</link>
          <comments>https://www.christianengvall.se/midi-reason-logic/#respond</comments>
          <description>&lt;p&gt;I had a few piano songs recorded in Reason. But i wanted to copy the midi from Reason to Logic because that’s the software I use to record things now.&lt;/p&gt;

&lt;p&gt;Last time I used Reason was when version 3 was released. So it was quite a long time ago. Could it have been around 2006? However… my first thought was to get hold of Reason 3 somehow and see if i could manually copy the midi tracks. Turns out that wasn’t needed at all.&lt;/p&gt;

&lt;h2 id=&quot;reason-9&quot;&gt;Reason 9&lt;/h2&gt;
&lt;p&gt;Propellerhead has made &lt;a href=&quot;https://www.propellerheads.se/reason/tryreason&quot;&gt;Reason 9 available to use as a trial for 30 days&lt;/a&gt;. So i installed the trial version and tried to open my old recordings. And thankfully it worked well! Even if i used some plugins or instruments that didn’t exist in the new version i could still see that the song was there, but i couldn’t listen to it. If you get this window when opening your song you can just close it.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/09/Missing-sounds.png&quot; aria-label=&quot;Missing sounds&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/09/Missing-sounds.png&quot; alt=&quot;Missing sounds&quot; width=&quot;603&quot; height=&quot;147&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/09/Missing-sounds.png&quot; alt=&quot;Missing sounds&quot; width=&quot;603&quot; height=&quot;147&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Missing sounds&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Next click the &lt;strong&gt;File&lt;/strong&gt; menu and select &lt;strong&gt;Export midi file&lt;/strong&gt;… and save it where ever you like.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/09/File-export-midi.png&quot; aria-label=&quot;File export midi&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/09/File-export-midi.png&quot; alt=&quot;File export midi&quot; width=&quot;276&quot; height=&quot;520&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/09/File-export-midi.png&quot; alt=&quot;File export midi&quot; width=&quot;276&quot; height=&quot;520&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;File export midi&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;logic&quot;&gt;Logic&lt;/h2&gt;
&lt;p&gt;Now open up a new project in Logic and go to &lt;strong&gt;File-&amp;gt; import -&amp;gt; Midi file&lt;/strong&gt; and select the midi file you just exported from Reason.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/09/File-import-midi.png&quot; aria-label=&quot;File import midi&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/09/File-import-midi.png&quot; alt=&quot;File import midi&quot; width=&quot;558&quot; height=&quot;567&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/09/File-import-midi.png&quot; alt=&quot;File import midi&quot; width=&quot;558&quot; height=&quot;567&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;File import midi&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Logic will add the tracks for you. You will get a question about the tempo of the song. i choose not to import the tempo. Not sure why though… i’m a developer… not a producer… don’t ask me those hard questions!&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/09/Logic-1024x584.png&quot; aria-label=&quot;Logic&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/09/Logic-1024x584.png&quot; alt=&quot;Logic&quot; width=&quot;1024&quot; height=&quot;584&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/09/Logic-1024x584.png&quot; alt=&quot;Logic&quot; width=&quot;1024&quot; height=&quot;584&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Logic&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/midi-reason-logic/">https://www.christianengvall.se/midi-reason-logic/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 02 Sep 2016 08:57:11 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/midi-reason-logic/</guid>
        </item>
      
    
      
        <item>
          <title>Electron frameless window</title>
          <link>https://www.christianengvall.se/electron-frameless-window/</link>
          <comments>https://www.christianengvall.se/electron-frameless-window/#respond</comments>
          <description>&lt;p&gt;Now it’s time to look at the Electron frameless window functionality. Using a frameless window removes the menu and menubar in your app. The electron documentation defines it as:&lt;/p&gt;

&lt;blockquote&gt;&quot;A frameless window is a window that has no [chrome](https://developer.mozilla.org/en-US/docs/Glossary/Chrome), the parts of the window, like toolbars, that are not a part of the web page.&quot;&lt;/blockquote&gt;

&lt;h2 id=&quot;alternatives&quot;&gt;Alternatives&lt;/h2&gt;
&lt;p&gt;There are two alternatives to choose between. Either remove the frame for all three platforms using &lt;strong&gt;frame: false&lt;/strong&gt; when initializing the browserwindow in main.js. Or you can use &lt;strong&gt;titleBarStyle: ‘hidden’&lt;/strong&gt;. This alternative is only for macOS. Lets look at them both.&lt;/p&gt;

&lt;p&gt;If you remove the frame around your app, the user also looses the ability to move the application around on the desktop. So we need to give that functionality back to the user. We do that with draggable regions. But more on that later.&lt;/p&gt;

&lt;h3 id=&quot;framefalse&quot;&gt;Frame:false&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This removes all the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Glossary/Chrome&quot;&gt;chrome&lt;/a&gt; around the application on all platforms. Then it is up to you to handle how the application closes, minimizes and maximizes. Electron provides api’s for this. so you can add buttons and style them the way you like. and then hook them up to the correct handler. Look at the &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/&quot;&gt;BrowserWindow&lt;/a&gt; class and the methods called &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/#winminimize&quot;&gt;minimize&lt;/a&gt;, &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/#winmaximize&quot;&gt;maximize&lt;/a&gt;, &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/#winunmaximize&quot;&gt;unmaximize&lt;/a&gt;, and &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/#winclose&quot;&gt;close&lt;/a&gt;. For macOS you don’t use maximize, instead you use &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/#winsetfullscreenflag&quot;&gt;setFullScreen&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is what the Electron tutorial app would look like when setting frame:false&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/electron-frameless-window.png&quot; aria-label=&quot;Electron frame false&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/electron-frameless-window-1024x670.png&quot; alt=&quot;Electron frame false&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/electron-frameless-window-1024x670.png&quot; alt=&quot;Electron frame false&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron frame false&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;titlebarstyle-hidden&quot;&gt;titleBarStyle Hidden&lt;/h3&gt;
&lt;p&gt;This is the macOS only alternative. It removes the titlebar but leaves the stop light buttons.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;titleBarStyle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Using this setting the app would look like this on macOS from Yosemite(10.10) and newer. On Windows and Linux there will be no change at all.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/electron-titlebarhidden.png&quot; aria-label=&quot;Electron titlebar hidden&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/electron-titlebarhidden-1024x670.png&quot; alt=&quot;Electron titlebar hidden&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/electron-titlebarhidden-1024x670.png&quot; alt=&quot;Electron titlebar hidden&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron titlebar hidden&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;I like the option to remove the titlebar on macOS and leaving it as is on Linux and Windows. So i’m going for the titleBarStyle: ‘hidden’ setting.&lt;/p&gt;

&lt;h3 id=&quot;hidden-inset&quot;&gt;Hidden-inset&lt;/h3&gt;
&lt;p&gt;There is also a titleBarStyle: ‘hidden-inset’. The docs explain it like this:&lt;/p&gt;

&lt;blockquote&gt;&quot;results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.&quot;&lt;/blockquote&gt;

&lt;h2 id=&quot;draggable-region&quot;&gt;Draggable region&lt;/h2&gt;
&lt;p&gt;As said earlier, when using frameless window the user looses the ability to drag your application around the desktop. Let’s fix that. Electron handles this with css.&lt;/p&gt;

&lt;p&gt;To make the whole window draggable you can set &lt;strong&gt;-webkit-app-region: drag&lt;/strong&gt; on the body element. To do that in the electron tutorial app open up &lt;strong&gt;assets/sass/base/_page.scss&lt;/strong&gt; and add this to the body.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;-ms-overflow-style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scrollbar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;-webkit-app-region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;drag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This makes our window draggable again. But it makes it a little to much draggable. For example the buttons will be draggable and the user won’t be able to click them. We’ll fix this with &lt;strong&gt;-webkit-app-region: no-drag;&lt;/strong&gt; open up &lt;strong&gt;assets/sass/components/_button.scss&lt;/strong&gt; and that property to button, textarea and input types submit, reset, button and text.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;submit&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;reset&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;text&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;textarea&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;-webkit-app-region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;no-drag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you implement your own titlebar and the user tries to move your app by dragging it the text in the titlebar may become selected. And we don’t want that. we can set this with &lt;strong&gt;-webkit-user-select: none;&lt;/strong&gt; The electron tutorial app uses h1 as some kind of titlebar. Let’s remove the users ability to select headers.&lt;/p&gt;

&lt;p&gt;Open up &lt;strong&gt;assets/sass/base/_typography.scss&lt;/strong&gt; and go down to line 57 where you add this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nt&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;h3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;h4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;h5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;h6&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;-webkit-user-select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can read more about &lt;a href=&quot;http://electron.atom.io/docs/api/frameless-window/&quot;&gt;Frameless window at the official docs&lt;/a&gt; or you can continue this tutorial with the &lt;a href=&quot;/electron-white-screen-app-startup/&quot;&gt;Electron white screen app startup&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-frameless-window/">https://www.christianengvall.se/electron-frameless-window/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 29 Aug 2016 09:18:03 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-frameless-window/</guid>
        </item>
      
    
      
        <item>
          <title>Electron app navigation</title>
          <link>https://www.christianengvall.se/electron-app-navigation/</link>
          <comments>https://www.christianengvall.se/electron-app-navigation/#respond</comments>
          <description>&lt;p&gt;It’s time to implement an electron app navigation in the &lt;a href=&quot;/electron-hello-world/&quot;&gt;Electron tutorial app&lt;/a&gt;. Not the main kind of menubar but a left menu kind. For this step some use react or some other framework. But i wanted to keep it simple so this tutorial does not use a UI framework. This is the way the navigation is implemented in the &lt;a href=&quot;https://github.com/electron/electron-api-demos&quot;&gt;Electron api demos application&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The name of the app is now called Electron tutorial app instead of electron hello world as it was before. I thought that name suits it better since it’s not only a hello world from now on. To get the source code of this application as it looks at the end of this tutorial you can &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/tree/d3efa228d991d9906526cee12b9711ff3dfc2385&quot;&gt;download it from github&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;1-adding-a-design&quot;&gt;1. Adding a design&lt;/h2&gt;
&lt;p&gt;First off the app looks pretty dull and does not have a menu. Since the design is out of scope for the tutorial we will use a template from HTML5up called &lt;a href=&quot;https://html5up.net/hyperspace&quot;&gt;hyperspace&lt;/a&gt;. Go ahead and download it.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Electron-tutorial-app-dull-look.png&quot; aria-label=&quot;Electron tutorial app - dull look&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Electron-tutorial-app-dull-look.png&quot; alt=&quot;Electron tutorial app - dull look&quot; width=&quot;912&quot; height=&quot;712&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Electron-tutorial-app-dull-look.png&quot; alt=&quot;Electron tutorial app - dull look&quot; width=&quot;912&quot; height=&quot;712&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron tutorial app - dull look&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Once you’ve downloaded and unpacked hyperspace, copy the folder called assets into the root folder of our electron app. Then copy this HTML-markup into our index.html.&lt;/p&gt;

&lt;p&gt;This is the hyperspace markup but with two differences&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Internet explorer specific css has been removed. Electron uses chromium.&lt;/li&gt;
  &lt;li&gt;The import of jquery at the bottom has been changed&lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE HTML&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--
 Hyperspace by HTML5 UP
 html5up.net | @ajlkn
 Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
--&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Electron tutorial app&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;utf-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/css/main.css&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Sidebar --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sidebar&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;nav&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#intro&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Welcome&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#one&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Who we are&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#two&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;What we do&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#three&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Get in touch&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Wrapper --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Intro --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;intro&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style1 fullscreen fade-up&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Electron tutorial app!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hopefully this helps someone to get up to speed with electron.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#one&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button scrolly&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- One --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;one&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style2 spotlights&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;image&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;images/pic01.jpg&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-position=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;center center&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Sed ipsum dolor&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;image&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;images/pic02.jpg&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-position=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;top center&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Feugiat consequat&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;image&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;images/pic03.jpg&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-position=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;25% 25%&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Ultricies aliquam&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Two --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;two&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style3 fade-up&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;What we do&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus, lacus eget hendrerit bibendum, urna est aliquam sem, sit amet imperdiet est velit quis lorem.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;features&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-code&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Lorem ipsum amet&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-lock&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Aliquam sed nullam&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-cog&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Sed erat ullam corper&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-desktop&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Veroeros quis lorem&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-chain&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Urna quis bibendum&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-diamond&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Aliquam urna dapibus&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Three --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;three&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style1 fade-up&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Get in touch&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus, lacus eget hendrerit bibendum, urna est aliquam sem, sit amet imperdiet est velit quis lorem.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;split style1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;form&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;post&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;field half first&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;for=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Name&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;field half&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;for=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Email&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;field&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;for=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;message&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Message&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;message&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;message&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rows=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button submit&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Send Message&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;contact&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Address&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&amp;gt;&lt;/span&gt;12345 Somewhere Road #654&lt;span class=&quot;nt&quot;&gt;&amp;lt;br&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 Nashville, TN 00000-0000&lt;span class=&quot;nt&quot;&gt;&amp;lt;br&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 USA&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Email&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;user@untitled.tld&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Phone&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&amp;gt;&lt;/span&gt;(000) 000-0000&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Social&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icons&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-twitter&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Twitter&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-facebook&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Facebook&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-github&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;GitHub&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-instagram&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Instagram&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-linkedin&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;LinkedIn&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Footer --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;footer&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;footer&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style1-alt&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;menu&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;&amp;amp;copy;&lt;/span&gt; Untitled. All rights reserved.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;/span&gt;Design: &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://html5up.net&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;HTML5 UP&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/footer&amp;gt;&lt;/span&gt;

 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Scripts --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/jquery.min.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/jquery.scrollex.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/jquery.scrolly.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/skel.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/util.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/main.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The media query that show the menu in hyperspace is defined to be over 1280 pixels. So go into our main.js file and go to line 13 and make it look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;minWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1281&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;minHeight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We change the startup width to 1281, the startup height to 800 and setting the minWidth and minHeight to the same values. You can read more about the &lt;a href=&quot;http://electron.atom.io/docs/api/browser-window/&quot;&gt;BrowserWindow Class&lt;/a&gt; and it’s properties at the official documentation.&lt;/p&gt;

&lt;p&gt;If you fire up the electron app now it looks very fancy ! &lt;a href=&quot;http://www.christianengvall.se/electron-hello-world/&quot;&gt;(Read the hello world if you need help firing it up)&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Electron-tutorial-app-new-look.png&quot; aria-label=&quot;Electron tutorial app - new look&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Electron-tutorial-app-new-look-1024x670.png&quot; alt=&quot;Electron tutorial app - new look&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Electron-tutorial-app-new-look-1024x670.png&quot; alt=&quot;Electron tutorial app - new look&quot; width=&quot;1024&quot; height=&quot;670&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron tutorial app - new look&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;You can download the repo at this stage &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app/archive/ab8526b4e5195b6c38c5c28e44b20661e6f87d46.zip&quot;&gt;from this commit&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;2-making-the-sidebar-menu-load-content&quot;&gt;2 .Making the sidebar menu load content&lt;/h2&gt;
&lt;p&gt;Hyperspace is a single page layout. So it works as it is now. But that’s not what i’m going for. If you scroll the main window you can see all the pages in our app. And if you click on a menu item you will be scrolled down to that section. An app with a lot of menu items will create a lot of markup in index.html this way. In this step we’ll make all the menu items load it’s own .html file with the markup we want.&lt;/p&gt;

&lt;h3 id=&quot;21-extract-sections&quot;&gt;2.1 Extract sections&lt;/h3&gt;
&lt;p&gt;Create a new folder called sections and add four new files to it that are called: &lt;strong&gt;getintouch.html&lt;/strong&gt;, &lt;strong&gt;welcome.html&lt;/strong&gt;, &lt;strong&gt;whatwedo.html&lt;/strong&gt; and &lt;strong&gt;whoweare.html&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The contents in these files are the different sections you can find in index.html at this point. But when they are extracted i also wrap a &lt;a href=&quot;http://www.html5rocks.com/en/tutorials/webcomponents/template/&quot;&gt;template&lt;/a&gt; tag around the sections. They will be used in the javascript later on. I’ve also deleted the fade-in classes on the sections because the didn’t work that well. They also got new id’s.&lt;/p&gt;

&lt;h4 id=&quot;getintouchhtml&quot;&gt;getintouch.html&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-template&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getintouch&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Get in touch&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus, lacus eget hendrerit bibendum, urna est aliquam sem, sit amet imperdiet est velit quis lorem.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;split style1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;form&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;post&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;field half first&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;for=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Name&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;field half&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;for=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Email&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;email&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;field&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;for=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;message&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Message&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;message&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;message&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rows=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button submit&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Send Message&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;contact&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Address&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&amp;gt;&lt;/span&gt;12345 Somewhere Road #654&lt;span class=&quot;nt&quot;&gt;&amp;lt;br&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 Nashville, TN 00000-0000&lt;span class=&quot;nt&quot;&gt;&amp;lt;br&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 USA&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Email&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;user@untitled.tld&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Phone&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&amp;gt;&lt;/span&gt;(000) 000-0000&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Social&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icons&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-twitter&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Twitter&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-facebook&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Facebook&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-github&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;GitHub&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-instagram&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Instagram&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fa-linkedin&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;label&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;LinkedIn&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;welcomehtml&quot;&gt;welcome.html&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-template&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style1 fullscreen intro&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Electron tutorial app!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hopefully this helps someone to get up to speed with electron.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#one&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button scrolly&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;whatwedohtml&quot;&gt;whatwedo.html&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-template&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;whatwedo&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style3&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;What we do&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus, lacus eget hendrerit bibendum, urna est aliquam sem, sit amet imperdiet est velit quis lorem.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;features&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-code&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Lorem ipsum amet&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-lock&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Aliquam sed nullam&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-cog&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Sed erat ullam corper&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-desktop&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Veroeros quis lorem&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-chain&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Urna quis bibendum&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;icon major fa-diamond&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;Aliquam urna dapibus&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullam corper amet et pulvinar. Duis aliquam turpis mauris, sed ultricies erat dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;whowearehtml&quot;&gt;whoweare.html&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;section-template&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;whoweare&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper style2 spotlights&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Sed ipsum dolor&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Feugiat consequat&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;section&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;content&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inner&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Ultricies aliquam&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Phasellus convallis elit id ullamcorper pulvinar. Duis aliquam turpis mauris, eu ultricies erat malesuada quis. Aliquam dapibus.&lt;span class=&quot;nt&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Learn more&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;22-empty-indexhtml-wrapper&quot;&gt;2.2 Empty index.html wrapper&lt;/h3&gt;
&lt;p&gt;Now the sections are extracted into their own respective files we can empty the div with the id wrapper in index.html. This is not the full index.html, only what the wrapper looks like. the HTML above and under should be left as is.&lt;/p&gt;

&lt;h4 id=&quot;indexhml&quot;&gt;index.hml&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt; &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Wrapper --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wrapper&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Footer --&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-preparing-the-menu-and-importing-sections&quot;&gt;3. Preparing the menu and importing sections&lt;/h2&gt;

&lt;h3 id=&quot;31-data-section&quot;&gt;3.1 data-section&lt;/h3&gt;
&lt;p&gt;In index.html there is a navigation in the sidebar section. Update the anchor tags to look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome-menu&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;welcome&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Welcome&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;whoweare&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Who we are&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;whatwedo&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;What we do&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-section=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getintouch&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Get in touch&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ve added a data-section attribute with the value of the file names that we created in step 2. We’ll later use this when loading the sections with javascript.&lt;/p&gt;

&lt;h3 id=&quot;32-importing-section-html-files&quot;&gt;3.2 Importing section html files&lt;/h3&gt;
&lt;p&gt;Update the head-section in index.html to look like below. We use import so that chromium can load the contents before we need to use them in our javascript. You can read more about how the rel=”import” works on &lt;a href=&quot;http://www.html5rocks.com/en/tutorials/webcomponents/imports/&quot;&gt;html5rocks&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Electron&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tutorial&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/title&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;meta&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;meta&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;viewport&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;width=device-width, initial-scale=1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stylesheet&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;assets/css/main.css&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sections/getintouch.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sections/welcome.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sections/whatwedo.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sections/whoweare.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/head&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-making-the-menu-do-something&quot;&gt;4. Making the menu do something&lt;/h2&gt;
&lt;p&gt;Add a new script to the assets/js folder called menu.js and import in in index.html with the require function.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt; &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- Scripts --&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/jquery.min.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/jquery.scrollex.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/jquery.scrolly.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/skel.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/util.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;assets/js/main.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./assets/js/menu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And now to the contents of menu.js:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{},&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;na&quot;&gt;constants&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;na&quot;&gt;sectionTemplate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.section-template&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
 &lt;span class=&quot;na&quot;&gt;contentContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#wrapper&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
 &lt;span class=&quot;na&quot;&gt;startSectionMenuItem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#welcome-menu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
 &lt;span class=&quot;na&quot;&gt;startSection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#welcome&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

 &lt;span class=&quot;na&quot;&gt;importSectionsToDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;links&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;link[rel=&quot;import&quot;]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nb&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;links&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constants&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sectionTemplate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;clone&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;importNode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constants&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;clone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

 &lt;span class=&quot;na&quot;&gt;setMenuOnClickEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dataset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;section&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hideAllSections&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showSection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

 &lt;span class=&quot;na&quot;&gt;showSection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sectionId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dataset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;section&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sectionId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sectionId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; section&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

 &lt;span class=&quot;na&quot;&gt;showStartSection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constants&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;startSectionMenuItem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constants&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;startSection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constants&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;startSection&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; section&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

 &lt;span class=&quot;na&quot;&gt;hideAllSections&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constants&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentContainer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; section&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

 &lt;span class=&quot;na&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;importSectionsToDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setMenuOnClickEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;showStartSection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;navigation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Lets go trough it. Start by looking in the init() function. This function will run when the document is loaded. It calls importSectionsToDOM(), setMenuOnClickEvent() and showStartSection().&lt;/p&gt;

&lt;h3 id=&quot;importsectionstodom&quot;&gt;importSectionsToDom()&lt;/h3&gt;
&lt;p&gt;This function loads all the rel=”imports” that we added to the head section in index.html and adds it to the div with id #wrapper in index.html.&lt;/p&gt;

&lt;h3 id=&quot;setmenuonclickevent&quot;&gt;setMenuOnClickEvent()&lt;/h3&gt;
&lt;p&gt;This function adds an eventlistener and looks for events where the data attribute section is set. If it is it calls hideAllSections() and showSection(event). More on these soon.&lt;/p&gt;

&lt;h3 id=&quot;showstartsection&quot;&gt;showStartSection()&lt;/h3&gt;
&lt;p&gt;We need to show a section when the app is started the first time. That is what this function does. Line 36 make sure that the first menu item is clicken, 37 and 38 makes the start section show.&lt;/p&gt;

&lt;h3 id=&quot;hideallsections&quot;&gt;hideAllSections()&lt;/h3&gt;
&lt;p&gt;This function is called before a new sections is shown. As the name hints it hides all the other sections so they are not in the way of the one that is about to show.&lt;/p&gt;

&lt;h3 id=&quot;showsectionevent&quot;&gt;showSection(event)&lt;/h3&gt;
&lt;p&gt;If the user has clicked a menu item this function will be called on line 24. it takes the id of the section to be shown and uses jquerys show to display it.&lt;/p&gt;

&lt;p&gt;This makes our menu work. But the hyperspace template needs some updates to make it work better.&lt;/p&gt;

&lt;h2 id=&quot;5-updating-hyperspace-to-work-with-our-menu&quot;&gt;5. Updating hyperspace to work with our menu&lt;/h2&gt;
&lt;p&gt;Hyperspace uses &lt;a href=&quot;http://sass-lang.com/&quot;&gt;sass&lt;/a&gt; so we’ll continue to do that. If you don’t want to do that. you can do the changes directly to assets/css/main.css or just download the &lt;a href=&quot;https://raw.githubusercontent.com/crilleengvall/electron-tutorial-app/master/assets/css/main.css&quot;&gt;css&lt;/a&gt; from the repo and replace the your own file with it.&lt;/p&gt;

&lt;h3 id=&quot;51-adding-configrb&quot;&gt;5.1 Adding config.rb&lt;/h3&gt;
&lt;p&gt;Add this content to a file and name it config.rb to get the correct paths to sass files. Save it in the same directory as index.html&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;css_dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;assets/css&quot;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by Compass.app&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sass_dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;assets/sass&quot;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by Compass.app&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;images_dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;assets/css/images&quot;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by Compass.app&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;output_style&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:compressed&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# :expanded or :nested or :compact or :compressed&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;relative_assets&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by Compass.app&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;line_comments&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by Compass.app&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sass_options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:debug_info&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by Compass.app&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sourcemap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# by Compass.app&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;52-updating-some-styles&quot;&gt;5.2 Updating some styles&lt;/h3&gt;
&lt;p&gt;open the file &lt;strong&gt;assets/sass/components/_section.scss&lt;/strong&gt; and add this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nf&quot;&gt;#wrapper&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;section&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next go into &lt;strong&gt;assets/sass/layout/_intro.scss&lt;/strong&gt; and change #intro to .intro and add .inner:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nc&quot;&gt;.intro&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background-attachment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;fixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;url('images/intro.svg')&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background-position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;top&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background-repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;no-repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nl&quot;&gt;background-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;err&quot;&gt;.inner&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nl&quot;&gt;padding-top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;255px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;53-updating-hyperspace-javascripts&quot;&gt;5.3 Updating hyperspace javascripts&lt;/h3&gt;
&lt;p&gt;Hyperspace uses &lt;a href=&quot;https://github.com/ajlkn/jquery.scrollex&quot;&gt;scrollex&lt;/a&gt; on some pages, that does not work to well now when we split the sections to separate files. open up &lt;strong&gt;assets/js/main.js&lt;/strong&gt; then go to line 149 and comment out that function all the way to line line 185:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// Spotlights.&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;/*$('.spotlights &amp;gt; section')
	.scrollex({
		mode: 'middle',
		top: '-10vh',
		bottom: '-10vh',
		initialize: function() {

		// Deactivate section.
			if (skel.canUse('transition'))					
                            $(this).addClass('inactive');
			},
			enter: function() {
			// Activate section.
				$(this).removeClass('inactive');
			     }
			})
			.each(function() {
				var	$this = $(this),
				$image = $this.find('.image'),
				$img = $image.find('img'),
				x;

				// Assign image.
				$image.css('background-image', 'url(' + $img.attr('src') + ')');
				// Set background position.
					if (x = $img.data('position'))
					    $image.css('background-position', x);
					// Hide .
						$img.hide();
});*/&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Features.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thats it for this short(oh my satan it’s to long!) tutorial.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-app-navigation/">https://www.christianengvall.se/electron-app-navigation/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 26 Aug 2016 09:44:55 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-app-navigation/</guid>
        </item>
      
    
      
        <item>
          <title>Screenbar version 0.2 released</title>
          <link>https://www.christianengvall.se/new-version-screenbar/</link>
          <comments>https://www.christianengvall.se/new-version-screenbar/#respond</comments>
          <description>&lt;p&gt;Screenbar is a Mac os Menubar application that helps you to set a timer to take screenshots. I recently did a minor update to it.&lt;/p&gt;

&lt;h2 id=&quot;update&quot;&gt;Update&lt;/h2&gt;
&lt;p&gt;You can now &lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar from App store&quot;&gt;download Screenbar from the App Store&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;settings&quot;&gt;Settings&lt;/h2&gt;
&lt;p&gt;The settings popup has been updated with a setting to select save path for your screenshots.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Screenbar-v02-settings-1.png&quot; aria-label=&quot;Screenbar v0.2 settings&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Screenbar-v02-settings-1.png&quot; alt=&quot;Screenbar v0.2 settings&quot; width=&quot;411&quot; height=&quot;175&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Screenbar-v02-settings-1.png&quot; alt=&quot;Screenbar v0.2 settings&quot; width=&quot;411&quot; height=&quot;175&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar v0.2 settings&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;icon&quot;&gt;Icon&lt;/h2&gt;
&lt;p&gt;The Screenbar icon is nothing fancy at all. Nevertheless the icon has been added in all the &lt;a href=&quot;https://developer.apple.com/library/prerelease/content/documentation/UserExperience/Conceptual/OSXHIGuidelines/Designing.html#//apple_ref/doc/uid/20000957-CH87-SW1&quot;&gt;different sizes a mac os application needs&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Screenbar-v02-icon.png&quot; aria-label=&quot;Screenbar v0.2 icon&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Screenbar-v02-icon.png&quot; alt=&quot;Screenbar v0.2 icon&quot; width=&quot;1024&quot; height=&quot;1024&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Screenbar-v02-icon.png&quot; alt=&quot;Screenbar v0.2 icon&quot; width=&quot;1024&quot; height=&quot;1024&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar v0.2 icon&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/new-version-screenbar/">https://www.christianengvall.se/new-version-screenbar/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 22 Aug 2016 18:54:11 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/new-version-screenbar/</guid>
        </item>
      
    
      
        <item>
          <title>Testing electron app on Ubuntu linux</title>
          <link>https://www.christianengvall.se/testing-electron-app-on-ubuntu-linux/</link>
          <comments>https://www.christianengvall.se/testing-electron-app-on-ubuntu-linux/#respond</comments>
          <description>&lt;p&gt;Testing electron app on Ubuntu linux is easy with VirtualBox and an Ubuntu ISO. All you need to do is some configuration to share your electron app between the host (your machine) and the guest (Ubuntu). The app we’ll be testing is the &lt;a href=&quot;/electron-hello-world/&quot;&gt;Electron hello world&lt;/a&gt; app that is covered in another tutorial.&lt;/p&gt;

&lt;h2 id=&quot;1-installing-ubuntu&quot;&gt;1. Installing ubuntu&lt;/h2&gt;
&lt;p&gt;The installation process took a lot of space so it’s been published in its own &lt;a href=&quot;/install-ubuntu-virtualbox/&quot;&gt;Install Ubuntu on VirtualBox&lt;/a&gt; tutorial.&lt;/p&gt;

&lt;h2 id=&quot;2-sharing-electron-project-folder-from-host&quot;&gt;2. Sharing electron project folder from host&lt;/h2&gt;
&lt;p&gt;This is one way to do it. You could also add the electron app to a git repo and push it from the host and pull it down to guest machine. The approach described below makes it possible for you to test the app on Linux before committing the changes to the repo.&lt;/p&gt;

&lt;p&gt;Make sure you have installed the guest additions as explained in step 1.&lt;/p&gt;

&lt;p&gt;Click on the folder icon at the bottom of the virtual machine window and select &lt;strong&gt;Shared Folder Settings…&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Shared-folder-settings-ubuntu-vb.png&quot; aria-label=&quot;Shared folder settings - ubuntu&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Shared-folder-settings-ubuntu-vb-1024x706.png&quot; alt=&quot;Shared folder settings - ubuntu&quot; width=&quot;1024&quot; height=&quot;706&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Shared-folder-settings-ubuntu-vb-1024x706.png&quot; alt=&quot;Shared folder settings - ubuntu&quot; width=&quot;1024&quot; height=&quot;706&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Shared folder settings - ubuntu&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Then click on the green plus sign to the left. And set the Path to your electron project in &lt;strong&gt;Folder path.&lt;/strong&gt; If you followed the &lt;a href=&quot;/electron-hello-world/&quot;&gt;Electron hello world&lt;/a&gt; the folder name will be called electron-hello-world&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Shared-Folders-VirtualBox-add-folder.png&quot; aria-label=&quot;Shared Folders - VirtualBox add folder&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Shared-Folders-VirtualBox-add-folder-1024x646.png&quot; alt=&quot;Shared Folders - VirtualBox add folder&quot; width=&quot;1024&quot; height=&quot;646&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Shared-Folders-VirtualBox-add-folder-1024x646.png&quot; alt=&quot;Shared Folders - VirtualBox add folder&quot; width=&quot;1024&quot; height=&quot;646&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Shared Folders - VirtualBox add folder&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Create an empty directory in your home folder of Ubuntu. We will use this to mount our share folder in. I called mine electron-hello-world and added it to my home folder with the terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;electron-hello-world&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;next it is time to mount the share:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mount &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; vboxsf electron-hello-world electron-hello-world/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-install-nodejs-and-electron&quot;&gt;3. Install node.js and electron&lt;/h2&gt;
&lt;p&gt;To install Node.js on Ubuntu, type this in the terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;curl &lt;span class=&quot;nt&quot;&gt;-sL&lt;/span&gt; https://deb.nodesource.com/setup_4.x | &lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-E&lt;/span&gt; bash -
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; nodejs
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;npm&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When done, run this command in a terminal to install electron globally:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; electron-prebuilt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-running-you-electron-app&quot;&gt;4. Running you Electron app&lt;/h2&gt;
&lt;p&gt;Now you are ready to fire up the electron app.&lt;/p&gt;

&lt;p&gt;type the following in the terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;electron-hello-world
electron .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Electron-app-ubuntu.png&quot; aria-label=&quot;Electron app - ubuntu&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Electron-app-ubuntu-1024x690.png&quot; alt=&quot;Electron app - ubuntu&quot; width=&quot;1024&quot; height=&quot;690&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Electron-app-ubuntu-1024x690.png&quot; alt=&quot;Electron app - ubuntu&quot; width=&quot;1024&quot; height=&quot;690&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Electron app - ubuntu&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;That’s it for now. Next tutorial in this series is &lt;a href=&quot;/electron-app-navigation/&quot;&gt;Electron app navigation&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/testing-electron-app-on-ubuntu-linux/">https://www.christianengvall.se/testing-electron-app-on-ubuntu-linux/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 08 Aug 2016 10:03:08 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/testing-electron-app-on-ubuntu-linux/</guid>
        </item>
      
    
      
        <item>
          <title>Install Ubuntu - VirtualBox</title>
          <link>https://www.christianengvall.se/install-ubuntu-virtualbox/</link>
          <comments>https://www.christianengvall.se/install-ubuntu-virtualbox/#respond</comments>
          <description>&lt;p&gt;How to install Ubuntu on a VirtualBox virtual machine. It’s very simple and won’t cost you a dime. Don’t forget to install the guest additions at the end.&lt;/p&gt;

&lt;h2 id=&quot;virtualbox&quot;&gt;Virtualbox&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://www.virtualbox.org/&quot;&gt;Virtualbox&lt;/a&gt; is a virtualization software that is free and open source. Start by &lt;a href=&quot;https://www.virtualbox.org/wiki/Downloads&quot;&gt;downloading&lt;/a&gt; and installing it. It runs on Windows, MacOS, Linux distributions and Solaris.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Install-virtualbox.png&quot; aria-label=&quot;Install virtualbox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Install-virtualbox-1024x769.png&quot; alt=&quot;Install virtualbox&quot; width=&quot;1024&quot; height=&quot;769&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Install-virtualbox-1024x769.png&quot; alt=&quot;Install virtualbox&quot; width=&quot;1024&quot; height=&quot;769&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Install virtualbox&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;ubuntu&quot;&gt;Ubuntu&lt;/h2&gt;
&lt;p&gt;Ubuntu is a popular Linux distribution for desktops. It’s free and open source. So go ahead and &lt;a href=&quot;http://www.ubuntu.com/download/desktop&quot;&gt;download Ubuntu&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;1-creating-avirtual-machine-in-virtualbox&quot;&gt;1. Creating a virtual machine in Virtualbox&lt;/h2&gt;
&lt;p&gt;Fire up VirtualBox and click on the New button in the top left menu. When i started to type Ubuntu, VirtualBox automatically set type to linux and version to Ubuntu.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Name-and-operating-system-VirtualBox.png&quot; aria-label=&quot;Name and operating system - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Name-and-operating-system-VirtualBox-1024x794.png&quot; alt=&quot;Name and operating system - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Name-and-operating-system-VirtualBox-1024x794.png&quot; alt=&quot;Name and operating system - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Name and operating system - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Next step is to set the amount of memory that will be allocated. VirtualBox will recommend you a number. But you can choose anything you’d like. This can be changed later if the virtual machine runs slow.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Allocated-memory-virtual-box.png&quot; aria-label=&quot;Memory size - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Allocated-memory-virtual-box-1024x794.png&quot; alt=&quot;Memory size - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Allocated-memory-virtual-box-1024x794.png&quot; alt=&quot;Memory size - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Memory size - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Next you select a size of the hard disk. 8 gb that VirtualBox recommends will work fine. Now click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Harddisk-size-VirtualBox.png&quot; aria-label=&quot;Harddisk size - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Harddisk-size-VirtualBox-1024x794.png&quot; alt=&quot;Harddisk size - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Harddisk-size-VirtualBox-1024x794.png&quot; alt=&quot;Harddisk size - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Harddisk size - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Select VDI as hard disk file type&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Harddisk-file-type-VirtualBox.png&quot; aria-label=&quot;Hard disk file type - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Harddisk-file-type-VirtualBox-1024x794.png&quot; alt=&quot;Hard disk file type - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Harddisk-file-type-VirtualBox-1024x794.png&quot; alt=&quot;Hard disk file type - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Hard disk file type - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Next use dynamically allocated when asked.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Storage-on-physical-disk-VirtualBox.png&quot; aria-label=&quot;Storage on physical hard disk - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Storage-on-physical-disk-VirtualBox-1024x794.png&quot; alt=&quot;Storage on physical hard disk - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Storage-on-physical-disk-VirtualBox-1024x794.png&quot; alt=&quot;Storage on physical hard disk - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Storage on physical hard disk - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Set the disk size to the standard 8GB&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Ubuntu-file-location-VirtualBox.png&quot; aria-label=&quot;Ubuntu file location - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Ubuntu-file-location-VirtualBox-1024x794.png&quot; alt=&quot;Ubuntu file location - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Ubuntu-file-location-VirtualBox-1024x794.png&quot; alt=&quot;Ubuntu file location - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Ubuntu file location - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;2-installing-ubuntuon-the-new-virtual-machine&quot;&gt;2. Installing Ubuntu on the new virtual machine&lt;/h2&gt;
&lt;p&gt;Now when the virtual machine is created it’s time to mount the Ubuntu ISO and install it.&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;settings&lt;/strong&gt; with the newly created virtual machine selected.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Settings-VirtualBox-1.png&quot; aria-label=&quot;Settings - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Settings-VirtualBox-1-1024x794.png&quot; alt=&quot;Settings - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Settings-VirtualBox-1-1024x794.png&quot; alt=&quot;Settings - VirtualBox&quot; width=&quot;1024&quot; height=&quot;794&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Settings - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now go to the storage pane and select the IDE controller, then click on the CD-icon to the right and click &lt;strong&gt;Choose Virtual Optical Disk File…&lt;/strong&gt; and select the ubuntu ISO.&lt;/p&gt;

&lt;p&gt;When you are done you can click on OK to go back to the main screen of VirtualBox.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Select-iso-VirtualBox.png&quot; aria-label=&quot;Select iso - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Select-iso-VirtualBox-1024x652.png&quot; alt=&quot;Select iso - VirtualBox&quot; width=&quot;1024&quot; height=&quot;652&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Select-iso-VirtualBox-1024x652.png&quot; alt=&quot;Select iso - VirtualBox&quot; width=&quot;1024&quot; height=&quot;652&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Select iso - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now start the virtual machine and the ubuntu ISO will be booting up to something like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Install-ubuntu-VirtualBox.png&quot; aria-label=&quot;Install Ubuntu - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Install-ubuntu-VirtualBox-1024x822.png&quot; alt=&quot;Install Ubuntu - VirtualBox&quot; width=&quot;1024&quot; height=&quot;822&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Install-ubuntu-VirtualBox-1024x822.png&quot; alt=&quot;Install Ubuntu - VirtualBox&quot; width=&quot;1024&quot; height=&quot;822&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Install Ubuntu - VirtualBox&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now you click on… wait for it…. &lt;strong&gt;Install Ubuntu.&lt;/strong&gt; I’m not going to guide you through this install. For 99%(this number was picked out of the blue) of you it’s only to click on continue until it’s installed.&lt;/p&gt;

&lt;p&gt;When the installation is done Ubuntu will be asked to be restarted. Click on that button. Then when the message “please remove installation medium” is displayed, VirtualBox has already unmounted the ISO, so you can hit &lt;strong&gt;ENTER&lt;/strong&gt; directly.&lt;/p&gt;

&lt;p&gt;Ubuntu installation is done!&lt;/p&gt;

&lt;h2 id=&quot;3-installing-virtualbox-guest-additions&quot;&gt;3. Installing VirtualBox guest additions&lt;/h2&gt;
&lt;p&gt;To share folders between the host and the guest machine we will need to install the guest additions.&lt;/p&gt;

&lt;p&gt;Go to Devices in the VirtualBox menu and click on &lt;strong&gt;Insert guest additions CD image.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click on run when Ubuntu asks you if you want to install the software.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Insert-guest-additions-VirtualBox.png&quot; aria-label=&quot;Insert guest additions - VirtualBox&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Insert-guest-additions-VirtualBox-1024x909.png&quot; alt=&quot;Insert guest additions - VirtualBox&quot; width=&quot;1024&quot; height=&quot;909&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Insert-guest-additions-VirtualBox-1024x909.png&quot; alt=&quot;Insert guest additions - VirtualBox&quot; width=&quot;1024&quot; height=&quot;909&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Insert guest additions - VirtualBox&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/install-ubuntu-virtualbox/">https://www.christianengvall.se/install-ubuntu-virtualbox/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 07 Aug 2016 09:30:04 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/install-ubuntu-virtualbox/</guid>
        </item>
      
    
      
        <item>
          <title>Electron hello world</title>
          <link>https://www.christianengvall.se/electron-hello-world/</link>
          <comments>https://www.christianengvall.se/electron-hello-world/#respond</comments>
          <description>&lt;p&gt;Thought i’d make a simple Electron hello world tutorial application. Electron is a framework for building desktop apps with CSS, Javascript and HTML. The apps will be cross platform and work on Windows, MacOS and Linux distributions.&lt;/p&gt;

&lt;p&gt;You can download this application from &lt;a href=&quot;https://github.com/crilleengvall/electron-tutorial-app&quot;&gt;Github&lt;/a&gt; if you’d like. After this blog post was written i decided to rebrand it to the electron tutorial app because that name suits it better when adding more electron tutorials to it.&lt;/p&gt;

&lt;p&gt;An electron app is built using the &lt;a href=&quot;https://nodejs.org/en/&quot;&gt;node.js&lt;/a&gt; framework and is brought to us by Github. Maybe you’ve already tested a few &lt;a href=&quot;http://electron.atom.io/apps/&quot;&gt;electron apps&lt;/a&gt; now. For example slack is a well know application built on electron. If you’d like to test one i can recommend &lt;a href=&quot;https://atom.io/&quot;&gt;Atom&lt;/a&gt;. In fact, why don’t you try this tutorial with that IDE?&lt;/p&gt;

&lt;h2 id=&quot;video-introduction&quot;&gt;Video introduction&lt;/h2&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/8YP_nOCO-4Q&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;1-installing-nodejs&quot;&gt;1. Installing Node.js&lt;/h2&gt;
&lt;p&gt;First we need to install &lt;a href=&quot;https://nodejs.org/en/&quot;&gt;node.js&lt;/a&gt;. So go ahead and do that.&lt;/p&gt;

&lt;h2 id=&quot;2-installing-electron-prebuilt&quot;&gt;2. Installing electron prebuilt&lt;/h2&gt;
&lt;p&gt;Now that we have Node.js installed, let’s install electron prebuilt globally.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; electron&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/Install-electron-prebuilt.png&quot; aria-label=&quot;Install electron&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/Install-electron-prebuilt-1024x484.png&quot; alt=&quot;Install electron&quot; width=&quot;1024&quot; height=&quot;484&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/Install-electron-prebuilt-1024x484.png&quot; alt=&quot;Install electron&quot; width=&quot;1024&quot; height=&quot;484&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Install electron&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;This makes us able to test run our electron application by running this command in our terminal. But more on this later.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-filestructure&quot;&gt;2. File structure&lt;/h2&gt;
&lt;p&gt;In its most basic form an electron app needs three files. package.json, main.js, and index.html. Making the folder structure look like this:&lt;/p&gt;

&lt;p&gt;electron-hello-world/&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;index.html&lt;/li&gt;
  &lt;li&gt;main.js&lt;/li&gt;
  &lt;li&gt;package.json&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Create a folder and add those files and let’s walk trough them one by one.&lt;/p&gt;

&lt;h2 id=&quot;3-packagejson&quot;&gt;3. package.json&lt;/h2&gt;
&lt;p&gt;Let’s add content to package.json. We need a name, a version and a main setting that points to a script that will handle the starting up of the app. If main is not present electron will look for a file called index.js.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;electron-hello-world&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;main.js&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-mainjs&quot;&gt;4. Main.js&lt;/h2&gt;
&lt;p&gt;As mentioned above the we pointed out main.js to handle the startup of our application. Lets add this content to it. This code is borrowed from &lt;a href=&quot;https://github.com/electron/electron-quick-start&quot;&gt;electron quick start&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Module to control application life.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Module to create native browser window.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Keep a global reference of the window object, if you don't, the window will&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// be closed automatically when the JavaScript object is garbage collected.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createWindow&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// Create the browser window.&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BrowserWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// and load the index.html of the app.&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;loadURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`file://&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/index.html`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// Open the DevTools.&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;webContents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;openDevTools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// Emitted when the window is closed.&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;closed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Dereference the window object, usually you would store windows&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// in an array if your app supports multi windows, this is the time&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// when you should delete the corresponding element.&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// This method will be called when Electron has finished&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// initialization and is ready to create browser windows.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Some APIs can only be used after this event occurs.&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Quit when all windows are closed.&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;window-all-closed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// On OS X it is common for applications and their menu bar&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// to stay active until the user quits explicitly with Cmd + Q&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;platform&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;darwin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;activate&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// On OS X it's common to re-create a window in the app when the&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// dock icon is clicked and there are no other windows open.&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;createWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// In this file you can include the rest of your app's specific main process&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// code. You can also put them in separate files and require them here.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;5-indexhtml&quot;&gt;5. index.html&lt;/h2&gt;
&lt;p&gt;The index.html takes care of the gui.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;UTF-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Electron Hello World!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Electron Hello World!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    We are using node &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;versions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;,
    Chromium &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;versions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;chrome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;,
    and Electron &lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;versions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;electron&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;.
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;6-running-the-electron-hello-world-app&quot;&gt;6. Running the Electron hello world app&lt;/h2&gt;
&lt;p&gt;Now let’s get back to the electron . command. That will start electron and run the app that we are currently building.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;electron .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This fires up an app looking like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/08/electron-hello-world-running.png&quot; aria-label=&quot;electron hello world running&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/08/electron-hello-world-running-1003x1024.png&quot; alt=&quot;electron hello world running&quot; width=&quot;1003&quot; height=&quot;1024&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/08/electron-hello-world-running-1003x1024.png&quot; alt=&quot;electron hello world running&quot; width=&quot;1003&quot; height=&quot;1024&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;electron hello world running&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;As you can see we also have the chromium developer tool window opened inside our app. This is opened with this call in &lt;strong&gt;main.js.&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;mainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;webContents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;openDevTools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;7read-more&quot;&gt;7. Read more&lt;/h2&gt;
&lt;p&gt;Next tutorial covers &lt;a href=&quot;/testing-electron-app-on-ubuntu-linux/&quot;&gt;testing your electron app in Ubuntu&lt;/a&gt;. If you are not interested in testing it in Ubuntu the next tutorial after that is &lt;a href=&quot;/electron-app-navigation/&quot;&gt;Electron app navigation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Read more about &lt;a href=&quot;http://electron.atom.io/&quot;&gt;electron at the official site&lt;/a&gt;, and check out the &lt;a href=&quot;http://electron.atom.io/docs/&quot;&gt;API&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/electron-hello-world/">https://www.christianengvall.se/electron-hello-world/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 06 Aug 2016 12:05:47 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/electron-hello-world/</guid>
        </item>
      
    
      
        <item>
          <title>Record audio with Soundflower</title>
          <link>https://www.christianengvall.se/record-audio-soundflower/</link>
          <comments>https://www.christianengvall.se/record-audio-soundflower/#respond</comments>
          <description>&lt;p&gt;Record audio with Soundflower on Mac. It’s free and &lt;a href=&quot;https://github.com/mattingalls/Soundflower&quot;&gt;open source&lt;/a&gt;. I use this as an alternative to Loopback, which is great but has a limitation to record only 20 minutes in the free version. But you can also buy it but it was to expensive in my opinion. To record audio we also use Quicktime player in this tutorial.&lt;/p&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
&lt;p&gt;Download the latest &lt;a href=&quot;https://github.com/mattingalls/Soundflower/releases&quot;&gt;release&lt;/a&gt; from &lt;a href=&quot;https://github.com/mattingalls/Soundflower/releases/download/2.0b2/Soundflower-2.0b2.dmg&quot;&gt;Github which is 2.0b2&lt;/a&gt; when this post is written, and run the installer.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/07/Soundflower-installation.png&quot; aria-label=&quot;Soundflower - installation&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/07/Soundflower-installation-1024x769.png&quot; alt=&quot;Soundflower - installation&quot; width=&quot;1024&quot; height=&quot;769&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/07/Soundflower-installation-1024x769.png&quot; alt=&quot;Soundflower - installation&quot; width=&quot;1024&quot; height=&quot;769&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Soundflower - installation&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;If you alt click on the sound icon you can see 4 new devices has been added for us to use.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/07/Soundflower-menu.png&quot; aria-label=&quot;Soundflower - menu&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/07/Soundflower-menu.png&quot; alt=&quot;Soundflower - menu&quot; width=&quot;368&quot; height=&quot;456&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/07/Soundflower-menu.png&quot; alt=&quot;Soundflower - menu&quot; width=&quot;368&quot; height=&quot;456&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Soundflower - menu&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;set-up-audio-device&quot;&gt;Set up audio device&lt;/h2&gt;
&lt;p&gt;Go into &lt;strong&gt;Audio midi setup&lt;/strong&gt; and click on the &lt;strong&gt;plus sign&lt;/strong&gt; in the bottom left corner and select &lt;strong&gt;Create multi output device&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/07/Audio-midi-setup.png&quot; aria-label=&quot;Audio midi setup&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/07/Audio-midi-setup-1024x849.png&quot; alt=&quot;Audio midi setup&quot; width=&quot;1024&quot; height=&quot;849&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/07/Audio-midi-setup-1024x849.png&quot; alt=&quot;Audio midi setup&quot; width=&quot;1024&quot; height=&quot;849&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Audio midi setup&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now select &lt;strong&gt;Built in output&lt;/strong&gt; and &lt;strong&gt;Soundflower (2ch).&lt;/strong&gt; Next click on the gear in the bottom left corner and select &lt;strong&gt;Use this device for sound output&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/07/Multi-output-device.png&quot; aria-label=&quot;Multi output device&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/07/Multi-output-device-1024x954.png&quot; alt=&quot;Multi output device&quot; width=&quot;1024&quot; height=&quot;954&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/07/Multi-output-device-1024x954.png&quot; alt=&quot;Multi output device&quot; width=&quot;1024&quot; height=&quot;954&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Multi output device&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;record-with-quicktime-player&quot;&gt;Record with quicktime player&lt;/h2&gt;
&lt;p&gt;Start quick time player and select &lt;strong&gt;File -&amp;gt; New audio recording.&lt;/strong&gt; Next click on the down arrow next to the record button. Then select Soundflower (2ch).&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/07/quicktime-player.png&quot; aria-label=&quot;Quicktime player&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/07/quicktime-player.png&quot; alt=&quot;Quicktime player&quot; width=&quot;848&quot; height=&quot;432&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/07/quicktime-player.png&quot; alt=&quot;Quicktime player&quot; width=&quot;848&quot; height=&quot;432&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Quicktime player&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now start the audio you’d like to record and click on the record button in quick time and you are done!&lt;/p&gt;

&lt;h2 id=&quot;uninstall-soundflower&quot;&gt;Uninstall Soundflower&lt;/h2&gt;
&lt;p&gt;To uninstall Soundflower you open or download the .dmg that Soundflower came in again.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/07/soundflower-dmg.png&quot; aria-label=&quot;soundflower dmg&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/07/soundflower-dmg-1024x636.png&quot; alt=&quot;soundflower dmg&quot; width=&quot;1024&quot; height=&quot;636&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/07/soundflower-dmg-1024x636.png&quot; alt=&quot;soundflower dmg&quot; width=&quot;1024&quot; height=&quot;636&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;soundflower dmg&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;This time double click on &lt;strong&gt;Uninstall Soundflower.scpt&lt;/strong&gt; and the script editor will open it. Then click on run script and enter administrator password when prompted. A reboot may be required to get rid of the audio devices after the uninstall.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/uploads/2016/07/Script-editor.png&quot; aria-label=&quot;Script editor&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/07/Script-editor-1019x1024.png&quot; alt=&quot;Script editor&quot; width=&quot;1019&quot; height=&quot;1024&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/07/Script-editor-1019x1024.png&quot; alt=&quot;Script editor&quot; width=&quot;1019&quot; height=&quot;1024&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Script editor&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/record-audio-soundflower/">https://www.christianengvall.se/record-audio-soundflower/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 11 Jul 2016 12:49:47 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/record-audio-soundflower/</guid>
        </item>
      
    
      
        <item>
          <title>Open source repositories generated during game development</title>
          <link>https://www.christianengvall.se/open-source-repositories-generated-during-game-development/</link>
          <comments>https://www.christianengvall.se/open-source-repositories-generated-during-game-development/#respond</comments>
          <description>&lt;p&gt;Last week I released a game called &lt;a href=&quot;http://www.friendsheepgame.com/&quot;&gt;Friendsheep&lt;/a&gt;, and open source repositories generated during game development. It’s a project I’ve been working on from 2015 until now. It is a mobile game for iOS- and Android phones. When this post is being written the game has got around 300 installs (rounded down). I got help releasing this game from &lt;a href=&quot;http://sciencepark.se/&quot;&gt;Science Park here in Jönköping&lt;/a&gt;. Thank you very much!&lt;/p&gt;

&lt;h2 id=&quot;story&quot;&gt;Story&lt;/h2&gt;
&lt;blockquote&gt;&quot;A deranged professor and farmer wanted to grow his two pigs, Baconesse and Porky, larger because of his unstoppable food cravings. But in his lab, the professor accidentaly spilled the bottle of toxic waste into the pigs' food supply. The pigs mutated into Supersheeps with the amazing ability to fly. At first everything seemed alright, except for the pigs being mutated into Supersheeps. As time went on the Supersheeps needed constant feeding to stay alive and the professors food was running out. It was in this time of chaos the sheeps bond and friendship grew stronger. When the food was completely gone they decided to fly away to find food elsewhere. Now you must help them survive for as long as you can!

That is where you, as a player, comes in. The two supersheeps are out hunting for superfood in the form of clovers. They can only be gathered up in the air since they are very light weight. The mission is to keep both sheeps in the air at the same time, if you miss a clover the sheep will loose energy and loose their ability to fly. The clover is also color coded so the sheep with the red cape can only eat red clovers, and the sheep with the blue cape can only eat blue clovers. They are allergic to each others clovers.&quot; &lt;a href=&quot;http://www.friendsheepgame.com/press-kit-in-english/&quot;&gt;Friendsheep presskit&lt;/a&gt;&lt;/blockquote&gt;

&lt;h2 id=&quot;trailer&quot;&gt;Trailer&lt;/h2&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/twV3eEGj6qQ&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;open-source&quot;&gt;Open source&lt;/h2&gt;
&lt;p&gt;Although not all of the code from Friendsheep is open source, some components from the game has been released into the wild. You can check out the &lt;a href=&quot;https://github.com/crilleengvall/UnityObjectPooler&quot;&gt;Object pooler&lt;/a&gt; and an &lt;a href=&quot;https://github.com/crilleengvall/UnityExamples&quot;&gt;example project&lt;/a&gt; (containing three tutorials now but more to come) on Github.&lt;/p&gt;

&lt;h2 id=&quot;object-pooling&quot;&gt;Object pooling&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/crilleengvall/UnityObjectPooler&quot;&gt;Object pooling&lt;/a&gt; is used to tuck away already instantiated game objects instead of destroying them.instantiating and destroying objects cost a lot of resources for the device running them, this i specially important on phones. So instead of instantiating a game object you as the object pooler to do it for you. When you are done using the object all you need to do is deactivate it. An example where this is used could be when firing bullets from a gun. When the bullet has hit its target(or not), the bullet is disabled and put into the object pool until the player fires again.&lt;/p&gt;

&lt;h2 id=&quot;unity-examples&quot;&gt;Unity examples&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://github.com/crilleengvall/UnityExamples&quot;&gt;unity examples repository&lt;/a&gt; currently contains three different examples: &lt;strong&gt;Saving and loading data in unity tutorial&lt;/strong&gt;, &lt;strong&gt;Toggling sound on and off tutorial&lt;/strong&gt;, &lt;strong&gt;DontDestroyOnLoad tutorial - Keep music playing when reloading scene.&lt;/strong&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/open-source-repositories-generated-during-game-development/">https://www.christianengvall.se/open-source-repositories-generated-during-game-development/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 04 Jun 2016 10:37:50 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/open-source-repositories-generated-during-game-development/</guid>
        </item>
      
    
      
        <item>
          <title>Automate screenshots in mac os x with Screenbar</title>
          <link>https://www.christianengvall.se/automate-screenshots-mac-os-x-screenbar/</link>
          <comments>https://www.christianengvall.se/automate-screenshots-mac-os-x-screenbar/#respond</comments>
          <description>&lt;p&gt;You can automate screenshots in mac os x with &lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar on App store&quot;&gt;screenbar&lt;/a&gt;. It’s a menu bar application from where you can start and stop a timer that takes a screenshot on a set interval of seconds.&lt;/p&gt;

&lt;h3 id=&quot;update-2018&quot;&gt;Update 2018&lt;/h3&gt;
&lt;p&gt;A newer version with updated GUI and functions can be found on &lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar on App store&quot;&gt;Mac app store&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2018/01/screenbar-screenshot.png&quot; aria-label=&quot;Screenbar screenshot&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2018/01/screenbar-screenshot.png&quot; alt=&quot;Screenbar screenshot&quot; width=&quot;541&quot; height=&quot;225&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2018/01/screenbar-screenshot.png&quot; alt=&quot;Screenbar screenshot&quot; width=&quot;541&quot; height=&quot;225&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar screenshot&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;continuing-post&quot;&gt;Continuing post&lt;/h3&gt;

&lt;p&gt;I’ve written before about a &lt;a href=&quot;/automate-screenshots-in-mac-os-x/&quot;&gt;terminal script&lt;/a&gt; that takes a screenshot every 5 seconds and saves it to your desktop. That is what Screenbar does but you get a user interface in the menu bar where you can start and stop. You can also set how many seconds the program should wait before taking the next one. I needed this program myself when taking &lt;a href=&quot;http://www.friendsheepgame.com&quot;&gt;screenshots for a game&lt;/a&gt; i’m working on.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/05/Screenbar.png&quot; aria-label=&quot;Screenbar&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/05/Screenbar.png&quot; alt=&quot;Screenbar&quot; width=&quot;502&quot; height=&quot;204&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/05/Screenbar.png&quot; alt=&quot;Screenbar&quot; width=&quot;502&quot; height=&quot;204&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/05/Screenbar-v01-settings.png&quot; aria-label=&quot;Screenbar settings v 0.1&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/05/Screenbar-v01-settings.png&quot; alt=&quot;Screenbar settings v 0.1&quot; width=&quot;828&quot; height=&quot;280&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/05/Screenbar-v01-settings.png&quot; alt=&quot;Screenbar settings v 0.1&quot; width=&quot;828&quot; height=&quot;280&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar settings v 0.1&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;installation&quot;&gt;Installation&lt;/h3&gt;
&lt;p&gt;You can either download &lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar App store&quot;&gt;Screenbar from the app store&lt;/a&gt; or you can download the &lt;a href=&quot;https://github.com/crilleengvall/Screenbar/&quot;&gt;repo and build it yourself&lt;/a&gt; with Xcode.&lt;/p&gt;

&lt;h3 id=&quot;usage&quot;&gt;Usage&lt;/h3&gt;
&lt;p&gt;To start taking a series of screenshots you click on the Screenbar icon and select &lt;strong&gt;Automatic Screenshot&lt;/strong&gt;. They will we saved on your Desktop.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/05/screenbar-automate-screenshot.png&quot; aria-label=&quot;Screenbar automate screenshot&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/05/screenbar-automate-screenshot.png&quot; alt=&quot;Screenbar automate screenshot&quot; width=&quot;484&quot; height=&quot;204&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/05/screenbar-automate-screenshot.png&quot; alt=&quot;Screenbar automate screenshot&quot; width=&quot;484&quot; height=&quot;204&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar automate screenshot&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;To stop the automatic screenshots go back to Screenbar and click &lt;strong&gt;Stop automatic screenshot&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/05/Screenbar-stop-automatic-screenshot.png&quot; aria-label=&quot;Screenbar - stop automatic screenshot&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/05/Screenbar-stop-automatic-screenshot.png&quot; alt=&quot;Screenbar - stop automatic screenshot&quot; width=&quot;546&quot; height=&quot;204&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/05/Screenbar-stop-automatic-screenshot.png&quot; alt=&quot;Screenbar - stop automatic screenshot&quot; width=&quot;546&quot; height=&quot;204&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Screenbar - stop automatic screenshot&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/automate-screenshots-mac-os-x-screenbar/">https://www.christianengvall.se/automate-screenshots-mac-os-x-screenbar/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 17 May 2016 14:04:32 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/automate-screenshots-mac-os-x-screenbar/</guid>
        </item>
      
    
      
        <item>
          <title>Sublime Text productivity plugin</title>
          <link>https://www.christianengvall.se/sublime-text-productivity-plugin/</link>
          <comments>https://www.christianengvall.se/sublime-text-productivity-plugin/#respond</comments>
          <description>&lt;p&gt;Need to check your twitter feed without anyone noticing? Tell your IDE to display the tweets as a python class! Sublime Text productivity plugin shows your twitter feed inside &lt;a href=&quot;https://www.sublimetext.com/&quot;&gt;Sublime text&lt;/a&gt; without having to browse &lt;a href=&quot;https://twitter.com/&quot;&gt;twitter.com&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-problem-to-be-solved&quot;&gt;The Problem to be solved&lt;/h2&gt;
&lt;p&gt;This plugin started as a joke between me and a colleague. We sit in an open office at work. I’ve always had my desk in a corner before, and no one could see whats on my computer monitors. One day this changed and i got a desk in the middle of the room, with my monitors facing a way so that all prying eyes could see what i did all day. How do i check my social medias without being caught? Well… you mask the tweets as a class in your IDE of course :=)&lt;/p&gt;

&lt;h2 id=&quot;what-it-does&quot;&gt;What it does&lt;/h2&gt;
&lt;p&gt;This plugin adds a new menu called “Productivity”, and asks twitter via oauth to get your twitter home feed. Then the plugin creates a python class(that is trying to follow the &lt;a href=&quot;https://www.python.org/dev/peps/pep-0008/&quot;&gt;PEP8 standard&lt;/a&gt;). This way you don’t have to open a browser and go to twitter.com.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/05/Sublime-productivity-gif.gif&quot; aria-label=&quot;Sublime productivity plugin&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/05/Sublime-productivity-gif.gif&quot; alt=&quot;Sublime productivity plugin&quot; width=&quot;960&quot; height=&quot;540&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/05/Sublime-productivity-gif.gif&quot; alt=&quot;Sublime productivity plugin&quot; width=&quot;960&quot; height=&quot;540&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Sublime productivity plugin&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;installing-and-testing-it&quot;&gt;Installing and testing it&lt;/h2&gt;
&lt;p&gt;At the time of writing this post the plugin needs to be installed manually. But don’t worry, adding it to the package manager of sublime is to be done.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Download the &lt;a href=&quot;https://github.com/crilleengvall/SublimeProductivity/archive/master.zip&quot;&gt;repo from Github.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Extract the repo into the sublime plugin path of Sublime:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;(OSX): Users\”Username”\Library\Application Support\Sublime Text 3\Packages&lt;/li&gt;
  &lt;li&gt;(WIN7): C:\Users\”Username”\AppData\Roaming\Sublime Text 3\Packages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; This step will be unnecessary in the future, but for now you need to create &lt;a href=&quot;https://apps.twitter.com/&quot;&gt;a twitter app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Open up the the file &lt;strong&gt;\Sublime Text 3\Packages\Productivity\twitterapicall.py&lt;/strong&gt; and &lt;strong&gt;add the consumer key, consumer secret, access token and access token secret&lt;/strong&gt; to the lines 8 - 11.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; &lt;del&gt;Currently there is a bug that stops the plugin from running the first time starting Sublime. But &lt;strong&gt;the work around this is to open  \Sublime Text 3\Packages\Productivity\productivity.py and just resave it.&lt;/strong&gt;&lt;/del&gt; This should be working in the latest version now.&lt;/p&gt;

&lt;p&gt;Now you are done and can use the menu &lt;strong&gt;Productivity -&amp;gt; Twitter&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;contributing&quot;&gt;Contributing&lt;/h2&gt;
&lt;p&gt;This plugin is open sourced at &lt;a href=&quot;https://github.com/crilleengvall/SublimeProductivity&quot;&gt;Github&lt;/a&gt; and i’ve got a few &lt;a href=&quot;https://github.com/crilleengvall/SublimeProductivity/issues&quot;&gt;issues that needs to be fixed&lt;/a&gt;. You are very welcome to fork it and help me with them. Or you are just as welcome to add your own ideas to the plugin.&lt;/p&gt;

&lt;p&gt;I’d like to thank &lt;a href=&quot;https://clarknikdelpowell.com/blog/creating-sublime-text-3-plugins-part-1/&quot;&gt;Sam Mello for posting this tutorial&lt;/a&gt; and &lt;a href=&quot;http://code.tutsplus.com/tutorials/how-to-create-a-sublime-text-2-plugin--net-22685&quot;&gt;Will Bond for this one&lt;/a&gt; to help me get started on creating this plugin.&lt;/p&gt;

&lt;h2 id=&quot;screenshot-from-the-plugin&quot;&gt;Screenshot from the plugin&lt;/h2&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/05/SublimeProductivity.png&quot; aria-label=&quot;Sublime productivity screenshot&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/05/SublimeProductivity-1024x855.png&quot; alt=&quot;Sublime productivity screenshot&quot; width=&quot;1024&quot; height=&quot;855&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/05/SublimeProductivity-1024x855.png&quot; alt=&quot;Sublime productivity screenshot&quot; width=&quot;1024&quot; height=&quot;855&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Sublime productivity screenshot&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/sublime-text-productivity-plugin/">https://www.christianengvall.se/sublime-text-productivity-plugin/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 14 May 2016 12:01:03 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/sublime-text-productivity-plugin/</guid>
        </item>
      
    
      
        <item>
          <title>Adding Flattr button to markdown</title>
          <link>https://www.christianengvall.se/adding-flattr-button-markdown/</link>
          <comments>https://www.christianengvall.se/adding-flattr-button-markdown/#respond</comments>
          <description>&lt;p&gt;You can add Flattr button to markdown on your github repo’s (or any other service that uses markdown). Here is how.&lt;/p&gt;

&lt;h3 id=&quot;form-for-creating-flattr-markdown&quot;&gt;Form for creating Flattr markdown&lt;/h3&gt;
&lt;p&gt;I found this &lt;a href=&quot;http://flattr.kejsarmakten.se/github/&quot;&gt;service&lt;/a&gt; created by &lt;a href=&quot;http://blog.kejsarmakten.se/&quot;&gt;Christopher Käck&lt;/a&gt;. You enter your username, url to the repo, and set a project name. Which then gives you markdown looking like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-markdown&quot; data-lang=&quot;markdown&quot;&gt;Support this open source repo by using
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;![Flattr this git repo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;http://api.flattr.com/button/flattr-badge-large.png&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;](https://flattr.com/submit/auto?user_id=ChristianEngvall&amp;amp;url=https://github.com/crilleengvall/GitUndo&amp;amp;title=GitUndo&amp;amp;language=&amp;amp;tags=github&amp;amp;category=software)&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And this will give you a &lt;a href=&quot;https://github.com/crilleengvall/GitUndo&quot;&gt;Flattr button looking like this&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/04/Readme-Adding-Flattr-button-to-markdown.png&quot; aria-label=&quot;Readme - Adding Flattr button to markdown&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/04/Readme-Adding-Flattr-button-to-markdown-1024x503.png&quot; alt=&quot;Readme - Adding Flattr button to markdown&quot; width=&quot;1024&quot; height=&quot;503&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/04/Readme-Adding-Flattr-button-to-markdown-1024x503.png&quot; alt=&quot;Readme - Adding Flattr button to markdown&quot; width=&quot;1024&quot; height=&quot;503&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Readme - Adding Flattr button to markdown&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;I myself has started using flattr, if you want to support the posts shared on this blog you can use the Flattr button at the top of this post.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/adding-flattr-button-markdown/">https://www.christianengvall.se/adding-flattr-button-markdown/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 30 Apr 2016 11:30:24 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/adding-flattr-button-markdown/</guid>
        </item>
      
    
      
        <item>
          <title>Git undo</title>
          <link>https://www.christianengvall.se/git-undo/</link>
          <comments>https://www.christianengvall.se/git-undo/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;https://github.com/crilleengvall/GitUndo&quot;&gt;Git undo&lt;/a&gt; is an extension for git that adds convenient,and easy to remember, commands to undo commits, applied stashes and pushed merges.&lt;/p&gt;

&lt;p&gt;Currently there are three commands you can run to undo things. &lt;strong&gt;git&lt;/strong&gt; &lt;strong&gt;undo commit&lt;/strong&gt;, &lt;strong&gt;git undo stash-apply&lt;/strong&gt; and &lt;strong&gt;git undo pushed-merge &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;merge-commit-hash&amp;gt;&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
&lt;p&gt;The installations is quite simple right now, &lt;a href=&quot;https://github.com/crilleengvall/GitUndo/archive/master.zip&quot;&gt;download&lt;/a&gt; the project and &lt;strong&gt;copy git-undo&lt;/strong&gt; to &lt;strong&gt;/usr/local/bin/&lt;/strong&gt; if you are running Linux or mac.&lt;/p&gt;

&lt;p&gt;On Windows you put the file into &lt;strong&gt;C:\Program Files\Git\mingw64\libexec\git-core&lt;/strong&gt; or &lt;strong&gt;C:\Program Files (x86)\Git\mingw64\libexec\git-core&lt;/strong&gt; depending on where git is installed.&lt;/p&gt;

&lt;h2 id=&quot;commands&quot;&gt;Commands&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git undo commit&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;the undo commit command undos the latest commit made and stages the changes from that commit, so you will not lose the changes, but can for example add files you forgot before committing. You can also do changes before committing again. To read more about how this command works you can &lt;a href=&quot;/aliasing-git-reset-soft-head-as-git-undo/&quot;&gt;read this post&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git undo stash-apply&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;the undo stash-apply, does what it says, if you have applied a stash on for example the wrong branch you can use this command to undo that, this command comes from this &lt;a href=&quot;/undo-git-stash-apply/&quot;&gt;blog post where you can read more.&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git undo pushed-merge &amp;lt;merge-commit-hash&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;the undo pushed-merge helps you undo a git merge that is already pushed to the origin. run a git log to get the merge commit hash. &lt;a href=&quot;/undo-pushed-merge-git/&quot;&gt;Read more about how this works.&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;contribute&quot;&gt;Contribute&lt;/h2&gt;
&lt;p&gt;This is an &lt;a href=&quot;https://github.com/crilleengvall/GitUndo&quot;&gt;open source project&lt;/a&gt;, if you would like to add some undo method you can fork the project and send a pull request!&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/git-undo/">https://www.christianengvall.se/git-undo/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 28 Apr 2016 19:34:20 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/git-undo/</guid>
        </item>
      
    
      
        <item>
          <title>Encrypt emails that wordpress send you</title>
          <link>https://www.christianengvall.se/encrypt-emails-that-wordpress-send-you/</link>
          <comments>https://www.christianengvall.se/encrypt-emails-that-wordpress-send-you/#respond</comments>
          <description>&lt;p&gt;If you use Wordpress and forms, or any other plugin that sends you an email, it could be a good idea to encrypt emails that Wordpress send you. For example Google &lt;a href=&quot;https://www.theguardian.com/technology/2014/apr/15/gmail-scans-all-emails-new-google-terms-clarify&quot;&gt;scans through your inbox&lt;/a&gt; looking for words they can use to show ads that is more interesting to you. Or if someone gets hold of your password and can get information on your site via your email. Encrypting the emails will make it harder to extract information from them. And if those arguments are not enough here is another one: it’s fun to work with encryption.&lt;/p&gt;

&lt;p&gt;This tutorial expect you to have set up your own private and public keys for email encryption already, if not this will take you around 5 minutes if you follow any of these guides: Encrypt emails for &lt;a href=&quot;https://goo.gl/7Wqb0t&quot;&gt;mac&lt;/a&gt;, &lt;a href=&quot;https://www.gpg4win.org/&quot;&gt;windows&lt;/a&gt; and &lt;a href=&quot;https://www.gnupg.org/&quot;&gt;linux&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;install-plugin&quot;&gt;Install plugin&lt;/h2&gt;
&lt;p&gt;As Wordpress has such a nice community that provides so many plugins already, there was already a plugin for this as well. So no need to do any coding. &lt;a href=&quot;https://maymay.net/&quot;&gt;Meitar Moscovitz&lt;/a&gt; provides us with a plugin called &lt;a href=&quot;https://wordpress.org/plugins/wp-pgp-encrypted-emails/&quot;&gt;WP PGP Encrypted Emails.&lt;/a&gt; So go ahead and install this plugin on your Wordpress site.&lt;/p&gt;

&lt;h2 id=&quot;generate-pgp-signing-key&quot;&gt;Generate PGP Signing key&lt;/h2&gt;
&lt;p&gt;After activating the plugin a notification shows up that wants you to &lt;strong&gt;Generate PGP Signing key&lt;/strong&gt;. Click that button. That will create a private and public key that is used to encrypt the mail.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/04/GeneratePGPsigningKey-Encrypt-emails-that-wordpress-send-you.png&quot; aria-label=&quot;Generate PGP signing key&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/04/GeneratePGPsigningKey-Encrypt-emails-that-wordpress-send-you.png&quot; alt=&quot;Generate PGP signing key&quot; width=&quot;791&quot; height=&quot;58&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/04/GeneratePGPsigningKey-Encrypt-emails-that-wordpress-send-you.png&quot; alt=&quot;Generate PGP signing key&quot; width=&quot;791&quot; height=&quot;58&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Generate PGP signing key&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;adding-your-own-public-key&quot;&gt;Adding your own public key&lt;/h2&gt;
&lt;p&gt;After you click &lt;strong&gt;Generate PGP signing key-button&lt;/strong&gt; you will be taken to &lt;strong&gt;wp-admin/options-general.php&lt;/strong&gt;. There you must add your own public key (the one that you generated when following the tutorials above, before installing the plugin) to the field &lt;strong&gt;Admin Email PGP Public Key.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Subjects are not encrypted in emails, therefore you have the option to empty them before sending by checking: &lt;strong&gt;Always empty subject lines for PGP-encrypted emails&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/04/GeneratePGPsigningKey-Encrypt-emails-that-wordpress-send-you.png&quot; aria-label=&quot;Settings - encrypt mail&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/04/setting-encrypt-mail-1024x143.png&quot; alt=&quot;Settings - encrypt mail&quot; width=&quot;1024&quot; height=&quot;143&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/04/setting-encrypt-mail-1024x143.png&quot; alt=&quot;Settings - encrypt mail&quot; width=&quot;1024&quot; height=&quot;143&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Settings - encrypt mail&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;At the time this post is being written this plugin does not support attachments being encrypted. You can either wait for it to happen or code it yourself since the plugin is &lt;a href=&quot;https://github.com/meitar/wp-pgp-encrypted-emails&quot;&gt;open sourced.&lt;/a&gt; Also, i suggest you read a bit on &lt;a href=&quot;https://maymay.net/&quot;&gt;Meitar Moscovitz&lt;/a&gt;, he sounds like a very interesting developer.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/encrypt-emails-that-wordpress-send-you/">https://www.christianengvall.se/encrypt-emails-that-wordpress-send-you/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 21 Apr 2016 12:53:10 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/encrypt-emails-that-wordpress-send-you/</guid>
        </item>
      
    
      
        <item>
          <title>Upload large file to wordpress</title>
          <link>https://www.christianengvall.se/uploading-large-files-to-wordpress/</link>
          <comments>https://www.christianengvall.se/uploading-large-files-to-wordpress/#respond</comments>
          <description>&lt;p&gt;If you have ever tried to upload large file to wordpress and got the HTTP error when using the the multi-file uploader, Or when using the browser’s built-in file uploader and got a ERR_CONNECTION_RESET error message, you can solve the problem with a plugin. This tutorial requires that you have FTP access to the wordpress installation.&lt;/p&gt;

&lt;p&gt;This is more of a quick fix than a solution. But it will get the problem out of the way for those single large files one needs to be uploaded.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/02/Upload-large-file-to-wordpress-http-error.png&quot; aria-label=&quot;HTTP Error&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/02/Upload-large-file-to-wordpress-http-error-1024x293.png&quot; alt=&quot;HTTP Error&quot; width=&quot;1024&quot; height=&quot;293&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/02/Upload-large-file-to-wordpress-http-error-1024x293.png&quot; alt=&quot;HTTP Error&quot; width=&quot;1024&quot; height=&quot;293&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;HTTP Error&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/02/ERR_CONNECTION_RESET-Upload-large-file-to-wordpress.png&quot; aria-label=&quot;ERR_CONNECTION_RESET&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/02/ERR_CONNECTION_RESET-Upload-large-file-to-wordpress.png&quot; alt=&quot;ERR_CONNECTION_RESET&quot; width=&quot;497&quot; height=&quot;312&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/02/ERR_CONNECTION_RESET-Upload-large-file-to-wordpress.png&quot; alt=&quot;ERR_CONNECTION_RESET&quot; width=&quot;497&quot; height=&quot;312&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;ERR_CONNECTION_RESET&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;how-to-upload-a-large-file-to-wordpress&quot;&gt;How to upload a large file to Wordpress&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Start of by installing the &lt;a href=&quot;https://dd32.id.au/wordpress-plugins/add-from-server/&quot;&gt;Add from server plugin.&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&quot;The heart of a CMS is the ability to upload and insert content, WordPress does a fantastic job at this, unfortunately, some web hosts have limited servers, or users simply do not have the ability to upload large files through their web browser. Add From Server is designed to help ease this pain, You can upload a bunch of files via FTP (Or your favourite transmission method) and simply import those files from the webserver directly into WordPress.&quot;&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Upload your large file via FTP to your Wordpress upload folder. If you haven’t changed this it’s located in &lt;strong&gt;wp-content/uploads.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Now go to &lt;strong&gt;Media-&amp;gt;Add from server&lt;/strong&gt; and browse to the path of the file you uploaded.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/02/Media-add-from-server-Upload-large-file-to-wordpress.png&quot; aria-label=&quot;Media add from server&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/02/Media-add-from-server-Upload-large-file-to-wordpress.png&quot; alt=&quot;Media add from server&quot; width=&quot;322&quot; height=&quot;96&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/02/Media-add-from-server-Upload-large-file-to-wordpress.png&quot; alt=&quot;Media add from server&quot; width=&quot;322&quot; height=&quot;96&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Media add from server&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; Click on the checkbox of the file and click &lt;strong&gt;import&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/02/clickimport.png&quot; aria-label=&quot;Click import&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/02/clickimport.png&quot; alt=&quot;Click import&quot; width=&quot;403&quot; height=&quot;185&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/02/clickimport.png&quot; alt=&quot;Click import&quot; width=&quot;403&quot; height=&quot;185&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Click import&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;/strong&gt; Now it’s done!&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/02/Done-add-Upload-large-file-to-wordpress.png&quot; aria-label=&quot;Done&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/02/Done-add-Upload-large-file-to-wordpress.png&quot; alt=&quot;Done&quot; width=&quot;367&quot; height=&quot;88&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/02/Done-add-Upload-large-file-to-wordpress.png&quot; alt=&quot;Done&quot; width=&quot;367&quot; height=&quot;88&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Done&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/uploading-large-files-to-wordpress/">https://www.christianengvall.se/uploading-large-files-to-wordpress/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 13 Feb 2016 12:57:13 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/uploading-large-files-to-wordpress/</guid>
        </item>
      
    
      
        <item>
          <title>Wordpress plugins</title>
          <link>https://www.christianengvall.se/wordpress-plugins/</link>
          <comments>https://www.christianengvall.se/wordpress-plugins/#respond</comments>
          <description>&lt;p&gt;I finally reached that point where I was satisfied with the development of &lt;a href=&quot;http://honkbarkstudios.com/&quot;&gt;Honkbark Studios new website&lt;/a&gt;. So i released it last week. I wanted a site that was playful with a lot of colors but also had some features that will lead the visitor to install &lt;a href=&quot;http://honkbarkstudios.com/games/friendsheep/&quot;&gt;Friendsheep&lt;/a&gt; or any other game that i will release after.&lt;/p&gt;

&lt;p&gt;A few years ago when I released a new Wordpress-site I posted a &lt;a href=&quot;/fem-plugin-att-lagga-till-efter-en-wordpress-installation/&quot;&gt;list of different plugins to add&lt;/a&gt; after a wordpress install (It’s written i Swedish so you english speaking people won’t have to read the horrorful piece). It was a really bad idea to do that, because when i read it now i shake my head and think “I would never install these plugins today”… But I am a man of many talents, and one of them is to learn from my mistakes… so this time i’ll do the same mistake but i’ll fix it by using the duct tape equivalent for the written word and advertising; the asterisk. It allows you to write anything you want and bail you out of anything at all at the end of the post, so you don’t have to stand by your words. Great huh?! :)&lt;/p&gt;

&lt;h2 id=&quot;four-plugins-to-add-after-a-wordpress-installation-&quot;&gt;Four plugins to add after a wordpress installation *&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://wordpress.org/plugins/wp-code-highlightjs/&quot;&gt;WP Code Highlight.js&lt;/a&gt;  &lt;br /&gt;
This plugin makes code pretty readable using highlight.js. Just put your code inside a &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;code&amp;gt;&lt;/code&gt; tag and the plugin fixes the rest.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://wordpress.org/plugins/wp-smushit/&quot;&gt;WP Smush&lt;/a&gt;  &lt;br /&gt;
Smush all the unnecesarry shit of the pictures you upload to your Wordpress installation. And it does it automatically after upload. Saving space and making your images load faster.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://wordpress.org/plugins/wp-super-cache/&quot;&gt;WP Super Cache&lt;/a&gt;  &lt;br /&gt;
This plugin caches your site and saves static html files which it serves instead of going through the whole Wordpress lifecycle to get the markup.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://wordpress.org/plugins/wordpress-seo/&quot;&gt;Yoast SEO&lt;/a&gt;  &lt;br /&gt;
Helps with on-page SEO. Also tells you how to write your blogpost to get the best possible rankings for specific focus keywords.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;* = If this post is more than a day old i probably can’t stand by these plugin suggestions.&lt;/em&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/wordpress-plugins/">https://www.christianengvall.se/wordpress-plugins/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 27 Jan 2016 10:02:18 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/wordpress-plugins/</guid>
        </item>
      
    
      
        <item>
          <title>Setup an Apache Cordova project</title>
          <link>https://www.christianengvall.se/setup-an-apache-cordova-project/</link>
          <comments>https://www.christianengvall.se/setup-an-apache-cordova-project/#respond</comments>
          <description>&lt;p&gt;To setup an Apache Cordova project you need &lt;a href=&quot;https://www.npmjs.com/package/cordova&quot;&gt;NPM&lt;/a&gt;. When you’ve done that you open a terminal.&lt;/p&gt;

&lt;h2 id=&quot;1-installing-cordova&quot;&gt;1. Installing Cordova&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; cordova&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-create-a-project&quot;&gt;2. Create a project&lt;/h2&gt;
&lt;p&gt;When this is done it’s time to create a project. This is done with the create command. Run the following line but replace CordovaAndGoogleMaps with the name of your project.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;cordova create CordovaAndGoogleMaps&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-add-platform&quot;&gt;3. Add platform&lt;/h2&gt;
&lt;p&gt;Next it’s time to add platform. At the time when this is being written you can choose from these available platforms: amazon-fireos, android, blackberry10, browser, firefoxos, ios, osx, webos&lt;/p&gt;

&lt;p&gt;Lets go for the ios platform, but first go in to the directory of your new project&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;CordovaAndGoogleMaps
cordova platform add ios&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;4-running-the-app&quot;&gt;4. Running the app&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;cordova run ios&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will start the iOS simulator and fire up your app, looking like this:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2016/01/Setup-an-apache-cordova-project-first-run.png&quot; aria-label=&quot;Setup an apache cordova project - first run&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2016/01/Setup-an-apache-cordova-project-first-run-623x1024.png&quot; alt=&quot;Setup an apache cordova project - first run&quot; width=&quot;623&quot; height=&quot;1024&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2016/01/Setup-an-apache-cordova-project-first-run-623x1024.png&quot; alt=&quot;Setup an apache cordova project - first run&quot; width=&quot;623&quot; height=&quot;1024&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Setup an apache cordova project - first run&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/setup-an-apache-cordova-project/">https://www.christianengvall.se/setup-an-apache-cordova-project/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 12 Jan 2016 18:39:39 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/setup-an-apache-cordova-project/</guid>
        </item>
      
    
      
        <item>
          <title>Disabling Sitecore search index update</title>
          <link>https://www.christianengvall.se/disabling-sitecore-search-index-update-during-package-install/</link>
          <comments>https://www.christianengvall.se/disabling-sitecore-search-index-update-during-package-install/#respond</comments>
          <description>&lt;p&gt;Disabling Sitecore search index update during package install will speed up the installation, making it noticable quicker for large packages. We found a good blog post &lt;a href=&quot;http://sitecoreblog.alexshyba.com/sitecore_installation_wizard_disable_search_index_update_during_install/&quot;&gt;about this&lt;/a&gt; by Alex Shyba. During the implementation of that solution we found an enhancement to do.&lt;/p&gt;

&lt;p&gt;Instead of enabling the indexing again after the user clicks &lt;strong&gt;“close”&lt;/strong&gt; in the installation wizard this tutorial will re-enable it directly after the installation is finished (before the user clicks close). This will avoid having the indexing disabled if you open another window or browse away from the sitecore gui directly after installing and not clicking close.&lt;/p&gt;

&lt;p&gt;This code is tested in Sitecore 8.&lt;/p&gt;

&lt;h2 id=&quot;1-custom-packager-class&quot;&gt;1. Custom packager class&lt;/h2&gt;
&lt;p&gt;Add a new class that will handle enable and disable indexing and make it look like this (code borrowed from &lt;a href=&quot;http://sitecoreblog.alexshyba.com/sitecore_installation_wizard_disable_search_index_update_during_install/&quot;&gt;Alex Shyba&lt;/a&gt;)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;SCUSAINC.Custom.Packager&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Reflection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Web.UI.HtmlControls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Web.UI.Sheer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Shell.Applications.Install.Dialogs.InstallPackage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomInstallPackageForm&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;HandleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;installer:setTaskId&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnSetTaskId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Message&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ReflectionUtil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CallMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;SetTaskID&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;HandleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;installer:commitingFiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnCommittingFiles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Message&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ReflectionUtil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CallMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;OnCommittingFiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Checkbox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnLoad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;EventArgs&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;OnLoad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnNext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;EventArgs&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;formEventArgs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;OnNext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;formEventArgs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Installing&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Sitecore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Settings&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Indexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Enabled&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;EndWizard&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;EndWizard&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Sitecore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Settings&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Indexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Enabled&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-copy-install-package-wizard&quot;&gt;2. Copy install package wizard&lt;/h2&gt;
&lt;p&gt;Copy &lt;strong&gt;/sitecore/shell/Applications/Install/Dialogs/Install package/Install Package.xml&lt;/strong&gt; to &lt;strong&gt;/sitecore/shell/override&lt;/strong&gt;
Open that file and edit the &lt;strong&gt;codebeside attribute&lt;/strong&gt; to this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;WizardForm&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Application=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Tools/Installer/InstallationWizard&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;CodeBeside=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SCUSAINC.Custom.Packager.CustomInstallPackageForm,SCUSAINC.Custom &quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Also add a checkbox to that xml markup between GridPanel and WizardFormIndent&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;...
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/GridPanel&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;Checkbox&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;ID=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;DisableIndexing&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Header=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Disable search index update during the install&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Checked=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;True&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/WizardFormIndent&amp;gt;&lt;/span&gt;
...&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-enhancing-functionality&quot;&gt;3. Enhancing functionality&lt;/h2&gt;

&lt;p&gt;The code above is, as said before, borrowed from Alex. Now to enhance this code to re-enable the indexing directly after package is installed but before clicking the close button.
Open &lt;strong&gt;web.config&lt;/strong&gt; and search for &lt;strong&gt;packageinstall:ended&lt;/strong&gt; and edit it to look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;event&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;packageinstall:ended&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
     &lt;span class=&quot;nt&quot;&gt;&amp;lt;handler&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SCUSAINC.Custom.Packager.CustomInstallPackageForm, Website&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;OnPackageInstallEnded&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/event&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now go back to the CustomInstallPackageForm and lets edit it to look like this instead:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;SCUSAINC.Custom.Packager&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Reflection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Web.UI.HtmlControls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Web.UI.Sheer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Sitecore.Shell.Applications.Install.Dialogs.InstallPackage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomInstallPackageForm&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Checkbox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IndexingIsDisabledCheckbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;HandleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;installer:setTaskId&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnSetTaskId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Message&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ReflectionUtil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CallMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;SetTaskID&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;HandleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;installer:commitingFiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnCommittingFiles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Message&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ReflectionUtil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CallMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstallPackageForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;OnCommittingFiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Checkbox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IndexingIsDisabledCheckbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IndexingIsDisabledCheckbox&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnLoad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;EventArgs&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;OnLoad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnNext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;EventArgs&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;formEventArgs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;OnNext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;formEventArgs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Active&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Installing&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Sitecore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Settings&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Indexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Enabled&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnPackageInstallEnded&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;EventArgs&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Checked&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Sitecore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Settings&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Indexing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Enabled&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;strong&gt;EndWizard()&lt;/strong&gt; method and contents is removed and replaced by another method called &lt;strong&gt;OnPackageInstallEnded()&lt;/strong&gt;.
This method is referenced from web.config. And as said before, it’s a smaller risk that the indexing will be left disabled with this approach.
The checkbox needs to be static as well, because the wizard and the callback is run by different threads.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt; &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Checkbox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IndexingIsDisabledCheckbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;  &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Checkbox&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DisableIndexing&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
       &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IndexingIsDisabledCheckbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
       &lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IndexingIsDisabledCheckbox&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Something to think about is that both these solutions might enable indexing for another user if more than one is installing packages at the same time.
Thanks to Peter Grace for the ideas!&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/disabling-sitecore-search-index-update-during-package-install/">https://www.christianengvall.se/disabling-sitecore-search-index-update-during-package-install/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 11 Jan 2016 10:00:11 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/disabling-sitecore-search-index-update-during-package-install/</guid>
        </item>
      
    
      
        <item>
          <title>Dribbble debut - Honkbark studios logo</title>
          <link>https://www.christianengvall.se/dribbble-debut/</link>
          <comments>https://www.christianengvall.se/dribbble-debut/#respond</comments>
          <description>&lt;p&gt;While waiting for the santa to come i took the time to update the &lt;a href=&quot;http://www.honkbarkstudios.com&quot;&gt;Honkbark Studios&lt;/a&gt; logo and make my &lt;a href=&quot;https://dribbble.com/Crillst&quot;&gt;Dribbble&lt;/a&gt; debut.&lt;/p&gt;

&lt;h2 id=&quot;why-the-monkey&quot;&gt;Why the monkey?&lt;/h2&gt;
&lt;p&gt;The name Honkbark Studios comes from the sound of the Kipunji monkey. It’s a species that was first discovered in 2003. And how cool isn’t it that after so long time on this earth we still discover new species? Inspired by this i needed to discover something new myself so i went from playing games to create my own. With this in mind i created the monkey with a pair of gamepad shades. It turned out pretty nice i think!&lt;/p&gt;

&lt;h2 id=&quot;tools-used&quot;&gt;Tools used&lt;/h2&gt;
&lt;p&gt;This logo was made using &lt;a href=&quot;http://www.pixelmator.com/mac/&quot;&gt;Pixelmator&lt;/a&gt;. It’s an alternative to Photoshop for people like me who doesn’t have that kind of budget and does not want to borrow it from the internet with a pirate bay license :) . At the time of writing this blog post Pixelmator costs 319 SEK on the &lt;a href=&quot;https://itunes.apple.com/se/app/pixelmator/id407963104?mt=12&quot;&gt;mac app store&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;upcoming-dribbble-shots&quot;&gt;Upcoming Dribbble shots&lt;/h2&gt;
&lt;p&gt;I will fill the dribbble account with some graphics from the upcoming game &lt;a href=&quot;http://honkbarkstudios.com/games/friendsheep/&quot;&gt;Friendsheep&lt;/a&gt;. And hopefully from the upcoming games.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;http://urre.me/&quot;&gt;Urban Sandén&lt;/a&gt; for the invite to Dribbble!&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/dribbble-debut/">https://www.christianengvall.se/dribbble-debut/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 04 Jan 2016 10:46:38 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/dribbble-debut/</guid>
        </item>
      
    
      
        <item>
          <title>Friendsheep</title>
          <link>https://www.christianengvall.se/friendsheep/</link>
          <comments>https://www.christianengvall.se/friendsheep/#respond</comments>
          <description>&lt;p&gt;As i’ve mentioned &lt;a href=&quot;/game-development/&quot;&gt;before&lt;/a&gt; , I’ve picked up game development. But i haven’t told you what i’m working on. It’s a game called &lt;a href=&quot;http://honkbarkstudios.com/games/friendsheep/&quot;&gt;Friendsheep&lt;/a&gt;. The game will be released on iOS and Android phones in 2016.
The game is my first game for the mobile market and I’ve put a lot of effort into it.&lt;/p&gt;

&lt;h2 id=&quot;the-plot&quot;&gt;The plot&lt;/h2&gt;
&lt;p&gt;It’s about to Sheeps, supersheeps, who are friends. They need to eat something otherwise they will starve. That’s your mission as a player to make sure they can continue flying. But it’s not as easy as it sounds. You have to use both you brain halves to get somewhere in this game as mutlitasking is a key thing to be able to handle.&lt;/p&gt;

&lt;p&gt;Here is a screenshot from the alpha 7-version:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2015/12/Friendsheep4-1.png&quot; aria-label=&quot;Friendsheep alpha 7&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2015/12/Friendsheep4-1-1024x576.png&quot; alt=&quot;Friendsheep alpha 7&quot; width=&quot;1024&quot; height=&quot;576&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2015/12/Friendsheep4-1-1024x576.png&quot; alt=&quot;Friendsheep alpha 7&quot; width=&quot;1024&quot; height=&quot;576&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Friendsheep alpha 7&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;beta-testing&quot;&gt;Beta testing&lt;/h2&gt;
&lt;p&gt;Right now it’s being beta tested by around 30 players. It’s about 50% testers on each platform.  And this has been a great way for me to get input on the game. When building a game you have a different perspective than your players. They also see a lot more bugs and have a lot of comments on how to improve the game. When i released it for beta i thought, wow, i’m getting very close to finishing this game. Now two weeks after i think i’ve got a few more fixes to do before i release. About 35 new issues were added to the issue tracker of the game. Which is awesome and means I will release a better product.&lt;/p&gt;

&lt;h2 id=&quot;open-source&quot;&gt;Open source&lt;/h2&gt;
&lt;p&gt;Working with this game under my own company &lt;a href=&quot;http://www.honkbarkstudios.com&quot;&gt;Honkbark Studios&lt;/a&gt; is something that gives me freedom to release code as open source. During the development of Friendsheep i’ve written tutorials and released &lt;a href=&quot;https://github.com/crilleengvall/UnityExamples&quot;&gt;example code&lt;/a&gt; for them, and also library that&lt;a href=&quot;https://github.com/crilleengvall/UnityObjectPooler&quot;&gt; pools objects&lt;/a&gt; so they can be reused without being instantiated again, and both are released on &lt;a href=&quot;https://github.com/crilleengvall&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next post about Friendsheep is hopefully about the game being released! Stay tuned at &lt;a href=&quot;http://honkbarkstudios.com/&quot;&gt;honkbarkstudios.com&lt;/a&gt; for news and updates.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/friendsheep/">https://www.christianengvall.se/friendsheep/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 21 Dec 2015 08:07:21 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/friendsheep/</guid>
        </item>
      
    
      
        <item>
          <title>Using git commit amend</title>
          <link>https://www.christianengvall.se/using-git-commit-amend/</link>
          <comments>https://www.christianengvall.se/using-git-commit-amend/#respond</comments>
          <description>&lt;p&gt;By using git commit amend you can add files if you forgot to do that to your most recent commit.
I’ve written about &lt;a href=&quot;/aliasing-git-reset-soft-head-as-git-undo/&quot;&gt;undoing a commit before&lt;/a&gt;, and also about &lt;a href=&quot;/undo-pushed-merge-git/&quot;&gt;undoing pushed commits&lt;/a&gt;. which you also could use in this scenario. But this is a bit faster.&lt;/p&gt;

&lt;p&gt;Say you’ve made changes in asdf.txt, and added a new file called fdsa.txt with very important stuff in it. You are very happy with the results and commit it.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git commit &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Doing changes'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Exactly after hitting enter you realized you forgot to run git add – . to begin to track and stage fdsa.txt
This is where amend comes in. But first run add.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git add &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;to add this file to the commit you just recently made all you got to do is run this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git commit &lt;span class=&quot;nt&quot;&gt;--amend&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;git-commit-official-docs&quot;&gt;Git commit official docs&lt;/h3&gt;
&lt;p&gt;This trick amends the new commit to the latest one made. Read more about the &lt;a href=&quot;https://git-scm.com/docs/git-commit&quot;&gt;git commit command&lt;/a&gt; at the official Git site.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/using-git-commit-amend/">https://www.christianengvall.se/using-git-commit-amend/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 14 Dec 2015 10:03:49 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/using-git-commit-amend/</guid>
        </item>
      
    
      
        <item>
          <title>Commit changes to new branch with git</title>
          <link>https://www.christianengvall.se/commit-changes-to-new-branch-git/</link>
          <comments>https://www.christianengvall.se/commit-changes-to-new-branch-git/#respond</comments>
          <description>&lt;p&gt;To commit changes to new branch with  git you can use the following three steps:&lt;/p&gt;

&lt;h2 id=&quot;create-a-new-branch&quot;&gt;Create a new branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt; git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; mynewbranchname&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will leave your current branch unedited, create a new branch called mynewbranchname, and you still have your uncommitted changes.
It’s the &lt;a href=&quot;https://git-scm.com/docs/git-checkout&quot;&gt;parameter -b that tells git to create a new branch&lt;/a&gt; with a selected name.&lt;/p&gt;

&lt;h2 id=&quot;add-files&quot;&gt;Add files&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt; git add &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This adds your new files for git to track in the new branch.&lt;/p&gt;

&lt;h2 id=&quot;commit-changes&quot;&gt;Commit changes&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git commit &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Adding my files'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This commits the files, and you’re done!
The parameter -a tells git to automatically stage files that have been modified and/or deleted.
and -m tells git that you provide a commit message.&lt;/p&gt;

&lt;p&gt;Read more &lt;a href=&quot;https://git-scm.com/docs/git-commit&quot;&gt;about commit in the git docs.&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/commit-changes-to-new-branch-git/">https://www.christianengvall.se/commit-changes-to-new-branch-git/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 07 Dec 2015 10:02:07 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/commit-changes-to-new-branch-git/</guid>
        </item>
      
    
      
        <item>
          <title>Serialize and deserialize dictionary</title>
          <link>https://www.christianengvall.se/serialize-and-deserialize-dictionary/</link>
          <comments>https://www.christianengvall.se/serialize-and-deserialize-dictionary/#respond</comments>
          <description>&lt;p&gt;A few years back i needed to serialize and deserialize a dictionary. The solution turned out to be Adar Wesleys &lt;a href=&quot;http://blogs.microsoft.co.il/files/folders/applisec/entry60979.aspx&quot;&gt;SerializeableDictionary&lt;/a&gt;. I can’t find the source blog post by Adar Wesley anymore but only the classes that you need to import into your project. If those files has been deleted as well i have a backup of those files here: &lt;a href=&quot;/wp-content/uploads/2015/11/serializabledictionary.zip&quot;&gt;serializabledictionary&lt;/a&gt;. This is an example on how to do it with C#.&lt;/p&gt;

&lt;h3 id=&quot;serialize-and-deserialize-dictionary-example&quot;&gt;Serialize and deserialize dictionary example&lt;/h3&gt;
&lt;p&gt;Once the files are included into your project you can use this example to serialize and deserialize a dictionary:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// Loads a Serializable dictionary which holds a saved values&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;LoadExistingFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;XmlSerializer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;XmlSerializer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;));&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StreamReader&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;StreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Deserialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// Saves existing KeyValuePairs to disc&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SaveDictionaryToDisc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;XmlSerializer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;XmlSerializer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;));&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StreamWriter&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sw&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;StreamWriter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Serialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This post is a translation of a &lt;a href=&quot;/serialisera-och-deserialisera-ett-dictionary/&quot;&gt;blog post that i wrote in Swedish&lt;/a&gt; a long time ago. I finally got my thumb out and translated it to English.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/serialize-and-deserialize-dictionary/">https://www.christianengvall.se/serialize-and-deserialize-dictionary/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 30 Nov 2015 10:50:42 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/serialize-and-deserialize-dictionary/</guid>
        </item>
      
    
      
        <item>
          <title>Schedule script in OSX</title>
          <link>https://www.christianengvall.se/schedule-script-in-osx/</link>
          <comments>https://www.christianengvall.se/schedule-script-in-osx/#respond</comments>
          <description>&lt;p&gt;To schedule script in &lt;a href=&quot;http://www.apple.com/osx/&quot;&gt;OSX&lt;/a&gt; to run every now and then you can use launchd. Add a scheduled job by saving a .plist in folder **/Users/&lt;my-user&gt;/Library/LaunchAgents**.
This example will run a php script every 10 seconds.&lt;/my-user&gt;&lt;/p&gt;

&lt;h2 id=&quot;1-example-plist&quot;&gt;1. Example .plist&lt;/h2&gt;
&lt;p&gt;This example is saved as &lt;strong&gt;se.christianengvall.dostuff.plist&lt;/strong&gt; in the folder mentioned above.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;plist&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;version=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;Label&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;se.christianengvall.dostuff&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;ProgramArguments&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;array&amp;gt;&lt;/span&gt;
           &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;/usr/bin/php&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
           &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;/Users/&lt;span class=&quot;nt&quot;&gt;&amp;lt;my-user&amp;gt;&lt;/span&gt;/Sites/dostuff.php&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;StartInterval&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;nt&quot;&gt;&amp;lt;integer&amp;gt;&lt;/span&gt;10&lt;span class=&quot;nt&quot;&gt;&amp;lt;/integer&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/plist&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Set the label value to the same name as the file.
In ProgramArguments we set the path to php and the path to the script we want to run.
The StartInterval sets how often to run the script, set in seconds.&lt;/p&gt;

&lt;h2 id=&quot;2-the-php-script&quot;&gt;2. The php script&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
 &lt;span class=&quot;nb&quot;&gt;syslog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;LOG_WARNING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;printing value to log&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Nothing much going on here, just add a message to the system log.&lt;/p&gt;

&lt;h2 id=&quot;3-schedule-script-in-osx&quot;&gt;3. Schedule script in OSX&lt;/h2&gt;
&lt;p&gt;Now to schedule the script run this in a terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;launchctl load  /Users/&amp;lt;my-user&amp;gt;/Library/LaunchAgents/se.christianengvall.dostuff.plist&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now start the Console utility and watch your script print: “printing value to log” every ten seconds.&lt;/p&gt;

&lt;h2 id=&quot;4-stopping-the-script&quot;&gt;4. Stopping the script&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;launchctl unload  /Users/&amp;lt;my-user&amp;gt;/Library/LaunchAgents/se.christianengvall.dostuff.plist&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/schedule-script-in-osx/">https://www.christianengvall.se/schedule-script-in-osx/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 26 Nov 2015 10:01:53 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/schedule-script-in-osx/</guid>
        </item>
      
    
      
        <item>
          <title>Untrack files in local repository but keep at origin with git</title>
          <link>https://www.christianengvall.se/untrack-files-local-repository-keep-origin-git/</link>
          <comments>https://www.christianengvall.se/untrack-files-local-repository-keep-origin-git/#respond</comments>
          <description>&lt;p&gt;To untrack files in local repository but keep at origin, as our scenario needed; to keep folder or files in git origin repository but untrack any local changes made in this folder, You can use “git update-index –assume-unchanged”. This will enable new developers to get all the files in the repository when cloning. The application can make all the changes it wants in the specified folder, but locally they won’t be committed an pushed to the origin. The only minor problem with this solution is that you have to do this on every new machine that clones the repo. But something positive that comes out of this is that when you need to update files in the untracked folder you can.&lt;/p&gt;

&lt;h2 id=&quot;1-preparing-the-repo&quot;&gt;1. Preparing the repo&lt;/h2&gt;
&lt;p&gt;Make sure you add the folder with all the containing files(that you later want to untrack) to the repo. And then commit and push it to your origin. In this example my folder is named Library.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git add &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
git commit &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'adding library folder'&lt;/span&gt;
git push&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;2-add-this-folder-to-gitignore&quot;&gt;2. Add this folder to .gitignore&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;/library/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And then commit this update.
If you need more information about how to use the .gitignore file you can look at &lt;a href=&quot;https://git-scm.com/docs/gitignore&quot;&gt;git online documentation.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this stage the folder library and its contents are still tracked by git. Any changes to a file in this folder will therefor be marked as changed still. Lets take care of that next.&lt;/p&gt;

&lt;h2 id=&quot;3untrack-files-in-local-repository-but-keep-at-origin&quot;&gt;3. Untrack files in local repository but keep at origin&lt;/h2&gt;
&lt;p&gt;Now run the following command to untrack the library folder and its contents:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git update-index &lt;span class=&quot;nt&quot;&gt;--assume-unchanged&lt;/span&gt; library/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Make a change to a file in this folder and git will assume it has not been changed, so you won’t commit anything in this folder.&lt;/p&gt;

&lt;h2 id=&quot;4-undo-this-change&quot;&gt;4. Undo this change&lt;/h2&gt;
&lt;p&gt;Say you need to update a file in the library folder after a while. Then you need only one command to start track this folder again:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git update-index &lt;span class=&quot;nt&quot;&gt;--no-assume-unchanged&lt;/span&gt; library/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;5-make-alias-of-these-commands&quot;&gt;5. Make alias of these commands&lt;/h2&gt;
&lt;p&gt;If you like you can create aliases for these commands to something simpler:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; alias.assume-unchanged &lt;span class=&quot;s1&quot;&gt;'update-index --assume-unchanged'&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; alias.assume-changed &lt;span class=&quot;s1&quot;&gt;'update-index --no-assume-unchanged'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This makes you able to run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git assume-unchanged library/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git assume-changed library/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/untrack-files-local-repository-keep-origin-git/">https://www.christianengvall.se/untrack-files-local-repository-keep-origin-git/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 23 Nov 2015 12:27:49 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/untrack-files-local-repository-keep-origin-git/</guid>
        </item>
      
    
      
        <item>
          <title>Validating C-sharp made JWT signature with PHP</title>
          <link>https://www.christianengvall.se/validating-c-sharp-made-jwt-signature-with-php/</link>
          <comments>https://www.christianengvall.se/validating-c-sharp-made-jwt-signature-with-php/#respond</comments>
          <description>&lt;p&gt;When validating C-Sharp made &lt;a href=&quot;http://jwt.io/&quot;&gt;JWT&lt;/a&gt; signature with PHP, or the other way around, you may run into some problems. What can happen is that the hash will be different but the data still won’t be tampered with. I noticed this when sending a JWT from a server using C# to a server using PHP. This code example will create the same signature with both PHP and C#.&lt;/p&gt;

&lt;h2 id=&quot;c&quot;&gt;C#:&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;CreateToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sharedSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encodedHeader&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Base64Encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{\&quot;typ\&quot;:\&quot;JWT\&quot;,\&quot;alg\&quot;:\&quot;HS256\&quot;}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encodedClaims&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Base64Encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;score&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;12&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Crille&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;signingInput&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encodedHeader&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encodedClaims&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;signingInput&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Base64Encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SHA256Sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;signingInput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sharedSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is what the method SHA256Sum looks like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SHA256Sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;signingInput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sharedSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;UTF8Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyByte&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sharedSecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hmacsha256&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HMACSHA256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;keyByte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;hmacsha256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ComputeHash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;signingInput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ByteToString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hmacsha256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Base64 encode method looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Base64Decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encodedString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;textBytes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Convert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;FromBase64String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encodedString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;textBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Base64 decode method:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Base64Encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plainText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plainTextBytes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plainText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Convert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ToBase64String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plainTextBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And a method to create a byte array to a string&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ByteToString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sbinary&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;++)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;sbinary&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ToString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;X2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sbinary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;php&quot;&gt;PHP:&lt;/h2&gt;
&lt;p&gt;This is a class that will encode, decode and validate a JWT-token and will return the same signature as the C# methods. If the data has not be tampered with that is.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;JWT&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$shared_secret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;thesharedsecret&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$encoded_header&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'{&quot;alg&quot;: &quot;HS256&quot;,&quot;typ&quot;: &quot;JWT&quot;}'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$encoded_payload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$encoded_header&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$encoded_payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;create_signature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$signature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$jwt_token&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$signature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$jwt_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is_valid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$is_valid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$token_parts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;explode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$token_parts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$token_parts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$recieved_signature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$token_parts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$new_signature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;create_signature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$new_signature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$recieved_signature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$is_valid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$is_valid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create_signature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;hash_hmac&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'sha256'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shared_secret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;strtoupper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/validating-c-sharp-made-jwt-signature-with-php/">https://www.christianengvall.se/validating-c-sharp-made-jwt-signature-with-php/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 16 Nov 2015 09:06:49 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/validating-c-sharp-made-jwt-signature-with-php/</guid>
        </item>
      
    
      
        <item>
          <title>JSON web token - JWT</title>
          <link>https://www.christianengvall.se/jwt-json-web-token/</link>
          <comments>https://www.christianengvall.se/jwt-json-web-token/#respond</comments>
          <description>&lt;p&gt;When sending data from an application to a backend server you can use json web token (&lt;a href=&quot;http://jwt.io/&quot;&gt;JWT&lt;/a&gt;) to make sure the data has not been tampered with. The token is compact making it quick to send to the backend.&lt;/p&gt;

&lt;p&gt;Here is an example of a token:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;A token is separated into three parts; Header, payload and signature. And, as you can see in the example above, these parts are separated by a “.”
All three parts are base64 encoded. Let’s go trough what the different parts contains.&lt;/p&gt;

&lt;h2 id=&quot;part-1---introduction&quot;&gt;Part 1 - Introduction&lt;/h2&gt;
&lt;h3 id=&quot;header&quot;&gt;Header&lt;/h3&gt;
&lt;p&gt;The header mostly consists of two parts alg, and typ.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;alg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;HS256&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;typ&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;JWT&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Alg defines what hashing algoritm has been used to create the signature(which we will look at soon). And typ defines type of token, which is JWT.&lt;/p&gt;

&lt;h3 id=&quot;payload&quot;&gt;Payload&lt;/h3&gt;
&lt;p&gt;The payload contains the data that you want to send to your backend. Example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;score&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;12&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Crille&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;signature&quot;&gt;Signature&lt;/h3&gt;
&lt;p&gt;The signature consists of a base64 encoded HS256-hash built on the first two parts of the token.
And this is signed with a shared secret that the app and the backend has.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;HMACSHA256&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
  base64UrlEncode&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;header&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; + &lt;span class=&quot;s2&quot;&gt;&quot;.&quot;&lt;/span&gt; +
  base64UrlEncode&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;payload&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,
  secret&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;part-2---example-creating-a-jwt-with-php&quot;&gt;Part 2 - Example: Creating a JWT with PHP&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$encoded_header&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'{&quot;alg&quot;: &quot;HS256&quot;,&quot;typ&quot;: &quot;JWT&quot;}'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$encoded_payload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'{&quot;score&quot;: &quot;12&quot;,&quot;name&quot;: &quot;Crille&quot;}'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$encoded_header&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$encoded_payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$secret_key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'thisismysecretkey'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$signature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;hash_hmac&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'sha256'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$secret_key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$jwt_token&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$header_and_payload_combined&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$signature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$jwt_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Line 3: This line base64 encodes the header json.&lt;/p&gt;

&lt;p&gt;Line 4: This line base64 encodes the payload json.&lt;/p&gt;

&lt;p&gt;Line 6: Here the the base64 strings are concatenated to one that looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;eyJhbGciOiAiSFMyNTYiLCJ0eXAiOiAiSldUIn0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;.eyJzY29yZSI6ICIxMiIsIm5hbWUiOiAiQ3JpbGxlIn0&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Line 10: Here the signature is created. It creates a hash with the s256 algoritm with the secret key that you can see on line 8. This is string is also base64 encoded.&lt;/p&gt;

&lt;p&gt;Line 12: This line concatenates the signature with the rest of the values, and creating a jwt token looking like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;eyJhbGciOiAiSFMyNTYiLCJ0eXAiOiAiSldUIn0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;.eyJzY29yZSI6ICIxMiIsIm5hbWUiOiAiQ3JpbGxlIn0&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;.Or5OIu2KjpE6/rQeg0yDyAjBX7KGlHqRJBBTZYgi3I0&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;part-3-example-verifying-signature&quot;&gt;Part 3: Example: Verifying signature&lt;/h2&gt;
&lt;p&gt;This code checks so that the signature that was received checks out.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#recieved_jwt would in real life be populated from a $_POST['values'] but for this example this will work&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$recieved_jwt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'eyJhbGciOiAiSFMyNTYiLCJ0eXAiOiAiSldUIn0=.eyJzY29yZSI6ICIxMiIsIm5hbWUiOiAiQ3JpbGxlIn0=.Or5OIu2KjpE6/rQeg0yDyAjBX7KGlHqRJBBTZYgi3I0='&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$secret_key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'thisismysecretkey'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$jwt_values&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;explode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$recieved_jwt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$recieved_signature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$jwt_values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$recieved_header_and_payload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$jwt_values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.'&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$jwt_values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$what_signature_should_be&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;base64_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;hash_hmac&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'sha256'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$recieved_header_and_payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$secret_key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$what_signature_should_be&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$recieved_signature&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;// signature is ok, the payload has not been tampered with&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Line 2:  $recieved_jwt contains the jwt. This would be received from a $_POST value in real life.&lt;/p&gt;

&lt;p&gt;Line 5: $jwt_values is an array with the jwt values in it.&lt;/p&gt;

&lt;p&gt;Line 7: $recieved_signature contains the signature from the original jwt&lt;/p&gt;

&lt;p&gt;Line 8: we separate the header and payload an concatenates them.&lt;/p&gt;

&lt;p&gt;Line 10: We create a new signature with the new header and payload.&lt;/p&gt;

&lt;p&gt;Line 12: Check if the signature we created is the same as the one we received. If it is the data has not been tampered with.&lt;/p&gt;

&lt;h2 id=&quot;part-4---a-quick-checklist&quot;&gt;Part 4 - A quick checklist&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;Base64 encode a header JSON Object.&lt;/li&gt;
  &lt;li&gt;Base64 encode a payload JSON Object.&lt;/li&gt;
  &lt;li&gt;Concatenate the header and payload strings with “.” separator&lt;/li&gt;
  &lt;li&gt;Compute the signature of the header and payload.&lt;/li&gt;
  &lt;li&gt;Base64 encode the signature.&lt;/li&gt;
  &lt;li&gt;Concatenate the signature to the header and payload string.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;A json web token is quite easy to create yourself. And it’s easy to validate the signature as well. If the shared key (or $secret_key as its called above) gets in the wrong hands you can not trust the signatures anymore and need to change it.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/jwt-json-web-token/">https://www.christianengvall.se/jwt-json-web-token/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 13 Nov 2015 10:10:44 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/jwt-json-web-token/</guid>
        </item>
      
    
      
        <item>
          <title>Automate screenshots in mac os x</title>
          <link>https://www.christianengvall.se/automate-screenshots-in-mac-os-x/</link>
          <comments>https://www.christianengvall.se/automate-screenshots-in-mac-os-x/#respond</comments>
          <description>&lt;h3 id=&quot;update&quot;&gt;Update&lt;/h3&gt;
&lt;p&gt;You can do this with &lt;a href=&quot;https://itunes.apple.com/us/app/screenbar/id1329392611?ls=1&amp;amp;mt=8&quot; title=&quot;Screenbar on App store&quot;&gt;Screenbar&lt;/a&gt;. It gives you a user interface instead of running it in the terminal.&lt;/p&gt;

&lt;h3 id=&quot;automate-screenshots-with-shell-script&quot;&gt;Automate screenshots with shell script&lt;/h3&gt;
&lt;p&gt;I needed to automate screenshots in mac os x, but i needed to use both my hands to play a game at the same time as i was taking screenshots.
So i found this gem at &lt;a href=&quot;http://www.trickyways.com/2010/01/how-to-set-timer-to-take-screenshot-on-mac-using-terminal/&quot;&gt;TrickyWays&lt;/a&gt;. The following script will take a screenshot with a unique name and save it on your desktop. Just copy and paste it into a terminal window:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; 1 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;vardate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; +%d&lt;span class=&quot;se&quot;&gt;\-&lt;/span&gt;%m&lt;span class=&quot;se&quot;&gt;\-&lt;/span&gt;%Y&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;%H.%M.%S&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; screencapture &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; jpg &lt;span class=&quot;nt&quot;&gt;-x&lt;/span&gt; ~/Desktop/&lt;span class=&quot;nv&quot;&gt;$vardate&lt;/span&gt;.jpg&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sleep &lt;/span&gt;5&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Just edit the number 5 to a interval in seconds that fit your needs.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2015/11/automate-screenshot-in-mac-osx-terminal.png&quot; aria-label=&quot;Automate screenshots in mac os x terminal&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2015/11/automate-screenshot-in-mac-osx-terminal.png&quot; alt=&quot;Automate screenshots in mac os x terminal&quot; width=&quot;962&quot; height=&quot;380&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2015/11/automate-screenshot-in-mac-osx-terminal.png&quot; alt=&quot;Automate screenshots in mac os x terminal&quot; width=&quot;962&quot; height=&quot;380&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Automate screenshots in mac os x terminal&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/automate-screenshots-in-mac-os-x/">https://www.christianengvall.se/automate-screenshots-in-mac-os-x/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 24 Oct 2015 13:19:17 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/automate-screenshots-in-mac-os-x/</guid>
        </item>
      
    
      
        <item>
          <title>Game development</title>
          <link>https://www.christianengvall.se/game-development/</link>
          <comments>https://www.christianengvall.se/game-development/#respond</comments>
          <description>&lt;p&gt;The last months i’ve picked up game development i Unity. Every week on Fridays I have a day off to work with this project. That project also comes with a new site and developer blog.&lt;/p&gt;

&lt;h3 id=&quot;honkbark-studios&quot;&gt;Honkbark studios&lt;/h3&gt;
&lt;p&gt;If you are interested in following that progress you can check it out at &lt;a href=&quot;http://www.honkbarkstudios.com/&quot;&gt;Honkbark studios&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/game-development/">https://www.christianengvall.se/game-development/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 17 May 2015 21:28:55 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/game-development/</guid>
        </item>
      
    
      
        <item>
          <title>Problem when downloading pdf from Sitecore site</title>
          <link>https://www.christianengvall.se/problem-when-downloading-pdf-from-sitecore-site/</link>
          <comments>https://www.christianengvall.se/problem-when-downloading-pdf-from-sitecore-site/#respond</comments>
          <description>&lt;p&gt;I had a Mime-type problem when downloading pdf from Sitecore site the following error showed up in the log:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;8368 10:31:54 ERROR Application error.
Exception: System.ArgumentOutOfRangeException
Message: The UTC &lt;span class=&quot;nb&quot;&gt;time &lt;/span&gt;represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
Source: mscorlib
   at System.DateTimeOffset..ctor&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;DateTime dateTime&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   at Sitecore.Resources.Media.Streaming.Preconditions.IfRangePrecondition.CheckRequestPreconditionAndSetResponseStatus&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;HttpContext context&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   at Sitecore.Resources.Media.Streaming.RangeRetrievalResponse.ExecuteRequest&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;HttpContext context&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   at Sitecore.Resources.Media.MediaRequestHandler.DoProcessRequest&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;HttpContext context, MediaRequest request, Media media&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   at Sitecore.Resources.Media.MediaRequestHandler.DoProcessRequest&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;HttpContext context&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   at Sitecore.Resources.Media.MediaRequestHandler.ProcessRequest&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;HttpContext context&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
   at System.Web.HttpApplication.ExecuteStep&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;IExecutionStep step, Boolean&amp;amp; completedSynchronously&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sitecore-mimeconfig&quot;&gt;Sitecore MimeConfig&lt;/h3&gt;
&lt;p&gt;This turned out to be a problem with MIME-types, and to solve it download the MimeConfig and add a reference to it in web.config as described in&lt;a href=&quot;http://sdn.sitecore.net/articles/media/avoid%20mime%20type%20related%20download%20problems.aspx&quot;&gt; this Sitecore documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Open the file and make sure that a mime entry for PDF exists and make sure it is not commented out.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/problem-when-downloading-pdf-from-sitecore-site/">https://www.christianengvall.se/problem-when-downloading-pdf-from-sitecore-site/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 01 Apr 2015 11:03:17 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/problem-when-downloading-pdf-from-sitecore-site/</guid>
        </item>
      
    
      
        <item>
          <title>git rename branch</title>
          <link>https://www.christianengvall.se/git-rename-branch/</link>
          <comments>https://www.christianengvall.se/git-rename-branch/#respond</comments>
          <description>&lt;p&gt;This operation is pretty simple, all you need to use is the branch commando with a -m flag to git rename branch:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git branch &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &amp;lt;oldbranchname&amp;gt; &amp;lt;newbranchname&amp;gt;

example:
git branch &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; feature/humanreadable feature/translation&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;git-rename-branch&quot;&gt;git rename branch&lt;/h2&gt;
&lt;p&gt;Or if you already checked out the branch you want to rename all you need to do is:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git branch &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &amp;lt;newbranchname&amp;gt;

example:
git branch &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; feature/translation&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Read more at the &lt;a href=&quot;http://git-scm.com/docs/git-branch/&quot;&gt;git branch documentation&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/git-rename-branch/">https://www.christianengvall.se/git-rename-branch/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 21 May 2014 12:16:21 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/git-rename-branch/</guid>
        </item>
      
    
      
        <item>
          <title>Undo a pushed merge with git</title>
          <link>https://www.christianengvall.se/undo-pushed-merge-git/</link>
          <comments>https://www.christianengvall.se/undo-pushed-merge-git/#respond</comments>
          <description>&lt;p&gt;How to undo a merge that has been pushed to origin? Use Revert. After merging my develop branch into the master branch i realized i didn’t want to release the code i just merged. But it was already pushed to origin. What do do?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I’ve made an easy extension to git that makes this command more easy to remember, i call it &lt;a href=&quot;/git-undo/&quot;&gt;gitUndo&lt;/a&gt;. With that extension all you need run is: &lt;strong&gt;git undo pushed-merge &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;merge-commit-hash&amp;gt;&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;first checkout the master branch:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git checkout master&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;then run a git log and get the id of the merge commit.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git log&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;then revert to that commit:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git revert &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 1 &amp;lt;merge-commit&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;With ‘-m 1’ we tell git to revert to the first parent of the mergecommit on the master branch. -m 2 would specify to revert to the first parent on the develop branch where the merge came from initially.&lt;/p&gt;

&lt;p&gt;Now commit the revert and push changes to the remote repo and you are done.&lt;/p&gt;

&lt;h3 id=&quot;getting-back-the-reverted-changes&quot;&gt;Getting back the reverted changes&lt;/h3&gt;
&lt;p&gt;This changes the data to look like before the merge, but not the history. So it’s not exactly like an undo. If we would merge develop into master again the changes we reverted in master wont be applied. So if we would like these changes back again we could revert our first revert(!).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git revert &amp;lt;commit-of-first-revert&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To get more information about this check out the &lt;a href=&quot;http://git-scm.com/docs/git-revert&quot;&gt;git revert documentation&lt;/a&gt; or read&lt;a href=&quot;http://opensource.apple.com/source/Git/Git-26/src/git-htmldocs/howto/revert-a-faulty-merge.txt&quot;&gt; Linus Torvalds explanation&lt;/a&gt; of this behavior&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/undo-pushed-merge-git/">https://www.christianengvall.se/undo-pushed-merge-git/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 13 May 2014 22:34:58 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/undo-pushed-merge-git/</guid>
        </item>
      
    
      
        <item>
          <title>Picking up game development</title>
          <link>https://www.christianengvall.se/picking-up-game-development/</link>
          <comments>https://www.christianengvall.se/picking-up-game-development/#respond</comments>
          <description>&lt;p&gt;A while back me and some friends figured we should make a game now when indie games is such a hot topic and we have a few game ideas of our own that we would like to implement. To do this we need to learn some new technologies, for example 3D modeling and the engine that we have chosen because it allows us to publish games on multiple platforms, and that is &lt;a href=&quot;http://unity3d.com/&quot;&gt;unity&lt;/a&gt;. Hopefully this post is just the start of many ones covering the progress of making an indie game.&lt;/p&gt;

&lt;h3 id=&quot;tutorials&quot;&gt;Tutorials&lt;/h3&gt;
&lt;p&gt;So this first post about game development i thought i’d share some nice tutorials that makes you get a hang of how unity works quite fast. They also bring a feeling of curiosity to dig deeper into the unity api.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=g5QFW12utdU&amp;amp;list=PLPV2KyIb3jR4u6zeBY77WPj0KuFdmv84g&quot;&gt;Make a game&lt;/a&gt;  &lt;br /&gt;
&lt;a href=&quot;http://www.youtube.com/watch?v=fRED_-LvJKQ&amp;amp;list=SPPV2KyIb3jR7F_B4p8X3YwHPaExh0R9Kk&quot;&gt;Create a survival game&lt;/a&gt;  &lt;br /&gt;
&lt;a href=&quot;http://www.youtube.com/watch?v=yQXdREL4GGg&amp;amp;list=PLPV2KyIb3jR4_IYZY2V0G3IUYcx1zZkJe&quot;&gt;How to make a 2D game&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks to Asbjørn Thirslund at &lt;a href=&quot;http://brackeys.com/&quot;&gt;brackeys&lt;/a&gt; for releasing these videos for free.&lt;/p&gt;

&lt;p&gt;But&lt;a href=&quot;http://unity3d.com/learn/tutorials/modules/&quot;&gt; unities own tutorials&lt;/a&gt; is also a good place to start.&lt;/p&gt;

&lt;p&gt;I would be happy if anyone would like to share some other great resources to learn unity, if so, why not add a link to them in the comments!&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/picking-up-game-development/">https://www.christianengvall.se/picking-up-game-development/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 15 Feb 2014 12:31:36 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/picking-up-game-development/</guid>
        </item>
      
    
      
        <item>
          <title>Error when installing cocoapods on mavericks</title>
          <link>https://www.christianengvall.se/error-when-installing-cocoapods-on-mavericks/</link>
          <comments>https://www.christianengvall.se/error-when-installing-cocoapods-on-mavericks/#respond</comments>
          <description>&lt;p&gt;When following the instructions to install cocoapods the following error occured:&lt;/p&gt;

&lt;p&gt;Building native extensions.  This could take a while…&lt;/p&gt;

&lt;p&gt;ERROR:  Error installing cocoapods:
ERROR: Failed to build gem native extension.&lt;/p&gt;

&lt;h3 id=&quot;command-line-tools&quot;&gt;Command line tools&lt;/h3&gt;
&lt;p&gt;The solution was to install the command line tools with this command:&lt;/p&gt;

&lt;p&gt;xcode-select –install&lt;/p&gt;

&lt;p&gt;and then again run:
sudo gem install cocoapods&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/error-when-installing-cocoapods-on-mavericks/">https://www.christianengvall.se/error-when-installing-cocoapods-on-mavericks/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 30 Nov 2013 15:13:00 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/error-when-installing-cocoapods-on-mavericks/</guid>
        </item>
      
    
      
        <item>
          <title>Undo git stash apply</title>
          <link>https://www.christianengvall.se/undo-git-stash-apply/</link>
          <comments>https://www.christianengvall.se/undo-git-stash-apply/#respond</comments>
          <description>&lt;p&gt;Sometimes we may need to undo a git stash apply, maybe we didn’t mean to apply it at all or we just applied it to the wrong branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I’ve made an easy extension to git that makes this command more easy to remember, i call it &lt;a href=&quot;/git-undo/&quot;&gt;gitUndo&lt;/a&gt;. With that extension all you need run is: &lt;strong&gt;git undo stash-apply&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 id=&quot;git-stash-commands&quot;&gt;Git stash commands&lt;/h3&gt;
&lt;p&gt;To un-apply the most recent stash this command is used:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git stash show &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; | git apply &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;now to add this as an alias we run this command in the terminal:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; alias.stash-unapply &lt;span class=&quot;s1&quot;&gt;'!git stash show -p | git apply -R'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now when un-applying is needed we will be able to run:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git stash-unapply&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/undo-git-stash-apply/">https://www.christianengvall.se/undo-git-stash-apply/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 31 Aug 2013 10:03:18 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/undo-git-stash-apply/</guid>
        </item>
      
    
      
        <item>
          <title>Aliasing git reset --soft HEAD^ as git undo</title>
          <link>https://www.christianengvall.se/aliasing-git-reset-soft-head-as-git-undo/</link>
          <comments>https://www.christianengvall.se/aliasing-git-reset-soft-head-as-git-undo/#respond</comments>
          <description>&lt;p&gt;I keep forgetting how to undo a commit with git because i very rarely need it. But i figured if i aliased it to &lt;strong&gt;&lt;em&gt;git undo&lt;/em&gt;&lt;/strong&gt; i wouldn’t need to google the command every time.
Now how does one do that? It turned out to be pretty simple actually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I’ve made an easy extension to git that makes this command more easy to remember, i call it &lt;a href=&quot;/git-undo/&quot;&gt;gitUndo&lt;/a&gt;. With that extension all you need run is: &lt;strong&gt;git undo commit&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 id=&quot;git-reset&quot;&gt;Git reset&lt;/h3&gt;
&lt;p&gt;The command to undo a commit and reset to the commit before HEAD and keeping the changes is:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git reset &lt;span class=&quot;nt&quot;&gt;--soft&lt;/span&gt; HEAD^&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And to add this as an alias to the .gitconfig file use this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; alias.undo &lt;span class=&quot;s1&quot;&gt;'reset --soft HEAD^'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now when running &lt;strong&gt;git undo&lt;/strong&gt; in the terminal your commit will be reset.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/aliasing-git-reset-soft-head-as-git-undo/">https://www.christianengvall.se/aliasing-git-reset-soft-head-as-git-undo/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 24 Jun 2013 22:19:31 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/aliasing-git-reset-soft-head-as-git-undo/</guid>
        </item>
      
    
      
        <item>
          <title>Xpath and default namespaced xml</title>
          <link>https://www.christianengvall.se/xpath-and-default-namespaced-xml/</link>
          <comments>https://www.christianengvall.se/xpath-and-default-namespaced-xml/#respond</comments>
          <description>&lt;p&gt;When using a default namespaced xml an xpath-expression need to look a bit different than when the xml uses namespace prefixes. Lets have a look at this namespaced XML:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;bk:bookstore&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:bk=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;urn:xmlns:25hoursaday-com:bookstore&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;bk:book&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;bk:title&amp;gt;&lt;/span&gt;Lord of the Rings&lt;span class=&quot;nt&quot;&gt;&amp;lt;/bk:title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;bk:author&amp;gt;&lt;/span&gt;J.R.R. Tolkien&lt;span class=&quot;nt&quot;&gt;&amp;lt;/bk:author&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/bk:book&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/bk:bookstore&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The xpath used to get the title of the book would look like: &lt;em&gt;/bk:bookstore/bk:book/bk:title&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now lets look at this default namespaced XML, it has no prefixes so we need to take another aproach to get the title of the book this time:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;bookstore&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;urn:xmlns:25hoursaday-com:bookstore&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;book&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Lord of the Rings&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;author&amp;gt;&lt;/span&gt;J.R.R. Tolkien&lt;span class=&quot;nt&quot;&gt;&amp;lt;/author&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/book&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/bookstore&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This time the xpath would look like: _/&lt;em&gt;[local-name()=’bookstore’]/&lt;/em&gt;[local-name()=’book’]/*[local-name()=’title’]
_The xpath matches any namespace and looks for the local name bookstore and after that book and title.&lt;/p&gt;

&lt;h3 id=&quot;php-example&quot;&gt;PHP Example&lt;/h3&gt;
&lt;p&gt;The following code shows how to use it, and the code including the xml files can be downloaded from &lt;a href=&quot;https://gist.github.com/crilleengvall/5620201&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;simplexml_load_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'namespaced.xml'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xpath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/bk:bookstore/bk:book/bk:title'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;simplexml_load_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'default-namespaced.xml'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$result_from_default_namespace&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$xml&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xpath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/*[local-name()='bookstore']/*[local-name()='book']/*[local-name()='title']&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$result_from_default_namespace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/xpath-and-default-namespaced-xml/">https://www.christianengvall.se/xpath-and-default-namespaced-xml/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 30 May 2013 07:38:32 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/xpath-and-default-namespaced-xml/</guid>
        </item>
      
    
      
        <item>
          <title>My first Ruby on rails experience</title>
          <link>https://www.christianengvall.se/my-first-ruby-on-rails-experience/</link>
          <comments>https://www.christianengvall.se/my-first-ruby-on-rails-experience/#respond</comments>
          <description>&lt;p&gt;I recently &lt;a href=&quot;http://www.husvisningar.se&quot;&gt;released Husvisningar.se&lt;/a&gt; with my friends &lt;a href=&quot;http://www.simonwall.se&quot;&gt;Simon&lt;/a&gt; and Jacob. It has been, and is continuing to be a really fun project. We decided to use &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Ruby on rails&lt;/a&gt; for this, just to learn something new.&lt;/p&gt;

&lt;p&gt;Ruby on rails is an open source mvc-framework that is used to build web applications with, some famous sites using it are Github and Twitter. According to it’s creator, David Heinemeier Hansson, the framework is &lt;a href=&quot;http://david.heinemeierhansson.com/&quot;&gt;optimized for programmer happiness and beautiful code.&lt;/a&gt; But this wasn’t the only good thing about it. There are tons of &lt;a href=&quot;http://en.wikipedia.org/wiki/RubyGems&quot;&gt;gems&lt;/a&gt; out there making it faster to create a site, and in almost every case there is someone else who has solved what you are trying to implement and shared the code. So I thought i’d share some good gems that we’ve used on our site.&lt;/p&gt;

&lt;h3 id=&quot;gems-used-on-husvisningar&quot;&gt;Gems used on Husvisningar&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rumblelabs/asset_sync&quot;&gt;Asset sync&lt;/a&gt;
This gem syncs images, css and javascript assets to &lt;a href=&quot;http://aws.amazon.com/s3/&quot;&gt;S3&lt;/a&gt;. This helps to load assets faster when serving them from a &lt;a href=&quot;https://developers.google.com/speed/docs/best-practices/request?hl=sv#ServeFromCookielessDomain&quot;&gt;cookieless domain. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mojombo/chronic&quot;&gt;Chronic&lt;/a&gt;
Chronic is a natural language date/time parser. So to get the date for next tuesday at 5 you can use Chronic this way:&lt;/p&gt;

&lt;p&gt;Chronic.parse(‘this tuesday 5:00’)
#=&amp;gt; Tue Aug 29 17:00:00&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/rsl/stringex&quot;&gt;Stringex
&lt;/a&gt;Stringex adds some useful extensions to the string class of ruby. For example it helps to remove unwanted chars when converting a string to use in a url.&lt;/p&gt;

&lt;p&gt;“simple English”.to_url =&amp;gt; “simple-english”&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/aws/aws-sdk-ruby&quot;&gt;aws-sdk
&lt;/a&gt;This gem is the official gem for amazon web services. Can be used for example if asset sync doesn’t fit your needs all the way.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/minimagick/minimagick&quot;&gt;MiniMagick&lt;/a&gt;
A lightweight alternative to RMagick to scale images with ImageMagick. Using it is as simple as this:&lt;/p&gt;

&lt;p&gt;image = MiniMagick::Image.open(“input.jpg”)
image.resize “100x100”
image.write “output.jpg”&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/railsjedi/rails_config&quot;&gt;RailsConfig&lt;/a&gt;
RailsConfig helps you easily manage environment specific Rails settings in an easy and usable manner.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/abhidsm/time_diff&quot;&gt;time_diff&lt;/a&gt;
Gem which calculates the difference between two dates and returns a hash of time difference in terms of years, month, week, day, hour, minute and second.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mperham/dalli&quot;&gt;Dalli&lt;/a&gt;
Dalli is a high performance pure Ruby client for accessing memcached servers.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/my-first-ruby-on-rails-experience/">https://www.christianengvall.se/my-first-ruby-on-rails-experience/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 24 May 2013 12:40:03 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/my-first-ruby-on-rails-experience/</guid>
        </item>
      
    
      
        <item>
          <title>Using IMCE with CKEditor and Drupal 7</title>
          <link>https://www.christianengvall.se/adding-imce-to-ckeditor-and-drupal-7/</link>
          <comments>https://www.christianengvall.se/adding-imce-to-ckeditor-and-drupal-7/#respond</comments>
          <description>&lt;p&gt;&lt;em&gt;“IMCE is an image/file uploader and browser that supports personal directories and quota.”&lt;/em&gt; - &lt;a href=&quot;http://drupal.org/project/imce&quot;&gt;http://drupal.org/project/imce
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This post describes how to use IMCE with CKEditor. If you haven’t installed CKEditor yet you can &lt;a href=&quot;/using-ckeditor-with-drupal-7/&quot;&gt;follow these steps.&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;1-download-and-install&quot;&gt;1. Download and install&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://drupal.org/project/imce&quot;&gt;Download&lt;/a&gt; the IMCE module install it and activate it.&lt;/p&gt;

&lt;h2 id=&quot;2-enable-filebrowser&quot;&gt;2. Enable filebrowser&lt;/h2&gt;
&lt;p&gt;Go to &lt;strong&gt;/admin/config/content/ckeditor/edit/Full&lt;/strong&gt; and scroll down to &lt;strong&gt;FILE BROWSER SETTINGS&lt;/strong&gt; and choose &lt;strong&gt;IMCE&lt;/strong&gt; as the file browser type.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/05/file-browser-drupal.png&quot; aria-label=&quot;File browser settings&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/05/file-browser-drupal.png&quot; alt=&quot;File browser settings&quot; width=&quot;665&quot; height=&quot;317&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/05/file-browser-drupal.png&quot; alt=&quot;File browser settings&quot; width=&quot;665&quot; height=&quot;317&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;File browser settings&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;3-create-content&quot;&gt;3. Create content&lt;/h2&gt;
&lt;p&gt;Now go to &lt;strong&gt;/admin/content&lt;/strong&gt; and create a new node. Make sure text format is set to Full HTML then click on the image icon and the button on the right to URL. My button says &lt;strong&gt;Bläddra på server&lt;/strong&gt; since my installation uses swedish.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/05/Skärmavbild-2013-05-21-kl.-14.46.22.png&quot; aria-label=&quot;Image properties&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/05/Skärmavbild-2013-05-21-kl.-14.46.22.png&quot; alt=&quot;Image properties&quot; width=&quot;442&quot; height=&quot;486&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/05/Skärmavbild-2013-05-21-kl.-14.46.22.png&quot; alt=&quot;Image properties&quot; width=&quot;442&quot; height=&quot;486&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Image properties&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;4-add-image&quot;&gt;4. Add image&lt;/h2&gt;
&lt;p&gt;Now the IMCE-window will appear and you can upload, delete, resize and insert file/image to your content.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/05/imce-window.png&quot; aria-label=&quot;IMCE Window&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/05/imce-window.png&quot; alt=&quot;IMCE Window&quot; width=&quot;859&quot; height=&quot;546&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/05/imce-window.png&quot; alt=&quot;IMCE Window&quot; width=&quot;859&quot; height=&quot;546&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;IMCE Window&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/adding-imce-to-ckeditor-and-drupal-7/">https://www.christianengvall.se/adding-imce-to-ckeditor-and-drupal-7/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 21 May 2013 15:00:59 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/adding-imce-to-ckeditor-and-drupal-7/</guid>
        </item>
      
    
      
        <item>
          <title>Unable to recreate feature in drupal 7</title>
          <link>https://www.christianengvall.se/unable-to-recreate-feature-in-drupal-7/</link>
          <comments>https://www.christianengvall.se/unable-to-recreate-feature-in-drupal-7/#respond</comments>
          <description>&lt;p&gt;In my drupal developer environment i had a problem which made it impossible to recreate features. When clicking the recreate tab all i would see was a blank page.&lt;/p&gt;

&lt;p&gt;First it’s hard to troubleshoot without an error message. So adding this code to index.php will display the error.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;error_reporting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;E_ALL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ini_set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'display_errors'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ini_set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'display_startup_errors'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now when reloading I could see the following error message:&lt;/p&gt;

&lt;p&gt;Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 115619 bytes) in /var/www/drupal/public/includes/common.inc on line 5849&lt;/p&gt;

&lt;h3 id=&quot;memory-leak&quot;&gt;Memory leak&lt;/h3&gt;
&lt;p&gt;This probably is happening because of a memoryleak somewhere. But since this only occurs in my dev environment and at this point a quick fix is needed, so i decided to override the maximum amount of memory that scripts can use with this line in index.php:&lt;/p&gt;

&lt;p&gt;ini_set(‘memory_limit’, ‘-1’);&lt;/p&gt;

&lt;p&gt;So the index.php now looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;error_reporting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;E_ALL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ini_set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'display_errors'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ini_set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'display_startup_errors'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;TRUE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ini_set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'memory_limit'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'-1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;cd&quot;&gt;/**
 * @file
 * The PHP page that serves all page requests on a Drupal installation.
 *
 * The routines here dispatch control to the appropriate handler, which then
 * prints the appropriate page.
 *
 * All Drupal code is released under the GNU General Public License.
 * See COPYRIGHT.txt and LICENSE.txt.
 */&lt;/span&gt;

&lt;span class=&quot;cd&quot;&gt;/**
 * Root directory of Drupal installation.
 */&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'DRUPAL_ROOT'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;getcwd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;require_once&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;DRUPAL_ROOT&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/includes/bootstrap.inc'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;drupal_bootstrap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DRUPAL_BOOTSTRAP_FULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;menu_execute_active_handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I would not recommend doing this on a production server though&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/unable-to-recreate-feature-in-drupal-7/">https://www.christianengvall.se/unable-to-recreate-feature-in-drupal-7/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 20 May 2013 07:45:56 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/unable-to-recreate-feature-in-drupal-7/</guid>
        </item>
      
    
      
        <item>
          <title>Gitignore exclude folder but include a subfolder</title>
          <link>https://www.christianengvall.se/gitignore-exclude-folder-but-include-a-subfolder/</link>
          <comments>https://www.christianengvall.se/gitignore-exclude-folder-but-include-a-subfolder/#respond</comments>
          <description>&lt;p&gt;In a project using Git i have a folder that is added to .gitignore. But i needed to include a subfolder that is tracked by git.&lt;/p&gt;

&lt;p&gt;What the folder structure looked like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Sites&lt;/li&gt;
  &lt;li&gt;-all&lt;/li&gt;
  &lt;li&gt;
    &lt;ul&gt;
      &lt;li&gt;
        &lt;ul&gt;
          &lt;li&gt;-files&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;ul&gt;
      &lt;li&gt;
        &lt;ul&gt;
          &lt;li&gt;
            &lt;ul&gt;
              &lt;li&gt;
                &lt;ul&gt;
                  &lt;li&gt;-private&lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;ul&gt;
      &lt;li&gt;
        &lt;ul&gt;
          &lt;li&gt;
            &lt;ul&gt;
              &lt;li&gt;
                &lt;ul&gt;
                  &lt;li&gt;
                    &lt;ul&gt;
                      &lt;li&gt;
                        &lt;ul&gt;
                          &lt;li&gt;-newspilot&lt;/li&gt;
                        &lt;/ul&gt;
                      &lt;/li&gt;
                    &lt;/ul&gt;
                  &lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;-default&lt;/li&gt;
  &lt;li&gt;
    &lt;ul&gt;
      &lt;li&gt;
        &lt;ul&gt;
          &lt;li&gt;-files&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;ul&gt;
      &lt;li&gt;
        &lt;ul&gt;
          &lt;li&gt;
            &lt;ul&gt;
              &lt;li&gt;
                &lt;ul&gt;
                  &lt;li&gt;-private&lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;ul&gt;
      &lt;li&gt;
        &lt;ul&gt;
          &lt;li&gt;
            &lt;ul&gt;
              &lt;li&gt;
                &lt;ul&gt;
                  &lt;li&gt;
                    &lt;ul&gt;
                      &lt;li&gt;
                        &lt;ul&gt;
                          &lt;li&gt;-newspilot&lt;/li&gt;
                        &lt;/ul&gt;
                      &lt;/li&gt;
                    &lt;/ul&gt;
                  &lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I needed to keep files in the &lt;em&gt;newspilot&lt;/em&gt; folder but the &lt;em&gt;files&lt;/em&gt; folder and its subfolders was ignored like this in the .gitignore: &lt;em&gt;sites/*/files&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I also didn’t want the files that exists in &lt;em&gt;files&lt;/em&gt; and &lt;em&gt;private&lt;/em&gt;. And this was the solution:&lt;/p&gt;

&lt;h3 id=&quot;git-ignore-and-exclude&quot;&gt;Git ignore and exclude&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;sites/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;/files/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;sites/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;/files/private
sites/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;/files/private/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;sites/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;/files/private/newspilot&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The first line ignores all files and folders in files.  &lt;br /&gt;
The second line excludes the private folder.  &lt;br /&gt;
The third line ignores all files and folder in private.  &lt;br /&gt;
And finally the last line excludes the newspilot folder.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/gitignore-exclude-folder-but-include-a-subfolder/">https://www.christianengvall.se/gitignore-exclude-folder-but-include-a-subfolder/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 15 May 2013 07:55:04 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/gitignore-exclude-folder-but-include-a-subfolder/</guid>
        </item>
      
    
      
        <item>
          <title>Using ckeditor with drupal 7</title>
          <link>https://www.christianengvall.se/using-ckeditor-with-drupal-7/</link>
          <comments>https://www.christianengvall.se/using-ckeditor-with-drupal-7/#respond</comments>
          <description>&lt;h2 id=&quot;1-download-and-install-module&quot;&gt;1. Download and install module&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://drupal.org/project/ckeditor&quot;&gt;Download&lt;/a&gt; and install the ckeditor module. Do not enable it yet.&lt;/p&gt;

&lt;h2 id=&quot;2-download-the-standalone-editor&quot;&gt;2. Download the standalone editor&lt;/h2&gt;
&lt;p&gt;Now we need to add the latest ckeditor files to the module. &lt;a href=&quot;http://ckeditor.com/download&quot;&gt;Download&lt;/a&gt; it and extract the contents of the zip file into the folder ckeditor in the newly installed module directory. (My module was installed in sites/all/modules/ckeditor)&lt;/p&gt;

&lt;h2 id=&quot;3-enable-module&quot;&gt;3. Enable module&lt;/h2&gt;
&lt;p&gt;Now go to &lt;em&gt;Administration panel -&amp;gt; Modules -&amp;gt; User Interface&lt;/em&gt; and enable CKEditor.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.51.30.png&quot; aria-label=&quot;User interface&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.51.30.png&quot; alt=&quot;User interface&quot; width=&quot;802&quot; height=&quot;155&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.51.30.png&quot; alt=&quot;User interface&quot; width=&quot;802&quot; height=&quot;155&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;User interface&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;4-permissions&quot;&gt;4. Permissions&lt;/h2&gt;
&lt;p&gt;Grant permission for the users that need to use the editor at &lt;strong&gt;people -&amp;gt; permissions.&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.53.52.png&quot; aria-label=&quot;Permissions&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.53.52.png&quot; alt=&quot;Permissions&quot; width=&quot;802&quot; height=&quot;282&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.53.52.png&quot; alt=&quot;Permissions&quot; width=&quot;802&quot; height=&quot;282&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Permissions&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;5-create-content&quot;&gt;5. Create content&lt;/h2&gt;
&lt;p&gt;When creating content for the standard basic page the text area is now a ckeditor instead.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.59.461.png&quot; aria-label=&quot;Permissions&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.59.461.png&quot; alt=&quot;Permissions&quot; width=&quot;820&quot; height=&quot;623&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-15.59.461.png&quot; alt=&quot;Permissions&quot; width=&quot;820&quot; height=&quot;623&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Permissions&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/using-ckeditor-with-drupal-7/">https://www.christianengvall.se/using-ckeditor-with-drupal-7/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 02 May 2013 12:35:38 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/using-ckeditor-with-drupal-7/</guid>
        </item>
      
    
      
        <item>
          <title>SEO-friendly urls in drupal 7</title>
          <link>https://www.christianengvall.se/seo-friendly-urls-in-drupal-7/</link>
          <comments>https://www.christianengvall.se/seo-friendly-urls-in-drupal-7/#respond</comments>
          <description>&lt;p&gt;To get seo-friendly urls in drupal 7 we need three modules.The first one we need is pathauto which takes care of the job to create the urls, but that doesn’t really get us all the way, we also need transliteration to get rid of, for example, åäö in the urls created. The last one we need is token, which is a dependency for pathatuto. This quick tutorial requires that you know how to install a drupal module.&lt;/p&gt;

&lt;h2 id=&quot;1-installation&quot;&gt;1. Installation&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://drupal.org/project/pathauto&quot;&gt; Download and install pathauto&lt;/a&gt; and &lt;a href=&quot;http://drupal.org/project/token&quot;&gt;token&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;2-activate-modules&quot;&gt;2. Activate modules&lt;/h2&gt;
&lt;p&gt;Active these modules by check the boxes and push save configuration.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-12.49.36.png&quot; aria-label=&quot;Activate modules&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-12.49.36.png&quot; alt=&quot;Activate modules&quot; width=&quot;897&quot; height=&quot;245&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-12.49.36.png&quot; alt=&quot;Activate modules&quot; width=&quot;897&quot; height=&quot;245&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Activate modules&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;3-update-pathauto-settings&quot;&gt;3. Update pathauto settings&lt;/h2&gt;
&lt;p&gt;Now go to &lt;strong&gt;Configuration -&amp;gt; search and metadata -&amp;gt; URL-aliases&lt;/strong&gt; (&lt;url-to-site&gt;/admin/config/search/path)&lt;/url-to-site&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-15.22.06.png&quot; aria-label=&quot;Url&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-15.22.06.png&quot; alt=&quot;Url&quot; width=&quot;600&quot; height=&quot;237&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-15.22.06.png&quot; alt=&quot;Url&quot; width=&quot;600&quot; height=&quot;237&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Url&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now click on the patterns tab in the top right corner to. This is where you can set at default url-pattern for all your content types or define a pattern for each type. The image below shows an example:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-15.31.47.png&quot; aria-label=&quot;Patterns&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-15.31.47.png&quot; alt=&quot;Patterns&quot; width=&quot;875&quot; height=&quot;295&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-15-kl.-15.31.47.png&quot; alt=&quot;Patterns&quot; width=&quot;875&quot; height=&quot;295&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Patterns&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;the pattern for all Article paths is myarticles/[node:title] and the pattern for Basic page is basicpages/[node:title]. A bit further down that page you can also set the pattern for taxonomy and users. When you are happy with the patterns just hit &lt;strong&gt;Save Configuration.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now if you create new content(&lt;em&gt;Content-&amp;gt; add-content -&amp;gt; pagetype&lt;/em&gt;) your pages will have seo-friendly urls.&lt;/p&gt;

&lt;h2 id=&quot;4-transliteration&quot;&gt;4. Transliteration&lt;/h2&gt;
&lt;p&gt;Transliteration helps out with chars you don’t want in a URL, for example åäö. &lt;a href=&quot;http://drupal.org/project/transliteration&quot;&gt;Download the module&lt;/a&gt;, install it and activate it.&lt;/p&gt;

&lt;p&gt;Go to &lt;em&gt;Configuration -&amp;gt; search and metadata -&amp;gt; url aliases -&amp;gt; settings&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.34.52.png&quot; aria-label=&quot;Transliteration&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.34.52.png&quot; alt=&quot;Transliteration&quot; width=&quot;891&quot; height=&quot;84&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.34.52.png&quot; alt=&quot;Transliteration&quot; width=&quot;891&quot; height=&quot;84&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Transliteration&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Scroll down to &lt;em&gt;Transliterate prior to creating alias _and activate it, then click _Save configuration.&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.38.14.png&quot; aria-label=&quot;Transliterate prior to creating alias&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.38.14.png&quot; alt=&quot;Transliterate prior to creating alias&quot; width=&quot;1139&quot; height=&quot;397&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.38.14.png&quot; alt=&quot;Transliterate prior to creating alias&quot; width=&quot;1139&quot; height=&quot;397&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Transliterate prior to creating alias&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now when creating new content the urls will contain valid characters.&lt;/p&gt;

&lt;h2 id=&quot;5-updating-already-added-content&quot;&gt;5. Updating already added content&lt;/h2&gt;
&lt;p&gt;To update urls for already existing content just go to &lt;em&gt;Configuration&lt;/em&gt; -_&amp;gt; search and metadata -_&amp;gt; url aliases -_&amp;gt;Delete aliases
&lt;em&gt;Check the&lt;/em&gt; all aliases &lt;em&gt;checkbox and click _Delete aliases now!&lt;/em&gt;&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.42.54.png&quot; aria-label=&quot;Url aliases&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.42.54.png&quot; alt=&quot;Url aliases&quot; width=&quot;1188&quot; height=&quot;413&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.42.54.png&quot; alt=&quot;Url aliases&quot; width=&quot;1188&quot; height=&quot;413&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Url aliases&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now click on the &lt;em&gt;BULK UPDATE&lt;/em&gt; tab and check all checkboxes you want to create an alias for and click &lt;em&gt;Update&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.43.07.png&quot; aria-label=&quot;Bulk update&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.43.07.png&quot; alt=&quot;Bulk update&quot; width=&quot;1188&quot; height=&quot;290&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/04/Skärmavbild-2013-04-24-kl.-12.43.07.png&quot; alt=&quot;Bulk update&quot; width=&quot;1188&quot; height=&quot;290&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Bulk update&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/seo-friendly-urls-in-drupal-7/">https://www.christianengvall.se/seo-friendly-urls-in-drupal-7/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 24 Apr 2013 12:48:15 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/seo-friendly-urls-in-drupal-7/</guid>
        </item>
      
    
      
        <item>
          <title>Updating ruby version in ruby on rails app</title>
          <link>https://www.christianengvall.se/updating-ruby-version-in-ruby-on-rails-app/</link>
          <comments>https://www.christianengvall.se/updating-ruby-version-in-ruby-on-rails-app/#respond</comments>
          <description>&lt;p&gt;To update ruby version used by a ruby on rails app we need to start with installing the ruby version we want. This can be accomplished very easy with Ruby Version Manager (RVM).&lt;/p&gt;

&lt;h3 id=&quot;rvm-terminal&quot;&gt;RVM Terminal&lt;/h3&gt;
&lt;p&gt;Start a terminal window and run this to install RVM and Ruby 1.9.3:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;url &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; https://get.rvm.io | bash &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; stable &lt;span class=&quot;nt&quot;&gt;--ruby&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1.9.3 &lt;span class=&quot;nt&quot;&gt;--autolibs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;enabled&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When the install is done quit the terminal and start it again, then run this command to set ruby version:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;rvm &lt;span class=&quot;nt&quot;&gt;--default&lt;/span&gt; use 1.9.3&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next update the gemfile with the new ruby version:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;ruby &lt;span class=&quot;s1&quot;&gt;'1.9.3'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And we’re done!&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/updating-ruby-version-in-ruby-on-rails-app/">https://www.christianengvall.se/updating-ruby-version-in-ruby-on-rails-app/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 08 Apr 2013 07:55:42 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/updating-ruby-version-in-ruby-on-rails-app/</guid>
        </item>
      
    
      
        <item>
          <title>Clear cache with after deploy hook on pagodabox</title>
          <link>https://www.christianengvall.se/clear-cache-with-after-deploy-hook-on-pagodabox/</link>
          <comments>https://www.christianengvall.se/clear-cache-with-after-deploy-hook-on-pagodabox/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;https://pagodabox.com/&quot;&gt;pagodabox&lt;/a&gt; is a good alternative to host a &lt;a href=&quot;http://symfony.com/&quot;&gt;Symfony2&lt;/a&gt; site. When updating it all you need to do is commit to your master branch and push it to pagodabox, then clear the cache via ssh to deploy the site. But the last step can be automated with an after deploy hook.&lt;/p&gt;

&lt;p&gt;An after deploy hook is is added in the boxfile and all we need to add is this:&lt;/p&gt;

&lt;p&gt;&lt;del&gt;after_deploy:&lt;/del&gt;
&lt;del&gt; - “rm -R app/cache/”&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;Update:
&lt;a href=&quot;http://vvv.tobiassjosten.net/&quot;&gt;Tobias Sjösten&lt;/a&gt; (thanks for the tip!) had an improvement to the hook, and it is to use symfonys console tool to clear the cache like this:&lt;/p&gt;

&lt;p&gt;after_deploy:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;“php app/console cache:clear –env=prod –no-debug”&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;boxfile-example&quot;&gt;Boxfile example&lt;/h3&gt;
&lt;p&gt;An example of a boxfile with after_deploy hook included:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;web1:
  &lt;span class=&quot;c&quot;&gt;################################################&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;## GENERAL SETTINGS&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;################################################&lt;/span&gt;
  shared_writable_dirs:
      - app/cache
      - app/logs

  &lt;span class=&quot;c&quot;&gt;################################################&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;## WEB SPECIFIC SETTINGS&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;################################################&lt;/span&gt;
  document_root: web
  default_gateway: app.php
  index_list: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;app.php]

  &lt;span class=&quot;c&quot;&gt;################################################&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;## PHP SPECIFIC SETTINGS&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;################################################&lt;/span&gt;
  php_version: 5.3.5
  php_extensions:
    - intl
    - mbstring
    - xsl
    - apc
    - mysql
    - posix
    - iconv
    - tokenizer
    - xml
    - pdo_mysql
  php_session_autostart: Off
  php_short_open_tag: Off
  magic_quotes_gpc: Off
  after_deploy:
    - &lt;span class=&quot;s2&quot;&gt;&quot;php app/console cache:clear --env=prod --no-debug&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/clear-cache-with-after-deploy-hook-on-pagodabox/">https://www.christianengvall.se/clear-cache-with-after-deploy-hook-on-pagodabox/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 11 Mar 2013 08:00:31 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/clear-cache-with-after-deploy-hook-on-pagodabox/</guid>
        </item>
      
    
      
        <item>
          <title>Developer resources # 2 - videos</title>
          <link>https://www.christianengvall.se/developer-resources-2-videos/</link>
          <comments>https://www.christianengvall.se/developer-resources-2-videos/#respond</comments>
          <description>&lt;h2 id=&quot;how-to-build-a-github-by-zach-holman&quot;&gt;How to build a github by Zach Holman&lt;/h2&gt;
&lt;p&gt;Zach Holman talks about how github has changed since the start but also interesting parts how github works to get employees to stay at their company, and so far no employee has left. The most interesting part was about how they automate tasks and deploy new things every day.&lt;/p&gt;

&lt;iframe src=&quot;https://player.vimeo.com/video/47017314&quot; width=&quot;640&quot; height=&quot;480&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;clean-code-by-robert-c-martin&quot;&gt;Clean code by Robert C. Martin&lt;/h2&gt;
&lt;p&gt;Robert C. Martin gives an introduction of how to write clean code at Oredev 2008.&lt;/p&gt;

&lt;iframe src=&quot;https://player.vimeo.com/video/12643301&quot; width=&quot;640&quot; height=&quot;400&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

&lt;h2 id=&quot;keep-your-goals-to-yourself-by-derek-sivers&quot;&gt;Keep your goals to yourself by Derek Sivers&lt;/h2&gt;
&lt;p&gt;This 3 minute TEDtalk is not developer specific but what Derek has to say helps getting things done. It doesn’t matter if it’s a work related goal, a goal to run a marathon or getting a side project deployed.&lt;/p&gt;

&lt;iframe src=&quot;https://player.vimeo.com/video/52798422&quot; width=&quot;640&quot; height=&quot;360&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/developer-resources-2-videos/">https://www.christianengvall.se/developer-resources-2-videos/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 14 Jan 2013 09:51:48 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/developer-resources-2-videos/</guid>
        </item>
      
    
      
        <item>
          <title>Add tab to facebook page</title>
          <link>https://www.christianengvall.se/add-tab-to-facebook-page/</link>
          <comments>https://www.christianengvall.se/add-tab-to-facebook-page/#respond</comments>
          <description>&lt;p&gt;With Static HTML: iframe tabs you can add static html to a Facebook page. This simple walkthrough(hello world) assumes you know how to create a page or already have a page to add a tab to and also simple html and css knowledge.&lt;/p&gt;

&lt;h2 id=&quot;1-add-static-htmliframe-tabs-to-your-page&quot;&gt;1. Add static HTML:iframe tabs to your page&lt;/h2&gt;
&lt;p&gt;Log in to your facebook account where you are admin for a page. Then browse to this url: &lt;a href=&quot;http://apps.facebook.com/static_html_plus/&quot;&gt;http://apps.facebook.com/static_html_plus/&lt;/a&gt; and click &lt;em&gt;&lt;strong&gt;Add static html to a page&lt;/strong&gt;&lt;/em&gt;. Then choose which of your pages to add it to.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/01-add.png&quot; aria-label=&quot;Add static html&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/01-add.png&quot; alt=&quot;Add static html&quot; width=&quot;800&quot; height=&quot;518&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/01-add.png&quot; alt=&quot;Add static html&quot; width=&quot;800&quot; height=&quot;518&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Add static html&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;When this is done you will be redirected to your page and a tab name welcome has been added. In the next step we will change the picture and rename the tab.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/02-startpage.png&quot; aria-label=&quot;Startpage&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/02-startpage.png&quot; alt=&quot;Startpage&quot; width=&quot;860&quot; height=&quot;311&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/02-startpage.png&quot; alt=&quot;Startpage&quot; width=&quot;860&quot; height=&quot;311&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Startpage&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;2-update-name-and-image-of-the-new-tab&quot;&gt;2. Update name and image of the new tab&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Go to Admin Panel -&amp;gt; Edit Page -&amp;gt;&lt;/em&gt;&lt;/strong&gt; and click on &lt;strong&gt;&lt;em&gt;Update Info&lt;/em&gt;&lt;/strong&gt;. Then click on &lt;strong&gt;&lt;em&gt;apps&lt;/em&gt;&lt;/strong&gt; in the menu to the left.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/03-adminpanel.png&quot; aria-label=&quot;Admin panel&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/03-adminpanel.png&quot; alt=&quot;Admin panel&quot; width=&quot;848&quot; height=&quot;222&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/03-adminpanel.png&quot; alt=&quot;Admin panel&quot; width=&quot;848&quot; height=&quot;222&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Admin panel&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;When you’ve clicked on apps you will se all the added apps for your page. Click on &lt;strong&gt;&lt;em&gt;Edit Settings&lt;/em&gt;&lt;/strong&gt; for the &lt;strong&gt;_ Static HTML: iframe tabs _&lt;/strong&gt; app.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/04-statichtmlsettings.png&quot; aria-label=&quot;Static html settings&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/04-statichtmlsettings.png&quot; alt=&quot;Static html settings&quot; width=&quot;860&quot; height=&quot;233&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/04-statichtmlsettings.png&quot; alt=&quot;Static html settings&quot; width=&quot;860&quot; height=&quot;233&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Static html settings&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;A new window will appear where you can set &lt;em&gt;&lt;strong&gt;Custom tab image&lt;/strong&gt;&lt;/em&gt; and &lt;strong&gt;&lt;em&gt;Custom tab name.&lt;/em&gt;&lt;/strong&gt; When you are done with uploading a image and setting the name of the tab click &lt;em&gt;&lt;strong&gt;Save&lt;/strong&gt;&lt;/em&gt; and then click &lt;strong&gt;&lt;em&gt;OK.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/05-statichtmlsettings2.png&quot; aria-label=&quot;iframe tabs settings&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/05-statichtmlsettings2.png&quot; alt=&quot;iframe tabs settings&quot; width=&quot;860&quot; height=&quot;233&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/05-statichtmlsettings2.png&quot; alt=&quot;iframe tabs settings&quot; width=&quot;860&quot; height=&quot;233&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;iframe tabs settings&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;3-adding-content&quot;&gt;3. Adding content&lt;/h2&gt;
&lt;p&gt;Go to the start of the page and click on the new tab, which you just renamed and edited the image of. In this case &lt;em&gt;&lt;strong&gt;My own tab.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/06-myowntab.png&quot; aria-label=&quot;My own tab&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/06-myowntab.png&quot; alt=&quot;My own tab&quot; width=&quot;860&quot; height=&quot;311&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/06-myowntab.png&quot; alt=&quot;My own tab&quot; width=&quot;860&quot; height=&quot;311&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;My own tab&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;You will now see the startscreen of the new tab. Where you can edit settings and add more tabs if you want to. But you can also choose to edit public content and fan content. Public content is shown for everyone and fan content is shown for people who has clicked like on your page. Click on &lt;em&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/em&gt; next to Public content.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/07-edittab.png&quot; aria-label=&quot;Edit tab&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/07-edittab.png&quot; alt=&quot;Edit tab&quot; width=&quot;860&quot; height=&quot;311&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/07-edittab.png&quot; alt=&quot;Edit tab&quot; width=&quot;860&quot; height=&quot;311&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Edit tab&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Next we will get a question which kind of tab/app we want to create. In this tutorial we choose HTML i recommend you play around with the other ones to but for now click on &lt;em&gt;&lt;strong&gt;Use this app&lt;/strong&gt;&lt;/em&gt; under html and click on &lt;strong&gt;_done _&lt;/strong&gt; at the top of the page.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/08-apps.png&quot; aria-label=&quot;apps&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/08-apps.png&quot; alt=&quot;apps&quot; width=&quot;699&quot; height=&quot;679&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/08-apps.png&quot; alt=&quot;apps&quot; width=&quot;699&quot; height=&quot;679&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;apps&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;In the &lt;strong&gt;_ index.html tab_&lt;/strong&gt; we add this code and click on &lt;strong&gt;save and publish&lt;/strong&gt; :
the [[style.css]] tag indicates that we want to use the css found in the style.css tab.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;lang=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;en&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xml:lang=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sv&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Something&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
 [[style.css]]
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;http-equiv=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;content=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/html; charset=UTF-8&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;crappyredtext&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Hello world!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And in the style.css tab you add this simple css class and click on &lt;strong&gt;save and publish&lt;/strong&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nc&quot;&gt;.crappyredtext&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2013/01/09-content.png&quot; aria-label=&quot;Content&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2013/01/09-content.png&quot; alt=&quot;Content&quot; width=&quot;823&quot; height=&quot;445&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2013/01/09-content.png&quot; alt=&quot;Content&quot; width=&quot;823&quot; height=&quot;445&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Content&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now if you go back to the start page and click on your tab you will see Hello World! in red.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/add-tab-to-facebook-page/">https://www.christianengvall.se/add-tab-to-facebook-page/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 09 Jan 2013 08:54:05 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/add-tab-to-facebook-page/</guid>
        </item>
      
    
      
        <item>
          <title>Developer resources - Books</title>
          <link>https://www.christianengvall.se/developer-resources-books/</link>
          <comments>https://www.christianengvall.se/developer-resources-books/#respond</comments>
          <description>&lt;p&gt;I’m always looking for resources that can help me become a better developer. This is a list of books that i’ve read or planning to read. The books are interesting to any developer regarding what language they use.&lt;/p&gt;

&lt;h3 id=&quot;developer-books&quot;&gt;Developer books&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?ie=UTF8&amp;amp;qid=1351250569&amp;amp;sr=8-1&amp;amp;keywords=clean+code&quot;&gt;Clean Code: A Handbook of Agile Software Craftsmanship - Robert C. Martin
&lt;/a&gt;&lt;em&gt;“Even bad code can function. But if code isn’t clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn’t have to be that way.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1351251030&amp;amp;sr=1-1&amp;amp;keywords=clean+coder&quot;&gt;Clean coder - Robert C. Martin&lt;/a&gt;
&lt;em&gt;“In The Clean Coder: A Code of Conduct for Professional Programmers, legendary software expert Robert C. Martin introduces the disciplines, techniques, tools, and practices of true software craftsmanship. This book is packed with practical advice–about everything from estimating and coding to refactoring and testing. It covers much more than technique: It is about attitude.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.amazon.com/Domain-Driven-Design-Quickly-Abel-Avram/dp/1411609255/ref=sr_1_2?s=books&amp;amp;ie=UTF8&amp;amp;qid=1357142008&amp;amp;sr=1-2&amp;amp;keywords=domain+driven+design+by+eric+evans&quot;&gt;Domain driven design quickly - Eric Evans&lt;/a&gt;
&lt;em&gt; ”Domain Driven Design is a vision and approach for dealing with highly complex domains that is based on making the domain itself the main focus of the project, and maintaining a software model that reflects a deep understanding of the domain. This book is a short, quickly-readable summary and introduction to the fundamentals of DDD; it does not introduce any new concepts; it attempts to concisely summarize the essence of what DDD is, drawing mostly Eric Evans’ original book, as well other sources since published such as Jimmy Nilsson’s Applying Domain Driven Design, and various DDD discussion forums. The main topics covered in the book include: Building Domain Knowledge, The Ubiquitous Language, Model Driven Design, Refactoring Toward Deeper Insight, and Preserving Model Integrity.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=13512509&quot;&gt;Refactoring - Martin Fowler&lt;/a&gt;
&lt;em&gt;“Refactoring is about improving the design of existing code. It is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure. With refactoring you can even take a bad design and rework it into a good one.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.amazon.com/Art-Unit-Testing-Examples-Net/dp/1933988274/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1351251005&amp;amp;sr=1-1&amp;amp;keywords=the+art+of+unit+testing&quot;&gt;The art of unit testing - Roy Osherove&lt;/a&gt;
&lt;em&gt;“The Art of Unit Testing builds on top of what’s already been written about this important topic. It guides you step by step from simple tests to tests that are maintainable, readable, and trustworthy. It covers advanced subjects like mocks, stubs, and frameworks such as Typemock Isolator and Rhino Mocks. And you’ll learn about advanced test patterns and organization, working with legacy code and even untestable code. The book discusses tools you need when testing databases and other technologies. It’s written for .NET developers but others will also benefit from this book.” &lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.amazon.com/Things-Every-Programmer-Should-Know/dp/0596809484&quot;&gt;97 things every programmer should know - Kevlin Henney
&lt;/a&gt;&lt;em&gt;“Tap into the wisdom of experts to learn what every programmer should know, no matter what language you use. With the 97 short and extremely useful tips for programmers in this book, you’ll expand your skills by adopting new approaches to old problems, learning appropriate best practices, and honing your craft through sound advice.”&lt;/em&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/developer-resources-books/">https://www.christianengvall.se/developer-resources-books/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 07 Jan 2013 10:02:20 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/developer-resources-books/</guid>
        </item>
      
    
      
        <item>
          <title>Clean code</title>
          <link>https://www.christianengvall.se/clean-code/</link>
          <comments>https://www.christianengvall.se/clean-code/#respond</comments>
          <description>&lt;p&gt;I recently held a presentation about Clean code at Sogeti and thought i’d recap the important parts in a post. The slides can be found on &lt;a href=&quot;http://prezi.com/m32zc9cbz_6a/clean-code/&quot;&gt;prezi.&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-length-of-a-method&quot;&gt;The length of a method&lt;/h2&gt;
&lt;p&gt;A method should be as small as possible, about 3 to 6 lines of code.  The method should never be more the 10 lines of code. It should also only do one thing.&lt;/p&gt;

&lt;h2 id=&quot;names&quot;&gt;Names&lt;/h2&gt;
&lt;p&gt;The name of a method should explain what the method does, and this gets simple since the method should only do one thing. Don’t be afraid to make the method name long, make sure to use a naming convention that allows multiple words in it.&lt;/p&gt;

&lt;p&gt;The name of a variable should explain what the contents of the variable is.
Bad name:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//Elapsed time in days&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;good name:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;elapsedTimeInDays&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Do not use any abbrevations, they might be simple for you to understand but when another developer comes into your code he might not know what the abbrevation means.&lt;/p&gt;

&lt;h2 id=&quot;arguments&quot;&gt;Arguments&lt;/h2&gt;
&lt;p&gt;A method should not accept more than three arguments, if you go over that number maybe you should think about making an object that contains these arguments as a property.&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Don’t use out arguments. When we read code we usually dont expect information to comeback from the arguments.&lt;/p&gt;

&lt;p&gt;Don’t use booleans as arguments. if you do the method you’re writing will probably do more than one thing, depending if the boolean is true or false. And if you se a call to a method like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;nf&quot;&gt;DeleteEmployee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;“&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;”&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;you will have to go into the method to know what it does with the true and false, instead of continue reading.&lt;/p&gt;

&lt;h2 id=&quot;comments&quot;&gt;Comments&lt;/h2&gt;
&lt;p&gt;Do not comment code. The method name should explain what the method does. A comment will probably not get updated when the code is changed therefore the comment will be outdated and only confuse other developers. If you se outocmmented code just delete it. If you need it later it will always be in the version control.&lt;/p&gt;

&lt;h2 id=&quot;if-else-while-foreach-and-try-catch&quot;&gt;If, else, while, foreach and try catch&lt;/h2&gt;
&lt;p&gt;The body of a if/else, while foreach and try catch should always be one line long and it should call another method. This is to keep the method small and the code will document itself with the methodname. Examples:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myBool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;callToMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;callToAnotherMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;DeleteCustomer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exception&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;do-not-return-null&quot;&gt;Do not return null&lt;/h2&gt;
&lt;p&gt;If a method encounters a problem and you decide to return null you’re going to have a lot of null checks in the code that calls this method. This is unnecessary, instead return a variable that is empty, for example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;n&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;employees&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getEmployees&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;employees&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;employee&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;employees&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;employees&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;raiseSalary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;if getEmployees() would return a empty list of employee when an error occured in that method we wouldn’t need to check for null and our methodcall could look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;n&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;employees&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getEmployees&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;employee&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;employees&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;employees&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;raiseSalary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;These are only a few tips from clean code, i recommend you &lt;a href=&quot;http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/&quot;&gt;buy the book&lt;/a&gt; or take a look at Robert C. Martins &lt;a href=&quot;http://www.cleancoders.com/&quot;&gt;code-cast about clean code.&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/clean-code/">https://www.christianengvall.se/clean-code/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 06 Dec 2012 12:52:35 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/clean-code/</guid>
        </item>
      
    
      
        <item>
          <title>A quick git commands refresh</title>
          <link>https://www.christianengvall.se/a-quick-git-commands-refresh/</link>
          <comments>https://www.christianengvall.se/a-quick-git-commands-refresh/#respond</comments>
          <description>&lt;p&gt;When using git i like to work with &lt;a href=&quot;http://nvie.com/about/&quot;&gt;Vincent Driessen&lt;/a&gt;’s &lt;a href=&quot;http://nvie.com/posts/a-successful-git-branching-model/&quot;&gt;a successful git branching model&lt;/a&gt;. But since my projects varies i switch between git and another version control system, and sometimes need a quick refresh to get up to speed with git again. So this is the short version of the successful branching model.&lt;/p&gt;

&lt;h2 id=&quot;create-feature-branch&quot;&gt;Create feature branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; myfeature develop
Switched to a new branch &lt;span class=&quot;s2&quot;&gt;&quot;myfeature&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;merge-feature-branch&quot;&gt;Merge feature branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout develop
Switched to branch &lt;span class=&quot;s1&quot;&gt;'develop'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git merge &lt;span class=&quot;nt&quot;&gt;--no-ff&lt;/span&gt; myfeature
Updating ea1b82a..05e9557
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Summary of changes&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git branch &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; myfeature
Deleted branch myfeature &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;was 05e9557&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git push origin develop&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;create-release-branch&quot;&gt;Create release branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; release-1.2 develop
Switched to a new branch &lt;span class=&quot;s2&quot;&gt;&quot;release-1.2&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./bump-version.sh 1.2
Files modified successfully, version bumped to 1.2.
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git commit &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Bumped version number to 1.2&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;release-1.2 74d9424] Bumped version number to 1.2
1 files changed, 1 insertions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;+&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, 1 deletions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;-&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;finish-release-branch&quot;&gt;Finish release branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; release-1.2 develop
Switched to a new branch &lt;span class=&quot;s2&quot;&gt;&quot;release-1.2&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./bump-version.sh 1.2
Files modified successfully, version bumped to 1.2.
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git commit &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Bumped version number to 1.2&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;release-1.2 74d9424] Bumped version number to 1.2
1 files changed, 1 insertions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;+&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, 1 deletions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;-&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;create-hotfix-branch&quot;&gt;Create hotfix branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; hotfix-1.2.1 master
Switched to a new branch &lt;span class=&quot;s2&quot;&gt;&quot;hotfix-1.2.1&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./bump-version.sh 1.2.1
Files modified successfully, version bumped to 1.2.1.
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git commit &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Bumped version number to 1.2.1&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1
1 files changed, 1 insertions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;+&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, 1 deletions&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;-&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;finish-hotfix-branch&quot;&gt;Finish hotfix branch&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout master
Switched to branch &lt;span class=&quot;s1&quot;&gt;'master'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git merge &lt;span class=&quot;nt&quot;&gt;--no-ff&lt;/span&gt; hotfix-1.2.1
Merge made by recursive.
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Summary of changes&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git tag &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; 1.2.1

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git checkout develop
Switched to branch &lt;span class=&quot;s1&quot;&gt;'develop'&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git merge &lt;span class=&quot;nt&quot;&gt;--no-ff&lt;/span&gt; hotfix-1.2.1
Merge made by recursive.
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Summary of changes&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;git branch &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; hotfix-1.2.1
Deleted branch hotfix-1.2.1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;was abbe5d6&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;.&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/11/gitbranchmodel.png&quot; aria-label=&quot;successful git branch model&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/11/gitbranchmodel.png&quot; alt=&quot;successful git branch model&quot; width=&quot;611&quot; height=&quot;815&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/11/gitbranchmodel.png&quot; alt=&quot;successful git branch model&quot; width=&quot;611&quot; height=&quot;815&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;successful git branch model&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://nvie.com/posts/a-successful-git-branching-model/&quot;&gt;Image from http://nvie.com/posts/a-successful-git-branching-model/&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/a-quick-git-commands-refresh/">https://www.christianengvall.se/a-quick-git-commands-refresh/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 15 Nov 2012 23:20:03 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/a-quick-git-commands-refresh/</guid>
        </item>
      
    
      
        <item>
          <title>Unable to publish page containing URL to image</title>
          <link>https://www.christianengvall.se/unable-publish-page-containing-url-image/</link>
          <comments>https://www.christianengvall.se/unable-publish-page-containing-url-image/#respond</comments>
          <description>&lt;p&gt;This error occurred after an upgrade from Episerver CMS 5 to CMS 6 R2. When trying to publish a page this error message was shown: “urltoimage.jpg”  is not a valid value for “imageproperty”&lt;/p&gt;

&lt;p&gt;Vladimir Terziyski &lt;a href=&quot;http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=51156&quot;&gt;wrote the following about why this error is happening:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“I’ve had the same problem some time ago. I’ve narrowed it down to using Native or other custom Virtual path provider. Seems it comes from the new base class for url properties called PropertyFileUrl, from which PropertyImageUrl and PropertyDocumentUrl inherit. It has one method called ValidateUri which throws an exception when the VirtualPathProvider you use doesn’t implement IFileResolver interface. For example - VirtualPathNativeProvider. Here is what is happening:&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;The user saves &amp;amp; publishes the page.&lt;/li&gt;
  &lt;li&gt;A call to Set accessor for the PropertyUrl.String property is made. Inside it, a call to PropertyFileUrl.ValidateUri method is made&lt;/li&gt;
  &lt;li&gt;ValidateUri throws an exception which says that the url is not absolute on the following line:&lt;/li&gt;
  &lt;li&gt;GenericHostingEnvironment.VirtualPathProvider.FileExists(uri.LocalPath))&lt;/li&gt;
  &lt;li&gt;This exception however is masked behind the text “[imagepath] is not a valid value for [imagepropertyname]”. This text is shown as error in the Edit interface.&lt;/li&gt;
  &lt;li&gt;If the selected VirtualPathProvider implements IFileResolver, call to ValidateUri will not be made if the file is resolved.”&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;how-to-solve-the-problem&quot;&gt;How to solve the problem&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;Download the latest release of &lt;a href=&quot;http://world.episerver.com/&quot;&gt;Episerver CMS 6 R2&lt;/a&gt; from episerver world.&lt;/li&gt;
  &lt;li&gt;Backup your site and database&lt;/li&gt;
  &lt;li&gt;Uninstall EPiServerFramework from the control panel&lt;/li&gt;
  &lt;li&gt;Uninstall EPiserverCMS&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Uninstall EPiServershared&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Install EPiServerShared.msi from the latest release of CMS 6 R2&lt;/li&gt;
  &lt;li&gt;Install EPiServerFramework.msi&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Install EPiServerCMS.msi&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Copy assemblies from  &lt;strong&gt;Program Files (x86)\EPiServer\CMS\6.1.379.0\bin&lt;/strong&gt; to the site’s bin folder.&lt;/li&gt;
  &lt;li&gt; Copy assemblies from &lt;strong&gt;Program Files (x86)\EPiServer\Framework\6.2.267.1\bin&lt;/strong&gt; to the site’s bin folder.&lt;/li&gt;
  &lt;li&gt;run an &lt;strong&gt;iisreset&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These instructions + instructions for Relate can be found &lt;a href=&quot;http://world.episerver.com/Articles/Items/About-the-Latest-Updates-for-EPiServer-CMS-and-Relate/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/unable-publish-page-containing-url-image/">https://www.christianengvall.se/unable-publish-page-containing-url-image/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 05 Oct 2012 14:34:54 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/unable-publish-page-containing-url-image/</guid>
        </item>
      
    
      
        <item>
          <title>Upgrading to episerver cms 6</title>
          <link>https://www.christianengvall.se/upgrading-episerver-cms-6/</link>
          <comments>https://www.christianengvall.se/upgrading-episerver-cms-6/#respond</comments>
          <description>&lt;p&gt;I recently ran into the same problem as&lt;a href=&quot;http://www.jamie-dixon.co.uk/episerver/upgrading-episerver-to-version-6/&quot;&gt; Jamie Dixon when upgrading&lt;/a&gt; a episerver site from cms 5 to cms6. But the solution was a little different.&lt;/p&gt;

&lt;p&gt;The error message is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Cannot resolve dependencies for the following module(s)&lt;/em&gt;&lt;/strong&gt;
&lt;strong&gt;&lt;em&gt;EPiServer.Cms.Shell.UI.InitializableModule&lt;/em&gt;&lt;/strong&gt;
&lt;strong&gt;&lt;em&gt;EPiServer.Cms.Shell.UI.InitializableModule&lt;/em&gt;&lt;/strong&gt;
&lt;strong&gt;&lt;em&gt;EPiServer.Web.InitializationModule&lt;/em&gt;&lt;/strong&gt;
&lt;strong&gt;&lt;em&gt;EPiServer.Web.InitializationModule&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And the problem was the same as Jamies post explained:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“After some digging around and much testing, it turns out that not all of the required DLLs are present in the “6.0.530.0″ folder (C:\Program Files\EPiServer\CMS\6.0.530.0 – on my machine).”&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;installing-a-site-without-database&quot;&gt;Installing a site without database&lt;/h3&gt;
&lt;p&gt;And it was solved by &lt;strong&gt;&lt;em&gt;installing a site without database&lt;/em&gt;&lt;/strong&gt; from &lt;strong&gt;&lt;em&gt;EPiServer Deployment Center&lt;/em&gt;&lt;/strong&gt;. Use all the standard settings and click next until the site is installed.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/09/deploy.png&quot; aria-label=&quot;Episerver deployment center&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/09/deploy.png&quot; alt=&quot;Episerver deployment center&quot; width=&quot;662&quot; height=&quot;505&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/09/deploy.png&quot; alt=&quot;Episerver deployment center&quot; width=&quot;662&quot; height=&quot;505&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Episerver deployment center&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;When the installation has finished copy the contents of the bin folder of the site to this folder: &lt;strong&gt;&lt;em&gt;C:\Program Files (x86)\EPiServer\CMS\6.0.530.0\bin&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When this is done just run the &lt;strong&gt;Upgrade site with SQL Server database&lt;/strong&gt; again on your site.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/upgrading-episerver-cms-6/">https://www.christianengvall.se/upgrading-episerver-cms-6/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 27 Sep 2012 12:34:34 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/upgrading-episerver-cms-6/</guid>
        </item>
      
    
      
        <item>
          <title>cache in csharp</title>
          <link>https://www.christianengvall.se/cache-in-csharp/</link>
          <comments>https://www.christianengvall.se/cache-in-csharp/#respond</comments>
          <description>&lt;p&gt;This is a wrapper around HttpRuntime.Cache i use when some object is to expensive to get from its source every time. For example a RSS-feed which might only need to get updates from its source every minute.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System.Web&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System.Web.Caching&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HttpRuntimeCache&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DateTime&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_Expiration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DateTime&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Expiration&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_Expiration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;set&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_Expiration&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HttpRuntimeCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_Expiration&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DateTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddHours&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objectToCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ValidateKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ValidateCacheObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objectToCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;HttpRuntime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objectToCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_Expiration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NoSlidingExpiration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CacheItemPriority&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Normal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ValidateKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpRuntime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Remove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ValidateKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;HttpRuntime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Remove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ValidateKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ThrowNullKeyError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ThrowEmptyKeyError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ValidateCacheObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objectToCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objectToCache&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ThrowObjectError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ThrowObjectError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;objectToCache&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ThrowNullKeyError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;key&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ThrowEmptyKeyError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ArgumentException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Input cannot be empty&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;key&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This code shows how to add and remove a string from the cache. If it’s not removed it will stay there for 4 hours which is set in the contstructor of HttpRuntimeCache class.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;simpleString&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;this string will be cached&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;HttpRuntimeCache&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HttpRuntimeCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;simpleString&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;simpleString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fromCache&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;simpleString&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Remove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;simpleString&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;change-cache-expiration&quot;&gt;Change cache expiration&lt;/h3&gt;
&lt;p&gt;To change the expiration the Expiration property can be set before adding the object to the cache:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;simpleString&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;this string will be cached&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;HttpRuntimeCache&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HttpRuntimeCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Expiration&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DateTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddHours&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;simpleString&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;simpleString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/cache-in-csharp/">https://www.christianengvall.se/cache-in-csharp/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 17 Sep 2012 21:16:46 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/cache-in-csharp/</guid>
        </item>
      
    
      
        <item>
          <title>Check if page in episerver is opened from edit/admin mode</title>
          <link>https://www.christianengvall.se/check-page-episerver-opened-editadmin-mode/</link>
          <comments>https://www.christianengvall.se/check-page-episerver-opened-editadmin-mode/#respond</comments>
          <description>&lt;p&gt;This code can be used to check if a page in episerver is opened in edit mode. It uses HttpContext.Current.Request.UrlReferrer.LocalPath to see if the word admin or edit exists in the url.&lt;/p&gt;

&lt;h3 id=&quot;check-edit-mode-code-example&quot;&gt;Check edit mode code example&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;IsOpenedInEditMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;isInEditMode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;If&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Current&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UrlReferrer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;isInEditMode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;IsMatch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Current&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UrlReferrer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LocalPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/admin/|/edit/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;RegexOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IgnoreCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;isInEditMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/check-page-episerver-opened-editadmin-mode/">https://www.christianengvall.se/check-page-episerver-opened-editadmin-mode/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 11 Sep 2012 12:39:51 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/check-page-episerver-opened-editadmin-mode/</guid>
        </item>
      
    
      
        <item>
          <title>Xcode breakpoint actions</title>
          <link>https://www.christianengvall.se/xcode-breakpoint-actions/</link>
          <comments>https://www.christianengvall.se/xcode-breakpoint-actions/#respond</comments>
          <description>&lt;p&gt;The simple way to use a breakpoint in Xcode is just to click on the line number next to the line of code that needs to be debugged and start to step through the code. But an action can also be added to the breakpoint to speed up the debugging. This post covers three out of the six available actions, as those are the ones i felt are most useful.&lt;/p&gt;

&lt;p&gt;To add actions to a breakpoint click on it while holding &lt;strong&gt;&lt;em&gt;option(alt) + command&lt;/em&gt;&lt;/strong&gt;
When the breakpoint settings are open you click on &lt;em&gt;&lt;strong&gt;add action&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;debugger-command&quot;&gt;Debugger command&lt;/h2&gt;
&lt;p&gt;A debugger command is useful when wanting to know what values an object holds while the breakpoint is hit. We can use it to print the values to the debugger output without having to step through the code or write code to output it with NSLOG.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Edit a breakpoint using the shortcut above and select &lt;strong&gt;&lt;em&gt;debugger command&lt;/em&gt;&lt;/strong&gt; as action.&lt;/li&gt;
  &lt;li&gt;In the textbox that shows up a debugger command can be entered. like &lt;em&gt;&lt;strong&gt;po foo&lt;/strong&gt;&lt;/em&gt;. foo is changed to a object in the scope of where your breakpoint is located.&lt;/li&gt;
  &lt;li&gt;Also check the &lt;strong&gt;&lt;em&gt;“automatically continue after evaluating”&lt;/em&gt;&lt;/strong&gt; checkbox as we don’t want to stop at this breakpoint.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the example below I have a breakpoint which outputs the values of a NSDictionary called DeviceData to my debugger window.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-13.43.48.png&quot; aria-label=&quot;Debugger window&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-13.43.48.png&quot; alt=&quot;Debugger window&quot; width=&quot;947&quot; height=&quot;426&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-13.43.48.png&quot; alt=&quot;Debugger window&quot; width=&quot;947&quot; height=&quot;426&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Debugger window&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;log-message&quot;&gt;Log Message&lt;/h2&gt;
&lt;p&gt;You can also log a message to the debugger console, if you for example want to know how many times a breakpoint is being hit.&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;To do this select &lt;em&gt;&lt;strong&gt;Log message&lt;/strong&gt;&lt;/em&gt; in the action dropdown&lt;/li&gt;
  &lt;li&gt;Select “&lt;em&gt;&lt;strong&gt;Log message to console&lt;/strong&gt;&lt;/em&gt;”.&lt;/li&gt;
  &lt;li&gt;Type “_&lt;strong&gt;%B has been hit %H_&lt;/strong&gt; times”&lt;/li&gt;
  &lt;li&gt;And as we did before we check the &lt;em&gt;&lt;strong&gt;“Automatically continue after evaluating”&lt;/strong&gt;&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-14.03.22.png&quot; aria-label=&quot;Log message to console&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-14.03.22.png&quot; alt=&quot;Log message to console&quot; width=&quot;800&quot; height=&quot;288&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-14.03.22.png&quot; alt=&quot;Log message to console&quot; width=&quot;800&quot; height=&quot;288&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Log message to console&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;sound&quot;&gt;Sound&lt;/h2&gt;
&lt;p&gt;This action can be used if we are only interested in to see if a message is sent to a method when we run our project. &lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-14.15.42.png&quot; aria-label=&quot;Sound&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-14.15.42.png&quot; alt=&quot;Sound&quot; width=&quot;800&quot; height=&quot;288&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/08/Skärmavbild-2012-08-09-kl.-14.15.42.png&quot; alt=&quot;Sound&quot; width=&quot;800&quot; height=&quot;288&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Sound&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/xcode-breakpoint-actions/">https://www.christianengvall.se/xcode-breakpoint-actions/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 10 Aug 2012 09:20:13 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/xcode-breakpoint-actions/</guid>
        </item>
      
    
      
        <item>
          <title>Sort and remove duplicate objective-c import directives</title>
          <link>https://www.christianengvall.se/sort-remove-duplicate-objective-c-import-directives/</link>
          <comments>https://www.christianengvall.se/sort-remove-duplicate-objective-c-import-directives/#respond</comments>
          <description>&lt;p&gt;With automator you can add scripts to your right click menu in xcode. We can use this to create a script that helps us keep our #import directives in order. In this example the directives will be sorted in alphabetical order and removing duplicates. Lets start automator and begin.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt; In automator go to &lt;strong&gt;File -&amp;gt; New&lt;/strong&gt; choose &lt;strong&gt;Service&lt;/strong&gt; as the type and click &lt;strong&gt;Choose&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/07/Skärmavbild-2012-07-26-kl.-11.14.24-AM.png&quot; aria-label=&quot;Automator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/07/Skärmavbild-2012-07-26-kl.-11.14.24-AM.png&quot; alt=&quot;Automator&quot; width=&quot;902&quot; height=&quot;747&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/07/Skärmavbild-2012-07-26-kl.-11.14.24-AM.png&quot; alt=&quot;Automator&quot; width=&quot;902&quot; height=&quot;747&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Automator&lt;/p&gt;
&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Drag a &lt;strong&gt;Run shell script&lt;/strong&gt; action to the drag actions here… area.
Select &lt;strong&gt;text &lt;/strong&gt;in the &lt;strong&gt;services recieves selected&lt;/strong&gt; dropdown.
select &lt;strong&gt;any application&lt;/strong&gt; in the &lt;strong&gt;in&lt;/strong&gt; dropdown.
Check the &lt;strong&gt;Output replaces selected text&lt;/strong&gt; checkbox&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;This is where the magic happens.
Type the following in your run shell script:&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sort&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;uniq&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;the automator window should now look like this:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/07/Skärmavbild-2012-07-26-kl.-11.30.46-AM.png&quot; aria-label=&quot;Automator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/07/Skärmavbild-2012-07-26-kl.-11.30.46-AM.png&quot; alt=&quot;Automator&quot; width=&quot;988&quot; height=&quot;831&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/07/Skärmavbild-2012-07-26-kl.-11.30.46-AM.png&quot; alt=&quot;Automator&quot; width=&quot;988&quot; height=&quot;831&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Automator&lt;/p&gt;
&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Choose &lt;strong&gt;File -&amp;gt; Save… **and save the service as **Sort and remove duplicates&lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Restart Xcode&lt;/strong&gt;, open a file with &lt;strong&gt;messy #import&lt;/strong&gt; directives, &lt;strong&gt;select them and right click and choose Sort and remove duplicates.&lt;/strong&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/07/Sk&amp;auml;rmavbild-2012-07-26-kl.-11.32.45-AM.png&quot; aria-label=&quot;Sort and remove duplicates&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/07/Sk&amp;auml;rmavbild-2012-07-26-kl.-11.32.45-AM.png&quot; alt=&quot;Sort and remove duplicates&quot; width=&quot;355&quot; height=&quot;573&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/07/Sk&amp;auml;rmavbild-2012-07-26-kl.-11.32.45-AM.png&quot; alt=&quot;Sort and remove duplicates&quot; width=&quot;355&quot; height=&quot;573&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Sort and remove duplicates&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;sort-and-remove-remove-duplicates-result&quot;&gt;Sort and remove remove duplicates result&lt;/h3&gt;
&lt;p&gt;These #import directives now looks like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/07/Sk&amp;auml;rmavbild-2012-07-26-kl.-14.10.42.png&quot; aria-label=&quot;Sort and remove duplicates&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/07/Sk&amp;auml;rmavbild-2012-07-26-kl.-14.10.42.png&quot; alt=&quot;Sort and remove duplicates&quot; width=&quot;299&quot; height=&quot;63&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/07/Sk&amp;auml;rmavbild-2012-07-26-kl.-14.10.42.png&quot; alt=&quot;Sort and remove duplicates&quot; width=&quot;299&quot; height=&quot;63&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Sort and remove duplicates&lt;/p&gt;
&lt;/div&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/sort-remove-duplicate-objective-c-import-directives/">https://www.christianengvall.se/sort-remove-duplicate-objective-c-import-directives/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 26 Jul 2012 14:20:15 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/sort-remove-duplicate-objective-c-import-directives/</guid>
        </item>
      
    
      
        <item>
          <title>Embed gist from github on a wordpress blog</title>
          <link>https://www.christianengvall.se/embed-gist-from-github-on-a-wordpress-blog/</link>
          <comments>https://www.christianengvall.se/embed-gist-from-github-on-a-wordpress-blog/#respond</comments>
          <description>&lt;p&gt;I found this snippet of code at &lt;a href=&quot;http://interconnectit.com/3920/embed-all-the-gists/&quot;&gt;Robert O’Rourkes blog&lt;/a&gt;. It easily lets you embed a gist from github to your wordpress posts. Up til now i’ve been using Syntax highlighter evolved which has not been working well all the time. And with this implementation you also get version control.&lt;/p&gt;

&lt;h3 id=&quot;php-code&quot;&gt;PHP code&lt;/h3&gt;
&lt;p&gt;Start of by adding the following to the functions.php file of your theme:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;cd&quot;&gt;/**
 * Usage:
 * Paste a gist link into a blog post or page and it will be embedded eg:
 * https://gist.github.com/2926827
 *
 * If a gist has multiple files you can select one using a url in the following format:
 * https://gist.github.com/2926827?file=embed-gist.php
 */&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;wp_embed_register_handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'gist'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/https:\/\/gist\.github\.com\/(\d+)(\?file=.*)?/i'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'wp_embed_handler_gist'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wp_embed_handler_gist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$rawattr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;$embed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
			&lt;span class=&quot;s1&quot;&gt;'&amp;lt;script src=&quot;https://gist.github.com/%1$s.js%2$s&quot;&amp;gt;&amp;lt;/script&amp;gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
			&lt;span class=&quot;nf&quot;&gt;esc_attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt;
			&lt;span class=&quot;nf&quot;&gt;esc_attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
			&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;apply_filters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'embed_gist'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$embed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$matches&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$attr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$rawattr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And when you’re done all you have to do is add a link to a post :&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/06/Sk&amp;auml;rmavbild-2012-06-24-kl.-14.00.38.png&quot; aria-label=&quot;Wordpress editor&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/06/Sk&amp;auml;rmavbild-2012-06-24-kl.-14.00.38.png&quot; alt=&quot;Wordpress editor&quot; width=&quot;497&quot; height=&quot;253&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/06/Sk&amp;auml;rmavbild-2012-06-24-kl.-14.00.38.png&quot; alt=&quot;Wordpress editor&quot; width=&quot;497&quot; height=&quot;253&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Wordpress editor&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;2015-11-05 Update: I don’t use this approach anymore. Github limits the usage for this service. I now use a wordpress highligher plugin instead.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/embed-gist-from-github-on-a-wordpress-blog/">https://www.christianengvall.se/embed-gist-from-github-on-a-wordpress-blog/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 24 Jun 2012 14:06:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/embed-gist-from-github-on-a-wordpress-blog/</guid>
        </item>
      
    
      
        <item>
          <title>NSDate to NSString with NSharpDate</title>
          <link>https://www.christianengvall.se/nsdate-to-nsstring-with-nsharpdate/</link>
          <comments>https://www.christianengvall.se/nsdate-to-nsstring-with-nsharpdate/#respond</comments>
          <description>&lt;p&gt;Converting an NSDate to NSString can sometimes be not as simple as one would hope. &lt;a href=&quot;https://github.com/crilleengvall/NSharpDate&quot;&gt;NSharpDate&lt;/a&gt; is a NSDate category that can help you with this. It adds easy to use methods and properties to the NSDate object.&lt;/p&gt;

&lt;h2 id=&quot;example-of-a-method&quot;&gt;Example of a method&lt;/h2&gt;

&lt;p&gt;To get a NSString from a NSDate you need to use a NSDateFormatter. The following code is how you could do it without NSharpDate which would produce a string looking like this: &lt;em&gt;5/27/12&lt;/em&gt; if the IOS device locale is US, or like this if the locale is Sweden: &lt;em&gt;2012-05-27&lt;/em&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objective-c&quot; data-lang=&quot;objective-c&quot;&gt;NSDate *date = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterShortStyle];
[formatter setTimeStyle:NSDateFormatterNoStyle];

NSString *dateString = [formatter stringFromDate:date];&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;With NSharpDate you only need one line of code to do this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objective-c&quot; data-lang=&quot;objective-c&quot;&gt;NSDate *date = [NSDate date];
NSString *dateString = [date stringByShortDateFormat];&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This is only one of the five methods added to NSDate, to see the other &lt;a href=&quot;http://crilleengvall.github.io/NSharpDate/&quot;&gt;methods head over to the NSharpDate site.&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;example-of-a-property&quot;&gt;Example of a property&lt;/h2&gt;

&lt;p&gt;To get the day of week from an nsdate you would use the following code without NSharpDate. This would give you a string like “Sunday” or “Söndag:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objective-c&quot; data-lang=&quot;objective-c&quot;&gt;NSDate *date = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@&quot;EEEE&quot;];

NSString *dateString = [formatter stringFromDate:date];&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To get the same result with NSharpDate you do the following:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objective-c&quot; data-lang=&quot;objective-c&quot;&gt;NSDate *date = [NSDate date];
NSString  *day = date.DayOfWeek;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;There are a few more properties added to NSDate which you can find &lt;a href=&quot;http://crilleengvall.github.io/NSharpDate/&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;download-and-setup&quot;&gt;Download and setup&lt;/h2&gt;
&lt;p&gt;there are only &lt;a href=&quot;http://crilleengvall.github.io/NSharpDate/&quot;&gt;three steps involved to get started&lt;/a&gt; with NSharpDate.&lt;/p&gt;

&lt;h2 id=&quot;contributing&quot;&gt;Contributing&lt;/h2&gt;
&lt;p&gt;If you find a bug or want to add a feature to the project you are very welcome to add this code to the category. You can head over to &lt;a href=&quot;https://github.com/crilleengvall/NSharpDate&quot;&gt;github to fork&lt;/a&gt; the project and send me a pull request when you are done.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/nsdate-to-nsstring-with-nsharpdate/">https://www.christianengvall.se/nsdate-to-nsstring-with-nsharpdate/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Fri, 01 Jun 2012 16:13:22 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/nsdate-to-nsstring-with-nsharpdate/</guid>
        </item>
      
    
      
        <item>
          <title>Phonegap gitignore</title>
          <link>https://www.christianengvall.se/phonegap-gitignore/</link>
          <comments>https://www.christianengvall.se/phonegap-gitignore/#respond</comments>
          <description>&lt;p&gt;I’ve started working on a gitignore file for Phonegap projects. The .gitignore file can be used with the folder structure explained in &lt;a href=&quot;/phonegap-and-multiple-platforms/&quot;&gt;Phonegap and multiple platforms&lt;/a&gt;. But also with projects only containing one platform.&lt;/p&gt;

&lt;p&gt;If you have any improvements to the file you are welcome to update it on Github. &lt;a href=&quot;https://github.com/crilleengvall/gitignore&quot;&gt;That is also the location where you can download Phonegap.gitignore.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don’t want to follow the folderstructure described in the post that i linked to above you can delete the following lines:&lt;/p&gt;

&lt;h3 id=&quot;generated-files---android-project-subfolder&quot;&gt;generated files - android project subfolder&lt;/h3&gt;
&lt;p&gt;Android/bin/  &lt;br /&gt;
Android/gen/  &lt;br /&gt;
Android/assets/&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/phonegap-gitignore/">https://www.christianengvall.se/phonegap-gitignore/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 16 Apr 2012 17:07:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/phonegap-gitignore/</guid>
        </item>
      
    
      
        <item>
          <title>Phonegap and multiple platforms</title>
          <link>https://www.christianengvall.se/phonegap-and-multiple-platforms/</link>
          <comments>https://www.christianengvall.se/phonegap-and-multiple-platforms/#respond</comments>
          <description>&lt;p&gt;This post provides an example of how to work with phonegap and multiple platforms. What folder structure to use and how to share the www folder between projects. Platforms used are iOS and Android. This example project can be &lt;a href=&quot;https://github.com/crilleengvall/Phonegap-GoogleMap-and-ProjectSettings-example&quot;&gt;downloaded at github&lt;/a&gt; but i recommend reading the post first.&lt;/p&gt;

&lt;h2 id=&quot;folder-structure&quot;&gt;Folder structure&lt;/h2&gt;

&lt;p&gt;The www folder is located in the top folder and linked in under android and iOS folders (windows phone and blackberry too if you’d like, but thats not covered here)
-www  &lt;br /&gt;
-Android  &lt;br /&gt;
-IOS  &lt;br /&gt;
(–WP)  &lt;br /&gt;
(–Blackberry)&lt;/p&gt;

&lt;h2 id=&quot;starting-with-ios&quot;&gt;Starting with iOS&lt;/h2&gt;

&lt;p&gt;Start with creating a new &lt;em&gt;Cordova-Based Application&lt;/em&gt; following &lt;a href=&quot;http://wiki.phonegap.com/w/page/52010495/Getting%20Started%20with%20PhoneGap-Cordova%20and%20Xcode%204&quot;&gt;these instructions&lt;/a&gt; on the phonegap wiki. But stop when the instruction tells you to copy the www folder and continue here. Save this application in your IOS folder.&lt;/p&gt;

&lt;p&gt;You’re back? Good! let’s continue.
Open Finder and navigate to your application. You should see a folder called www in the folder where you created the cordova based application. After copying it to the root folder your folderstructure should look like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/04/folderstructure.png&quot; aria-label=&quot;Folderstructure&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/04/folderstructure.png&quot; alt=&quot;Folderstructure&quot; width=&quot;816&quot; height=&quot;526&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/04/folderstructure.png&quot; alt=&quot;Folderstructure&quot; width=&quot;816&quot; height=&quot;526&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Folderstructure&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now drop the www folder into the xcode project(images borrowed from phonegap wiki):&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/04/cordovo-ios-6.png&quot; aria-label=&quot;Cordova project&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/04/cordovo-ios-6.png&quot; alt=&quot;Cordova project&quot; width=&quot;971&quot; height=&quot;471&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/04/cordovo-ios-6.png&quot; alt=&quot;Cordova project&quot; width=&quot;971&quot; height=&quot;471&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Cordova project&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Choose the following options and click finish:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/04/cordovo-ios-7.png&quot; aria-label=&quot;Cordova project options&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/04/cordovo-ios-7.png&quot; alt=&quot;Cordova project options&quot; width=&quot;731&quot; height=&quot;493&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/04/cordovo-ios-7.png&quot; alt=&quot;Cordova project options&quot; width=&quot;731&quot; height=&quot;493&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Cordova project options&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now click on run and your cordova application is working!&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-15.45.05.png&quot; aria-label=&quot;Cordova project in iOS simulator&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-15.45.05.png&quot; alt=&quot;Cordova project in iOS simulator&quot; width=&quot;396&quot; height=&quot;744&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-15.45.05.png&quot; alt=&quot;Cordova project in iOS simulator&quot; width=&quot;396&quot; height=&quot;744&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Cordova project in iOS simulator&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now we’re done with the IOS part, Let’s continue to Android and Eclipse.&lt;/p&gt;

&lt;h2 id=&quot;continuing-with-android&quot;&gt;Continuing with Android&lt;/h2&gt;

&lt;p&gt;Follow &lt;a href=&quot;http://phonegap.com/getstarted/&quot;&gt;this guide to set up your Phonegap project&lt;/a&gt; with Eclipse for android. Skip the part with creating the www folder and continue here when you’re done.&lt;/p&gt;

&lt;p&gt;Now our folder structure should look like this:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-16.26.16.png&quot; aria-label=&quot;Folderstructure - Android&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-16.26.16.png&quot; alt=&quot;Folderstructure - Android&quot; width=&quot;480&quot; height=&quot;309&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-16.26.16.png&quot; alt=&quot;Folderstructure - Android&quot; width=&quot;480&quot; height=&quot;309&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Folderstructure - Android&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now if you try to run the project in the simulator you get the following error, which we will deal with next:&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-16.19.09.png&quot; aria-label=&quot;Folderstructure - Android&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-16.19.09.png&quot; alt=&quot;Folderstructure - Android&quot; width=&quot;434&quot; height=&quot;299&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2012/04/Skärmavbild-2012-04-05-kl.-16.19.09.png&quot; alt=&quot;Folderstructure - Android&quot; width=&quot;434&quot; height=&quot;299&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Folderstructure - Android&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Now let’s link the www folder in the assets folder. Open a terminal and navigate to your assets folder and create a symbolic link to the www folder:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; ../../www/ www&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Or if you are working with the Android project on windows you have to open a console and create a link with this command:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;mklink /D c:&lt;span class=&quot;se&quot;&gt;\p&lt;/span&gt;athtoproject&lt;span class=&quot;se&quot;&gt;\A&lt;/span&gt;ndroid&lt;span class=&quot;se&quot;&gt;\a&lt;/span&gt;ssets&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;ww c:&lt;span class=&quot;se&quot;&gt;\p&lt;/span&gt;athtoproject&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;ww&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note: If you’ll be using git you want to add assets/www to your .gitignore file to avoid having trouble with commits on Windows. &lt;a href=&quot;/phonegap-gitignore/&quot;&gt;You can get my phonegap gitignore file here.&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And we are almost done, but first we must add a reference to the cordova.js file for android. In the phonegap archive you downloaded when you first installed it, you got a folder called lib. And inside that folder you another one called Android/example. If you go navigate to the www folder for that example project you see a file called &lt;em&gt;cordova-1.5.0.js.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Copy that file to your own www folder and rename it to cordova-1.5.0-android.js&lt;/p&gt;

&lt;p&gt;Open up index.html and go to the line that now contains this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;utf-8&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;cordova-1.5.0.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CDATA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// ]]&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and replace it with this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CDATA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;navigator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;userAgent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/android/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;script charset=&quot;utf-8&quot; src=&quot;cordova/cordova-1.5.0-android.js&quot;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/script&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;navigator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;userAgent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/iphone/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;navigator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;userAgent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/ipad/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;script charset=&quot;utf-8&quot; src=&quot;cordova/cordova-1.5.0-ios.js&quot;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/script&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// ]]&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And now you are ready to run the project on your emulator or android phone.
As i wrote at the top of this post you can download the &lt;a href=&quot;https://github.com/crilleengvall/Phonegap-GoogleMap-and-ProjectSettings-example/&quot;&gt;example project from github&lt;/a&gt; to see how i have done it if you’re having trouble.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/phonegap-and-multiple-platforms/">https://www.christianengvall.se/phonegap-and-multiple-platforms/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 16 Apr 2012 17:06:02 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/phonegap-and-multiple-platforms/</guid>
        </item>
      
    
      
        <item>
          <title>Phonegap and Google maps</title>
          <link>https://www.christianengvall.se/phonegap-and-google-maps/</link>
          <comments>https://www.christianengvall.se/phonegap-and-google-maps/#respond</comments>
          <description>&lt;p&gt;How to show a Google map in your Phonegap app using Google Map api V3, and what whitelist urls to add to your project. This post expect you know how to set up a new Phonegap project.&lt;/p&gt;

&lt;h2 id=&quot;1-start-by-adding-a-reference-to-google-maps-api-in-indexhtml&quot;&gt;1. Start by adding a reference to Google maps api in index.html&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://maps.googleapis.com/maps/api/js?sensor=false&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://code.google.com/apis/maps/documentation/javascript/examples/default.css&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/css&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then add a div that will contain the map. Choose an id like “map_canvas”. That id will be used to add our map from our javascript later on.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;map_canvas&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;##2. Create a new javascript file called googlemap.js in the www folder and add the following content&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GoogleMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;initialize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;showMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;showMap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapOptions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;zoom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;151&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;mapTypeId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;MapTypeId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ROADMAP&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;map_canvas&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and add a reference to it in index.html&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-hmtl&quot; data-lang=&quot;hmtl&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;googlemap.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;the mapOptions variable contains information about zoomlevel, where the center of the map is and what kind of map we want to show.
And the line containing the map variable uses getElementById to get our map_canvas and adding the map.&lt;/p&gt;

&lt;h2 id=&quot;3-whitelisting-google-urls&quot;&gt;3. Whitelisting google urls&lt;/h2&gt;

&lt;p&gt;Now we must add the following urls to our Cordova.plist under externalHosts if using Xcode:&lt;/p&gt;

&lt;p&gt;*.google.com  &lt;br /&gt;
*.googleapis.com  &lt;br /&gt;
*.gstatic.com&lt;/p&gt;

&lt;h2 id=&quot;4-showing-the-map&quot;&gt;4. Showing the map&lt;/h2&gt;
&lt;p&gt;To show the map we must run the initialize function in googlemap.js. Since we are using the example index.html from phonegap we add these lines to the onDeviceReady function in index.html&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;onDeviceReady&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GoogleMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now run the app and you should se a map over Australia.&lt;/p&gt;

&lt;h2 id=&quot;5-adding-markers&quot;&gt;5. Adding markers&lt;/h2&gt;
&lt;p&gt;To add markers to our map we use the LatLng and Marker object from Google API.
Edit the initialize function in googlemap.js to look like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GoogleMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;initialize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;showMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and add the following function, called addMarkersToMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeOne&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;-33.890542&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;151.274856&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;markerOne&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeOne&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeTwo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;57.77828&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;14.17200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;markerOne&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeTwo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Here we added a function called addMarkersToMap and called it from the initialize function.
What it’s doing is adding two markers on our map at the given latitude and longitude. And when we create a new marker object, like markerOne, we give the object the position and which map we want to add the marker to.&lt;/p&gt;

&lt;p&gt;But if we run the app now we only see one marker. Let’s fix that.&lt;/p&gt;

&lt;h2 id=&quot;6-zooming-out-the-map-to-show-all-markers&quot;&gt;6. Zooming out the map to show all markers&lt;/h2&gt;
&lt;p&gt;to zoom out the map without knowing which zoomlevel to use we are going to use the LatLngBounds object from the Google Map API.&lt;/p&gt;

&lt;p&gt;Start off by adding the following line first in the addMarkersToMap function:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLngBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and before the closing tag of the function add these lines:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeOne&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeTwo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fitBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The addMarkersToMap function now looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;addMarkersToMap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLngBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeOne&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;-33.890542&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;151.274856&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;markerOne&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeOne&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeTwo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;LatLng&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;57.77828&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;14.17200&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;markerOne&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;google&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;maps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Marker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeTwo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeOne&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;latitudeAndLongitudeTwo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fitBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mapBounds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now we’re done, run the app and the map now zooms out so you can see the marker which we added in Sweden.&lt;/p&gt;

&lt;p&gt;I’ve created an example application of this and pushed it to a &lt;a href=&quot;https://github.com/crilleengvall/Phonegap-GoogleMap-and-ProjectSettings-example&quot;&gt;repository on Github&lt;/a&gt;, have a look at it if you want to see the code.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/phonegap-and-google-maps/">https://www.christianengvall.se/phonegap-and-google-maps/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 16 Apr 2012 00:00:00 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/phonegap-and-google-maps/</guid>
        </item>
      
    
      
        <item>
          <title>Continuing in English</title>
          <link>https://www.christianengvall.se/continuing-in-english/</link>
          <comments>https://www.christianengvall.se/continuing-in-english/#respond</comments>
          <description>&lt;p&gt;From now on posts will be in English. Hopefully my posts can provide help for more people that way. The posts will be translated one by on but let me know if i forgot to translate something on the site.&lt;/p&gt;

&lt;h3 id=&quot;spelling-errors&quot;&gt;Spelling errors&lt;/h3&gt;
&lt;p&gt;If you find any spelling or any other errors please let me know.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/continuing-in-english/">https://www.christianengvall.se/continuing-in-english/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 15 Apr 2012 12:22:06 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/continuing-in-english/</guid>
        </item>
      
    
      
        <item>
          <title>Schemalägga php-script i OSX Lion</title>
          <link>https://www.christianengvall.se/schemalagga-php-script-i-osx-lion/</link>
          <comments>https://www.christianengvall.se/schemalagga-php-script-i-osx-lion/#respond</comments>
          <description>&lt;p&gt;För att schemalägga script i OSX Lion används launchd. Lägg till ett jobb genom att spara en .plist i mappen &lt;strong&gt;/Users/%användare%/Library/LaunchAgents&lt;/strong&gt;. Ett exempel på en .plist är:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;plist&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;version=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;Label&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;se.christianengvall.phptelldus&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;ProgramArguments&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;array&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;/usr/bin/php&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;/Users/%användare%/Sites/Telldus/hello.php&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;StartInterval&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;integer&amp;gt;&lt;/span&gt;10&lt;span class=&quot;nt&quot;&gt;&amp;lt;/integer&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/plist&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Under &lt;strong&gt;Label&lt;/strong&gt; namnger man sitt jobb, som man sedan kan se genom att skriva “launchctl list” i terminalen.
I &lt;strong&gt;ProgramArguments&lt;/strong&gt; anges att vi vill använda php för att köra filen hello.php.
&lt;strong&gt;StartInterval&lt;/strong&gt; anger i sekunder hur ofta jobbet kommer att köras.&lt;/p&gt;

&lt;p&gt;i hello.php finns logiken man vill utföra, här är ett exempel som skriver ut ett meddelande i Systemmeddelanden:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
 &lt;span class=&quot;nb&quot;&gt;syslog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;LOG_WARNING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;meddelande som syns i sysstemmeddelanden&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;starta-jobb-med-launchctl&quot;&gt;Starta jobb med launchctl&lt;/h3&gt;
&lt;p&gt;För att köra jobbet läggs det till genom att skriva följande i ett terminalfönster:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;launchctl load  /Users/%användarnamn%/Library/LaunchAgents/se.christianengvall.phptelldus.plist&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Starta sedan Systemmeddelanden och klicka på “Alla meddelanden” så kommer texten “meddelande som syns i sysstemmeddelanden” dyka upp var tionde sekund.&lt;/p&gt;

&lt;h3 id=&quot;stoppa-samma-jobb-med-launchctl&quot;&gt;Stoppa samma jobb med launchctl&lt;/h3&gt;
&lt;p&gt;Stoppa sedan jobbet genom att skriva:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;launchctl unload  /Users/%användarnamn%/Library/LaunchAgents/se.christianengvall.phptelldus.plist&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/schemalagga-php-script-i-osx-lion/">https://www.christianengvall.se/schemalagga-php-script-i-osx-lion/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 01 Feb 2012 12:32:01 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/schemalagga-php-script-i-osx-lion/</guid>
        </item>
      
    
      
        <item>
          <title>hockeyligan.se nästan helt obefintliga api</title>
          <link>https://www.christianengvall.se/hockeyligan-se-nastan-helt-obefintliga-api/</link>
          <comments>https://www.christianengvall.se/hockeyligan-se-nastan-helt-obefintliga-api/#respond</comments>
          <description>&lt;p&gt;Jag håller för tillfället på att vidareutveckla en mjukvara som skulle behöva visa lite sportresultat, och lite mer precist ska den visa hockeyresultat. Jag hade hoppats på att &lt;a href=&quot;http://www.hockeyligan.se&quot;&gt;hockeyligan.se&lt;/a&gt; hade ett publikt api som man kunde använda. Tyvärr fanns det inget sådant men om någon vill visa resultaten i de senaste matcherna så hittade jag en url på hockeyligan.se som returnerar just detta i JSON. Förhoppningsvis kan den här informationen hjälpa någon!&lt;/p&gt;

&lt;p&gt;URL:en är: &lt;a href=&quot;http://www.hockeyligan.se/elitserien-arena/currentstandings&quot;&gt;http://www.hockeyligan.se/elitserien-arena/currentstandings&lt;/a&gt; och det används på hockeyligan.se för att skriva ut det som visas till höger i denna bild:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2011/09/Sk&amp;auml;rmavbild-2011-09-20-kl.-18.04.05.png&quot; aria-label=&quot;Current standings&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2011/09/Sk&amp;auml;rmavbild-2011-09-20-kl.-18.04.05.png&quot; alt=&quot;Current standings&quot; width=&quot;1008&quot; height=&quot;324&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2011/09/Sk&amp;auml;rmavbild-2011-09-20-kl.-18.04.05.png&quot; alt=&quot;Current standings&quot; width=&quot;1008&quot; height=&quot;324&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Current standings&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;json-svar&quot;&gt;JSON-svar&lt;/h3&gt;
&lt;p&gt;i json strängen finns följande information:&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2011/09/Sk&amp;auml;rmavbild-2011-09-20-kl.-18.24.04.png&quot; aria-label=&quot;Current standings JSON&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2011/09/Sk&amp;auml;rmavbild-2011-09-20-kl.-18.24.04.png&quot; alt=&quot;Current standings JSON&quot; width=&quot;473&quot; height=&quot;375&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2011/09/Sk&amp;auml;rmavbild-2011-09-20-kl.-18.24.04.png&quot; alt=&quot;Current standings JSON&quot; width=&quot;473&quot; height=&quot;375&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Current standings JSON&lt;/p&gt;
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;id&lt;/strong&gt; : matchens id, kan användas i följande url: http://www.hockeyligan.se/elitserien-arena/37713&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;isaId&lt;/strong&gt; : ?&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;homeTeamCode&lt;/strong&gt; : Hemmalagets förkortning&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;awayTeamCode&lt;/strong&gt; : Bortalagets förkortning&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;startDateString&lt;/strong&gt;: Startdatum för matchen&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;startDateTime&lt;/strong&gt; : datum med tid för matchstart&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;arenaActive&lt;/strong&gt;: ?&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt; : Status på matchen, avslutad match, ej spelad match eller pågående match.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;statusString&lt;/strong&gt;: Samma som status fast översatt text&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;homeTeamGoals&lt;/strong&gt; : antal mål hemmalaget gjort.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;awayTeamGoals&lt;/strong&gt;: antal mål bortalaget gjort.&lt;/li&gt;
&lt;/ul&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/hockeyligan-se-nastan-helt-obefintliga-api/">https://www.christianengvall.se/hockeyligan-se-nastan-helt-obefintliga-api/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 03 Oct 2011 19:54:55 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/hockeyligan-se-nastan-helt-obefintliga-api/</guid>
        </item>
      
    
      
        <item>
          <title>HVTV Boxee app</title>
          <link>https://www.christianengvall.se/hvtv-boxee-app/</link>
          <comments>https://www.christianengvall.se/hvtv-boxee-app/#respond</comments>
          <description>&lt;p&gt;I sommras skapade jag en Boxee app som äntligen har publicerats i deras app-repository så att den blir tillgänglig för alla Boxee-användare. Appen visar hvtvs avsnitt hämtade från deras &lt;a href=&quot;http://www.youtube.com/user/HV71&quot;&gt;youtube-kanal&lt;/a&gt;. HVTV Följer HV71 och lägger upp dessa avsnitt för fans att kolla på.&lt;/p&gt;

&lt;h3 id=&quot;boxee-app&quot;&gt;Boxee-app&lt;/h3&gt;
&lt;p&gt;Kolla gärna in appen här.  &lt;br /&gt;
Uppdatering: Denna app finns ej kvar längre.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/hvtv-boxee-app/">https://www.christianengvall.se/hvtv-boxee-app/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 19 Sep 2011 13:05:37 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/hvtv-boxee-app/</guid>
        </item>
      
    
      
        <item>
          <title>Google analytics på ett intranät</title>
          <link>https://www.christianengvall.se/google-analytics-pa-ett-intranat/</link>
          <comments>https://www.christianengvall.se/google-analytics-pa-ett-intranat/#respond</comments>
          <description>&lt;p&gt;När jag googlade “google analytics intranet” fick jag som &lt;a href=&quot;http://adwords.google.com/support/aw/bin/answer.py?hl=sv&amp;amp;answer=55510&quot;&gt;första svar&lt;/a&gt; att “JavaScript-koden fungerar inte om du får åtkomst till intranätet med ett icke-fullständigt domännamn (t.ex. &lt;strong&gt;http://intranet&lt;/strong&gt;)” vilket var precis det jag ville.
Dock visar det sig att svaret var felaktigt.
Genom att lägga till &lt;strong&gt;_gaq.push([‘_setDomainName’, ‘none’]);&lt;/strong&gt; innan &lt;strong&gt;_gaq.push([‘_trackPageview’])&lt;/strong&gt; började Google Analytics snappa upp besök även om man använder sig av ett icke &lt;a href=&quot;http://en.wikipedia.org/wiki/Fully_qualified_domain_name&quot;&gt;FQDN&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;google-tracker-med-setdomain-none&quot;&gt;Google tracker med setDomain none&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_gaq&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_gaq&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;_gaq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;_setAccount&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;UA-XXXXX-X&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;_gaq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;_setDomainName&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;_gaq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;_trackPageview&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ga&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ga&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ga&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;ga&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://ssl&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://www&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.google-analytics.com/ga.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementsByTagName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parentNode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;insertBefore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ga&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;})();&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/google-analytics-pa-ett-intranat/">https://www.christianengvall.se/google-analytics-pa-ett-intranat/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 13 Sep 2011 12:46:03 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/google-analytics-pa-ett-intranat/</guid>
        </item>
      
    
      
        <item>
          <title>Max objektorienterar (okänd upphovsman)</title>
          <link>https://www.christianengvall.se/max-objektorienterar/</link>
          <comments>https://www.christianengvall.se/max-objektorienterar/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;http://www.rabensjogren.se/bocker/Utgiven/1981/Okand-saljperiod/lindgren_barbro-max_kaka-kartonnage/&quot;&gt;Orginalet&lt;/a&gt; må vara bra, men denna är bättre. (Jag är inte upphovsman till detta guldkorn).&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2011/09/3672304005_b57ae77339_o.jpg&quot; aria-label=&quot;Max objektorienterar&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2011/09/3672304005_b57ae77339_o.jpg&quot; alt=&quot;Max objektorienterar&quot; width=&quot;442&quot; height=&quot;475&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2011/09/3672304005_b57ae77339_o.jpg&quot; alt=&quot;Max objektorienterar&quot; width=&quot;442&quot; height=&quot;475&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Max objektorienterar&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2011/09/3672304045_15b7d832c6_o.jpg&quot; aria-label=&quot;Titta klass&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2011/09/3672304045_15b7d832c6_o.jpg&quot; alt=&quot;Titta klass&quot; width=&quot;475&quot; height=&quot;298&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2011/09/3672304045_15b7d832c6_o.jpg&quot; alt=&quot;Titta klass&quot; width=&quot;475&quot; height=&quot;298&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Titta klass&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2011/09/3672304109_90be68444a_o.jpg&quot; aria-label=&quot;Titta arv&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2011/09/3672304109_90be68444a_o.jpg&quot; alt=&quot;Titta arv&quot; width=&quot;475&quot; height=&quot;298&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2011/09/3672304109_90be68444a_o.jpg&quot; alt=&quot;Titta arv&quot; width=&quot;475&quot; height=&quot;298&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Titta arv&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2011/09/3672304163_3495ca8671_o.jpg&quot; aria-label=&quot;&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2011/09/3672304163_3495ca8671_o.jpg&quot; alt=&quot;&quot; width=&quot;475&quot; height=&quot;298&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2011/09/3672304163_3495ca8671_o.jpg&quot; alt=&quot;&quot; width=&quot;475&quot; height=&quot;298&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;max-objektorienterar-i-text&quot;&gt;Max objektorienterar i text&lt;/h3&gt;

&lt;p&gt;Titta polymorphism, där klasserna som repsresenterar ätbarheter alla ärver den abstrakta basklassen Mat. Detta gör att de alla kan användas av klienten Max, som enbart anropar metoden Ät() i interfacet Mat. Max behöver alltså inte känna till att det finns olika typer av Mat, utan kan utan extra programkod hantera dem alla.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/max-objektorienterar/">https://www.christianengvall.se/max-objektorienterar/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 08 Sep 2011 21:36:24 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/max-objektorienterar/</guid>
        </item>
      
    
      
        <item>
          <title>Fem plugin att lägga till efter en Wordpress-installation</title>
          <link>https://www.christianengvall.se/fem-plugin-att-lagga-till-efter-en-wordpress-installation/</link>
          <comments>https://www.christianengvall.se/fem-plugin-att-lagga-till-efter-en-wordpress-installation/#respond</comments>
          <description>&lt;p&gt;Dessa plugin hjälpte mig att komma igång bra med Wordpress. Artikeln är gammal nu, men någon kanske hittar ett intressant plugin.&lt;/p&gt;

&lt;h3 id=&quot;förslag-på-wordpress-plugins&quot;&gt;Förslag på Wordpress-plugins&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://www.w3-edge.com/wordpress-plugins/w3-total-cache/&quot;&gt;W3 Total Cache&lt;/a&gt;
hjälper dig att snabba upp din wordpress-installation genom att minifiera och komprimera den html, css och javascript som skickas till användaren från din site. Det ser också till innehållet cacheas och på så sätt kan laddas snabbare.
Jämför hur snabbt din site laddas på &lt;a href=&quot;http://www.blamestella.com&quot;&gt;Blame Stella&lt;/a&gt; före och efter pluginet är installerat.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://yoast.com/wordpress/plugins/seo/&quot;&gt;WP-SEO&lt;/a&gt;
hjälper till att sökmotoroptimera siten genom att du bestämmer hur dina titlar och description sätts. Det skapar även sitemaps som sökmotorerna kan använda för att indexera dina sidor. Jag har i en föregående &lt;a href=&quot;/installningar-for-wordpress-seo-by-yoast-pluginet/&quot;&gt;inlägg&lt;/a&gt; gått igenom hur man ställer in pluginet.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.bravenewcode.com/store/plugins/wptouch-pro/&quot;&gt;WP-Touch&lt;/a&gt;
För att få din Wordpress-site att bli mer användarvänlig i dagens smartphones finns ett plugin vid namn WP-Touch som kontrollerar vilken webbläsare besökaren använder och anpassar siten efter den. Enheterna som stöds för tillfället är:  iPhone, iPod touch, Android, Palm Pre, Samsung touch and BlackBerry Storm/Torch mobile devices. (OBS, Detta pluginet kan sluta fungera om man använder W3 Total Cache)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://disqus.com/&quot;&gt;Disqus Comment System&lt;/a&gt;
 är ett kommentars-system med vilket besökaren kan logga in med flera olika konton som Facebook, Google, Twitter, Yahoo, OpenID och disqus-konton.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.aakashweb.com/wordpress-plugins/wp-socializer/&quot;&gt;WP-Socializer
&lt;/a&gt; lägger till dela funktionalitet på inläggen på t.ex Facebook, twitter, linkedin och tumblr, men även många fler nätverk finns att lägga till.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/fem-plugin-att-lagga-till-efter-en-wordpress-installation/">https://www.christianengvall.se/fem-plugin-att-lagga-till-efter-en-wordpress-installation/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 02 Aug 2011 10:04:59 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/fem-plugin-att-lagga-till-efter-en-wordpress-installation/</guid>
        </item>
      
    
      
        <item>
          <title>301 Redirect i PHP och ASP.NET</title>
          <link>https://www.christianengvall.se/301-redirect-i-php-och-asp-net/</link>
          <comments>https://www.christianengvall.se/301-redirect-i-php-och-asp-net/#respond</comments>
          <description>&lt;p&gt;En 301 redirect betyder att man har flyttat en sida permanent till en annan URL.
Om man använder 301-redirecten kommer den mesta länkkraften att flyttas över till den nya webbplatsen och man kommer inte tappa  för många placeringar på Google. På följande sätt kan man göra en redirect i PHP och C#:&lt;/p&gt;

&lt;h3 id=&quot;301-redirect-med-php&quot;&gt;301 redirect med PHP&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;HTTP/1.1 301 Moved Permanently&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Location: http://www.nyurl.se&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;301-redirect-med-aspnet&quot;&gt;301 redirect med ASP.NET&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Status&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;301 Moved Permanently&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Location&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.nyurl.se&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;End&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/301-redirect-i-php-och-asp-net/">https://www.christianengvall.se/301-redirect-i-php-och-asp-net/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 18 Jul 2011 08:22:59 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/301-redirect-i-php-och-asp-net/</guid>
        </item>
      
    
      
        <item>
          <title>Att välja rätt datatyper vid databasdesign</title>
          <link>https://www.christianengvall.se/att-valja-ratt-datatyper-vid-databasdesign/</link>
          <comments>https://www.christianengvall.se/att-valja-ratt-datatyper-vid-databasdesign/#respond</comments>
          <description>&lt;p&gt;Att välja rätt datatyper för sina kolumner är viktigt när man designar en databas för att slippa ändra dom senare och för att en stor databas inte ska bli onödigt seg. Det kan t.ex innebära:&lt;/p&gt;

&lt;p&gt;Se till att använda den datatypen som använder minst utrymme. T.ex en int istället för bigint ifall man vet att man inte kommer behöva en bigint i framtiden.&lt;/p&gt;

&lt;p&gt;Använd inte en datatyp du vet kommer behövas ändras i framtiden vilket ökar utvecklingstid och serverns workload.&lt;/p&gt;

&lt;p&gt;Använd inte datetime och smalldatetime om du använder en MSSQL2008databas. använd istället  date och time eller datetime2 då de andra tar mer utrymme.&lt;/p&gt;

&lt;p&gt;Använd bara &lt;em&gt;float&lt;/em&gt; eller &lt;em&gt;real&lt;/em&gt; ifall &lt;em&gt;decimal&lt;/em&gt; inte räcker till.&lt;/p&gt;

&lt;h3 id=&quot;dokumentation-datatyper-för-mssql-och-mysql&quot;&gt;Dokumentation datatyper för mssql och mysql&lt;/h3&gt;
&lt;p&gt;Kolla in &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/data-types.html&quot;&gt;datatyperna för mysql&lt;/a&gt; och &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms187752.aspx&quot;&gt;Mssql &lt;/a&gt;för att se hur mycket utrymme varje datatyp använder. De ger även mer specifika tips om de olika databasernas best practices vid val av datatyp.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/att-valja-ratt-datatyper-vid-databasdesign/">https://www.christianengvall.se/att-valja-ratt-datatyper-vid-databasdesign/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 14 Jul 2011 14:43:13 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/att-valja-ratt-datatyper-vid-databasdesign/</guid>
        </item>
      
    
      
        <item>
          <title>Serialisera och deserialisera ett Dictionary</title>
          <link>https://www.christianengvall.se/serialisera-och-deserialisera-ett-dictionary/</link>
          <comments>https://www.christianengvall.se/serialisera-och-deserialisera-ett-dictionary/#respond</comments>
          <description>&lt;p&gt;Behövde i dagarna xml-serialisera och deserialisera ett dictionary för att spara information på disk. Lösningen blev Adar Wesleys &lt;a href=&quot;http://blogs.microsoft.co.il/files/folders/applisec/entry60979.aspx&quot;&gt;SerializableDictionary&lt;/a&gt;. När filerna är inkluderade i projektet går det använda Serializable Dictionary såhär:&lt;/p&gt;

&lt;h3 id=&quot;kodexempel-serialisering-och-deserialisering-av-dictionary&quot;&gt;Kodexempel serialisering och deserialisering av dictionary&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// Loads a Serializable dictionary which holds a saved values&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;LoadExistingFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;XmlSerializer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;XmlSerializer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;));&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StreamReader&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sr&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;StreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Deserialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// Saves existing KeyValuePairs to disc&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SaveDictionaryToDisc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;XmlSerializer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;XmlSerializer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SerializableDictionary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;));&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StreamWriter&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sw&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;StreamWriter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file.xml&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Serialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/serialisera-och-deserialisera-ett-dictionary/">https://www.christianengvall.se/serialisera-och-deserialisera-ett-dictionary/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 16 May 2011 16:34:21 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/serialisera-och-deserialisera-ett-dictionary/</guid>
        </item>
      
    
      
        <item>
          <title>HttpOnly-cookies i .NET</title>
          <link>https://www.christianengvall.se/httponly-cookies-i-net/</link>
          <comments>https://www.christianengvall.se/httponly-cookies-i-net/#respond</comments>
          <description>&lt;h3 id=&quot;gästbloggning-på-webbsäkerhet&quot;&gt;Gästbloggning på Webbsäkerhet&lt;/h3&gt;
&lt;p&gt;Jag fortsätter att gästblogga på &lt;a href=&quot;http://www.xn--webbskerhet-p8a.se/2011/03/skydd-fran-cookiestold-med-hjalp-av-httponly-i-net/&quot;&gt;webbsäkerhet.se&lt;/a&gt;, denna gången om att skydda sina användare ifrån cooke-theft via xss genom att använga sig av HttpOnly.&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/httponly-cookies-i-net/">https://www.christianengvall.se/httponly-cookies-i-net/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 28 Mar 2011 12:58:17 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/httponly-cookies-i-net/</guid>
        </item>
      
    
      
        <item>
          <title>AntiXSS och MVC</title>
          <link>https://www.christianengvall.se/antixss-och-mvc/</link>
          <comments>https://www.christianengvall.se/antixss-och-mvc/#respond</comments>
          <description>&lt;h3 id=&quot;gästblogginlägg&quot;&gt;Gästblogginlägg&lt;/h3&gt;
&lt;p&gt;Gästbloggade i veckan på &lt;a href=&quot;http://www.webbsäkerhet.se&quot;&gt;webbsäkerhet.se&lt;/a&gt; om cross site scripting och mvc, gå gärna över dit och läs &lt;a href=&quot;http://www.xn--webbskerhet-p8a.se/2011/03/implementera-antixss-i-net-mvc-projekt/&quot;&gt;inlägget!&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/antixss-och-mvc/">https://www.christianengvall.se/antixss-och-mvc/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sat, 19 Mar 2011 09:13:54 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/antixss-och-mvc/</guid>
        </item>
      
    
      
        <item>
          <title>Cross-site request forgery och ASP.NET MVC</title>
          <link>https://www.christianengvall.se/cross-site-request-forgery-och-asp-net-mvc/</link>
          <comments>https://www.christianengvall.se/cross-site-request-forgery-och-asp-net-mvc/#respond</comments>
          <description>&lt;p&gt;Cross-site request forgery, även kallat CSRF och XSRF, är ett sätt att lura en användare att utföra saker den inte vill göra. T.ex kan någon ha postat följande som en kommentar på en sida som en inloggad användare går in på:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-hmtl&quot; data-lang=&quot;hmtl&quot;&gt;&amp;lt;img src=&quot;http://forumsite.com/?action=logout&quot; /&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Resultatet kommer bli att användaren loggas ut varje gång han går in på sidan och inte förstår varför då en GET-request gjordes mot http://forumsite.com/?action=logout. Detta är en ganska ofarlig handling men tekniken kan användas för andra saker så som att komma över användarnamn och lösenord vilket Johan Rydberg Möller har som exempel på &lt;a href=&quot;http://www.webbsäkerhet.se&quot;&gt;webbsäkerhet.se&lt;/a&gt;. Jag läste hans inlägg om &lt;a href=&quot;http://www.xn--webbskerhet-p8a.se/2011/02/sakerhetsguide-for-utvecklare-del-3/&quot;&gt;Cross Site request forgery&lt;/a&gt; där han visade PHP-kod för att motverka ett sådant försök att stjäla information och jag tänkte dra mitt strå till stacken och visa hur man gör samma kontroll i ASP.NET MVC:&lt;/p&gt;

&lt;h3 id=&quot;antiforgerytoken&quot;&gt;AntiForgeryToken&lt;/h3&gt;
&lt;p&gt;Lägg in en AntiForgeryToken med hjälp av &amp;lt;%=Html.AntiForgeryToken()%&amp;gt; så att formuläret ser ut något likande detta:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;    &lt;span class=&quot;p&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BeginForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()){&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;%&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;&amp;lt;%=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AntiForgeryToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()%&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;lt;%:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;TextBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;username&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;%&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;lt;%:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;TextBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;%&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;submit&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;login&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;%}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I ActionResultet som tar emot postningen från formuläret läggs Action Filtret [ValidateAntiForgeryToken] till:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-csharp&quot; data-lang=&quot;csharp&quot;&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpPost&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValidateAntiForgeryToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ActionResult&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FormCollection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;formValues&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;View&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Tas &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;%=Html.AntiForgeryToken()%&amp;gt;&lt;/code&gt; bort ifrån formuläret kommer det inte att gå att posta.&lt;/p&gt;

&lt;p&gt;läs mer på &lt;a href=&quot;http://www.cgisecurity.com/csrf-faq.html&quot;&gt;CSRF på cgisecurity.com&lt;/a&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/cross-site-request-forgery-och-asp-net-mvc/">https://www.christianengvall.se/cross-site-request-forgery-och-asp-net-mvc/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Tue, 15 Mar 2011 07:53:08 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/cross-site-request-forgery-och-asp-net-mvc/</guid>
        </item>
      
    
      
        <item>
          <title>Inställningar för Wordpress-SEO by Yoast pluginet</title>
          <link>https://www.christianengvall.se/installningar-for-wordpress-seo-by-yoast-pluginet/</link>
          <comments>https://www.christianengvall.se/installningar-for-wordpress-seo-by-yoast-pluginet/#respond</comments>
          <description>&lt;p&gt;&lt;a href=&quot;https://yoast.com/wordpress/plugins/seo/&quot;&gt;Wordpress SEO&lt;/a&gt; är ett verktyg för att ställa in titlar och descriptions mm till din Wordpress installation för att optimera den för sökmotorer. Detta pluginet tipsade &lt;a href=&quot;http://www.simonwall.se/seo-plugin-till-wordpress/&quot;&gt;Simon Wall&lt;/a&gt; mig om. När man precis har installerat pluginet måste man göra vissa inställningar. Ta fram inställningarna för title och descriptions genom att klicka på &lt;strong&gt;SEO -&amp;gt; Titles&lt;/strong&gt;. Gör sedan följande inställningar:&lt;/p&gt;

&lt;p&gt;Se till att alla titlar och descriptions inte blir mer än 64 respektive 150 tecken då det är antalet som visas i Googles sökresultat.&lt;/p&gt;

&lt;h3 id=&quot;homepage&quot;&gt;Homepage&lt;/h3&gt;
&lt;p&gt;Title template:              Systemutveckling och Webbutveckling | %%sitename%%
Meta description template:   %%sitedesc%%&lt;/p&gt;

&lt;p&gt;Förklaring: Denna egenskap sätter title och description på din förstasida. Här har jag valt att skriva ut de två ord som bloggen handlar om samt namnet på webbplatsen. I description skrivs sloganen för webbplatsen ut. %%Sitename%% och %%sitedesc%% ställs in under allmäna inställningar och heter “Titel för webbplats” samt “slogan”.&lt;/p&gt;

&lt;h3 id=&quot;post&quot;&gt;Post&lt;/h3&gt;
&lt;p&gt;Title template:              %%title%% | %%sitename%%
Meta description template:   %%excerpt%%&lt;/p&gt;

&lt;p&gt;Förklaring: Egenskaperna för post sätter title och description för inläggen. %%title%% är titeln på posten och detta följs av namnet på webbplatsen. På inläggets description sätts utdraget för posten, finns det inget sådant autogenereras ett.&lt;/p&gt;

&lt;h3 id=&quot;page&quot;&gt;Page&lt;/h3&gt;
&lt;p&gt;Title template:             %%title%% | %%sitename%%  &lt;br /&gt;
Meta description template:  %%excerpt%%&lt;/p&gt;

&lt;p&gt;Förklaring: Page-egenskaperna sätter title och description för en sida i wp. Även här används %%title%%, %%sitename%% och %%excerpt%%.&lt;/p&gt;

&lt;h3 id=&quot;category&quot;&gt;Category&lt;/h3&gt;
&lt;p&gt;Title template:             %%category%% | %%sitename%%  &lt;br /&gt;
Meta descriptoin template:  %%category_description%%&lt;/p&gt;

&lt;p&gt;Förklaring: Category-egenskaperna sätter title och description för kategorier. %%category%% ersätts med kategorinamnet, %%sitename%% är nammnet på webbplatsen och %%category_description%% ersätts med beskrivningen på kategorin.&lt;/p&gt;

&lt;h3 id=&quot;post_tag&quot;&gt;Post_tag&lt;/h3&gt;
&lt;p&gt;Title template:            %%tag%% | %%sitename%%  &lt;br /&gt;
Meta description template: %%tag_description%%&lt;/p&gt;

&lt;p&gt;Förklaring: egenskaperna för post_tag sätter title och description när en användare kollar på taggar. Numera börjar det mest bli upprepning, du förstår säkert vad koderna står för.&lt;/p&gt;

&lt;h3 id=&quot;search-pages&quot;&gt;Search Pages&lt;/h3&gt;
&lt;p&gt;Title template:           Sökresultat för %%searchphrase%% | %%sitename%%&lt;/p&gt;

&lt;p&gt;Förklaring: Search pages title visas när en besökare gör en sökning på webbplatsen. %%searchphrase%% ersätts med den sökningen besökaren gör.&lt;/p&gt;

&lt;p&gt;Gå till sist in på Dashboard och klicka i “check this box to enable XML-sitemap functionality”&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/installningar-for-wordpress-seo-by-yoast-pluginet/">https://www.christianengvall.se/installningar-for-wordpress-seo-by-yoast-pluginet/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Thu, 03 Mar 2011 15:45:06 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/installningar-for-wordpress-seo-by-yoast-pluginet/</guid>
        </item>
      
    
      
        <item>
          <title>Lista över kodstandarder, konventioner och stilguider</title>
          <link>https://www.christianengvall.se/lista-over-kodstandarder-konventioner-och-stilguider/</link>
          <comments>https://www.christianengvall.se/lista-over-kodstandarder-konventioner-och-stilguider/#respond</comments>
          <description>&lt;p&gt;När man arbetar med kod är det bra att följa standarder och stilguider för att kunna samarbeta eller lämna över ett projekt. Men följ dom inte religiöst.
Nedan följer en lista på kodstandarder, konventioner och stilguider för diverse språk. Guiderna från Google är ganska omfattande och kan vara ganska svåra att ta sig igenom då de bara innehåller text rakt upp och ner, men är ändå bra ifall man vill kolla upp något specifikt för det språket man intresserar sig av.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://framework.zend.com/manual/1.12/en/coding-standard.coding-style.html&quot;&gt;Php + zend&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://google.github.io/styleguide/javascriptguide.xml&quot;&gt;Google Javascript styleguide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://google.github.io/styleguide/jsoncstyleguide.xml&quot;&gt;Google jSON styleguide
&lt;/a&gt;
&lt;a href=&quot;https://google.github.io/styleguide/objcguide.xml&quot;&gt;Google Objective-c styleguide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://google.github.io/styleguide/xmlstyle.html&quot;&gt;Google XML styleguide&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;ide-plugins&quot;&gt;IDE-Plugins&lt;/h3&gt;
&lt;p&gt;Till .NET och Visual studio finns även två plugins som ser till att man skriver korrekt, de heter &lt;a href=&quot;http://www.jetbrains.com/resharper/&quot;&gt;ReSharper&lt;/a&gt; och &lt;a href=&quot;http://code.msdn.microsoft.com/sourceanalysis&quot;&gt;StyleCop&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I föregående &lt;a href=&quot;/ren-kod/&quot;&gt;inlägg&lt;/a&gt; har jag också skrivit om att hålla sin kod ren.&lt;/p&gt;

&lt;p&gt;Följer du några kodstandarder, konventioner och stilguider som passar in i listan?&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/lista-over-kodstandarder-konventioner-och-stilguider/">https://www.christianengvall.se/lista-over-kodstandarder-konventioner-och-stilguider/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Mon, 28 Feb 2011 08:33:58 +0100</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/lista-over-kodstandarder-konventioner-och-stilguider/</guid>
        </item>
      
    
      
        <item>
          <title>Ren kod!</title>
          <link>https://www.christianengvall.se/ren-kod/</link>
          <comments>https://www.christianengvall.se/ren-kod/#respond</comments>
          <description>&lt;p&gt;Efter att ha jobbat som systemutvecklare i ett år nu har jag märkt hur viktigt det är att ha kodstandarder. Med tipsen som Robert C. Martin ger i nedanstående video får man kod som är mer läsbar, lättare att komma tillbaka till efter att man påbörjat något annat projekt, och lättare för andra utvecklare att ta över.&lt;/p&gt;

&lt;h3 id=&quot;hur-lång-ska-en-metod-vara&quot;&gt;Hur lång ska en metod vara?&lt;/h3&gt;
&lt;p&gt;På 80-talet skulle en metod vara så lång att den fick plats på skärmen. På den tiden fick man plats med 24 rader varav 4 av dom användes av programmet man utvecklade i. Idag får vi plats med hundratals rader. Martin anser att metoden ska vara så liten att den endast gör en sak, och att man då kan hålla ner radantalet &lt;strong&gt;mellan 3 till 10 rader.&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;metodnamn&quot;&gt;Metodnamn&lt;/h3&gt;
&lt;p&gt;Se till att metodnamnet förklarar vad metoden gör och den ska endast göra en sak. &lt;strong&gt;Var inte rädd för att namnet ska bli för långt&lt;/strong&gt;, se till att &lt;strong&gt;använda en namnkonvention som tillåter flera ord i namnet.&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;if-else-while-satser-foreach-och-try-catch&quot;&gt;If, else, while-satser, foreach och try catch&lt;/h3&gt;
&lt;p&gt;Koden i en if, else, while-sats, foreach och try catch ska vara max 1 rad lång och kalla på en annan metod. Detta för att hålla metoden liten och för att man dokumenterar vad som händer med hjälp av metodanropets namn.&lt;/p&gt;

&lt;h3 id=&quot;hur-många-argument-ska-en-metod-ta-emot&quot;&gt;Hur många argument ska en metod ta emot?&lt;/h3&gt;
&lt;p&gt;Det idealiska antalet argument en metod har är &lt;strong&gt;0&lt;/strong&gt;, och &lt;strong&gt;max är 3.&lt;/strong&gt; Över detta antalet ska man se till att man passar runt ett objekt med värdena i istället.&lt;/p&gt;

&lt;h3 id=&quot;outargument&quot;&gt;Outargument&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Använd inte out-argument alls.&lt;/strong&gt; Man är van vid att man skickar in argument i en metod och tar emot det som returneras av den. Normalt förväntar vi oss inte att information kommer tillbaka genom argumenten.&lt;/p&gt;

&lt;h3 id=&quot;booleans-i-argument&quot;&gt;Booleans i argument&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Använd inte booleans i en metods argument.&lt;/strong&gt; Då kommer metoden med stor säkerhet göra mer än en sak. En sak ifall du passar in true, och en annan ifall du passar in false.
Även anropen till denna metod kommer bli svår att tolka. Martin använder exemplet DeleteEmployee(“Bob”, false, true); Man måste gå in i metoden för att se vad den gör beroende på de booleans man skickar in.&lt;/p&gt;

&lt;h3 id=&quot;kommentarer&quot;&gt;Kommentarer&lt;/h3&gt;
&lt;p&gt;Kommentera inte koden, metodnamnet ska förklara vad metoden gör tillräckligt bra. Kommentarer riskerar att bli utdaterade när man gör ändringar i metoden och lurar utvecklaren som kommer tillbaka till metoden efter en tid. Martin beskriver kommentarer som lögner just för att de sällan uppdateras när metoden uppdateras.&lt;/p&gt;

&lt;p&gt;Bortkommenterad kod ska tas bort direkt. Den är bara i vägen. Den finns fortfarande i versionshanteringen och går att hämta ut när du vill.&lt;/p&gt;

&lt;h3 id=&quot;variabelnamn&quot;&gt;Variabelnamn&lt;/h3&gt;
&lt;p&gt;Använd inte förtkortningar i namnen på variablar. Använd samma princip som i metodnamn&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/ren-kod/">https://www.christianengvall.se/ren-kod/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Wed, 27 Oct 2010 19:25:40 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/ren-kod/</guid>
        </item>
      
    
      
        <item>
          <title>Twitter instant</title>
          <link>https://www.christianengvall.se/twitter-instant/</link>
          <comments>https://www.christianengvall.se/twitter-instant/#respond</comments>
          <description>&lt;p&gt;För några dagar sedan utvecklade jag en egen version av Twitter instant. Den uppmärksammades på bland annat &lt;a href=&quot;http://www.pusha.se/twitter-instant&quot;&gt;pusha&lt;/a&gt; och av &lt;a href=&quot;http://blogg.tkj.se/twitter-instant/&quot;&gt;Tommy K Johansson&lt;/a&gt;. Den är inspirerad av &lt;a href=&quot;http://www.feross.org/&quot;&gt;Feross Aboukhadijeh&lt;/a&gt; sökfunktion &lt;a href=&quot;http://ytinstant.com/&quot;&gt;youtube instant&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;wp-caption alignnone&quot;&gt;
  &lt;a href=&quot;/wp-content/uploads/2010/10/twitterinstant.jpg&quot; aria-label=&quot;Twitter instant search&quot;&gt;
    &lt;img data-src=&quot;/wp-content/uploads/2010/10/twitterinstant.jpg&quot; alt=&quot;Twitter instant search&quot; width=&quot;538&quot; height=&quot;469&quot; /&gt;
    &lt;noscript&gt;
      &lt;img src=&quot;/wp-content/uploads/2010/10/twitterinstant.jpg&quot; alt=&quot;Twitter instant search&quot; width=&quot;538&quot; height=&quot;469&quot; /&gt;
    &lt;/noscript&gt;
  &lt;/a&gt;
  &lt;p class=&quot;wp-caption-text&quot;&gt;Twitter instant search&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;tekniker&quot;&gt;Tekniker&lt;/h3&gt;
&lt;p&gt;Teknikerna som används i söken är jQuery, JSON och Javascript. På sökrutans OnKeyUp-attribut kallas en javascript funktion som i sig gör ett anrop till twitters api och får tillbaka ett JSON svar som sedan visas på sidan. Twitter instant finns att testa &lt;del&gt;här&lt;/del&gt;&lt;/p&gt;

						&lt;p&gt;
						Posted on &lt;a href=&quot;https://www.christianengvall.se/twitter-instant/">https://www.christianengvall.se/twitter-instant/&lt;/a&gt;
						&lt;/p&gt;
					</description>
          <pubDate>Sun, 03 Oct 2010 19:38:40 +0200</pubDate>
          <guid isPermaLink="true">https://www.christianengvall.se/twitter-instant/</guid>
        </item>
      
    

  </channel>
</rss>
