<?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 Kumar Harsh on Medium]]></title>
        <description><![CDATA[Stories by Kumar Harsh on Medium]]></description>
        <link>https://medium.com/@kumarharsh?source=rss-413e46919df6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kDGh0fm-xyTEGwkz.jpg</url>
            <title>Stories by Kumar Harsh on Medium</title>
            <link>https://medium.com/@kumarharsh?source=rss-413e46919df6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:42:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kumarharsh/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[Modernizing my Windows Development Environment]]></title>
            <link>https://medium.com/@kumarharsh/modernizing-my-windows-development-environment-418b7f710aad?source=rss-413e46919df6------2</link>
            <guid isPermaLink="false">https://medium.com/p/418b7f710aad</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tmux]]></category>
            <category><![CDATA[windows-10]]></category>
            <dc:creator><![CDATA[Kumar Harsh]]></dc:creator>
            <pubDate>Sat, 02 Feb 2019 20:04:53 GMT</pubDate>
            <atom:updated>2019-02-02T20:44:10.237Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDH4V-r0rm0yShO2D-lowA.png" /><figcaption>Photo by <a href="https://unsplash.com/photos/k03ornGON08?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Blake Connally</a> on <a href="https://unsplash.com/@blakeconnally?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>. Damn, I should get a plant for office too :)</figcaption></figure><p>At work, I code mostly in Javascript (Webpack, React, Flow) and some Golang on a Windows machine. And as anyone who has tried working on vanilla Windows cmd/powershell will tell you, it’s a painful plod. So the first few things I used to do till now were: install <a href="https://github.com/Maximus5/ConEmu">ConEMU</a>, <a href="https://gitforwindows.org/">git-for-windows</a>, and <a href="https://mingw-w64.org/doku.php">MinGW</a> (or <a href="https://www.msys2.org/">msys2</a>). And recently, I also started using <a href="https://github.com/powershell/powershell">PowerShell-Core</a> and WSL (Windows Subsystem for Linux) Ubuntu distro from the Microsoft Store. The WSL mostly lay dormant and acted as a fallback when doing some things on Powershell turned out to be hard. For the most part, I was pretty happy with the setup. Things were not ideal performance wise, but switching between OS’s to code and run a business is a bigger trade-off for me.</p><p>So, what did I go looking for something better? Because that’s what I do. Also, because <em>Flow</em>. For all the niceness it brings to a JS code-base, it’s a complete train-wreck of a tool on Windows, with no hope in sight that things will ever improve for Windows users (or <a href="https://medium.com/flow-type/what-the-flow-team-has-been-up-to-54239c62004f">maybe there is</a>?). We’ve not moved to Typescript because most of my team works in Linux, so it’s not been a big priority to shift from Flow (for now, although <a href="https://medium.com/paypal-engineering/why-every-new-web-app-at-paypal-starts-with-typescript-9d1acc07c839">you should</a>). Another big reason was that for all time I spent setting up the environment I have outlined above, I couldn’t get my own backend written in Golang to run natively on Windows. I wrote about <a href="https://medium.com/@kumarharsh/using-libxml2-headers-in-windows-5d548077cde5">how I got it working</a>, but after re-installing Windows, I found that I couldn’t reproduce my own steps 🤦🏽‍♂️.</p><p>But the most recent and ironic reason was a 3-year-younger me. when I find myself stuck writing some script, I usually fire up the wsl bash and try it there. So this week, when I did that, a though crossed my mind — I think I can install fish instead of bash and get better completions. So I did that, and then I installed pure, and it <a href="https://github.com/rafaelrinaldi/pure/issues/29">rendered very badly</a>. In a slightly miffed mood, I headed to their repository to complain to find that there was an issue already for this. Only that this had happened 3 years ago. And that it was <strong>me</strong> who had reported the issue. I had come a full circle in WSL-fish, and it stumped me that nothing had changed in WSL land! Surely, that was not true!</p><p>So this Friday, I thought of giving the dormant <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">WSL</a> another serious try. There have been several significant changes to the system since it was first introduced. The Windows Console team keeps happily <a href="https://blogs.msdn.microsoft.com/commandline">writing about the changes</a> in nice in-depth blog posts. So I fired up my terminal and set about exploring the new possibilities…</p><p>First, I switched into wsl bash:</p><pre>PS&gt; wsl</pre><p>And I installed the <a href="https://fishshell.com/">fish</a> shell, and <a href="https://github.com/jorgebucaran/fisher">fisher</a> to manage plugins. Then, I installed tmux — which works very well on WSL now — and <a href="https://github.com/tmux-plugins/tpm">tpm</a> to manage tmux plugins. Then, I found out that <a href="https://github.com/jwilm/alacritty">Alacritty</a> — a completely new terminal emulator written in Rust had recently added support for Windows. I have heard some great things about it, and so I gave it a try. It’s a replacement for ConEMU, so you are gonna miss the tabs. But with tmux, that’s not a big problem. And boy is Alacritty <em>fast</em>! To endanger my life a little more living on the bleeding edge, I <a href="https://github.com/jwilm/alacritty/issues/1973">enabled some settings</a> in the Alacritty config (default location is %APPDATA%\alacritty\alacritty.yml) to get the state of the art of Windows console technology:</p><pre>enable_experimental_conpty_backend: true</pre><pre># add some transparency<br>background_opacity: 0.95</pre><pre># set some default keybindings<br>key_bindings:<br>  ...<br>  # add a keybinding to open alacritty settings with Ctrl+,<br>  - { key: Comma, mods: Control, command: { program: &quot;C:\\Users\\&lt;username&gt;\\AppData\\Local\\Programs\\Microsoft VS Code\\code.exe&quot;, args: [&quot;C:\\Users\\&lt;username&gt;\\AppData\\Roaming\\alacritty\\alacritty.yml&quot;] } }</pre><p>Then, I installed a new version of <a href="https://github.com/powershell/Win32-OpenSSH">Window’s fork of OpenSSH</a> which had an incredibly neat feature: you can run your ssh-agent inside Windows, which will persist your keys in the Windows credential manager, so you don’t have to keep typing your passphrases again and again. And then, I installed <a href="https://github.com/rupor-github/ssh-agent-wsl">ssh-agent-wsl</a> which lets my WSL environment get access to the keys held by my Windows environment! How cool is that?</p><p>So that’s the crux of the new setup. I’m still learning new things, but overall, this setup seems way faster than before. I also installed the <a href="https://github.com/rafaelrinaldi/pure">pure</a> theme for fish shell, and got it to display properly by <a href="https://github.com/rafaelrinaldi/pure/issues/29#issuecomment-459638318">changing the symbol variables in the fish config</a>.</p><p>I also installed a bunch of other nice-to-haves for tmux which are pretty useful:</p><pre>set -g <a href="http://twitter.com/plugin">@plugin</a> &#39;tmux-plugins/tmux-sensible&#39;<br>set -g <a href="http://twitter.com/plugin">@plugin</a> &#39;tmux-plugins/tmux-yank&#39;<br>set -g <a href="http://twitter.com/plugin">@plugin</a> &#39;tmux-plugins/tmux-pain-control&#39;<br>set -g <a href="http://twitter.com/plugin">@plugin</a> &#39;tmux-plugins/tmux-sessionist&#39;<br>set -g <a href="http://twitter.com/plugin">@plugin</a> &#39;jbnicolai/tmux-fpp&#39;<br>set -g <a href="http://twitter.com/plugin">@plugin</a> &#39;jimeh/tmux-themepack&#39;</pre><p>Oddly enough, I haven’t yet installed and evaluated Flow. But the golang backend runs like a charm. No need of docker for that anymore.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=418b7f710aad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using libxml2 headers in Windows]]></title>
            <link>https://medium.com/@kumarharsh/using-libxml2-headers-in-windows-5d548077cde5?source=rss-413e46919df6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d548077cde5</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mingw]]></category>
            <category><![CDATA[gcc]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Kumar Harsh]]></dc:creator>
            <pubDate>Tue, 12 Dec 2017 08:33:20 GMT</pubDate>
            <atom:updated>2018-03-09T06:45:07.978Z</atom:updated>
            <content:encoded><![CDATA[<p>I had installed the <a href="https://github.com/lestrrat/go-libxml2">go-libxml2</a> library in one of my projects, but after installing it, the project failed to run under Windows because there is no libxml-2, or for that matter any of the unix toolchain, by default in Windows. I tried to manually hack through all of the steps to somehow get libxml working, <a href="https://github.com/lestrrat/go-libxml2/issues/17#issuecomment-270204364">but couldn’t get very far</a>. Then I gave up and started running the project within Docker.</p><p>Today, after many months, things just <em>clicked</em> in my head, and within an hour, I got everything working. The steps:</p><ul><li>Install <strong>MSYS2</strong>. [<a href="http://www.msys2.org/">Official Source</a>]<br>Take care to install msys2 on a <strong>path without spaces</strong>. I install these packages on `C:\bin\msys64` to keep the paths short and simple. Going forward, I’ll refer to this installation path as MSYS_ROOT. The msys installation also has the pacman software for managing packages.</li><li>Add msys’s bin path to your <strong>system environment variables</strong>. The path should be: `MSYS_ROOT\usr\bin`. Restart your terminal, and ensure `pacman` is available to run by writing which pacman into your terminal.</li><li>Ensure you have gcc installed (run which gcc to ensure). If you don’t have gcc installed, install MinGW-w64 which includes gcc. Source: <a href="https://sourceforge.net/projects/mingw-w64/files">https://sourceforge.net/projects/mingw-w64/files</a>. Note: You can also install gcc via pacman but that version of gcc (even the latest one) starts giving me problems and the build always fails (probably due to incompatible paths or some such nuisance). To install gcc via pacman, use pacman -S gcc. This might install an older version of gcc, which you can update by updating all pacman packages by running pacman -Syuu until it shows there is nothing to do. (Read this post for a better explanation: <a href="https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&amp;-MSYS2">https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&amp;-MSYS2</a>). Note again that I won’t recommend using the pacman version of gcc as it fails to build the libxml bindings — I haven’t been able to figure out why, nor do I have the patience to do so.</li><li>Run `pacman -S libxml2-devel`. Note that you need to install <strong>libxml2</strong>’s <strong>development headers</strong>, not just the base library, otherwise you won’t get the header (*.h) files. Once installed, the `libxml2` headers would be installed and available in `MSYS_ROOT\usr\include\libxml2\libxml` folder. There are other ways to get libxml too, but I found this one to be the simplest and it actually worked unlike my previous tries.</li><li>Install the latest version of <a href="https://sourceforge.net/projects/pkgconfiglite/files/"><strong>pkg-config-lite</strong></a> by downloading the archive and unzipping it. Finding and installing pkg-config is really painful: See <a href="http://mingw.org/wiki/FAQ">FAQ</a> and <a href="https://stackoverflow.com/a/25605631/630170">this Stackoverflow answer</a>. The <strong>pkg-config</strong> linked in the FAQ above crashes, so that’s out of the question. So <strong>pkg-config-lite</strong> it is!</li><li>Create a new system environment variable called `PKG_CONFIG_PATH` and set it’s value to the <strong>default pkgconfig folder</strong>:`MSYS_ROOT\usr\lib\pkgconfig`. This folder should have the pkg-config files (`*.pc`) here, such as `libxml-2.0.pc`.</li><li>Verify your libxml-2.0.pcfile. It should read like this:</li></ul><pre>prefix=/usr<br>exec_prefix=${prefix}<br>libdir=${exec_prefix}/lib<br>includedir=${prefix}/include<br>modules=1</pre><pre>Name: libXML<br>Version: 2.9.2<br>Description: libXML library version2.<br>Requires:<br>Libs: -L${libdir} -lxml2<br>Libs.private:  -lpthread -lz -llzma    -liconv -lm  <br>Cflags: -I${includedir}/libxml2</pre><ul><li>It’s done! Now go-libxml2 will find the libxml headers and the program will compile and run!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*3CfilJnfPtg2PuzgH2rayg.png" /><figcaption>A program with go-libxml2 builds successfully now!</figcaption></figure><p>References:</p><ul><li><a href="http://mingw.org/wiki/FAQ">http://mingw.org/wiki/FAQ</a></li><li><a href="https://stackoverflow.com/questions/1710922/how-to-install-pkg-config-in-windows/25605631#25605631">https://stackoverflow.com/questions/1710922/how-to-install-pkg-config-in-windows/25605631#25605631</a></li><li><a href="https://stackoverflow.com/questions/30960805/error-libxml2-not-found-on-installing-gokogiri-on-windows">https://stackoverflow.com/questions/30960805/error-libxml2-not-found-on-installing-gokogiri-on-windows</a></li><li><a href="https://github.com/mysqludf/lib_mysqludf_xml/issues/1#issuecomment-22078561">https://github.com/mysqludf/lib_mysqludf_xml/issues/1#issuecomment-22078561</a></li><li><a href="https://github.com/lestrrat/go-libxml2/issues/17#issuecomment-270204364">https://github.com/lestrrat/go-libxml2/issues/17#issuecomment-270204364</a></li><li><a href="https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&amp;-MSYS2">https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&amp;-MSYS2</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d548077cde5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experiences of writing my first UWP app]]></title>
            <link>https://medium.com/@kumarharsh/experiences-of-writing-my-first-uwp-app-4e90976db486?source=rss-413e46919df6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e90976db486</guid>
            <category><![CDATA[uwp]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[visual-studio]]></category>
            <dc:creator><![CDATA[Kumar Harsh]]></dc:creator>
            <pubDate>Mon, 27 Nov 2017 11:13:48 GMT</pubDate>
            <atom:updated>2017-11-27T11:13:48.003Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently wrote an app called <a href="https://www.microsoft.com/en-in/store/p/store-insider/9nqfmq5sxxcb">Store Insider</a> which tells you the latest version of any Windows store app, and when it was last updated. Through this post, I’ll share my experience of making my first UWP app.</p><h3>Why?</h3><p>Well, the simple answer is that the Windows Store s̶u̶c̶k̶s̶ isn’t as good as I want it to be — even after 2 years, the store doesn’t tell you the app’s version number, when the app was last updated, etc. The store in Windows Phone 8.1 did show the versions after all! Yes, there is a contrived way to see the app version by going to “Downloads and Updates” and under the “Recent Activity” head, the versions and last updated dates for the apps you’ve already installed show up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*nAghm2QB9JOG2qh0RjatQw.png" /><figcaption>Versions and last “modified” dates for apps I already own :-(</figcaption></figure><p>Well, while that’s better than nothing, I also wanted to see the current version of the app I’m going to install. Is the app <em>in-beta</em>? Is the app being maintained — given the recent state of Microsoft’s attention towards mobile, the default option to that question is to assume “no”, even when the desktop app system is much better by comparison. Thus, given the state of the store (esp. the mobile side), I think a higher level of transparency from MS could build a better trust within the ecosystem.</p><p>Another good reason for me to give it a shot was because most of the work for my app was already done! I found this awesome website called <a href="http://wpsnitch.appspot.com/">WPSnitch</a> which basically had the same functionality as a web app. And getting a look at the whole <a href="https://gitlab.com/subversion/wpsnitch">source code</a> was definitely handy. So I calculated that all my lazy ass had to do was:</p><ol><li>Rip out the source code from the wpsnitch guy — max time: 1 hour</li><li>Make a UWP app which implemented the same stuff — max time: 1 day</li><li>???</li><li>Profit!!!</li></ol><h3>The road to profit</h3><p>First, the source code for wpsnitch. Though I don’t know much python, it was well-written and straightforward enough to get it through my head in about the time I assumed it’d take. And so, I proceeded to step #2, which was to code the UWP app.</p><p>So, I fired up Visual Studio on a sultry Sunday afternoon, and started off with a simple template. Having worked with C# already as an intern in the past, I chose that option to get started. Also, I wanted to see how developing in native XAML/C# felt like.</p><p>So, I created a new project with the “Blank App (Universal App in C#)”, and followed the <a href="https://docs.microsoft.com/en-us/windows/uwp/get-started/create-a-hello-world-app-xaml-universal">official UWP tutorial</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*jw90m9jNndOT5T_zgaiAvA.png" /><figcaption>First UWP app!</figcaption></figure><p>To say the least, I was pretty excited with the whole thing about starting off a new app, and created the UI in a breeze and ported over most of the python code to C# (and eliminated the legacy windows store code — more on that later). I was on time to creating the app (3 hours of work). If everything went well, I’d publish the app by 10pm, and by the time I wake up, tens of thousands of people will be using the app! So, I fire up the app to test it out an app URL.</p><h3>Speed bumps!</h3><p>Murphy’s law struck on first go! The app crashed in spectacular style due to some error, and it took about an hour to find out that the Windows Store API I was using to fetch the app data was not very consistent in the data it returned. And I also found out that working with APIs in Visual Studio is not as easy as it is with Chrome — there’s no inspect response, retry request, etc. So all I could do was launch the app over and over with logging response objects until I could figure it out. Maybe there are plugins like fiddler which might have helped? I sure as hell didn’t think of that at that time. And thus, tired with all the logging and debugging, I found out that 10pm had come and gone, and I was sitting there burning the midnight tubelight working out basic bugs. So, off I go to bed at 1am, accomplishing nothing.</p><h3>Week 2</h3><p>This being a side project, I took it up next Saturday, confident I had figured it all out. I fixed the bug in about 20–30 minutes, and then it seemed like everything was working for any app I checked on the Windows 10 Store. Time to build it and run it on mobile. So I connect my Lumia 950XL via USB, and launch the app there, and after some issues, finally I’m able to run it. The first app I try, <em>Whatsapp</em>, fails. Because it’s not a Windows 10 Store app, but a Windows 8.1 Silverlight app, so the API response would be nothing I was expecting. OBVIOUSLY! After going 4–5 more hours with figuring it all out, I figured it was time to build a production build and use it on my phone. This should be easy.</p><h3>Building for production</h3><p>Now, although I’ve not mentioned this before, while developing the app, I was using VS 2015. Then, I was notified by Microsoft that a newer version, VS2017 was available with some nifty performance improvements. “<em>Wow! Nice! I might save some time building stuff”</em> I thought. I updated the IDE to the latest and greatest version so that my productivity improves. Well, I should have done <a href="https://xkcd.com/1205/">some calculations</a> first. After updating VS to 2017, things went wrong — horribly wrong. I couldn’t even get the project to compile. Not being in-touch with how VS worked for a long time, the misery was compounded by VS throwing weird non-obvious error codes at my face, something which Microsoft apparently excels at:</p><pre>Your project.json doesn&#39;t have a runtimes section. <br>You should add &#39;&quot;runtimes&quot;: { &quot;win&quot;: { } }&#39; to your project.json and <br>then re-run NuGet restore. RethinkDb.Driver</pre><p>Where do I add this project.json? Even after adding the project.json with the recommended suggestion, the app failed to compile. Even after copying the project.json file to every possible directory, sub-directory, and parent-directory, VS didn’t budge. Then, lost and spent, I <a href="https://www.google.com/search?q=nuget+15+your+project+doesn%27t+have+project.json">turned to google</a>, and yup, people were having a lot of this kind of problems. So, I tried most of the <a href="https://github.com/Microsoft/msbuild/issues/394">suggestions mentioned in the issue</a> in MSBuild’s official repo. And none of them worked. So, I put my head through the wall and gave up for 2 weeks.</p><h3>Building for production — try 2</h3><p>After recovering from the aforementioned trauma, I manned up and waded back into the mess that my project had become. Googling some more brought me to the realization that updating the Visual Studio version might have been a mistake. Since I’m writing this blog post after quite some time, I don’t remember exactly what broke, but I all I have got left from that is a small note left in an untitled file which reads:</p><blockquote>Move to vs2017 broke some things, such as nuGet 4.0? Project was started in vs2015, but moved to vs2017 (due to expectation of ‘cool stuff’). In the end, had to create a new project, and copy the files over.</blockquote><p>So, I guess that was it. Started off a completely new project in VS, spent some time copying the old code and installing dependencies again with nuget, and the project compiled on first go! Things worked well enough on my phone and on the desktop to warrant taking the next step — publishing.</p><h3>Publishing to the store</h3><p>To publish the app to the store, VS does a bunch of automated checks and tells you to put app description and images and stuff in your manifest. The steps seem easy enough, and I did complete most of it. To list the app on the store, VS asks me to put the app’s logo in a zillion different sizes — 100x100, 50x50, 100x100_size50, 50x50_size100, and so on… The names were very confusing, but at least VS offered me to upload a vector file and autogenerate the whole batch for me. Good, I thought! But then I find out that it won’t accept SVG, but for some reason, AI! Won’t implementing support for SVG be an easier choice than some proprietary standard? Anyways, so I upload the logo and everything goes fine. But I find that at a particular size, my logo looks like utter shit, so I go ahead and delete the resource. And then, another level of hell broke loose. VS won’t publish the app, and I can’t “re-add” the logo — even after running `git reset HEAD — hard`. I don’t understand why VS is so opaque in these things, and surely there must be a better way to communicate such issues to the new developer than throwing undecipherable errors. Finding such stuff on google didn’t help either, so I had to <a href="https://stackoverflow.com/questions/44481911/how-do-i-remove-visual-assets-from-uwp-projects">post a question</a> on SO, which got a few helpful suggestions. But look at <a href="https://stackoverflow.com/a/44483638/630170">this answer</a>! The amount of work involved, and that too, by opening the project file in <em>another</em> editor, just to fix an issue which VS should handle by itself is incomprehensible. Well, it did fix the issue though.</p><p>So, finally, I was able to build and submit the app to the Store for review. The submit screen said to expect about 3 days to get listed in the Store. Though like everything else till this point, 3 days came and went, with not a peep from the MS Developer Center. Contacting Support seemed to push things along, and finally, the app got published to the Store.</p><h3>Overall Experience</h3><ol><li>Fun — yes. I mean it was frustrating with the issues I underlined earlier, but it was also fun. Developing with C# is pretty good and building interfaces in XAML is a pleasant experience. I do web development in ReactJS currently, and have been doing JS development for quite some time, but going to C#/XAML doesn’t feel too alien.</li><li>VS feels nice, but coming from a web-development background, some things are different and sometimes very painful, such as installing dependencies via nuget — like when things go wrong. Makes you appreciate the work the npm community (and others!) have done to make it so easy.</li><li>After figuring out how to do it once, cross-device builds are very easy to do. But the figuring out part is not straight forward — visual studio was throwing some weird errors about targets while trying to compile app for ARM (Lumia 950xl). Maybe switching to vs2017 mid-development might have caused those issues too?</li><li>XBOX and Hololens!</li></ol><h3>Issues Faced While Releasing</h3><ol><li>Many controls which UWP apps now generally have are not in the default “toolbox”, such as the familiar-but-controversial hamburger menu, etc. You should definitely use the <a href="https://github.com/Microsoft/UWPCommunityToolkit">UWP community toolkit</a> for your UIs to kick some ass!</li><li>While the app built fine in development, when I built for Release, it failed because the .Net Native Compiler did not understand implicit reflection?<br>I kept getting a `reflection_insufficientmetadata` error. <br>Ref: <a href="https://www.google.co.in/uwp+reflection_insufficientmetadata">https://www.google.co.in/uwp+reflection_insufficientmetadata</a><br>Ref: <a href="https://docs.microsoft.com/en-us/dotnet/framework/net-native/reflection-and-net-native">https://docs.microsoft.com/en-us/dotnet/framework/net-native/reflection-and-net-native</a><br>I was using dynamic types while parsing JSON via the Newtonsoft.JSON lib. In the end, I ended up removing the ‘dynamic’ type, and making it static.</li><li>This might be an isolated problem, but the Microsoft Store certification process was extremely slow. They say they’ll take 3–5 days to get the app on the store, but it took more than 2 weeks for the Manual review process to take place. I hope the process improves in the future.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e90976db486" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Merging Multi-Branched Git Projects]]></title>
            <link>https://medium.com/@kumarharsh/merging-multi-branched-git-projects-8069bff2191e?source=rss-413e46919df6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8069bff2191e</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Kumar Harsh]]></dc:creator>
            <pubDate>Sun, 28 Aug 2016 16:36:38 GMT</pubDate>
            <atom:updated>2018-12-28T13:21:03.286Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>At Playlyfe, we’ve been working on large multi-repository project for quite some time. We started off with just one repository, which flowered into 9 core repositories, and many more peripheral ones. Then, we shook up things a little and started a new product. At the beginning, to keep development fast and prevent teams from being held up by each other, we split up the front-end and back-end code into two different repositories. Once the product matured though, it was time to merge the projects back in to have more control over what we were deploying, and having the back-end and front-end parts in sync. And writing from the experience, splitting a repo is far more easier than doing the reverse. So, I thought I’d document the task, for future reference and for anyone on the internet struggling with the same.</p><h4>The initial scene</h4><p>In the initial phases of the product’s development, each of our clients demanded something <em>different</em> or <em>extra</em> from what we had in our product plan. This led to us maintaining separate forks and experiment branches for every deployment along with the usual develop and master branches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/137/1*c_SHd7NF4k3Y1Hisr_VjXg.png" /><figcaption>The branching &amp; merging we were dealing with on our back-end. The front-end looked only slightly pretty, but only due to some aggressive rebasing, which was not without it’s own downsides.</figcaption></figure><h4>Starting off</h4><p>Our back-end is written in golang, and resided in a folder which I’ll call ‘<em>go-project</em>’ for illustration purposes. The front-end is contained in a sub-sub-directory within the project, say at ‘<strong><em>apps/react-project/ui</em></strong><em>’</em>.</p><p>When we decided to merge the two repositories, our goals were:</p><ul><li>keeping the existing folder structure — obviously.</li><li>to preserve the complete history of both repositories — this meant doing a simple cut-copy-paste to include the front-end code wasn’t going to cut it.</li></ul><p>I started off by searching for the best way to go about it, and found some great starting points for it. First was Jason Karns’ approach here in <a href="http://jasonkarns.com/blog/merge-two-git-repositories-into-one/">Merge Two Git Repositories Into One</a>. As a first try, I followed that one word for word, but soon found out that the using sub-trees was not very good, as my file histories were being clobbered. After finishing, even when the full history of the files <em>was </em>there, I could only access it using ‘<em>git log --follow’. </em>Some more digging led me to Mark van Lent’s post, <a href="https://www.vlent.nl/weblog/2013/11/02/merge-a-separate-git-repository-into-an-existing-one/">Merge a separate Git repository into an existing one</a>, which described the process beautifully. If you have a simple repository structure, following the steps mentioned there would suffice. But the special thing in our case was that there were multiple branches for both front-end and back-end. And some of the front-end branches were tightly coupled with specific back-end branches, meaning the individual branches had to be aligned carefully, something like strands while knitting a sweater.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mF941E5sh2dqc_bvqimGGg.jpeg" /></figure><h4>The method</h4><ol><li>First, I cloned the front-end repo to a new folder (say `frontend`) and back-end branch to another folder (say `merged`). I also checked out the primary branch (<em>develop</em>) which I needed to merge with the back-end’s branch (<em>develop</em>).</li><li>Since I needed the final files to be in the ‘<strong><em>apps/react-project/ui</em></strong>’<em> </em>folder in the merged repo, so I ran the filter-branch command, as described in Mark’s post referenced above:</li></ol><pre>git filter-branch --index-filter \<br>      &#39;git ls-files -s | sed &quot;s-\t-&amp;apps/react-project/ui/-&quot; |<br>       GIT_INDEX_FILE=$GIT_INDEX_FILE.new \<br>       git update-index --index-info &amp;&amp;<br>       mv &quot;$GIT_INDEX_FILE.new&quot; &quot;$GIT_INDEX_FILE&quot;<br>      &#39; HEAD</pre><p>This command took some good 2 minutes to rewrite the history of all the commits (some 3,000 in number) and prefixed all folder names with ‘<em>apps/react-project/ui</em>’ while preserving the history as-is. Now, I’m ready to import this modified front-end project history into the main back-end project.</p><p>Switching to the back-end folder, I added the front-end folder on my disk as a remote, and merged it in. Since I was merging two different branches with completely unrelated histories, git required me to set the ‘<em>allow-unrelated-histories</em>’ flag while merging.</p><pre>cd ../merged    // in frontend dir<br>git remote add -f modified-ui ../frontend   // added remote<br>git fetch modified-ui<br>git merge modified-ui/develop --allow-unrelated-histories</pre><h4>Merging the other branches</h4><p>After merging the histories, the only task left was including the other forks from the front-end. This can be done in the same way as we did earlier by running the <em>git filter-branch</em> command on each branch, but this takes time as it rewrites the <em>whole history</em> for <strong><em>each </em></strong><em>branch </em>again. Since we had already rewritten <em>most</em> of the history once, why do it again, right? So, I used another way: the <em>format-patch </em>command. Put simply, I extracted all the commits from each experiment branch and rewrote only those commits and put it back into our new combined repo.</p><pre>/**<br> * current directory = frontend<br> * current branch = develop<br> */</pre><pre>// checkout the fork<br>git checkout fork-1</pre><pre>// extract all changes since it forked from develop<br>git format-patch develop --stdout &gt; .\patch.patch</pre><pre>// move patch to the `merged` folder<br>mv patch.patch ../merged<br>cd merged</pre><pre>// checkout relevant fork in backend<br>git checkout -b fork-1<br>git am --signoff --directory=apps/react-project/ui patch.patch</pre><p>To apply the patch, I use the <a href="https://git-scm.com/docs/git-am">git am</a> command and use the <em>directory </em>flag to rewrite the changed files’ paths before committing them into the repo. That’s it. Repeat this step for as many branches you want to import into your project.</p><p>At the end, don’t forget pushing this new merged code to a new repo, and keep the old ones around for some days, just in case.</p><h4>Some pain points</h4><p>Since I was doing all of this in Windows, there were a few gotchas I ran into.</p><ol><li>I was using Powershell and had <a href="https://git-for-windows.github.io/">Git for Windows</a> installed, with all those MSYS binaries put into the path. Most of the commands work perfectly, but I ran into some trouble while running the <em>filter-branch</em> command above. No matter what combination of escaping, quotation marks and regex I tried, nothing worked. The <em>sed</em> part works in isolation, but when passed as a command into <em>git filter-branch</em> it never worked. So I gave up, and used the exciting new <a href="https://msdn.microsoft.com/en-us/commandline/wsl/about">Bash on Ubuntu on Windows</a> for running that command.</li><li><strong>Note</strong>: Please see the <strong><em>Update #1</em></strong> below — there is a neat solution for this point.<br>The default encoding in Powershell is UTF-16LE instead of UTF-8. Therefore, the redirection operator used in the git format-patch command creates files which are unreadable by the git am command. I tried using this command instead:</li></ol><pre>git format-patch develop --stdout | out-file -Encoding utf-8 .\patch.patch</pre><p>but Powershell also converts all LF to CRLF, which git am cannot consume.<br>There are two ways out of this mess:</p><ol><li>Use a non-powershell shell like Bash for running this command.</li><li>Just run git format-patch develop without the --stdout flag or the redirection. This command will create as many files as there are commits. Depending on your use case, this may or may not be desirable. Choose your way.</li></ol><p>That’s all. Happy hacking! :)</p><p><strong>Update #1 (2018–12–28)</strong>: I had raised an issue in the Powershell project regarding this particular use case (<a href="https://github.com/PowerShell/PowerShell/issues/2145">https://github.com/PowerShell/PowerShell/issues/2145</a>). It’s a very deep issue, and the new Powershell 6.0 has fixed most of the issues, but it’s still not completely fixed — the generated patches still get a CRLF line-ending. Luckily, you can install <a href="https://github.com/GeeLaw/PowerShellThingies/tree/master/modules/Use-RawPipeline">this awesome module</a> by <a href="https://github.com/GeeLaw">GeeLaw</a> to use binary pipelines and write nearly the same commands as bash for generating and applying patches in one go:</p><pre># Install the RawPipeline module<br>&gt; Install-Module -Name &#39;Use-RawPipeline&#39;</pre><pre># Now generate the format-patch and output to a file<br># named &#39;patch&#39; using this binary pipeline.<br># The original encoding and line endings output<br># by `git format-patch` will be preserved in the `patch` file.<br>&gt; run git format-patch develop --stdout | out2 patch</pre><pre># Now apply the patches<br>&gt; git am ./patch</pre><h4>More useful references</h4><p>While doing research before merging, I came upon more sources which really helped my understand the whole process of merging repos together. Here is a list:</p><ol><li><a href="http://stackoverflow.com/a/22024760/630170">StackOverflow Link #1</a>: <a href="http://stackoverflow.com/a/22024760/630170">A very elaborate answer</a> by <a href="http://stackoverflow.com/users/1256452/torek">torek</a> to <a href="http://stackoverflow.com/questions/22014090/any-way-to-use-filter-branch-in-a-incremental-sense">Any way to use filter-branch in a incremental sense</a>.</li><li>Blog post by Jeremy Herr about <a href="http://blog.caplin.com/2013/09/18/merging-two-git-repositories/">Merging two git repositories</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8069bff2191e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Please use Slack for FOSS Projects]]></title>
            <link>https://medium.com/@kumarharsh/please-use-slack-for-foss-projects-bf9d53ce3f7d?source=rss-413e46919df6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf9d53ce3f7d</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[science-fiction]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Kumar Harsh]]></dc:creator>
            <pubDate>Sun, 01 Nov 2015 19:54:08 GMT</pubDate>
            <atom:updated>2015-11-04T14:33:39.485Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Let’s start with a story I read a few weeks ago which goes like this: Humanity has found a source of <strong>free</strong> energy — an <em>Electron Pump</em> — and people are literally over-the-moon because of it! But there is one man who is convinced that the cost of this supposed free energy is that our own Sun would explode in a <strong>supernova</strong> soon. When he realizes this, he runs pillar to post trying to get his voice heard, to get the Electron Pump stopped for good. But as you can imagine, no one pays any heed to his doomsday calls. He finally manages to setup a hearing with a Senator, and he gets a gem of an advice:</p><blockquote>“It is a mistake,” he [the senator] said, “to suppose that the public wants the environment protected or their lives saved and that they will be grateful to any idealist who will fight for such ends. What the public wants is their own individual comfort. We know that well enough from our experience in the environmental crisis of the twentieth century.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*YBUIpmzc6DQ8anbe5NKI7A.jpeg" /><figcaption>(c) Chris Foss — <a href="http://www.chrisfossart.com/2011/04/mission-to-the-stars/">http://www.chrisfossart.com/2011/04/mission-to-the-stars/</a></figcaption></figure><p>Recently, I came across this article on *Hacker News*: <a href="https://news.ycombinator.com/item?id=10486541">https://news.ycombinator.com/item?id=10486541</a>. The article <a href="https://drewdevault.com/2015/11/01/Please-stop-using-slack.html">implores and begs people</a> to **not** use the team-chat application **Slack** for Free and Open Source Software (*FOSS*) projects, instead ditching it for the grand-daddy of internet chats: the Internet Relay Chat (IRC).</p><p>To give you some background on the terms I’ve thrown at you, IRC was invented in the late ’80s, and used for chatting online and also caught on as a way of connecting with fellow programmers and scientists across the world in the old days.</p><p>The arguments in the blogs which implore the user to switch to IRC are that it:</p><ul><li>is a standardized and well-supported protocol</li><li>has hundreds of open source clients, servers, and bots</li><li>is a distributed design with several networks</li><li>allows several projects to co-exist on the same network</li><li>has no hacks for registration and is designed to be open</li></ul><p>which are all true, but here’s the thing: Are you going to use an online service which let’s you “quickly” communicate with your colleagues/collaborators across the world which looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*J1ti_2x2_uajM1yYDzoTXw.jpeg" /><figcaption>A console-based IRC client, Xaric</figcaption></figure><p>I know, I know, people who’ve been using IRC would be angry if they read the lines above, but I’ve put that particular image there after giving it some thought — even the most popular IRC clients you can find with a quick google search return software such as mIRC and ChatZilla, which do provide some native UI, but in essence, the experience with using any IRC is more or less the same, from what I’ve experienced. But the worst problem I faced is not the UI, but the very non-intuitive language. Checkout this screenshot just after you join one of the bigger networks, <em>freenode</em>, using ChatZilla:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XnD-GEQgdujprTR2yO8mZQ.png" /><figcaption>The IRC welcoming me on joining the freenode network, but to what?</figcaption></figure><p>Even many government websites here in India are much more intuitive than that IRC room, and that’s says a LOT about the state of affairs in IRC world.</p><p>Now imagine that you are a regular user, maybe just starting out your career in programming, and try to make <em>any</em> sense from the screen you just saw. Yes, maybe all of that information spat out there <em>may</em> be important, but there is a place for that, and that place is certainly not as a welcome message to a new user.</p><p>Compare that, with Slack’s homeliness:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dspPYeRKz7ssErZv-NifcA.jpeg" /><figcaption>(c) Slack, as featured on <a href="http://rickpastoor.nl/post/112438899512/onboarding-26-slack">http://rickpastoor.nl/post/112438899512/onboarding-26-slack</a></figcaption></figure><p>Now, can you argue with *any* newbie to ditch this cool-talking-bot-chat-service and jump to a service that makes no sense at all at first sight? And do you really expect to win any of those arguments? No, you’re not. Maybe you’ll win at max 5%, but that would require you to put immense amount of energy into educating the newbie the dangers of Slack, and the profits of IRC. You’ll be stretched thin and sapped of all energy by the end, because as it stands right now, Slack (and similar new-wave services) wipe the floor with the aging IRC.</p><h4>The Way Forward</h4><p>Now, enough with the criticism of the rant. It does have some merit on the thing it’s actually trying to say: walled gardens, like Slack, have their own shortcomings, but as I’ve said earlier, people are not going to change because of ideals. Let me pull out that book again, and continue the quote from the top of the post. The Senator says this to the alarmist about stopping the Electron Pump:</p><blockquote>Once it was well known that cigarettes increased the incidence of lung cancer, the <strong>obvious remedy </strong>was to stop smoking, but the <strong>desired remedy </strong>was a cigarette that did not encourage cancer. When it became clear that the internal-combustion engine was polluting the atmosphere dangerously, the obvious remedy was to abandon all such engines, and the desired remedy was to develop <strong>non-polluting</strong> engines.</blockquote><blockquote>Now then, young man, don’t ask me to stop the Pumping. The economy and comfort of the entire planet depend on it. Tell me, instead, how to keep the Pumping from exploding the Sun.</blockquote><p>The one really positive thing I found on that blog was links to a few IRC services which have come up relatively recently, such as <a href="http://shout-irc.com/">Shout-IRC</a>, which looks much more approachable to the average user. It still has obscure or unclear fields to fill out while trying to connect, but it’s a good start.</p><p>Now, I’m not saying that you should just put a pretty UI and users would start using it, but at least make the damn software more approachable. Until that problem is not addressed, please use Slack, **or whatever tool helps you communicate better** for your next FOSS project. It’ll reduce the friction a lot for *newbie* users joining your project, and not require a degree in rocket-science to figure out stuff.</p><p>I’ve not been very thorough with some of the research, and maybe I can explain some points better to the reader, but then this post would hardly get many readers anyway ;)</p><p>The book I’ve quoted from is “<strong>The Gods Themselves</strong>” by <em>Isaac Asimov</em>. <a href="http://www.amazon.com/Gods-Themselves-Isaac-Asimov-ebook/dp/B004JHYRP4">Read it</a> if you have some time on your hands. It’s fantastic!</p><p>The first photo for this article is by Chris Foss, who has done some incredible artworks for sci-fi novels. Check out some of his breathtaking artwork <a href="http://www.gavinrothery.com/my-blog/2012/4/6/more-chris-foss.html">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf9d53ce3f7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Pain of Browserifying]]></title>
            <link>https://medium.com/@kumarharsh/the-pain-of-browserifying-290147823839?source=rss-413e46919df6------2</link>
            <guid isPermaLink="false">https://medium.com/p/290147823839</guid>
            <dc:creator><![CDATA[Kumar Harsh]]></dc:creator>
            <pubDate>Thu, 30 Oct 2014 13:49:29 GMT</pubDate>
            <atom:updated>2014-10-30T13:52:38.901Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>This is just my first post on medium, and I’ve written this more as a rant… So, kindly excuse me if the post is not very easy to read…</em></blockquote><p>Trying to use Browserify for the first time, and I must admit that for whatever reason it’s heralded as the great build-tool, the learning curve is incredibly steep.</p><p>I have a project which uses the following:</p><ul><li>Jquery</li><li>AngularJS</li><li>CodeMirror</li><li>Angular-CodeMirror</li><li>HighlightJS</li><li>Angular-HighlightJS</li></ul><p>It starts off simple, but very quickly devolves into a lot of hacks and head-scratching. Simple examples worked OK, but as soon as I jumped into the main project, wrote all the configurations (painstakingly), and setup the gulp tasks and ran it — Boom. Either browserify couldn’t build the thing, or if I do somehow happen to conjure up a configuration which didn’t break browserify, the browser didn’t load the modules properly.</p><p>So, finally I had to stash all the changes, and start from scratch… building up the project one library at a time, and slowly I could ensure that atleast a subset of the libraries ran perfectly (angular + jquery + highlightjs), but the codemirror libraries are a pain to browserify if you’re new to it.</p><p>Normally, you’d include the main CodeMirror, include the `mode` file (say `mode/javascript/javascript.js`) and the angular ui.codemirror module. Not in browserify world. Apparently, you don’t even need to include the main CodeMirror file. Just include the mode file, and browserify will <em>automatically</em> find the main CodeMirror file and bundle it for you.</p><p>&lt;del&gt;But, the main kicker comes when integrating the ui.codemirror module from angular. It’s nigh-impossible it seems. I’ve not had any success till now, with 2 days gone. Perhaps, I’ll have to rewrite it.&lt;/del&gt;</p><p>The solution to this problem is this:</p><ol><li>First include the aforementioned Codemirror mode file.</li><li>Then in your browserify-shim config (in package.json), specify this shim for the ui.codemirror to work:<br>```<br>“browser”: { “angular-codemirror”: “./src/public/components/angular-ui-codemirror/ui-codemirror.js” }, “browserify-shim”: { “angular-codemirror”: { “depends”: [“./src/public/components/codemirror/lib/codemirror.js:CodeMirror”], “exports”: “angular.module(‘ui.codemirror’).name” } }<br>```</li><li>In your main file write this:<br>```<br>require(‘../public/components/codemirror/mode/javascript/javascript.js’)<br>require(‘angular-codemirror’)</li><li>app = angular.module(‘myApp’, [ ‘ui.codemirror’])<br>```</li><li>And you’re done!</li></ol><p>Also, note that the `debowerify` transformer doesn’t work along with the `browserify-shim`. It took me about half a day, and half of my hairs to find this thing out. <strong>(╯°□°）╯︵ ┻━┻</strong></p><p>If you’re new to Browserify, it’s going to be a painful ride in the start… So, here are some useful resources to help you along the way:</p><ul><li><a href="https://medium.com/p/bb359b3f9623"></a></li><li><a href="http://viget.com/extend/gulp-browserify-starter-faq">Gulp + Browserify: The Everything Post | Viget</a></li><li><a href="https://github.com/substack/browserify-handbook#how-browserify-works">substack/browserify-handbook</a></li><li><a href="http://aymericbeaumet.me/blog/properly-shim-angularjs-applications-using-browserify">Properly shim AngularJS applications using Browserify</a></li></ul><p>Now, on to watchify.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=290147823839" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>