<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: miheer vaidya</title>
    <description>The latest articles on DEV Community by miheer vaidya (@vmiheer).</description>
    <link>https://dev.to/vmiheer</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F554300%2Fdeed4057-9ba0-4c7e-9ac2-91a5180e3282.png</url>
      <title>DEV Community: miheer vaidya</title>
      <link>https://dev.to/vmiheer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vmiheer"/>
    <language>en</language>
    <item>
      <title>Connecting to machine without static IP</title>
      <dc:creator>miheer vaidya</dc:creator>
      <pubDate>Thu, 14 Apr 2022 07:20:27 +0000</pubDate>
      <link>https://dev.to/vmiheer/connecting-to-machine-without-static-ip-22h</link>
      <guid>https://dev.to/vmiheer/connecting-to-machine-without-static-ip-22h</guid>
      <description>&lt;p&gt;So I needed to access a computer without static IP from internet. Here's the way to accomplish it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get &lt;a href="https://www.noip.com/"&gt;no.ip&lt;/a&gt; ddns account. Create a ddns host and preferably create &lt;code&gt;AAAA&lt;/code&gt; record which allows both IPv4 and IPv6.&lt;/li&gt;
&lt;li&gt;Hopefully your router has ddns support. Thankfully &lt;a href="https://fiber.google.com"&gt;google fiber&lt;/a&gt; had it. It will be buried under "advanced" but most likely it should be there. Goto step 4.&lt;/li&gt;
&lt;li&gt;If the router doesn't have ddns support, you can install the &lt;a href="https://github.com/ddclient/ddclient"&gt;ddns client&lt;/a&gt;, don't install &lt;a href="https://askubuntu.com/a/459213/66023"&gt;no.ip client&lt;/a&gt;. Configure it using &lt;a href="https://medium.com/@nobuto_m/minimal-dynamic-dns-configuration-for-no-ip-com-with-ddclient-cb7c038a74be"&gt;this article&lt;/a&gt;. Note, ubuntu package installation will ask most of these questions.&lt;/li&gt;
&lt;li&gt;Add the no.ip configurations in your router. By this point you should reach your router from outside world but not actually reach your machine.&lt;/li&gt;
&lt;li&gt;In router configuration, find a way to forward a port. Here we will forward ssh port to outside.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Advanced/Anxious steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In &lt;code&gt;sshd.conf&lt;/code&gt; add an additional port to run ssh server on.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="m"&gt;22&lt;/span&gt;
&lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="m"&gt;10101&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We will use port 22 from connecting to the computer from within network but when we want to access computer from outside of network we will use &lt;code&gt;10101&lt;/code&gt; port instead. You might ask why not just use router to do this redirection from 22 to 10101 or other port number? Read on :).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create &lt;a href="https://duo.com/"&gt;duo account&lt;/a&gt;. Setup your machine to use &lt;a href="https://duo.com/docs/duounix"&gt;duo&lt;/a&gt;. Steps differ if you are targeting unix/windows. You can instead use &lt;a href="https://ubuntu.com/tutorials/configure-ssh-2fa#1-overview"&gt;google authenticator&lt;/a&gt; but I am not fan of adding 6 digits for each login. AFAIK Microsoft authenticator doesn't support non-windows systems otherwise Microsoft Authenticator also uses passwordless 1 tap authentication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now use &lt;a href="https://man7.org/linux/man-pages/man5/sshd_config.5.html"&gt;Match&lt;/a&gt; clause in sshd_config to make sure all external accesses are guarded by duo_login. This tells sshd that if connection is coming from the port 10101, make sure public key matches and duo_login is satisfied and password authentication is not allowed.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="c"&gt;# sshd.conf
&lt;/span&gt;...
&lt;span class="c"&gt;# put at the end of file
&lt;/span&gt;&lt;span class="n"&gt;Match&lt;/span&gt; &lt;span class="n"&gt;LocalPort&lt;/span&gt; &lt;span class="m"&gt;10101&lt;/span&gt;
&lt;span class="n"&gt;AuthenticationMethods&lt;/span&gt; &lt;span class="s2"&gt;"publickey,keyboard-interactive"&lt;/span&gt;
&lt;span class="n"&gt;PasswordAuthentication&lt;/span&gt; &lt;span class="n"&gt;no&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Restart sshd service&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;service sshd restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Hope you find it useful!&lt;br&gt;
✌&lt;/p&gt;

</description>
      <category>ddns</category>
      <category>ssh</category>
      <category>sshd</category>
      <category>remote</category>
    </item>
    <item>
      <title>Julia ❤ Python</title>
      <dc:creator>miheer vaidya</dc:creator>
      <pubDate>Sun, 25 Jul 2021 01:08:08 +0000</pubDate>
      <link>https://dev.to/vmiheer/julia-python-4nb3</link>
      <guid>https://dev.to/vmiheer/julia-python-4nb3</guid>
      <description>&lt;p&gt;If you have read my earlier posts you know I love multilingual programming. One important part of multilingual programming is how to interface one language with other. Typically this is called FFI or &lt;a href="https://en.wikipedia.org/wiki/Foreign_function_interface"&gt;foreign function interface&lt;/a&gt;. At the lowest level often there are libraries (aka bindings) to talk across languages or across implementations of same language e.g. &lt;a href="https://github.com/libffi/libffi"&gt;libffi&lt;/a&gt;. In my undergrad we did a &lt;a href="https://github.com/vmiheer/leviosa"&gt;group project&lt;/a&gt; where we created language bindings to separate algorithmic part written in python and opencv and X11 logic in c.&lt;/p&gt;

&lt;p&gt;Recently I have started learning &lt;a href="https://julialang.org/"&gt;Julia&lt;/a&gt; which promises programmer productivity of &lt;a href="https://www.python.org/"&gt;Python&lt;/a&gt; and performance of &lt;a href="https://en.wikipedia.org/wiki/C_(programming_language)"&gt;C*&lt;/a&gt;. Julia &lt;a href="https://github.com/JuliaPy/PyCall.jl"&gt;PyCall&lt;/a&gt; library provides FFI for Python. After multiple unsuccessful attempts to use PyCall on Windows, I found out one needs to set &lt;code&gt;PYTHONPATH&lt;/code&gt; environment variable in addition to &lt;code&gt;PYTHON&lt;/code&gt; environment variable in Julia script to use specific python virtual environment. PyCall can automatically install conda and packages from conda but seems like if one wishes to use virtualenvironment and pip one needs to set these environment variables manually in the Julia script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight julia"&gt;&lt;code&gt;&lt;span class="nb"&gt;ENV&lt;/span&gt;&lt;span class="x"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"PYTHON"&lt;/span&gt;&lt;span class="x"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;pathToVirtualEnv&amp;gt;\Scripts\python.exe"&lt;/span&gt;
&lt;span class="nb"&gt;ENV&lt;/span&gt;&lt;span class="x"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"PYTHON"&lt;/span&gt;&lt;span class="x"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;pathToVirtualEnv&amp;gt;\lib\site-packages"&lt;/span&gt;
&lt;span class="c"&gt;# Note the `raw` string literal in Julia which eliminates&lt;/span&gt;
&lt;span class="c"&gt;# need of escaping `\` in Windows paths.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope you find it useful.&lt;br&gt;
✌&lt;/p&gt;

</description>
      <category>ffi</category>
      <category>julia</category>
      <category>python</category>
      <category>codereuse</category>
    </item>
    <item>
      <title>x2x definitive guide</title>
      <dc:creator>miheer vaidya</dc:creator>
      <pubDate>Sun, 27 Jun 2021 20:58:28 +0000</pubDate>
      <link>https://dev.to/vmiheer/x2x-definitive-guide-2809</link>
      <guid>https://dev.to/vmiheer/x2x-definitive-guide-2809</guid>
      <description>&lt;p&gt;So you want to share your clipboard across the machines? &lt;code&gt;x2x&lt;/code&gt; is free software to do that over x server protocol.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install x server and x2x on both machines. On windows/wsl &lt;a href="https://techcommunity.microsoft.com/t5/windows-dev-appconsult/running-wsl-gui-apps-on-windows-10/ba-p/1493242"&gt;use these instructions&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On remote system, if you use gdm, edit &lt;code&gt;/etc/gdm3/custom.conf&lt;/code&gt; to add:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[security]
DisallowTCP=false
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;and restart gdm &lt;code&gt;sudo service gdm3 restart&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find out on which display X server is running on remote machine.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# on remote machine,&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$DISPLAY&lt;/span&gt; &lt;span class="c"&gt;# This command assumes that you are logged in using some GUI method, vnc/rdp/nomachine etc.&lt;/span&gt;
&lt;span class="c"&gt;# Let's say it was 0.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On local machine issue below command:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="c"&gt;# on local machine:&lt;/span&gt;

 &lt;span class="nv"&gt;$ &lt;/span&gt;ssh &lt;span class="nt"&gt;-XC&lt;/span&gt; remoteMachine x2x &lt;span class="nt"&gt;-east&lt;/span&gt; &lt;span class="nt"&gt;-to&lt;/span&gt; :0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://help.ubuntu.com/community/X2xHowto"&gt;Ubuntu wiki x2xHowTo&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ssh</category>
      <category>xorg</category>
      <category>kvm</category>
    </item>
    <item>
      <title>Doom emacs: First impressions</title>
      <dc:creator>miheer vaidya</dc:creator>
      <pubDate>Wed, 10 Mar 2021 23:18:53 +0000</pubDate>
      <link>https://dev.to/vmiheer/doom-emacs-first-impressions-h5o</link>
      <guid>https://dev.to/vmiheer/doom-emacs-first-impressions-h5o</guid>
      <description>&lt;p&gt;Emacs is great for configurability. People even say &lt;a href="https://wiki.c2.com/?EmacsAsOperatingSystem"&gt;emacs is an operating system&lt;/a&gt;. With that OS analogy, you can use emacs as &lt;a href="https://archlinux.org/"&gt;Arch Linux&lt;/a&gt; or Vanilla Emacs as an empty slate or you can start with something like &lt;a href="https://www.spacemacs.org/"&gt;Spaceemacs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have always stayed away from large emacs frameworks and relied on having Vanilla emacs and a good package manager, &lt;a href="https://github.com/dimitri/el-get/"&gt;el-get&lt;/a&gt;.&lt;br&gt;
Recently, &lt;a href="https://github.com/dimitri/el-get/pull/2813#issuecomment-794904718"&gt;sluggishness in the package manager&lt;/a&gt; and my inability to find good emacs packages for my requirements made me look at frameworks.&lt;/p&gt;

&lt;p&gt;I am pleasantly surprised with doom emacs. It just works out of the box!&lt;br&gt;
I am looking forward to the experience with configurability addition of packages.&lt;/p&gt;

</description>
      <category>emacs</category>
      <category>config</category>
      <category>framework</category>
      <category>elisp</category>
    </item>
    <item>
      <title>Thinking of ending my love affair with vcpkg</title>
      <dc:creator>miheer vaidya</dc:creator>
      <pubDate>Thu, 14 Jan 2021 22:45:59 +0000</pubDate>
      <link>https://dev.to/vmiheer/thinking-of-ending-my-love-affair-with-vcpkg-5pg</link>
      <guid>https://dev.to/vmiheer/thinking-of-ending-my-love-affair-with-vcpkg-5pg</guid>
      <description>&lt;h1&gt;
  
  
  What was the enticing thing about vcpkg
&lt;/h1&gt;

&lt;p&gt;When vcpkg was incarnated, there were not good alternatives to &lt;code&gt;apt-get&lt;/code&gt; which I knew of on Windows. I always liked visual studio and having a package manager from big company like Microsoft was really enticing. It wasn't the best in the sense that it won't give me binaries, but it would automate a lot of things for me and so it was welcome change. With lack of admin rights on hpc clusters, it was useful to get some libraries in Linux environments too.&lt;/p&gt;

&lt;h1&gt;
  
  
  The rift
&lt;/h1&gt;

&lt;h2&gt;
  
  
  The secrets
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;We the people by the people for the people&lt;/em&gt; taken too far
&lt;/h3&gt;

&lt;p&gt;Many open-source libraries will denote their competitors and denote their differences in readme, but vcpkg doesn't list and compare itself with competitors, there is hidden &lt;a href="https://github.com/microsoft/vcpkg/blob/master/docs/about/faq.md"&gt;FAQ&lt;/a&gt; which sheds some light with comparisons with competitors. After hearing about conan, I decided to step back and try to understand vcpkg's philosophy. I came across with this line:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;C++ should be used in a C++ package manager for C++ programmers. You should not be required to learn another programming language just to understand your package manager.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I'll try to give some counter-arguments to this mission statement.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;As I started in &lt;a href="https://dev.to/vmiheer/human-perspective-in-language-design-42c9"&gt;earlier post&lt;/a&gt;, polyglot development is key to productive development.&lt;/li&gt;
&lt;li&gt;Contrary to vcpkg's mission statement, it has significant amount of cmake apart from c++. If the mission was to build everything in c++, I could envision "only" executing cmake binary as part of vcpkg.&lt;/li&gt;
&lt;li&gt;There are instances where you would need to keep distinct copies of vcpkg sources, and having a tool built in it implies the tool needs to be built before it can be used. There are efforts to bring vcpkg binary distribution.
### The package manager which can't handle multiple library versions
You would assume you would have support for maintaining different version for same library but vcpkg can't do that. The only way until &lt;a href="https://github.com/microsoft/vcpkg/pull/15565"&gt;https://github.com/microsoft/vcpkg/pull/15565&lt;/a&gt; is resolved is clone vcpkg in seperate folder and &lt;strong&gt;&lt;em&gt;build vcpkg&lt;/em&gt;&lt;/strong&gt;, git checkout port related files to older version and built it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  The conan way
&lt;/h1&gt;

&lt;p&gt;Conan has binary package support; it's written in python which is not as terrible as cmake to work with and learn. It supports not only cmake, but any other generators you would like to use with your c++ project including raw gcc flags. I am looking forward to how it goes with conan.&lt;/p&gt;

&lt;h1&gt;
  
  
  References:
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/52doho/vcpkg-vs-conan"&gt;https://github.com/52doho/vcpkg-vs-conan&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>cpp</category>
      <category>vcpkg</category>
      <category>conan</category>
      <category>packagemanagement</category>
    </item>
    <item>
      <title>Human perspective in language design</title>
      <dc:creator>miheer vaidya</dc:creator>
      <pubDate>Tue, 05 Jan 2021 21:20:18 +0000</pubDate>
      <link>https://dev.to/vmiheer/human-perspective-in-language-design-42c9</link>
      <guid>https://dev.to/vmiheer/human-perspective-in-language-design-42c9</guid>
      <description>&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;I was listening to &lt;a href="https://cppcast.com/michael-park/"&gt;cppcast episode 201&lt;/a&gt; and there was a discussion about &lt;code&gt;_&lt;/code&gt; not being used for pattern matching proposal because Google Mock uses it and technically &lt;code&gt;_&lt;/code&gt; is not reserved keyword in c++ in local scopes. I was wondering, how does c++ committee weighs in good for developers vs being constitutionally right.&lt;/p&gt;

&lt;h1&gt;
  
  
  Good for developers
&lt;/h1&gt;

&lt;p&gt;I think monoglot developers are hard to come by these days, because I don't believe there is one true general purpose language excellent enough to do all jobs. In &lt;a href="https://adspthepodcast.com/2020/12/18/Episode-4.html"&gt;adsp the podcast episode 4&lt;/a&gt; One of the Bryce's mentors says one needs to know 3 languages, I think it was c++, python and javascript. For me it's c++, python and typescript. My argument for these three languages is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Language to do quick prototyping: python&lt;/li&gt;
&lt;li&gt;Language to do high performance work: c/c++/cuda&lt;/li&gt;
&lt;li&gt;Language to dabble in web developement: typescript&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Given that polyglot development is essential these days, it makes sense to have similar syntax for similar concepts (language structures and core algorithms and data structures). Imagine having different regex syntaxes for accomplishing same thing. &lt;a href="https://twitter.com/code_report"&gt;Conor Hoekstra&lt;/a&gt; frequently complains about how some of the algorithms in c++ are named unintuitively.&lt;/p&gt;

&lt;p&gt;I wonder:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Of course, it's not entirely possible to give up on backwards compatibility and hence embracing syntax of other language for all cases, what tread-off is consider for human perspective.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What tools are available to language designers to figure out if proposed syntax for a new feature conflicts with existing syntax of another (pre-existing) feature?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Consider a bnf grammar:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A =&amp;gt; B C D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;consider B and D are new syntactic constructs and A and C are legacy constructs, will we be open to assign new semantic meaning to C given presence of B and D for good for developers? In this case C being &lt;code&gt;_&lt;/code&gt;?&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>hci</category>
      <category>developers</category>
    </item>
  </channel>
</rss>
