<?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>Forem: Jesse Phillips</title>
    <description>The latest articles on Forem by Jesse Phillips (@jessekphillips).</description>
    <link>https://forem.com/jessekphillips</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%2F121016%2F0db96ddc-06d7-4a3c-a9b2-4f5d7d7b5797.png</url>
      <title>Forem: Jesse Phillips</title>
      <link>https://forem.com/jessekphillips</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jessekphillips"/>
    <language>en</language>
    <item>
      <title>Removing Physical disk from LVM</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Fri, 15 Sep 2023 02:09:51 +0000</pubDate>
      <link>https://forem.com/jessekphillips/removing-physical-disk-from-lvm-288b</link>
      <guid>https://forem.com/jessekphillips/removing-physical-disk-from-lvm-288b</guid>
      <description>&lt;p&gt;Since I've obtained new fast NVME drives, and I'm trying to manage my disk allocation with LVM I have a desire to migrate my currently Linux installation to the new drives.&lt;/p&gt;

&lt;p&gt;I already have some LVM data spanning a couple of disks, one of which needs to be removed. Luckily for me the data I needed to move could fit within the freespace on my other disk. This results in touching a number of LVM commands and strategy.&lt;/p&gt;

&lt;p&gt;First I needed to create space within Logical Volume so data in the other Logical Volume can fit on the disk. This includes a step of shrinking the filesystem.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lv_reduce"&gt;https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lv_reduce&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.casesup.com/category/knowledgebase/howtos/how-to-shrink-an-lvm-volume-safely-on-linux"&gt;https://www.casesup.com/category/knowledgebase/howtos/how-to-shrink-an-lvm-volume-safely-on-linux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now lets move the data off the Physical Volume.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/online_relocation"&gt;https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/online_relocation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we tell LVM to move the Volume Group off the physical disk.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/4/html/cluster_logical_volume_manager/vg_remove_pv"&gt;https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/4/html/cluster_logical_volume_manager/vg_remove_pv&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Working with LVM requires remembering the layers and ensuring the each layer gets the needed attention. There are some protections to help ensure you've taken desired steps to save your data.&lt;/p&gt;

&lt;p&gt;One of the things I learned is that the LVM tools provide arguments to perform the Filesystem sizing for you. &lt;code&gt;--resizefs&lt;/code&gt; added to the lvreduce or lvextend commands performs the desired operations if possible. This was nice to realize because these commands also provide the ability to resize relative to the existing size.&lt;/p&gt;

&lt;p&gt;I'm a little surprised that asking to vgreduce does not handle the pvmove (moving data off the physical volume).&lt;/p&gt;

</description>
      <category>lvm</category>
      <category>linux</category>
    </item>
    <item>
      <title>Logical Volume Manager (lvm)</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Thu, 14 Sep 2023 04:23:52 +0000</pubDate>
      <link>https://forem.com/jessekphillips/logical-volume-manager-lvm-2ojb</link>
      <guid>https://forem.com/jessekphillips/logical-volume-manager-lvm-2ojb</guid>
      <description>&lt;p&gt;I'm a fiddler when it comes to computers, but I'm also behind the times so new Linux utilities like &lt;code&gt;ip&lt;/code&gt; still trip me up. One of the areas I'm behind is disk management. I made some progress on GPT partitions and what is happening with UEFI. But LVM is currently on my new things list.&lt;/p&gt;

&lt;p&gt;LVM is disk management above the partition table, but lower than the filesystem. One of the main benefits is that you can expand storage on a mount point through additional disks.&lt;/p&gt;

&lt;p&gt;This capability is really nice but has implications when dealing with different storage mediums. I have ordered M.2 drivers and am thinking this will be where games and OS live. I can try to live within these 500GB but I expect that won't be enough and I have other desire for some backup space, movies/photos, etc. To get into the concern let me explain the LVM architecture more.&lt;/p&gt;

&lt;p&gt;There are three primary concepts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;physical drive/partition&lt;/li&gt;
&lt;li&gt;group&lt;/li&gt;
&lt;li&gt;logical drive/partition&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Volume Groups (VG) owns a disk partition and holds logical partitions, like the Master boot Record (MBR) does for a disk. Unlike the MBR the group can manage space across physical disks. The VG can now allocate and resize Logical Volumes (LV) and the disk partition cannot be owned by multiple Volume Groups.&lt;/p&gt;

&lt;p&gt;If I put all my storage under a single Volume Group then I can easily assign space to where it is needed and I don't need to allocate all of it upfront. Doing so means I also lose control of what data is stored on which drives (my OS could be moved to a slower disk). Thus I'm thinking through what types of control I desire for my storage management. &lt;/p&gt;

</description>
      <category>lvm</category>
      <category>linux</category>
    </item>
    <item>
      <title>JSON in Different Languages</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Wed, 19 Oct 2022 17:43:31 +0000</pubDate>
      <link>https://forem.com/jessekphillips/json-in-different-languages-3in3</link>
      <guid>https://forem.com/jessekphillips/json-in-different-languages-3in3</guid>
      <description>&lt;p&gt;JSON is a data format that uses Javascript notation to layout the structure of the data. But Javascript isn't the only language that can represent these structures in code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Javascript&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"firstitem"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"first data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
  &lt;/span&gt;&lt;span class="nl"&gt;"list"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"bold"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"italics"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm utilizing the two main structures, generally referred to as 'object' &lt;code&gt;{}&lt;/code&gt; and 'list' &lt;code&gt;[]&lt;/code&gt; because that is how Javascript talks of them. Most languages can represent these in one or more ways. These structures don't produce JSON, but libraries (beyond this article) can make the translation.&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Lua&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;firstitem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"first data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"bold"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"italics"&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lua is almost the same with just object &lt;code&gt;{}&lt;/code&gt; notation even for lists. The equal rather than colon is used for association. We also don't quote the field names, though Lua does allow spaces like JSON, &lt;code&gt;["first item"] = "first data"&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Python&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s"&gt;'firstitem'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'first data'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="s"&gt;'list'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s"&gt;'bold'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'italics'&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Python looks really close, but string literals are single not double quote. We can also use tuples to build your list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Python&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s"&gt;'firstitem'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'first data'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="s"&gt;'list'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;'bold'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'italics'&lt;/span&gt;
   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the list syntax different, but you'll get the needed output.&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// c#&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Data&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;firstitem&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;C# is a statically typed language so we define a type that matches the structure. However C# has many different features and we can get away with much more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// c#&lt;/span&gt;
&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;firstitem&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"first data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"bold"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"italics"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// c#&lt;/span&gt;
&lt;span class="n"&gt;Dictionary&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;object&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;"firstitem"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"first data"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;"list"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"bold"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"italics"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This one is a cheat. The specification of &lt;code&gt;object&lt;/code&gt; just places the data in to the libraries "general" representation, for example Newtonsoft's Json library would use a JObject, JArray for the type you could cast to.&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight d"&gt;&lt;code&gt;&lt;span class="c1"&gt;// D&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Data&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nb"&gt;string&lt;/span&gt; &lt;span class="n"&gt;firstitem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nb"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight d"&gt;&lt;code&gt;&lt;span class="c1"&gt;// D&lt;/span&gt;
&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;firstitem&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"first data"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s"&gt;"bold"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"italics"&lt;/span&gt;
  &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight d"&gt;&lt;code&gt;&lt;span class="c1"&gt;// D&lt;/span&gt;
&lt;span class="n"&gt;Variant&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s"&gt;"firstitem"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Variant&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"first data"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="s"&gt;"list"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Variant&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s"&gt;"bold"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"italics"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike in C# where all types have an &lt;code&gt;object&lt;/code&gt; representation, there is not parent for all types with Auto-Boxing. D does however provide a type, &lt;code&gt;Variant&lt;/code&gt;, which can hold other types and that needs to be explicitly created.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Working with Dolt Version Control Database</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Sun, 16 Oct 2022 19:59:49 +0000</pubDate>
      <link>https://forem.com/jessekphillips/working-with-dolt-version-control-database-1i2g</link>
      <guid>https://forem.com/jessekphillips/working-with-dolt-version-control-database-1i2g</guid>
      <description>&lt;p&gt;I'm currently exploring the idea of building an application using &lt;a href="https://www.dolthub.com/"&gt;Dolt&lt;/a&gt; and &lt;a href="https://dlang.org/"&gt;Dlang&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I'd been following along with the getting started docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.dolthub.com/introduction/installation/application-server"&gt;https://docs.dolthub.com/introduction/installation/application-server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.dolthub.com/introduction/getting-started/database"&gt;https://docs.dolthub.com/introduction/getting-started/database&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the key thing I missed was the relationship between the server and the Dolt database. Dolt provides a &lt;a href="https://docs.dolthub.com/introduction/getting-started/git-for-data"&gt;command-line tool&lt;/a&gt; where you can initialize a database in any folder, just like with git.&lt;/p&gt;

&lt;p&gt;Utilizing the SQL interface requires that the Server be started with the database directory as the working directory. This can be as simple as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir newdb
$ cd newdb
$ dolt init
$ dolt sql-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or as complicated as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo useradd -r -m -d /var/lib/doltdb dolt
$ cd /var/lib/doltdb
$ sudo -u dolt dolt config --global --add user.email doltServer@company.com
$ sudo -u dolt dolt config --global --add user.name "Dolt Server Account"
$ cd /var/lib/doltdb
$ sudo -u dolt mkdir -p databases/my_db
$ cd databases/my_db
$ sudo -u dolt dolt init
$ sudo -u dolt /usr/local/bin/dolt sql-server -u root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I started with the second one here which is really about standing up the machine as a Database Server, The first option would have been perfect for my personal usage.&lt;/p&gt;

&lt;p&gt;Once the server is up and running I could build a simple D application to connect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ dub init
$ sudo apt install default-libmysqlclient-dev
$ dub add arsd-official:mssql
$ gvim source/app.d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight d"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;arsd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;MySql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"getting_started"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The connection needed to use the loopback IP as it would not work specifying localhost. It will launch the server on 3306 which is default SQL, but it can be changed with &lt;code&gt;-P&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ dolt sql-server -P 63444
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight d"&gt;&lt;code&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;MySql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"getting_started"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;63444&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enjoy.&lt;/p&gt;

</description>
      <category>dolt</category>
      <category>database</category>
    </item>
    <item>
      <title>You're not Making Test Automation Mistakes</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Wed, 14 Sep 2022 04:49:51 +0000</pubDate>
      <link>https://forem.com/jessekphillips/youre-not-making-test-automation-mistakes-59gb</link>
      <guid>https://forem.com/jessekphillips/youre-not-making-test-automation-mistakes-59gb</guid>
      <description>&lt;p&gt;This topic comes up after reading&lt;/p&gt;

&lt;p&gt;&lt;a href="https://blog.testproject.io/2020/10/06/common-mistakes-in-test-automation/"&gt;https://blog.testproject.io/2020/10/06/common-mistakes-in-test-automation/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I attempted to respond as a comment but it did not make it through review.&lt;/p&gt;

&lt;p&gt;Namely I take issue with "Writing WebDriver API Methods in Tests/Page Objects" as being an issue.&lt;/p&gt;

&lt;p&gt;The premise of the issue "Having WebDriver methods in tests is a really bad idea since if there are any changes in Selenium WebDrivers API or different versions of the library"&lt;/p&gt;

&lt;p&gt;Wrapping your third party libraries can bring the expressed benefits, but I would claim that only happens when you can create an abstraction for your particular use. Let me put it another way. &lt;/p&gt;

&lt;p&gt;The library writer is providing an API to control the inner workings. This API is going to expose all sorts of functionality. When writing a wrapping class two things are likely to happen, you expose all of the same functionality (possibly with the same function signatures) or you cut functionality and provide a simpler interface. You will not know how the public API for selenium will be broken so even your trimmed API could need to be modified to accommodate those changes.&lt;/p&gt;

&lt;p&gt;An abstraction on the other hand relies not on the browser interaction but the application and that is what you page objects are providing. &lt;/p&gt;

</description>
      <category>testing</category>
    </item>
    <item>
      <title>Maintain Internal API During a Refactor</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Thu, 14 Oct 2021 03:18:46 +0000</pubDate>
      <link>https://forem.com/jessekphillips/maintain-internal-api-during-a-refactor-4p4k</link>
      <guid>https://forem.com/jessekphillips/maintain-internal-api-during-a-refactor-4p4k</guid>
      <description>&lt;p&gt;I went down the wrong path recently. This topic relates to internal APIs and to discuss this I must ensure I define this.&lt;/p&gt;

&lt;p&gt;When performing a refactor, the idea is that you can make any changes you want as long as the external contract remains the same. The internal components which talk to each other are all fair game when performing a refactor.&lt;/p&gt;

&lt;p&gt;I have been in a position where these internal APIs were also like external APIs in that multiple people use these APIs to deliver their functionality, but we all own the maintenance and updates.&lt;/p&gt;

&lt;p&gt;This meant they were treated more like external APIs. This is a pain to do and it feels like so much more work.&lt;/p&gt;

&lt;p&gt;Well I found myself positioned were I thought the API was self contained enough I could just throw it out and reimplement. I think that is still the case but what a mistake.&lt;/p&gt;

&lt;p&gt;See the biggest benefit to supporting the old API while doing a refactor is that your code still compiles and your tests still pass.&lt;/p&gt;

&lt;p&gt;Dynamic languages can avoid this as code you're not running does not need to work to test the code you're working on. I could not handle needing to run all the tests to find issues the compiler tells me about right away.&lt;/p&gt;

&lt;p&gt;When I continue to maintain the old API I could technically merge in progress into mainline. Sure that would create some confusion, but it still makes it a possibility. &lt;/p&gt;

</description>
      <category>refactor</category>
      <category>api</category>
    </item>
    <item>
      <title>Rebase and Merge Don't Mix</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Wed, 04 Aug 2021 04:20:44 +0000</pubDate>
      <link>https://forem.com/jessekphillips/rebase-and-merge-don-t-mix-4aj</link>
      <guid>https://forem.com/jessekphillips/rebase-and-merge-don-t-mix-4aj</guid>
      <description>&lt;p&gt;When working with git it is possible to utilize both rebase and merge functionality. These two can live harmoniously within the same repository history, but things get messing if you try to mix them together.&lt;/p&gt;

&lt;p&gt;This is a mistake made when working with remote repositories and local repositories while attempting to follow a rebase type workflow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Remote
  M---R---Q
 /
A---B---C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local
  M---R---Q (foo)
 /
A---B---C (origin/main)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I show that Local and Remote are in the same state. If you try to do any sync related to the remote and local git won't take any action, "Already up to date."&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git switch foo&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git rebase origin/main&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local
  M---R---Q (origin/foo)
 /        M'---R'---Q' (foo)
/        /
A---B---C (origin/main)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I'm going to work off the local repository since that is an accurate depiction of what git works with.&lt;/p&gt;

&lt;p&gt;In this case I have rebased the branch &lt;code&gt;foo&lt;/code&gt; onto the main branch, new commits are created, but the remote still has the same old commits.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git pull origin&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local
     M-----R----Q (origin/foo)
   /             \
  /               \
 /        M'-R'-Q'-Merge (foo)
/        /
A---B---C (origin/main)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unless you have changed your configurations with&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git config --global pull.rebase true&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The use of pull will actually perform a merge for the remote branch &lt;code&gt;foo&lt;/code&gt;. This is by no means desired. It results in merge conflicts and messy history with commits which duplicate each other, it is excessively bad when you've attempted additional commits on the local branch and you just want to get them out to the remote.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push --force-with-lease origin foo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is the most correct way to work in a rebase workflow. You own the branch and you can rewrite history and force push the changes out.&lt;/p&gt;




&lt;p&gt;In general you should only be using rebase within a branch you own. However that does not mean that you can't collaborate within a rebase branch. Most optimally you would want to transfer ownership and only when you own the branch do you do any work on it.&lt;/p&gt;

&lt;p&gt;When you take ownership of a branch:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git fetch origin foo&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git reset --hard origin/foo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;However git can handle commit divergence if the commit content has not been modified (--fixup, --squash).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local
  M---R---Z (origin/foo)
 /        M'-R'-Q (foo)
/        /
A---B---C (origin/main)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Going back a little bit, lets say the remote had &lt;code&gt;Z&lt;/code&gt; added and locally &lt;code&gt;Q&lt;/code&gt; was created. You've rebased to &lt;code&gt;main&lt;/code&gt; but don't have the &lt;code&gt;Z&lt;/code&gt; commit. Sure we could:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git cherry-pick origin/foo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And there are probably even more fancy commands to handle multiple commits desired. But here is just one simple way to get the commits you want and still end up on &lt;code&gt;main&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git switch foo
git rebase origin/foo

Local
   M---R---Z (origin/foo)
  /         \
 /           Q' (foo)
/
A---B---C (origin/main)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After moving onto the remote updates, bring it back to main.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rebase origin/main

Local
  M---R---Z (origin/foo)
 /        M'-R'-Z'-Q' (foo)
/        /
A---B---C (origin/main)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when the branch is force pushed, the changes from both sides still remain within the history and everything is linear.&lt;/p&gt;

</description>
      <category>git</category>
      <category>rebase</category>
    </item>
    <item>
      <title>Stop Using Short Hand Autocomplete</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Thu, 17 Jun 2021 03:33:15 +0000</pubDate>
      <link>https://forem.com/jessekphillips/stop-using-short-hand-autocomplete-2i6n</link>
      <guid>https://forem.com/jessekphillips/stop-using-short-hand-autocomplete-2i6n</guid>
      <description>&lt;p&gt;This is just a simple plea to IDE builders.&lt;/p&gt;

&lt;p&gt;Visual Studio provides quick help to generate code. For example if you inherent from an interface the IDE can generate methods which throw a not implemented exception.&lt;/p&gt;

&lt;p&gt;This generative auto complete is there to get you started to build the implementation.&lt;/p&gt;

&lt;p&gt;Well C# provides a short hand =&amp;gt; operator to implement short method bodies. Great feature.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;M&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IFoo&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nf"&gt;Bar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;NotImplementedException&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The point of this short hand is so I don't need to write down so much for a simple return.&lt;/p&gt;

&lt;p&gt;The point of code generating is so I don't need to write down all the expected structure. If you generate the simple thing, you aren't doing your job. I have to convert all those arrows into bodies so I can actually implement the methods rather then claim I didn't implement them. &lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>Cheatsheet for Git Rebase</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Sat, 17 Apr 2021 04:13:59 +0000</pubDate>
      <link>https://forem.com/jessekphillips/cheatsheet-for-git-rebase-11lk</link>
      <guid>https://forem.com/jessekphillips/cheatsheet-for-git-rebase-11lk</guid>
      <description>&lt;p&gt;I don't really use a bunch of cheatsheets, at least not in the conventional sense. Historically I recall having an ascii chart and dvorak keyboard. Yes there were others for school like imperial and metric conversion. &lt;/p&gt;

&lt;p&gt;Though maybe their is something to this. Usually I will do a search for what I want to do and possibly pull up the link I visited last time. This can have the benefit that I my hit some updated information.&lt;/p&gt;

&lt;p&gt;The world is quite different with information just one accurate search for the the thing you may not know you wanted. I also can get a little tired of searching for the same thing but forgetting which was the best answer. &lt;/p&gt;

&lt;p&gt;This is my first creation, it isn't for me. I did this because I looked at a really nice cheatsheet for Git which had things I don't use or deliberately avoid. So I thought I would try my hand at the things I use almost daily. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://cheatography.com/jessekphillips/cheat-sheets/git-rebase-workflow/" rel="noopener noreferrer"&gt;https://cheatography.com/jessekphillips/cheat-sheets/git-rebase-workflow/&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I really wanted stay away from creating groups which were focused on a command, I wanted to draw attention to a task. I also chose my tasks in such a manner that I could show that even though git has a reputation for inconsistent commands, today it really does provide some consistency.&lt;/p&gt;

&lt;p&gt;So now that I created something for others maybe I can do something I'll use myself. &lt;/p&gt;

&lt;p&gt;Also hidden within the sheet is my personal choices much has been explained here on dev.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/jessekphillips" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F121016%2F0db96ddc-06d7-4a3c-a9b2-4f5d7d7b5797.png" alt="jessekphillips"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/jessekphillips/delete-your-master-210a" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Delete Your Master &lt;/h2&gt;
      &lt;h3&gt;Jesse Phillips ・ Apr 8 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#git&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;
 

</description>
      <category>git</category>
      <category>cheatsteet</category>
    </item>
    <item>
      <title>Scratch Diff Using Vim</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Sat, 10 Apr 2021 02:29:04 +0000</pubDate>
      <link>https://forem.com/jessekphillips/scratch-diff-using-vim-17nb</link>
      <guid>https://forem.com/jessekphillips/scratch-diff-using-vim-17nb</guid>
      <description>&lt;p&gt;First as I have not seen this term utilized let me define what I mean by a "scratch diff." I have chosen this in reference to a "scratch pad." The idea is that you have some text and would like clarity in what is different between them, but you don't need to make a big deal out of the comparison.&lt;/p&gt;

&lt;p&gt;Previously I have done this with creating two files and placing the text desired in both of them. Getting the filesystem involved at times just seems like too much for the desired diff. But an internet diff is also not acceptable because at times I need to manipulate the formatting/structure to get a decent comparison.&lt;/p&gt;

&lt;p&gt;Well I finally took some time to learn the vim approach to making a scratch diff and isn't too bad.&lt;/p&gt;

&lt;p&gt;After opening Vim&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:vnew
:diffthis
&amp;lt;ctrl+w&amp;gt;&amp;lt;ctrl+w&amp;gt;
:diffthis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>vim</category>
      <category>diff</category>
    </item>
    <item>
      <title>Static Typing or Typescript</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Sun, 14 Feb 2021 02:19:28 +0000</pubDate>
      <link>https://forem.com/jessekphillips/static-typing-or-typescript-gkm</link>
      <guid>https://forem.com/jessekphillips/static-typing-or-typescript-gkm</guid>
      <description>&lt;p&gt;This is in response to&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;div class="ltag__link__content"&gt;
    &lt;div class="missing"&gt;
      &lt;h2&gt;Article No Longer Available&lt;/h2&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
 

&lt;p&gt;I have mixed feelings about Typescript. To quote Indian Jones, "you call that a type, this is a type."&lt;/p&gt;

&lt;p&gt;If this is where people get their opinions of static typing, no wonder they think they should live without types.&lt;/p&gt;

&lt;p&gt;On the other hand, trying to quantify root cause of an issue is not trivial. Generally people are not tracking these types of things and it is only a "sense" of the situation. I want to summarize some of my experiences with types and talk to an anecdote.&lt;/p&gt;

&lt;h1&gt;
  
  
  Experience
&lt;/h1&gt;

&lt;p&gt;Types&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Help with code reuse&lt;/li&gt;
&lt;li&gt;Help with refactoring&lt;/li&gt;
&lt;li&gt;Help guide programmers to correct usage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This first point is really about the next two; you do not need types to make reusable code. If the programmer misuses your library then it isn't very reusable. If you can't make refactoring changes because others might be using it, isn't very reusable. &lt;/p&gt;

&lt;p&gt;Let's consider the simplist refactor, rename. Your IDE will very well replace all the usage in the code and you'll be confident things are still working the same. But you have a development team, they are working off branches, some work has practically died on other branches. How do we make sure that the rename propagates to the code in these branches? &lt;/p&gt;

&lt;p&gt;With a static typed language, this is a build error. An annoying build error, but preventative nevertheless. &lt;/p&gt;

&lt;p&gt;Build failure can occur from attempts to pass objects without the needed properties. And when using a language with compile time execution, these static guarantees can be quite helpful. (plug for D here)&lt;/p&gt;

&lt;h1&gt;
  
  
  Anecdote
&lt;/h1&gt;

&lt;p&gt;Recently a bug was introduced into some backend code when types were introduced (yes static typed language can work with untyped data). What happened was the type defined expected data before passing the information on to the next system. The previous implementation would blindly pass the blob on.&lt;/p&gt;

&lt;p&gt;The previous implementation worked perfectly, the introduction of types was caught by my extensive introduction tests. Why am I so happy that we introduced this bug?&lt;/p&gt;

&lt;p&gt;The two systems had a mismatch in expectations for what was contained in the "fault tolerant" web. The system using the data had built its expectations off the existing production data. The type was built from the new data source which did not contain such fields. Our conversations lead to communicating our concerns to the upstream 3rd party.&lt;/p&gt;

&lt;p&gt;As my tests use a mock of the 3rd party, had the type been built from our expectations, we would not have caught this issue as we would not have had influence from the real 3rd party API. That is on me, but it all panned out that a bug introduced by types identified issues upstream.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Substring/Slice of a String</title>
      <dc:creator>Jesse Phillips</dc:creator>
      <pubDate>Fri, 29 Jan 2021 05:08:14 +0000</pubDate>
      <link>https://forem.com/jessekphillips/substring-slice-of-a-string-2ff1</link>
      <guid>https://forem.com/jessekphillips/substring-slice-of-a-string-2ff1</guid>
      <description>&lt;p&gt;A Substring or Slice of a string, is a way to create a new string from an existing string. This technique usually is completed without allocation for the new string.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"hello world"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"o wor"&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  C# and Java
&lt;/h1&gt;

&lt;p&gt;These languages provide a string class which are considered immutable as they don't expose methods s to modify the string. &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Substring&lt;/code&gt; (C#) and &lt;code&gt;substring&lt;/code&gt;(Java) are used to create new strings from an existing one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// C#&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We supply the starting index of the original string, then specify the length of the new string. You can leave off the second number if you want it to go the end of the original.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Java&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;substring&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;While similar in syntax, the second argument is the index of the where the string ends in the original.&lt;/p&gt;
&lt;h1&gt;
  
  
  Python
&lt;/h1&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Python
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hello world&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The &lt;a href="https://www.google.com/amp/s/www.digitalocean.com/community/tutorials/how-to-index-and-slice-strings-in-python-3.amp" rel="noopener noreferrer"&gt;Python&lt;/a&gt; language includes a specific syntax, which resembles that used for indexing. Here the second number is an index specifier for where the slice ends within the original array.&lt;/p&gt;

&lt;p&gt;Like C# the second number can be left out to include to the end of the original.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Python
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hello world&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  Javascript
&lt;/h1&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Javascript&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello world!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://www.w3schools.com/jsref/jsref_slice_string.asp" rel="noopener noreferrer"&gt;Javascript&lt;/a&gt; takes its behavior from Python, utilizing an index rather than length for its second parameter.&lt;/p&gt;
&lt;h1&gt;
  
  
  Unicode
&lt;/h1&gt;

&lt;p&gt;Not a single one of these will protect you from splitting surrogates.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/31935240/utf-16-safe-substring-in-c-sharp-net" rel="noopener noreferrer"&gt;C#&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/5695714/python-len-and-slices-on-unicode-strings" rel="noopener noreferrer"&gt;Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/62341685/javascript-unicode-aware-string-slice" rel="noopener noreferrer"&gt;Javascript&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is possible for this method to work well for your use case, even if unicode is within the string.&lt;/p&gt;

&lt;p&gt;Even my preferred language requires consideration of the unicode details. &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/jessekphillips" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F121016%2F0db96ddc-06d7-4a3c-a9b2-4f5d7d7b5797.png" alt="jessekphillips"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/jessekphillips/string-contained-in-a-string-in-d-4po8" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;String Contained in a String in D&lt;/h2&gt;
      &lt;h3&gt;Jesse Phillips ・ Aug 25 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#dlang&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#string&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



</description>
      <category>java</category>
      <category>javascript</category>
      <category>python</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
