<?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: Kevin Hulquest</title>
    <description>The latest articles on DEV Community by Kevin Hulquest (@hulquest).</description>
    <link>https://dev.to/hulquest</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%2F57511%2Fefd690f0-dbb9-4046-8152-6dc313d0538f.jpeg</url>
      <title>DEV Community: Kevin Hulquest</title>
      <link>https://dev.to/hulquest</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hulquest"/>
    <language>en</language>
    <item>
      <title>Relative Path to Virtual Env with VS Code</title>
      <dc:creator>Kevin Hulquest</dc:creator>
      <pubDate>Sun, 05 Apr 2020 20:17:03 +0000</pubDate>
      <link>https://dev.to/hulquest/relative-path-to-virtual-env-with-vs-code-3o9m</link>
      <guid>https://dev.to/hulquest/relative-path-to-virtual-env-with-vs-code-3o9m</guid>
      <description>&lt;p&gt;Given there is nothing to do outside the house these days, I thought I would fill some time this weekend and hack on some python code.  The code I wanted to work on was a small side project located in a directory that was not the project root.  Visual Studio Code calls this the ${workspaceDir}.&lt;/p&gt;

&lt;p&gt;The utility I wrote had a small set of dependencies and I organized them into a virtual environment.  A virtual environment in the directory of the code I wrote; so again it's off the top level project directory.  The problem I ran into was that Code didn't recognize this virtual environment since (I believe) it is not directly in the workspace directory.  &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cl8x8GrO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/hulquest/my-stuff/blob/master/img/vs-code-relative-pythonpath-default.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cl8x8GrO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/hulquest/my-stuff/blob/master/img/vs-code-relative-pythonpath-default.png%3Fraw%3Dtrue" alt="alt text" title="Code doesn't find my python virtualenv"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This isn't an insurmountable problem for sure but finding the answer proved to be more difficult than I thought.  So I am writing an article to unify the information I found in separate corners of the internet.&lt;/p&gt;

&lt;p&gt;The image above is produced when you search for the "Python Interpreter" command.  To add the virtualenv in a subdirectory, I had to edit the workspace settings.  You can do this by typing F1 followed by "workspace setting".  This will open properties dialog. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3R05m9DL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/hulquest/my-stuff/blob/master/img/vs-code-pythonpath-selection.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3R05m9DL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/hulquest/my-stuff/blob/master/img/vs-code-pythonpath-selection.png%3Fraw%3Dtrue" alt="alt-text" title="How to edit Workspace properties in Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are many properties to chose from and this is where I ran into trouble.  Exactly which setting will allow me to configure a relative python virtualenv?  Searching for &lt;em&gt;python.pythonPath&lt;/em&gt; is the silver bullet in this case.  Once found, you can enter the full or relative path to your python virtual environment. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---X6QjSNE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/hulquest/my-stuff/blob/master/img/vs-code-relative-python-path.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---X6QjSNE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/hulquest/my-stuff/blob/master/img/vs-code-relative-python-path.png%3Fraw%3Dtrue" alt="alt-text" title="Setting a python virtualenv not at the top level of the project."&gt;&lt;/a&gt;  You'll notice I annotated the picture with red and green arrows.  The red arrow indicates the top level project directory while the green is the subdirectory that contains the python virtualenv directory called &lt;em&gt;venv&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>python</category>
      <category>virtualenv</category>
    </item>
    <item>
      <title>Standing on the Shoulders of Giants</title>
      <dc:creator>Kevin Hulquest</dc:creator>
      <pubDate>Mon, 20 Aug 2018 18:13:12 +0000</pubDate>
      <link>https://dev.to/hulquest/standing-on-the-shoulders-of-giants-4pma</link>
      <guid>https://dev.to/hulquest/standing-on-the-shoulders-of-giants-4pma</guid>
      <description>

&lt;p&gt;I've always had an affinity for the Windows development platform.  In the past I've written a plugin for SQLServer Management Studio and some PowerShell cmdlets for a storage platform.  My main work has always been predominantly writing Java and Python.&lt;/p&gt;

&lt;p&gt;Recently I had an  opportunity to use my corporate Windows 10 laptop more often.  Since I read all of the rave reviews about Visual Studio Code, I thought I'd reawaken my Windows development environment.&lt;/p&gt;

&lt;p&gt;Just like any skill we acquire, if we don't use it and keep the skills sharp, then the skills become dull.  But just like muscle memory, our brains quickly remember the skills that were once second nature.  I have this relationship with PowerShell.  I'll never be able to get over the lack of Vim keybindings but I'm always pleasantly (re)surprised at the capabilities of PowerShell.  It truly blows the doors off text-based shells.  Sorry Linux.&lt;/p&gt;

&lt;p&gt;Part of my current reawakening led me to a new technique that I wanted to share with you all.  The problem I faced was &lt;em&gt;"I know I have a function defined to do this but I wonder what the code is behind the function?"&lt;/em&gt; Then I stumbled across &lt;strong&gt;Get-Content function:FunctionName&lt;/strong&gt;.  While this is cool, it is really just a way to remember about code that I've written in the past.  The technique becomes much more powerful when it's pointed to the content written by pros.  &lt;/p&gt;

&lt;p&gt;A simple demonstration of this lay with New-Guid.  Let's take a look at the result when we run &lt;em&gt;Get-Content function:New-Guid&lt;/em&gt;.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS [hci-monitor] &amp;gt; Get-Content Function:\New-Guid

    [CmdletBinding(HelpURI='https://go.microsoft.com/fwlink/?LinkId=526920')]
        [OutputType([System.Guid])]
    Param()

    Begin
    {
        [Guid]::NewGuid()
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you see, this is a bit of C# that implements the Cmdlet interface.  It has a pointer to documentation and arguably a (small formatting) bug since the OutputType decorator is indented too far.  The function simply returns a new Guid object.  I don't think the Linux folks really appreciate that this Guid isn't the text you want but a full fledged object you can forward, associate and (of course) get a text representation.&lt;/p&gt;

&lt;p&gt;This is just a simple example.  Have a look at something more complicated like &lt;em&gt;Update-IscsiTargetPortal&lt;/em&gt;.  Now you can inspect this code to get a better idea about how the pro's at Microsoft accomplish a non-trivial task.  This is how you sharpen your PowerShell skills and stand on the shoulders of giants.&lt;/p&gt;

&lt;p&gt;Until next time...&lt;/p&gt;


</description>
      <category>windows</category>
      <category>net</category>
      <category>powershell</category>
    </item>
  </channel>
</rss>
