<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mehanig on Medium]]></title>
        <description><![CDATA[Stories by Mehanig on Medium]]></description>
        <link>https://medium.com/@mehanig?source=rss-8b8662cdd8f4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OyIu_VSEjueKJW83MaJMVA@2x.jpeg</url>
            <title>Stories by Mehanig on Medium</title>
            <link>https://medium.com/@mehanig?source=rss-8b8662cdd8f4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:04:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehanig/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building website in 2021 (mehanig.com)]]></title>
            <link>https://mehanig.medium.com/building-website-in-2021-mehanig-com-e1c79dc2a2fe?source=rss-8b8662cdd8f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1c79dc2a2fe</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Mehanig]]></dc:creator>
            <pubDate>Sun, 24 Jan 2021 02:29:28 GMT</pubDate>
            <atom:updated>2021-01-24T02:31:19.197Z</atom:updated>
            <content:encoded><![CDATA[<p>We will be using a lot of latest technologies to build simple, ugly one-page <a href="https://mehanig.com/">website</a>.</p><p>Let’s start with WHY: There is literally no reason to build a website for yourself in 2021, except if you want to build a website for yourself. So we will be doing exactly that.</p><p>First we need to came up with a set of requirements. Then create a plan and split up into smaller items. And then execute. This is all obvious. Let’s start with a set of requirements.</p><p>The content of the website will be a collection of links to my social accounts, work and some basic info about me.</p><p>I would prefer some basic design with interesting elements, I don’t have much of the content to put on the front page, so there can be some visual blocks, maybe custom font, few weird color just to make it stand out.</p><p><strong>1. Design</strong></p><p>Let’s have 2 pages, front page with 2 blocks — “Logo Visual” + Links, and let’s make the scalable like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*3cGCQ9N4fpJTEkdE07i_Mg.png" /></figure><p>And for vertical screens we can put those two block one under another.</p><p><strong>2. React, Typescript, Webpack</strong></p><p>Let’s be honest, no one is building websites with HTML + JS + CSS nowadays, we need to have a framework and React seems OK. We also need to have typesafety so we will Typescript, and to combine those two together we will use webpack.</p><p><strong>3. Go server-less</strong></p><p>To make it cost-efficient, the website will be just a set of static files and it will be served as a static website in Azure blob storage. This is a great way to create websites where the backend is not required.</p><p>Here is my list of things to consider before choosing whether or not website can be hosted in a blob storage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*G_hs7OBs5aYhIseqOxCcXw.png" /></figure><p>For my example answers are No, No, No, so we can simply create a website with blob storage.</p><p><strong>4. Routing</strong></p><p>I would think that there needs to be at least 2 routes a) <strong>/</strong> b) <strong>/about</strong></p><p>For that we can use React-router.</p><p>The problem though is that it will only work inside App, so we will be able to go to / and then click /about link,</p><p>But if someone will share the link it will not work because blob storage will look at $web/about/index.html.</p><p>To solve this problem we have at least 3 options:</p><ol><li>We can create a folder “about” and put /index.html there with about route (this is how it’s done in <a href="https://bgrenderer.com/about">bgrenderer.com</a>)</li><li>We can create file called about.html and add redirect rules in CDN from {1}.html -&gt; {1}</li><li>We can point all 404 pages to special 404index.html, where we can serve routes or show error page based on the config.</li></ol><p>For this website, just for fun, I will go with option 2 and here Is how we can do it:</p><ul><li>First let’s add react-router and wrap components around route</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*kLawLKvDajTVnTTVr-f8vQ.png" /></figure><ul><li>(order of &lt;Route&gt; components is important, otherwise “/” will match all the routes)</li><li>We need to create 2 identical pages, one for index.html, another for about.html (yes, this is a waste, but let’s not over-optimize things yet and fix it later) for that we will create 2 html files using webpack:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*3VYkYGlz2ZjF27VVeKj1ag.png" /></figure><ul><li>For index we will use index.tsx, and for about — about.tsx, but notice that they are completely identical. But we can’t reuse same chunk. If we use index in both, in navigation event router will not work</li></ul><p>The resulting build will create 4 files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*DTJFcHQEjyVNmyRZ1LyE3w.png" /></figure><p>The problem though is with the fact that about.js and index.js are completely identical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*YuU6Dx8lIy_RoMX-XIoCMA.png" /></figure><p>Let’s fix that later, for now, let’s make it work.</p><p>Last missing piece is to add re-write routes in the CDN.</p><p>Since I am using Azure, the only available CDN with custom page rules is Verizon Premium (as of January 2021),</p><p>Let’s create it and connect to out Blob Storage Static Website by putting website url into CDN Origin value</p><p>We now need to set rules in Verizon Rules Engine, click ”Mange” and we will be redirected to Verizon CDN panel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*YkeI0wJG_qIhe4sSwjcOIQ.png" /></figure><p>There in Verizon UI creating simple rule in HTTPLarge -&gt; Rules Engine will do the trick</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBKyT09w29eT_68cXEyaUg.png" /></figure><p>Don’t forget to deploy rule from Rules Engine, and routing should be working</p><p><strong>5. Cloudflare</strong></p><p>Azure Blob storage is great and all that, but managing SSL is still not the simplest task there and for the purpose of simplicity I will use Cloudflare Full SSL/TLS mode which uses cloudflare self-signed cert on cloudflare server. This makes having SSL connection working in just one button.</p><p>I will also move DNS management into Cloudflare. End structure will the the following:</p><p>Browser → Cloudflare CDN → Verizon Premium CND → Azure Blob Storage (Origin)</p><p><strong>6. Github actions</strong></p><p>Let’s also create some kind of simple CI/CD pipeline so that there will be no need to manually deploy code each time.</p><p>It will have 4 steps:</p><ol><li>Build</li><li>Deploy code from each commit to master</li><li>Flush Verizon CDN</li><li>Flush Cloudflare CDN</li></ol><p>We can use Node.js CI from github workflows for step 1 which will be just calling yarn &amp;&amp; yarn build</p><p>And for step 2 and 3, we can just use azure/CLI workflow step, we only need do provide AZURE_CREDENTIALS through secrets to workflow which is greatly described here:</p><p>Last step is to flush DNS using Clouldflare API,</p><p>Let’s create a token with correct scope</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*blUD33T0MAeC9PjqELcVJg.png" /></figure><p>Add it to github secrets again,</p><p>And use through API by invoking network request during pipeline</p><p>Example of request we need to make is the following:</p><pre>curl -X POST <a href="https://api.cloudflare.com/client/v4/zones/cfd7a75d18978e0f7744d0935f3b6ff7/purge_cache/">https://api.cloudflare.com/client/v4/zones/cfd7a75d18978e0f7744d0935f3b6ff7/purge_cache/</a> -H &#39;Authorization:Bearer ${{token}}&#39; -H &#39;Content-Type:application/json&#39; -H &#39;cache-control:no-cache&#39; -d &#39;{&quot;purge_everything&quot;:true}&#39;</pre><p>There is workflow action to call curl in github so our action can look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QtBMgrTYCUX7NgmBdT4iZw.png" /></figure><p>It doesn’t work though, and I assume this is something with formatting. Let’s deal with that later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*qM1Ic-E3k9OvIjbpax7TMg.png" /></figure><p>As for now we have our mehanig.com working, with few bugs, small issues and errors, but this is fine. At least we got something working and had fun during the development. Source code is here: <a href="https://github.com/mehanig/mehanig.com">Github</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*PFtxZdLjZKGak8cVccXlww.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1c79dc2a2fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[POPSOLVER — good friend when you want to add some extra life to your simulations]]></title>
            <link>https://mehanig.medium.com/popsolver-good-friend-when-you-want-to-add-some-extra-life-to-your-simulations-95dddeb60932?source=rss-8b8662cdd8f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/95dddeb60932</guid>
            <dc:creator><![CDATA[Mehanig]]></dc:creator>
            <pubDate>Fri, 02 Jan 2015 12:49:19 GMT</pubDate>
            <atom:updated>2015-01-02T12:49:19.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/483/0*NIe7VqGVZXas18NN.png" /></figure><p>Popsolver is essentially POP Network and we can drop usual particle operators in it to drive particle velocity and create more reallistic feel about our sceene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/0*pszIm-Z_qju2ULb5.png" /></figure><p>As you can see, Pop solver doesn’t generate any new particles. it uses null group instead. I also uncheck Handle Collisions, and Solve mode to Update Velocity. Let’s look inside PopSolver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/0*4lxII-t4Ek72JLHC.png" /></figure><p>There is nothing except nullobject an voppop noise generator for our velocity</p><p>Lets dive inside Voppop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/0*heznGW7VVBSxHCk9.png" /></figure><p>I Also noted that Noise Type is very important in this situation. Try change “Original Perlin Noise” to “Perlin Noise”.</p><p>Here is the picture of simulation without Popsolver:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*UBW7yKtqebeYm_0F.png" /></figure><p>And here it is with PopSolver connected:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*G6FlaKwCogAc-rYJ.png" /></figure><p>Mehanig 2013</p><p><em>Originally published at </em><a href="http://mehanig.com/blog/popsolver-good-freind-when-you-want-to-ass-some-extra-life-to-yours-simulations/"><em>mehanig.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95dddeb60932" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MOD_WSGI: How to print from django files]]></title>
            <link>https://mehanig.medium.com/mod_wsgi-how-to-print-from-django-files-f4b162e39f1?source=rss-8b8662cdd8f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b162e39f1</guid>
            <dc:creator><![CDATA[Mehanig]]></dc:creator>
            <pubDate>Fri, 02 Jan 2015 12:48:24 GMT</pubDate>
            <atom:updated>2015-01-02T12:48:24.891Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes, while debugging your production server, you might want to print some data</p><p>like you usually do with your local script. Ohhhh gosh, why there is no print function..!</p><p>But wait, <strong>there is!</strong></p><h2>import sys</h2><h2>print &gt;&gt; sys.stderr, YOUR_STRING</h2><p>just add that inside any of yours .py files in django, than restart apache and chech you log folder!</p><p>Message will be printed at error_app file</p><p>Mehanig 2013</p><p><em>Originally published at </em><a href="http://mehanig.com/blog/mod_wsgi-how-to-print-from-django-files/"><em>mehanig.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b162e39f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>