<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>random Archives - Pietari Heino&#039;s personal website</title>
	<atom:link href="https://www.extreg.com/blog/category/random/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.extreg.com/blog/category/random/</link>
	<description></description>
	<lastBuildDate>Tue, 16 Apr 2019 17:37:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.5</generator>
<site xmlns="com-wordpress:feed-additions:1">99365322</site>	<item>
		<title>Testing React HOC&#8217;s private logic</title>
		<link>https://www.extreg.com/blog/2019/04/testing-react-hocs-private-logic/</link>
					<comments>https://www.extreg.com/blog/2019/04/testing-react-hocs-private-logic/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Sun, 14 Apr 2019 13:34:14 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[material-ui]]></category>
		<category><![CDATA[react]]></category>
		<category><![CDATA[react hoc]]></category>
		<category><![CDATA[withstyles]]></category>
		<guid isPermaLink="false">https://www.extreg.com/?p=447</guid>

					<description><![CDATA[<p>I had a problem with higher-order components, their use of even higher-order components, passing styles from the component-to-be-wrapped to the HOC, and testing of the bare/naked/base HOC without involving the wrapped component. In this post I shortly present the solution my colleague and I found to be working quite nicely (I expect you know all ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2019/04/testing-react-hocs-private-logic/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2019/04/testing-react-hocs-private-logic/">Testing React HOC&#8217;s private logic</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I had a problem with higher-order components, their use of even higher-order components, passing styles from the component-to-be-wrapped to the HOC, and testing of the bare/naked/base HOC without involving the wrapped component. In this post I shortly present the solution my colleague and I found to be working quite nicely (I expect you know all the terms/names used in this post). What I wanted:</p>



<ul><li>Create a higher-order component (WithBaseEditor) that has its own styles (using withStyles from material-ui/JSS)</li><li>Be able to override styles in the HOC from the wrapped component (ImageEditor/VideoEditor/ArticleEditor) </li><li>Be able to easily test the HOC methods separated from the wrapped component</li></ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
// BaseEditor.js
const baseEditorStyles = {...};

const WithBaseEditor = (Component, options = {}, overrideStyles = {}) =&gt; {
  class BaseEditor extends React.Component {
    ...
    baseEditorMethod() {} // this is &quot;private&quot;
    mutualMethod() {}
    ...
    render() {
      return (
      // some mutual jsx for layout
        &lt;Component
          mutualMethod={this.mutualMethod}
        /&gt;
      );
    }
  }
  
  const enhanced = withStyles(overrideStyles)(withStyles(baseEditorStyles)(BaseEditor));

  enhanced.__Naked = BaseEditor;

  return enhanced;
};

export default WithBaseEditor;


// ImageEditor.js
import WithBaseEditor from 'BaseEditor';

const styles = {...};
class ImageEditor extends React.Component {...}

export default WithBaseEditor(withStyles(styles)(ImageEditor), options, styleConfig);
</pre></div>


<p>What happens in the code:<br>Create a HOC called WithBaseEditor that is implemented as a function that takes a component, some options, and styles. In the function body create a new class extending React.Component that implements what I call a BaseEditor that has got some private logic and some mutual logic. Private logic is never to be passed down to the component that is being wrapped whereas mutual logic is passed explicitly in the props. In order to use isolated styles for the BaseEditor, they&#8217;re defined in the HOC&#8217;s own file. In order to have some styling in the BaseEditor to be overwritten with customised styles &#8220;coming from&#8221; the wrapped component, they&#8217;re passed into the HOC function. What the HOC returns, finally, is BaseEditor, that is first wrapped with its own isolated styles defined in the same file and then re-wrapped with the styles passed in from the caller of the HOC. This way, the wrapped component, ImageEditor, can define its own styles and some styles that it wants to overwrite in the BaseEditor, and just call the HOC with carefully chosen arguments.</p>



<p>What&#8217;s that with the __Naked = BaseEditor?<br>Immediately before returning the enhanced component the actual BaseEditor class is injected into the returned component. This way BaseEditor is available bare/naked/whatever when you want to test it without involving wrapped component logic. You just pass in some dummy wrapped component and write the tests for the BaseEditor&#8217;s private methods.</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2019/04/testing-react-hocs-private-logic/">Testing React HOC&#8217;s private logic</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2019/04/testing-react-hocs-private-logic/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">447</post-id>	</item>
		<item>
		<title>Paranoid Optimist</title>
		<link>https://www.extreg.com/blog/2018/10/paranoid-optimist/</link>
					<comments>https://www.extreg.com/blog/2018/10/paranoid-optimist/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Sun, 28 Oct 2018 11:05:09 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[paranoid optimist]]></category>
		<category><![CDATA[risto siilasmaa]]></category>
		<guid isPermaLink="false">https://www.extreg.com/?p=379</guid>

					<description><![CDATA[<p>I really recommend Paranoid Optimist by Risto Siilasmaa. It has got some very good insights on Nokia&#8217;s transformation from the smartphone market leader to Symbian&#8217;s destruction partly through iPhone and new world ignorance, Windows Phone deal with Microsoft, rising from the ashes and finally the transformation to a more or less new company providing not ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2018/10/paranoid-optimist/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/10/paranoid-optimist/">Paranoid Optimist</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" class="wp-image-380 aligncenter" src="https://www.extreg.com/wp-content/uploads/2018/10/Transforming-Nokia-839x1024.png" alt="Transforming Nokia by Risto Siilasmaa" width="281" height="343" />I really recommend Paranoid Optimist by Risto Siilasmaa. It has got some very good insights on Nokia&#8217;s transformation from the smartphone market leader to Symbian&#8217;s destruction partly through iPhone and new world ignorance, Windows Phone deal with Microsoft, rising from the ashes and finally the transformation to a more or less new company providing not only radio tech but also network systems for the big iron companies. You would be surprised to know that Symbian&#8217;s complete compilation with all the necessary bits and pieces of the platform took two weeks and how and why Meego was shutdown. The book clearly tells what went wrong in the management inside the company and in the board meetings, what sort of problems the employees and their foremen had in communicattion, how Windows Phone was actually the best option, and that Stephen Elop was most definitely not a Trojan horse. Also a lot of interesting details about the forces at play in the phone business are covered, and how big international companies deal with tough situations and negotiate deals and so on. <strong>There really is something interesting to learn for everyone </strong>from multiple perspectives.</p>
<p>When I was finishing the second part of the book I decided to write a short word on it on my blog. I started to feel that the book is actually too thin on material: it is not a complete story of Nokia from the beginning to the ALu merger but it is not only a business book either (at least in my opinion). I&#8217;m not sure what I expected but I started to feel that it&#8217;s a mixed bag in some way, not being able to clearly articulate my feelings. Now after finishing the book, I looked at the title and remembered that it actually is <em><strong>Transforming Nokia: The Power of Paranoid Optimism to Lead Through Colossal Change</strong>. </em>I then realised that it is <strong><em>the </em>perfect</strong> title for the book, it says it all. This is Nokia&#8217;s transformation told by Risto Siilasmaa with not only the story itself but filled with business and decision making bullets and ideas and whatnot – the Paranoid Optimism that he developed.</p>
<p>It is a very good and interesting book, I really did enjoy reading it.</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/10/paranoid-optimist/">Paranoid Optimist</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2018/10/paranoid-optimist/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">379</post-id>	</item>
		<item>
		<title>TabJump Chrome extension updates</title>
		<link>https://www.extreg.com/blog/2018/09/tabjump-chrome-extension-updates/</link>
					<comments>https://www.extreg.com/blog/2018/09/tabjump-chrome-extension-updates/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Sun, 16 Sep 2018 17:41:51 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[chrome extension]]></category>
		<category><![CDATA[tabjump]]></category>
		<guid isPermaLink="false">https://www.extreg.com/?p=360</guid>

					<description><![CDATA[<p>I&#8217;ve updated my TabJump Chrome extension, which lets you easily search through your open tabs from any windows, and jump into them. A longer explanation of the ideas and functionality of the extension may be found from my first blog posting about it, here. This time around I&#8217;ve changed the core functionality of the extension to make ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2018/09/tabjump-chrome-extension-updates/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/09/tabjump-chrome-extension-updates/">TabJump Chrome extension updates</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" class=" wp-image-361 aligncenter" src="https://www.extreg.com/wp-content/uploads/2018/09/tabjump-chrome-extension.png" alt="" width="582" height="313" srcset="https://www.extreg.com/wp-content/uploads/2018/09/tabjump-chrome-extension.png 775w, https://www.extreg.com/wp-content/uploads/2018/09/tabjump-chrome-extension-300x161.png 300w, https://www.extreg.com/wp-content/uploads/2018/09/tabjump-chrome-extension-768x413.png 768w" sizes="(max-width: 582px) 100vw, 582px" /></p>
<p>I&#8217;ve updated my TabJump Chrome extension, which lets you easily search through your open tabs from any windows, and <em>jump </em>into them. A longer explanation of the ideas and functionality of the extension may be found from my first blog posting about it, <a href="https://www.extreg.com/blog/2017/11/introducing-tabjump-chrome-extension-jump-tabs/">here</a>.</p>
<p>This time around I&#8217;ve changed the core functionality of the extension to make it work more reliably and to enable better end-user customization. Now the extension&#8217;s UI is not drawn on top of the current page but instead it utilizes the usual popup container functionality of web extensions. It&#8217;s also possible to open it on a separate page, and when doing so, it is aware of its previous appearances and instead of spawning a multitude of TabJump tabs it always focuses on the living one.</p>
<p>The only missing feature as of now is history search. When you open up the search and try to find something that doesn&#8217;t exist as a tab on the machine, you need to close the extension, focus the URL bar, and type it in in there. This is of course not-optimal and a pain in the ass. The extension should do two things in a case of a missing match: first, suggest from your history and enable creation of a new tab based on user selection, and second, let you type any URL and hit enter to just get there.</p>
<p>The code is still very experimental and badly organized because of the experimental nature of the development (getting to know the web extension inner workings), and as such, not available anywhere. Also, some bugs might be hiding in the source. If you&#8217;d like to try out the extension, you can access it from <a href="https://chrome.google.com/webstore/detail/tabjump/llgdignfpbanaeejhiilkipocphhgcbl">this public link</a>. When you install it, make sure you open Chrome&#8217;s extension shortcuts and map the two functions to some keys (my mappings are: CTRL+, opens the popup while CTRL+. opens the single tab view).</p>
<p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/09/tabjump-chrome-extension-updates/">TabJump Chrome extension updates</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2018/09/tabjump-chrome-extension-updates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">360</post-id>	</item>
		<item>
		<title>Center current window in KDE Plasma</title>
		<link>https://www.extreg.com/blog/2018/07/center-current-window-in-kde-plasma/</link>
					<comments>https://www.extreg.com/blog/2018/07/center-current-window-in-kde-plasma/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Sun, 29 Jul 2018 10:48:03 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[center window]]></category>
		<category><![CDATA[kde plasma]]></category>
		<category><![CDATA[kubuntu]]></category>
		<category><![CDATA[kwin]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://www.extreg.com/?p=336</guid>

					<description><![CDATA[<p>I&#8217;ve got a nice Samsung 27&#8243; 2K monitor at my home office. The one and only pain I have got with the resolution and size of the monitor is that most programs don&#8217;t need that much of horizontal space and become mostly useless and horrible to use. For instance your web browser very rarely needs ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2018/07/center-current-window-in-kde-plasma/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/07/center-current-window-in-kde-plasma/">Center current window in KDE Plasma</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve got a nice Samsung 27&#8243; 2K monitor at my home office. The one and only pain I have got with the resolution and size of the monitor is that most programs don&#8217;t need that much of horizontal space and become mostly useless and horrible to use. For instance your web browser very rarely needs to be that wide if you&#8217;re not staring at a dashboard or a video or something. Usually I want the browser to be a little more than half of the width of the screen and in the center if I&#8217;m doing web surfing etc.</p>
<p>KDE Plasma 5.12 doesn&#8217;t come with the required functionality to get the window resized to half of the screen and positioned in the center so I needed to dig in to KWin scripting and do it myself. I now have three shortcuts that let me:</p>
<ol>
<li>resize the current window to 1/2 of screen width and center it</li>
<li>grow it horizontally by 40 px</li>
<li>shrink it horizontally by 40 px</li>
</ol>
<p>This is super useful – one button to get the size where it functions nicely 99 % of time and then a few pushes more to grow/shrink it if needed.</p>
<p>You may find my KWin script as a git repository that may be installed into your Plasma system with one command <a href="https://github.com/piehei/kde-plasma-center-window">right here over at Github</a>. The script itself is very simple and might even give you nice pointers on how to achieve something similar with the KWin&#8217;s scripting facilities. More details on KWin scripting (and Plasma UI manipulation) may be found from <a href="https://techbase.kde.org/Development/Tutorials/KWin/Scripting">the official documentation</a>.</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/07/center-current-window-in-kde-plasma/">Center current window in KDE Plasma</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2018/07/center-current-window-in-kde-plasma/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">336</post-id>	</item>
		<item>
		<title>Using D3 and Puppeteer to generate visualizations</title>
		<link>https://www.extreg.com/blog/2018/04/using-d3-and-puppeteer-to-generate-visualizations/</link>
					<comments>https://www.extreg.com/blog/2018/04/using-d3-and-puppeteer-to-generate-visualizations/#comments</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Sun, 08 Apr 2018 10:37:19 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[d3]]></category>
		<category><![CDATA[puppeteer]]></category>
		<category><![CDATA[springer]]></category>
		<category><![CDATA[visualization]]></category>
		<guid isPermaLink="false">https://www.extreg.com/?p=310</guid>

					<description><![CDATA[<p>While working on a book chapter called Criterion-based grading, agile goals, and course (un)completion strategies (with Ihantola, Isohanni &#38; Mikkonen) for a new Springer book that concentrates on agile learning strategies etc. we needed to generate lots of visualizations. The visualizations were supposed to show the completion paths of different students for the first programming course at ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2018/04/using-d3-and-puppeteer-to-generate-visualizations/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/04/using-d3-and-puppeteer-to-generate-visualizations/">Using D3 and Puppeteer to generate visualizations</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_311" style="width: 970px" class="wp-caption alignright"><img aria-describedby="caption-attachment-311" loading="lazy" class="size-full wp-image-311" src="https://www.extreg.com/wp-content/uploads/2018/04/d3_vis.png" alt="" width="960" height="540" srcset="https://www.extreg.com/wp-content/uploads/2018/04/d3_vis.png 960w, https://www.extreg.com/wp-content/uploads/2018/04/d3_vis-300x169.png 300w, https://www.extreg.com/wp-content/uploads/2018/04/d3_vis-768x432.png 768w" sizes="(max-width: 960px) 100vw, 960px" /><p id="caption-attachment-311" class="wp-caption-text">Criterion-based grading, agile goals, and course (un)completion strategies: a visualization of a student&#8217;s learning path on TUT Programming 1 course. The Y-axis shows different automatically assessed programming tasks and the X-axisshows the rounds of the course (mapping to weeks on a semester). Colored balls are completed (the student&#8217;s solution passed the tests). Different colors represent different categories/levels of the tasks.</p></div></p>
<p>While working on a book chapter called <em>Criterion-based grading, agile goals, and course (un)completion strategies </em>(with Ihantola, Isohanni &amp; Mikkonen) for a new Springer book that concentrates on agile learning strategies etc. we needed to generate lots of visualizations. The visualizations were supposed to show the completion paths of different students for the first programming course at Tampere University of Technology.</p>
<p>I took on the task and chose Python for scripting to digest all the data and transform it to a suitable format, D3.js for generating the actual visualizations, and Puppeteer to handle the generation and PNG saving of ~1000 visualizations.</p>
<p>The visualizations turned out pretty nice and the workflow was good. After nailing down the Python data digestion and what we even wanted from it, I played a ton with D3 and came up with a nice looking visualization. After we all agreed on how the thing should look like I used a simple Puppeteer script to turn everything into a nice directory hierarchy of lots of PNGs. I was happy that each of the steps were self-contained and didn&#8217;t depend on any of the other steps. My initial data was in CSV format and I used Python to go through it and dig out the needed bits and pieces. I made a simple visualization.html that contained all HTML, CSS, and JavaScript to display a single visualization, nothing more. I ran Python&#8217;s SimpleHTTPServer to serve the page on my localhost and to play with it until it looked nice. In the end I had a very simple Node.JS script that started Puppeteer which uses Headless Chrome browser in the background to do all sorts of webpage manipulation; Puppeteer went over every student&#8217;s data and loaded the visualization.html for all of them and turned to page into a PNG file.</p>
<p>I could have gone for all Python solution but I hadn&#8217;t had any reason to use Puppeteer before so this was a nice thing to tryout. Also, I had some experience from D3.js so it was much easier to come up with the visualization code using the library and the web instead of some Python plotting library or whatnot. We were happy with the results.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/04/using-d3-and-puppeteer-to-generate-visualizations/">Using D3 and Puppeteer to generate visualizations</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2018/04/using-d3-and-puppeteer-to-generate-visualizations/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">310</post-id>	</item>
		<item>
		<title>Lazy loading the Vue root component</title>
		<link>https://www.extreg.com/blog/2018/02/lazy-loading-vue-root-component/</link>
					<comments>https://www.extreg.com/blog/2018/02/lazy-loading-vue-root-component/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Wed, 21 Feb 2018 07:07:07 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[lazy load]]></category>
		<category><![CDATA[vue]]></category>
		<category><![CDATA[vue root component]]></category>
		<category><![CDATA[webpack]]></category>
		<guid isPermaLink="false">https://www.extreg.com/?p=296</guid>

					<description><![CDATA[<p>Webpack and Vue together make it possible to split your bundle in chunks and lazy load only the actually needed chunks. Usually one chunk is one view, one component, or one of any encapsulated bunch of only optionally shown piece of content, a software component. This, of course, means that the client makes fewer requests ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2018/02/lazy-loading-vue-root-component/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/02/lazy-loading-vue-root-component/">Lazy loading the Vue root component</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Webpack and Vue together make it possible to split your bundle in chunks and lazy load only the actually needed chunks. Usually one chunk is one view, one component, or one of any encapsulated bunch of only optionally shown piece of content, a software component. This, of course, means that the client makes fewer requests to the server, transfers fewer kb over the network, and parses, compiles and evals fewer lines of JavaScript etc. Huge win.</p>
<p>I&#8217;ve been using this pattern with <a href="https://nyssetutka.fi">Nyssetutka.fi</a> for quite a some time. The client loads more or less the minimum needed JS payload in order to get the UI going as fast as possible and then conditionally more if the user navigates to some specific views. This isn&#8217;t the complete truth and there are a couple of things I could do to make the initial payload even smaller but the gist of it is that not everything is loaded at once in the beginning.</p>
<p>The other day I 15 minutes of hard time googling around along the lines of the title of this blog posting. How would one lazy load the root component of a Vue application? Couldn&#8217;t find the answer anywhere so here it is:</p>
<pre class="brush: jscript; title: ; notranslate">
const rootComp = () =&gt; import('./components/rootComp.vue');

new Vue({
  el: &quot;#app-container&quot;,
  render: h =&gt; h(rootComp)
})
</pre>
<p>Now that I know the answer&#8230; it&#8217;s completely clear and logical that this is the way to do it. It&#8217;s the completely same syntax you would use for any other component lazy loading but here you just use it for the root component. But even if it&#8217;s kinda implicit that this is the way, the official Vue documentation nor any of the Vue lazy loading blog postings out there mention it. So here it is if someone else is looking for the info.</p>
<p><strong>When could this be useful?</strong> The answer is not so clear if you compare it to lazy loading <em>just </em>normal components. They&#8217;re normal components not needed at the initialization of the app, right, but why would you lazy load the root, eh? If your app has multiple Vue instances and you don&#8217;t need them all either at the beginning or at all. In my case the app implements a notification popup telling about new updates and improvements to the site. The popup was easy to implement as a completely separate component used only by a separate Vue instance sharing the same Vuex store with the main app. So this was the way to do it – the popup itself is shown only to a small number of visitors, conditionally, and only once.</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2018/02/lazy-loading-vue-root-component/">Lazy loading the Vue root component</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2018/02/lazy-loading-vue-root-component/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">296</post-id>	</item>
		<item>
		<title>Android battery life: Pixel 2 and Oreo (8.1) nail it</title>
		<link>https://www.extreg.com/blog/2017/12/android-battery-life-pixel-2-oreo-8-1-nail/</link>
					<comments>https://www.extreg.com/blog/2017/12/android-battery-life-pixel-2-oreo-8-1-nail/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Mon, 11 Dec 2017 00:04:47 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[android battery life]]></category>
		<category><![CDATA[android oreo]]></category>
		<category><![CDATA[pixel 2]]></category>
		<guid isPermaLink="false">https://extreg.com/?p=270</guid>

					<description><![CDATA[<p>Android is the mobile operating system for me. It has been for quite a many years. I especially love the vanilla experience and have been a proud owner of Nexus 4, Nexus 5, Nexus 5X, Pixel and now Pixel 2. I’ve also had a couple of devices from HTC and Samsung. I love having the ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2017/12/android-battery-life-pixel-2-oreo-8-1-nail/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/12/android-battery-life-pixel-2-oreo-8-1-nail/">Android battery life: Pixel 2 and Oreo (8.1) nail it</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Android is the mobile operating system for me. It has been for quite a many years. I especially love the vanilla experience and have been a proud owner of Nexus 4, Nexus 5, Nexus 5X, Pixel and now Pixel 2. I’ve also had a couple of devices from HTC and Samsung. I love having the latest and greatest from Google and am happy to pay the big price of the last two generations of Google-made phones in order to get the vanilla experience, fast updates, and the most optimized hw-sw combo there is.</p>
<p>One thing that has *always* bothered me is battery life. No matter what phone I’ve been using the battery life has never been good. Doesn&#8217;t matter what sort of battery saving strategies I&#8217;ve been using (builtin, limiting services/apps etc.) or what resources the apps have been able to use, the juice has always run out surprisingly easily. At the same time some people around me have had *vastly* better experiences on their iDevices. That has sucked a big time.</p>
<p>This has now changed. Pixel 2 and the latest and greatest of the Google&#8217;s mobile OS deliver. I don&#8217;t have any numbers to share and am not interested in checking them up from the system stats since everything&#8217;s subjective and one person&#8217;s usage habits very rarely match anyone else&#8217;s. But I&#8217;m the type of user who wants to get multiple hours of screen time through various reading-this-and-that sessions, browsing the web to its bottom, and taking the phone into hand when you literally have to wait 35 seconds for the bus.</p>
<p>Pixel 2 running Oreo 8.1 has consistently delivered a <strong>MUCH BETTER</strong> battery life experience than <strong>*ANY*</strong> of my previous devices (<em>first paragraph</em>). This is not just a tad better, this is <strong>hugely better</strong>. The phone lasts so long that it has surprised me multiple times and had me over and again spontaneously praise it to my iGeeky brother. This is something totally different.</p>
<p>I really do hope this is more an advancement in the OS and not specific to the Pixel 2 hardware. If you&#8217;re interested, I really recommend to check out Ars Technica&#8217;s excellent deep-dive review of the new Google phones over <a href="https://arstechnica.com/gadgets/2017/10/pixel-2-and-2-xl-review-the-best-android-phone-you-can-buy/">here</a>. The picture below is from their review and shows the excellence – at least in what I use my phone for, web browsing and stuff, not gaming. If you&#8217;ve got some insight or speculation to this happy matter, please share!</p>
<p><img loading="lazy" class="alignright size-large wp-image-271" src="https://extreg.com/wp-content/uploads/2017/12/ars_technica_pixel2_review_battery-1024x768.jpeg" alt="" width="700" height="525" srcset="https://www.extreg.com/wp-content/uploads/2017/12/ars_technica_pixel2_review_battery-1024x768.jpeg 1024w, https://www.extreg.com/wp-content/uploads/2017/12/ars_technica_pixel2_review_battery-300x225.jpeg 300w, https://www.extreg.com/wp-content/uploads/2017/12/ars_technica_pixel2_review_battery-768x576.jpeg 768w, https://www.extreg.com/wp-content/uploads/2017/12/ars_technica_pixel2_review_battery.jpeg 1440w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/12/android-battery-life-pixel-2-oreo-8-1-nail/">Android battery life: Pixel 2 and Oreo (8.1) nail it</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2017/12/android-battery-life-pixel-2-oreo-8-1-nail/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">270</post-id>	</item>
		<item>
		<title>GCS Service Account private key not working from env?</title>
		<link>https://www.extreg.com/blog/2017/12/gcs-service-account-private-key-not-working-env/</link>
					<comments>https://www.extreg.com/blog/2017/12/gcs-service-account-private-key-not-working-env/#comments</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Sun, 03 Dec 2017 17:45:03 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[env]]></category>
		<category><![CDATA[gcloud]]></category>
		<category><![CDATA[gcloud node]]></category>
		<category><![CDATA[gcs]]></category>
		<category><![CDATA[gcs service account]]></category>
		<category><![CDATA[pem routines error]]></category>
		<category><![CDATA[pem_read_bio: no start line]]></category>
		<category><![CDATA[private key environment variable]]></category>
		<category><![CDATA[service account private key]]></category>
		<guid isPermaLink="false">https://extreg.com/?p=259</guid>

					<description><![CDATA[<p>The sole purpose of this post is to help people who are googling for the same issue. It took me quite a while before finding the answer. TL;DR: check out this answer. If you&#8217;re trying to initialize gcloud, google-cloud-node, or whatever Google Cloud related npm package on your NodeJS project using secrets stored in environment ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2017/12/gcs-service-account-private-key-not-working-env/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/12/gcs-service-account-private-key-not-working-env/">GCS Service Account private key not working from env?</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The sole purpose of this post is to help people who are googling for the same issue. It took me quite a while before finding the answer. TL;DR: check out this <a href="https://github.com/GoogleCloudPlatform/google-cloud-node/issues/1173#issuecomment-199183259">answer</a>.</p>
<p>If you&#8217;re trying to initialize gcloud, google-cloud-node, or whatever Google Cloud related npm package on your NodeJS project using secrets stored in environment variables (specifically <strong>Service Account private key!</strong>) and you&#8217;re running into this problem:</p>
<p style="padding-left: 10px;"><strong>[Error: Could not authenticate request</strong><br />
<strong>error:0906D06C:PEM routines:PEM_read_bio:no start line]</strong></p>
<p>This is most likely caused by either of these problems (or both):</p>
<p>1. You touched the beginning and end of the private key string, leave them intact! So the string *has to* look like this:</p>
<p><code style="padding-left: 10px;">-----BEGIN PRIVATE KEY-----\n[base64encoded...]==\n-----END RPIVATE KEY-----\n</code></p>
<p>2. When you read in the private key in your NodeJS server application, remember check it&#8217;s not amended in any way. If you look at the private key string that&#8217;s included in the service account json provided by Google Cloud Console&#8217;s IAM manager, it has got a multitude of <em><strong>\n </strong></em>every here and there. Those are converted into <strong>\\n</strong>&#8216;s when the private key is accessed from the environment variable and they have to be put back in order. So basically do something like this:</p>
<p><code style="padding-left: 10px;">const privKey = process.env.PRIVATE_KEY.replace(/\\n/g, '\n');</code></p>
<p>That&#8217;s it.</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/12/gcs-service-account-private-key-not-working-env/">GCS Service Account private key not working from env?</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2017/12/gcs-service-account-private-key-not-working-env/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">259</post-id>	</item>
		<item>
		<title>Introducing TabJump, a Chrome extension to &#8230; jump between your tabs!</title>
		<link>https://www.extreg.com/blog/2017/11/introducing-tabjump-chrome-extension-jump-tabs/</link>
					<comments>https://www.extreg.com/blog/2017/11/introducing-tabjump-chrome-extension-jump-tabs/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Tue, 21 Nov 2017 19:57:53 +0000</pubDate>
				<category><![CDATA[random]]></category>
		<category><![CDATA[chrome extension]]></category>
		<category><![CDATA[tabjump]]></category>
		<guid isPermaLink="false">https://extreg.com/?p=248</guid>

					<description><![CDATA[<p>I have the habit of keeping multiple Chrome windows filled with more than a hundred tabs. As of late I&#8217;ve become very frustrated at finding a specific tab since it can take a bit of time. Also, I hate it when a website opens slowly (eg. Gmail, Google Drive, Facebook, Slack, Twitter etc.) and most ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2017/11/introducing-tabjump-chrome-extension-jump-tabs/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/11/introducing-tabjump-chrome-extension-jump-tabs/">Introducing TabJump, a Chrome extension to &#8230; jump between your tabs!</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" class="size-large wp-image-249 aligncenter" src="https://extreg.com/wp-content/uploads/2017/11/tabjump-chrome-extension-1024x484.png" alt="" width="700" height="331" srcset="https://www.extreg.com/wp-content/uploads/2017/11/tabjump-chrome-extension-1024x484.png 1024w, https://www.extreg.com/wp-content/uploads/2017/11/tabjump-chrome-extension-300x142.png 300w, https://www.extreg.com/wp-content/uploads/2017/11/tabjump-chrome-extension-768x363.png 768w, https://www.extreg.com/wp-content/uploads/2017/11/tabjump-chrome-extension.png 1140w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>I have the habit of keeping multiple Chrome windows filled with more than a hundred tabs. As of late I&#8217;ve become very frustrated at finding a specific tab since it can take a bit of time. Also, I hate it when a website opens slowly (eg. Gmail, Google Drive, Facebook, Slack, Twitter etc.) and most of the time prefer to get back to the previous instance of that website in my precious tab collection. Whatever.</p>
<p>I didn&#8217;t want to check what the Chrome extension store had to offer. Instead I implemented my own solution. It&#8217;s still in beta, as you can see from the screenshot, and it&#8217;s freakin&#8217; ugly, <em><strong>but it works as intended</strong></em><em>. </em>Also, I got to implement something super useful and learned a tad of Chrome extension development. Yikes.</p>
<p>It&#8217;s mighty simple. You press jj or JJ (the presses have to happen very quickly and simultaneously) and the grey popup appears. It comes with a search box which then lists all the tabs from all windows based on whatever you type in the search box. The tabs are matched by their URLs and titles. Up and down arrows let you navigate and enter first focuses the window where the chosen tab may be found and then focuses the tab. Perfect. <strong>jj + g + enter</strong> &#8211;&gt; Gmail focused instantaneously.</p>
<p>TabJump has saved me a lot of frustration and made my browsing experience nicer than I previously thought it could be. The extension is very simple but still comes with a very nice usability improvement. Not kidding. I&#8217;m amazed how many hundreds of times I&#8217;ve used it in the past couple of weeks even though it&#8217;s still buggy and looks disgusting.</p>
<p>If you want to try it out, check out this <a href="https://chrome.google.com/webstore/detail/tabjump/llgdignfpbanaeejhiilkipocphhgcbl">public link</a>. But as I said, it&#8217;s buggy, I haven&#8217;t had the time (nor the need) to finish it. I&#8217;ll try to do that someday and publish the extension in Chrome store publicly.</p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/11/introducing-tabjump-chrome-extension-jump-tabs/">Introducing TabJump, a Chrome extension to &#8230; jump between your tabs!</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2017/11/introducing-tabjump-chrome-extension-jump-tabs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">248</post-id>	</item>
		<item>
		<title>Wicked cool neural network video primer</title>
		<link>https://www.extreg.com/blog/2017/11/wicked-cool-neural-network-video-primer/</link>
					<comments>https://www.extreg.com/blog/2017/11/wicked-cool-neural-network-video-primer/#respond</comments>
		
		<dc:creator><![CDATA[Pietari]]></dc:creator>
		<pubDate>Sun, 05 Nov 2017 17:09:22 +0000</pubDate>
				<category><![CDATA[Fascinating engineering]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[3blue1brown]]></category>
		<category><![CDATA[machine learning]]></category>
		<category><![CDATA[neural networks]]></category>
		<category><![CDATA[video series]]></category>
		<guid isPermaLink="false">https://extreg.com/?p=239</guid>

					<description><![CDATA[<p>One of those people who have heard about neural networks and machine learning n+1 times but don&#8217;t really understand the actual fundamental basics behind it? I surely am. Well, of course I know that there are some ways of training a network with pre-labeled data and then discovering similarities in never-seen data and yada yada ... <span class="more"><a class="more-link" href="https://www.extreg.com/blog/2017/11/wicked-cool-neural-network-video-primer/">[Read more...]</a></span></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/11/wicked-cool-neural-network-video-primer/">Wicked cool neural network video primer</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>One of those people who have heard about neural networks and machine learning n+1 times but don&#8217;t really understand the actual fundamental basics behind it? I surely am. Well, of course I know that there are some ways of training a network with pre-labeled data and then discovering similarities in never-seen data and yada yada but I&#8217;m not a person to teach the inner workings to anyone. It&#8217;s one of the subjects that are so this and that and buzzing all over the place but I&#8217;ve never found it so interesting that I would have dug into it.</p>
<p>I really suggest you watch <a href="https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw/videos">3Blue1Brown&#8217;s</a> series on the subject. Watch through all of them. Don&#8217;t skip anything.</p>
<p>One of the best series I&#8217;ve seen anywhere. Check them out!</p>
<p><a href="https://www.youtube.com/watch?v=aircAruvnKk" target="_blank" rel="noopener">But what *is* a Neural Network? | Deep learning, chapter 1</a><br />
<a href="https://www.youtube.com/watch?v=IHZwWFHWa-w">Gradient descent, how neural networks learn | Deep learning, chapter 2</a><br />
<a href="https://www.youtube.com/watch?v=Ilg3gGewQ5U">What is backpropagation and what is it actually doing? | Deep learning, chapter 3</a><br />
<a href="https://www.youtube.com/watch?v=tIeHLnjs5U8">Backpropagation calculus | Appendix to deep learning chapter 3</a></p>
<p>The post <a rel="nofollow" href="https://www.extreg.com/blog/2017/11/wicked-cool-neural-network-video-primer/">Wicked cool neural network video primer</a> appeared first on <a rel="nofollow" href="https://www.extreg.com">Pietari Heino&#039;s personal website</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.extreg.com/blog/2017/11/wicked-cool-neural-network-video-primer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">239</post-id>	</item>
	</channel>
</rss>
