<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Software &#8211; Sandy Scott&#039;s Web Spot</title>
	<atom:link href="https://www.sandyscott.net/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sandyscott.net</link>
	<description>My little corner of the web</description>
	<lastBuildDate>Thu, 17 Mar 2022 11:13:28 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>KiCad Simulation &#8211; Node sequence</title>
		<link>https://www.sandyscott.net/2022/03/kicad-simulation-node-sequence/</link>
					<comments>https://www.sandyscott.net/2022/03/kicad-simulation-node-sequence/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Thu, 17 Mar 2022 11:13:26 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=846</guid>

					<description><![CDATA[I&#8217;ve just started using KiCad, and I&#8217;m really impressed. However, setting up a simulation can be awkward, because you need to match up the pin numbers from your schematic (which defines what is connected to what) with the node numbers that you ngspice model has. Most people encounter this first...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2022/03/kicad-simulation-node-sequence/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;ve just started using KiCad, and I&#8217;m really impressed. However, setting up a simulation can be awkward, because you need to match up the pin numbers from your schematic (which defines what is connected to what) with the node numbers that you ngspice model has.</p>



<p>Most people encounter this first with transistors. eg. a typical BJT has the following pin assignments:</p>



<ol class="wp-block-list"><li>Emitter</li><li>Base</li><li>Collector</li></ol>



<figure class="wp-block-image size-full"><a href="https://www.sandyscott.net/wp-content/uploads/2022/03/image.png"><img fetchpriority="high" decoding="async" width="346" height="225" src="https://www.sandyscott.net/wp-content/uploads/2022/03/image.png" alt="" class="wp-image-847" srcset="https://www.sandyscott.net/wp-content/uploads/2022/03/image.png 346w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-300x195.png 300w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-150x98.png 150w" sizes="(max-width: 346px) 100vw, 346px" /></a><figcaption>This is fine &#8211; KiCad is mainly for creating PCBs, so the most important thing is that the pins on the schematic match up to the pins on the footprint on the PCB.<br></figcaption></figure>



<p>However, our simulation models have nodes, and each node will correspond to a pin on the schematic and PCB, so we need to make sure that each pin is connected to the right node.</p>



<p>From the datasheet you&#8217;ll be able to get the pin assignments &#8211; e.g. pin 2 is the Base. Where do you find the ngspice node assignments? It depends on the type of spice model you&#8217;re using. </p>



<ul class="wp-block-list"><li>Built-in .MODEL. These are used for standard components, so the behaviour of the component can be defined with just a few parameters &#8211; e.g. for a basic simulation all you need to know about a resistor is the resistance. There are 17 types of model.</li><li>Custom .SUBCKT (Sub-circuit). These can be used for components that don&#8217;t fit into the standard categories, or for a complete add-on board.</li></ul>



<p>Which one is it? In KiCad, look at the spice model editor:</p>



<figure class="wp-block-image size-full"><a href="https://www.sandyscott.net/wp-content/uploads/2022/03/image-1.png"><img decoding="async" width="348" height="116" src="https://www.sandyscott.net/wp-content/uploads/2022/03/image-1.png" alt="" class="wp-image-848" srcset="https://www.sandyscott.net/wp-content/uploads/2022/03/image-1.png 348w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-1-300x100.png 300w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-1-150x50.png 150w" sizes="(max-width: 348px) 100vw, 348px" /></a><figcaption>The first highlighted text shows that this is a .MODEL</figcaption></figure>



<h2 class="wp-block-heading">.MODEL</h2>



<p>To get the information you need, you&#8217;ll need to <a href="http://ngspice.sourceforge.net/docs/ngspice-html-manual/manual.xhtml#magicparlabel-952">look at the ngspice manual</a>.</p>



<p>This includes the <a href="http://ngspice.sourceforge.net/docs/ngspice-html-manual/manual.xhtml#magicparlabel-952">list of 17 standard models</a> (reproduced here):</p>



<figure class="wp-block-table"><table><tbody><tr><td>Code</td><td>Model Type</td></tr><tr><td>R</td><td>Semiconductor resistor model</td></tr><tr><td>C</td><td>Semiconductor capacitor model</td></tr><tr><td>L</td><td>Inductor model</td></tr><tr><td>SW</td><td>Voltage controlled switch</td></tr><tr><td>CSW</td><td>Current controlled switch</td></tr><tr><td>URC</td><td>Uniform distributed RC model</td></tr><tr><td>LTRA</td><td>Lossy transmission line model</td></tr><tr><td>D</td><td>Diode model</td></tr><tr><td>NPN</td><td>NPN BJT model</td></tr><tr><td>PNP</td><td>PNP BJT model</td></tr><tr><td>NJF</td><td>N-channel JFET model</td></tr><tr><td>PJF</td><td>P-channel JFET model</td></tr><tr><td>NMOS</td><td>N-channel MOSFET model</td></tr><tr><td>PMOS</td><td>P-channel MOSFET model</td></tr><tr><td>NMF</td><td>N-channel MESFET model</td></tr><tr><td>PMF</td><td>P-channel MESFET model</td></tr><tr><td>VDMOS</td><td>Power MOS model</td></tr></tbody></table></figure>



<p>Go back to KiCad Spice Model Editor</p>



<figure class="wp-block-image size-full is-style-default"><a href="https://www.sandyscott.net/wp-content/uploads/2022/03/image-1.png"><img decoding="async" width="348" height="116" src="https://www.sandyscott.net/wp-content/uploads/2022/03/image-1.png" alt="" class="wp-image-848" srcset="https://www.sandyscott.net/wp-content/uploads/2022/03/image-1.png 348w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-1-300x100.png 300w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-1-150x50.png 150w" sizes="(max-width: 348px) 100vw, 348px" /></a><figcaption>The second highlighted text shows that this is an NPN BJT.</figcaption></figure>



<p>So, now look at <a href="http://ngspice.sourceforge.net/docs/ngspice-html-manual/manual.xhtml#magicparlabel-8435">the section of the ngspice manual for BJTs</a>:</p>



<figure class="wp-block-image size-full"><a href="https://www.sandyscott.net/wp-content/uploads/2022/03/image-3.png"><img decoding="async" width="687" height="361" src="https://www.sandyscott.net/wp-content/uploads/2022/03/image-3.png" alt="" class="wp-image-850" srcset="https://www.sandyscott.net/wp-content/uploads/2022/03/image-3.png 687w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-3-300x158.png 300w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-3-150x79.png 150w" sizes="(max-width: 687px) 100vw, 687px" /></a></figure>



<p>This tells us that ngspice expects the nodes to be listed in the order <strong>collector</strong>, <strong>base</strong>, <strong>emitter</strong>.</p>



<p>We&#8217;ll use this later.</p>



<h2 class="wp-block-heading">.SUBCKT</h2>



<p>Sub-circuits can be easy to figure out, or they can be hard, depending on whether the creator of the model has made sensible choices about the node names.</p>



<p>Look at the KiCad Spice Model Editor &#8211; this example is from a manufacturer spice model of an N-channel MOSFET, that has chosen to use .SUBCKT instead of .MODEL:</p>



<figure class="wp-block-image size-full"><a href="https://www.sandyscott.net/wp-content/uploads/2022/03/image-4.png"><img loading="lazy" decoding="async" width="365" height="134" src="https://www.sandyscott.net/wp-content/uploads/2022/03/image-4.png" alt="" class="wp-image-851" srcset="https://www.sandyscott.net/wp-content/uploads/2022/03/image-4.png 365w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-4-300x110.png 300w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-4-150x55.png 150w" sizes="(max-width: 365px) 100vw, 365px" /></a><figcaption>The stuff immediately after the .SUBCKT is what we need &#8211; the first thing is the type of device, the next 3 items are the nodes, helpfully lablled as <strong>drain</strong>, <strong>gate </strong>and <strong>source </strong>in that order.</figcaption></figure>



<h2 class="wp-block-heading">Alternate Node Sequence</h2>



<p>Now we&#8217;re ready to fill in the Alternate Node Sequence box in KiCad:</p>



<figure class="wp-block-image size-full"><a href="https://www.sandyscott.net/wp-content/uploads/2022/03/image-5.png"><img loading="lazy" decoding="async" width="365" height="51" src="https://www.sandyscott.net/wp-content/uploads/2022/03/image-5.png" alt="" class="wp-image-852" srcset="https://www.sandyscott.net/wp-content/uploads/2022/03/image-5.png 365w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-5-300x42.png 300w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-5-150x21.png 150w" sizes="(max-width: 365px) 100vw, 365px" /></a></figure>



<p>In this you write a list of the <strong>pin numbers</strong>, separated by spaces, in the correct <strong>node sequence</strong>.</p>



<p>e.g. for our BJT example we know that the correct node sequence is</p>



<p><strong><em>collector, base, emmitter</em></strong></p>



<p>Recall our pin assigments:</p>



<ol class="wp-block-list"><li>Emitter</li><li>Base</li><li>Collector</li></ol>



<p>So I&#8217;ll rewrite the node sequence with the pin number in brackets:</p>



<p><strong><em>collector (3), base(2), emmitter(1)</em></strong></p>



<p>Now all we need are the pin numbers, so strip out everything else:</p>



<p><strong><em>3 2 1</em></strong></p>



<p>And put that in the Alternate Node Sequence box:</p>



<figure class="wp-block-image size-full"><a href="https://www.sandyscott.net/wp-content/uploads/2022/03/image-6.png"><img loading="lazy" decoding="async" width="242" height="37" src="https://www.sandyscott.net/wp-content/uploads/2022/03/image-6.png" alt="" class="wp-image-853" srcset="https://www.sandyscott.net/wp-content/uploads/2022/03/image-6.png 242w, https://www.sandyscott.net/wp-content/uploads/2022/03/image-6-150x23.png 150w" sizes="(max-width: 242px) 100vw, 242px" /></a><figcaption>Hit OK and we&#8217;re done!</figcaption></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2022/03/kicad-simulation-node-sequence/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Backup</title>
		<link>https://www.sandyscott.net/2022/02/backup/</link>
					<comments>https://www.sandyscott.net/2022/02/backup/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Mon, 21 Feb 2022 22:04:43 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=838</guid>

					<description><![CDATA[I&#8217;ve been using SpiderOak for backup, and to cut a long story short it&#8217;s becoming tiresome. In fairness, it&#8217;s not really meant for backing up servers, but there&#8217;s still a lot of things it could do better. So I&#8217;m on the hunt for an offsite backup solution for this server....<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2022/02/backup/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;ve been using SpiderOak for backup, and to cut a long story short it&#8217;s becoming tiresome. In fairness, it&#8217;s not really meant for backing up servers, but there&#8217;s still a lot of things it could do better.</p>



<p>So I&#8217;m on the hunt for an offsite backup solution for this server.</p>



<p>This is Linux, so nothing is simple &#8211; the solution is divided into two pieces:</p>



<ul class="wp-block-list"><li>Remote data storage service &#8211; to actually hold the data.</li><li>Backup software &#8211; to figure out what needs to be uploaded, and keep track of versions and suchlike.</li></ul>



<p>For the remote side I&#8217;ve got three real options:</p>



<ul class="wp-block-list"><li>rsync.net &#8211; starts at $10/mo for 400 GB</li><li>Backblaze B2 &#8211; starts at $5/mo for 1TB</li><li>Wasabi &#8211; starts at $5.99/mo for 1TB</li></ul>



<p>However, although rsync.net looks pretty simple &#8211; the price isn&#8217;t competitive. Backblaze B2 and Wasabi are similar &#8211; the benefit of Wasabi is that the&#8217;s no extra charges for downloads &#8211; B2 has a 1GB daily download threshold, and you start getting charged if you go over that.</p>



<p>For the backup software. These are the options I&#8217;m looking at. Please note that tools like rsync and rclone aren&#8217;t backup tools &#8211; they&#8217;re just for syncing, so don&#8217;t manage the versions or encryption</p>



<ul class="wp-block-list"><li>duplicity</li><li>borg</li><li>restic</li><li>duplicacy</li><li>Duplicati</li></ul>



<h3 class="wp-block-heading" id="duplicacy">Duplicacy</h3>



<p>I&#8217;m going to rule this one out right away it&#8217;s not free &#8211; I&#8217;m only mentioning it because it&#8217;s often included in conversations about Linux backup software.</p>



<h3 class="wp-block-heading" id="duplicity">Duplicity</h3>



<p>Duplicity has been described as an <a href="https://www.backblaze.com/blog/backing-linux-backblaze-b2-duplicity-restic/">old-school approach by this Backblaze blog post</a>. That means it&#8217;s the model whereby you create a backup of everything &#8211; a <strong>full backup</strong>, then the next time you back up you only back up what&#8217;s changed &#8211; that&#8217;s an <strong>incremental backup</strong>. This can be space-efficient and fast and easy to understand, but the downside is to do a restore you need the last full backup, and all the incremental backups since then. This then creates headaches about deciding when to create a new full backup and how often to get rid of the old ones. Having said that it&#8217;s a respected and reliable tool which supports everything it needs to: Encryption, Compression, Backblaze B2 storage is supported, Wasabi is not.</p>



<h3 class="wp-block-heading" id="restic">Restic</h3>



<p>The same article describes Restic as the new-school tool &#8211; which supports deduplication to save space. There isn&#8217;t a version 1.0.0 yet, but it seems to be fairly popular already, and supports B2 storage &amp; Wasabi.</p>



<h3 class="wp-block-heading" id="borg">Borg</h3>



<p>Borg is also a deduplicating backup software &#8211; seems to be a bit less fashionable that restic, a bit more mature. As far as I can tell the key advantage that Borg offers is compression, but can be slower with large respositories and large files because it&#8217;s single-threaded. However it doesn&#8217;t natively support remote object storage, so needs another tool to upload the data. <a href="https://forum.rclone.org/t/borgbackup-backblaze-b2-uploading/3679/5">See this forum post</a>. It has some nice features, like the ability to mount a backup as a FUSE filesystem so you can browse it.</p>



<h3 class="wp-block-heading" id="duplicati">Duplicati</h3>



<p>Not sure which type of tool this is. It does support B2 storage, but not Wasabi. Some people have had issues with reliability with it.</p>



<h2 class="wp-block-heading" id="final-thoughts">Final Thoughts</h2>



<p>I&#8217;ve gone with restic and Backblaze B2. They can talk to each other directly, but I like the idea of having a local copy of the repo, so I&#8217;ve set restic to backup to a portable HDD, the which then is copied to Backblaze. This means I have the offsite copy in case my house burns down but can still get at the data in more mundane scenarios.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2022/02/backup/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Linux software updates &#8211; How to resolve changed configuration files.</title>
		<link>https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/</link>
					<comments>https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Fri, 02 Apr 2021 15:46:00 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[dpkg]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=821</guid>

					<description><![CDATA[Sometimes, when you&#8217;re updating software on your Linux machine, the person maintaining the package will have also updated the default configuration file that ships with the software. This is an issue if you have customised that configuration file on your system &#8211; the system doesn&#8217;t know whether it should keep...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>Sometimes, when you&#8217;re updating software on your Linux machine, the person maintaining the package will have also updated the default configuration file that ships with the software.</p>



<p>This is an issue if you have customised that configuration file on your system &#8211; the system doesn&#8217;t know whether it should keep your version, use the new one, or something else. So it asks you to decide what to do about it.</p>



<p>I&#8217;m using Debian, which uses the <code>dpkg </code>package management system &#8211; that name may be unfamiliar, but if you&#8217;ve used any of the Debain family (Ubuntu, Mint, MX, elementary etc.) you will have used one of the friendlier wrappers around it: <code>apt </code>or <code>apt-get</code>.</p>



<p>Today, it&#8217;s the Collabora Office configuration file that has been updated:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">Configuration file '/etc/loolwsd/loolwsd.xml'
 ==&gt; Modified (by you or by a script) since installation.
 ==&gt; Package distributor has shipped an updated version.
   What would you like to do about it ? Your options are:
    Y or I : install the package maintainer's version
    N or O : keep your currently-installed version
      D    : show the differences between the versions
      Z    : start a shell to examine the situation
 The default action is to keep your current version.
*** loolwsd.xml (Y/I/N/O/D/Z) [default=N] ?</pre></div>



<ul class="wp-block-list"><li>The first option is self-explanatory &#8211; you&#8217;ll lose any customizations you&#8217;ve made, but that might be OK for you.</li><li>Keeping your currently-installed version is usually OK &#8211; well designed software shouldn&#8217;t break because it&#8217;s missing a line in an old configuration file.</li></ul>



<p>In either case the system will keep a copy of the one you don&#8217;t pick, so you can change your mind later. If you choose to use the package mantainer&#8217;s version, there will be a copy of your old one with <code>.dpkg-old</code> added to the filename. If you keep you own config file, the package maintainer&#8217;s version will be saved alongside it, with <code>.dpkg-dist</code> added to the filename.</p>



<ul class="wp-block-list"><li>Choosing option D can help you decide &#8211; but ultimately doesn&#8217;t resolve the situation.</li><li>Option Z is the point of today&#8217;s post &#8211; this is how you can fix the situation.</li></ul>



<p>Lets hit Z, and this is what I get:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}"> The default action is to keep your current version.
*** loolwsd.xml (Y/I/N/O/D/Z) [default=N] ? Z
Useful environment variables:
 - DPKG_SHELL_REASON
 - DPKG_CONFFILE_OLD
 - DPKG_CONFFILE_NEW
Type 'exit' when you're done.
root@waldorf:/# </pre></div>



<p>The system tells you about 3 environment variables that might be useful to help fix the situation. here I&#8217;ve use the echo command (with a $ before the environment variable name) to see what&#8217;s in them:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">root@waldorf:/# echo $DPKG_SHELL_REASON
conffile-prompt
root@waldorf:/# echo $DPKG_CONFFILE_OLD
/etc/loolwsd/loolwsd.xml
root@waldorf:/# echo $DPKG_CONFFILE_NEW
/etc/loolwsd/loolwsd.xml.dpkg-new</pre></div>



<p>DPKG_CONFFILE_PROMPT isn&#8217;t much use to us, but the other two are. We can start a program to compare and merge the differences between the two. I&#8217;m using Neovim in diff mode &#8211; there are lots of otherways of doing this &#8211; I&#8217;d suggest you do your research and find your preferred merge tool or text editor.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">root@waldorf:/# nvim -d $DPKG_CONFFILE_OLD $DPKG_CONFFILE_NEW</pre></div>



<p>I wont to get into the details of how to use [Neo]vim, but if you&#8217;re already a vim user and haven&#8217;t used diff mode before, these commands will get you started. <a href="https://neovim.io/doc/user/diff.html">You can find more info in the documentation.</a></p>



<figure class="wp-block-table"><table><tbody><tr><td><strong>Keystrokes</strong></td><td><strong>Command</strong></td></tr><tr><td>&lt;Ctrl-w&gt; l</td><td>Move to the right window</td></tr><tr><td>&lt;Ctrl-w&gt; h</td><td>Move to the left window</td></tr><tr><td>]c</td><td>Move to the next change</td></tr><tr><td>[c</td><td>Move to the previous change</td></tr><tr><td>:diffget</td><td>Copy the change you&#8217;re on from the other window</td></tr><tr><td>:diffput</td><td>Push the change from your current window into the other one.</td></tr></tbody></table></figure>



<dl class="wp-block-simple-definition-list-blocks-list"></dl>



<p>Note that the last two commands will make the files the same at that point</p>



<p>Modifiy one of the files (I typically modify my old file &#8211; pulling the changes from the new one that I want, and leaving the ones that I don&#8217;t), then save and exit your text editor or mergetool</p>



<p>Type exit at the prompt, then the system will ask you again what you want to do:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">*** loolwsd.xml (Y/I/N/O/D/Z) [default=N] ?</pre></div>



<p>In this case I&#8217;ll choose N or O because I&#8217;ve made the changes I want to the original config file.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Install Sage Math from source on WSL</title>
		<link>https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/</link>
					<comments>https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/#comments</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Wed, 02 Dec 2020 15:59:14 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sage]]></category>
		<category><![CDATA[sagemath]]></category>
		<category><![CDATA[WSL]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=747</guid>

					<description><![CDATA[Here&#8217;s how I got a fully featured Sage Math install on my system. I did this because I wanted to run on windows, and still be able to install packages, which isn&#8217;t possible with the precompiled binary. Basic process: Enable hardware assisted virtualization. Set up WSL (Windows Subsystem for Linux)...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>Here&#8217;s how I got a fully featured Sage Math install on my system. I did this because I wanted to run on windows, and still be able to install packages, which isn&#8217;t possible with the precompiled binary.</p>



<h2 class="wp-block-heading">Basic process:</h2>



<ol class="wp-block-list"><li>Enable hardware assisted virtualization.</li><li>Set up WSL (Windows Subsystem for Linux)</li><li>Install Linux into WSL</li><li>Download and compile Sage</li><li>Configure JupyterLab</li><li>Make it easy to start from windows</li></ol>



<h2 class="wp-block-heading">Enable hardware assisted virtualization</h2>



<p>WSL requires that your system supports hardware assisted virtualization (which pretty much all modern systems do), there are 3 things that you need to get it working:</p>



<ul class="wp-block-list"><li>The CPU must support it</li><li>The motherboard must support it.</li><li>You need to enable it in the EFI (or BIOS)</li></ul>



<p>This article takes you through getting everything sorted out:</p>



<p><a href="https://support.bluestacks.com/hc/en-us/articles/115003174386-How-to-enable-Virtualization-VT-on-Windows-10-for-BlueStacks-4">https://support.bluestacks.com/hc/en-us/articles/115003174386-How-to-enable-Virtualization-VT-on-Windows-10-for-BlueStacks-4</a></p>



<h2 class="wp-block-heading">Set up WSL 2</h2>



<p>Follow this guide: <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">https://docs.microsoft.com/en-us/windows/wsl/install-win10</a></p>



<h2 class="wp-block-heading">Install and configure Linux:</h2>



<ol class="wp-block-list"><li>Go to the Microsoft store and install Ubuntu.</li></ol>



<p>Note: If you already have Ubuntu installed, I&#8217;d recommend you follow these instructions to set up a separate, clean install for sage: <a href="https://hfakhraei.github.io/Install-multiple-instance-of-same-Linux-Distribution-on-WSL">https://hfakhraei.github.io/Install-multiple-instance-of-same-Linux-Distribution-on-WSL</a></p>



<ol class="wp-block-list" start="2"><li>Start Ubuntu from the start menu. A command window should pop up.</li><li>Run these commands to update Ubuntu:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">    sudo apt update
    sudo apt upgrade</pre></div>



<ol class="wp-block-list" start="4"><li>Reboot by going (in Windows) to Services and restarting the LxssManager. You can also shut down all running WSL instances using the command <code>wsl --shutdown</code> in the Windows command prompt or Powershell.</li><li>If necessary upgrade to the latest release: <a href="https://linuxconfig.org/how-to-upgrade-ubuntu-to-20-10">https://linuxconfig.org/how-to-upgrade-ubuntu-to-20-10</a></li></ol>



<h2 class="wp-block-heading">Set up Sage</h2>



<p>These instructions are a simplified version of the official documentation: <a href="https://doc.sagemath.org/html/en/installation/source.html">https://doc.sagemath.org/html/en/installation/source.html</a></p>



<ol class="wp-block-list"><li>Start Ubuntu &#8211; All the commands in this section should be run on the Ubuntu installation.</li><li>Install the packages we need to have ready in advance:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install bc binutils bzip2 ca-certificates cliquer cmake coinor-cbc coinor-libcbc-dev curl default-jdk dvipng eclib-tools fflas-ffpack ffmpeg flintqs g++ gcc gfan gfortran git glpk-utils gmp-ecm imagemagick latexmk lcalc libatomic-ops-dev libavdevice-dev libboost-dev libbraiding-dev libbrial-dev libbrial-groebner-dev libbz2-dev libcdd-dev libcdd-tools libcliquer-dev libcurl4-openssl-dev libec-dev libecm-dev libffi-dev libfile-slurp-perl libflint-arb-dev libflint-dev libfreetype6-dev libgc-dev libgd-dev libgf2x-dev libgiac-dev libgivaro-dev libglpk-dev libgmp-dev libgsl-dev libiml-dev libisl-dev libjson-perl liblfunction-dev liblrcalc-dev liblzma-dev libm4rie-dev libmongodb-perl libmpc-dev libmpfi-dev libmpfr-dev libnauty-dev libncurses5-dev libntl-dev libopenblas-dev libpari-dev libpcre3-dev libperl-dev libplanarity-dev libppl-dev libpython3-dev libreadline-dev librw-dev libsqlite3-dev libssl-dev libsuitesparse-dev libsvg-perl libsymmetrica2-dev libterm-readkey-perl libterm-readline-gnu-perl libxml2-dev libxml-libxslt-perl libxml-writer-perl libz-dev libzmq3-dev libzn-poly-dev m4 make nauty ninja-build openssl palp pandoc pari-doc pari-elldata pari-galdata pari-galpol pari-gp2c pari-seadata patch perl pkg-config planarity ppl-dev python3 python3-distutils r-base-dev r-cran-lattice sqlite3 sympow tachyon tar texlive texlive-xetex xcas xz-utils yasm</pre></div>



<ol class="wp-block-list" start="3"><li>Download and extract the source tarball into a subfolder of your home directory</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd ~
wget http://www.mirrorservice.org/sites/www.sagemath.org/src/sage-9.2.tar.gz
tar xvf sage-9.2.tar.gz</pre></div>



<ol class="wp-block-list" start="4"><li>Start building</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd sage-9.2/
./configure
make</pre></div>



<p>This will take a long time (3 hours on my system)</p>



<ol class="wp-block-list" start="5"><li>Test sage</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">./sage</pre></div>



<p>You should get a prompt that looks like this:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.6. Type &quot;help()&quot; for help.                        │
└────────────────────────────────────────────────────────────────────┘
sage:</pre></div>



<ol class="wp-block-list" start="6"><li>Type <code>exit </code>and press enter to leave.</li></ol>



<ol class="wp-block-list" start="7"><li>Make the command available from anywhere on this ubuntu system &#8211; edit ~/.bashrc and add this line:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">alias sage=~/sage-9.2/sage</pre></div>



<ol class="wp-block-list" start="8"><li>Close ubuntu then reopen it.</li><li>Try typing <code>sage</code> and verify that it starts.</li></ol>



<h2 class="wp-block-heading">JupyterLab</h2>



<ol class="wp-block-list"><li>Install Jupyter Lab and it&#8217;s extras:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sage -i jupyterlab_widgets</pre></div>



<p>This also involves compliation from source, so will take a while.</p>



<ol class="wp-block-list" start="2"><li>When it&#8217;s done, try starting the jupyterlab notebook like this:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sage --notebook jupyterlab</pre></div>



<p>You might notice a problem &#8211; the list of files only includes those on your linux machine &#8211; you probably want the ones on your windows computer. You can do this by navigating to where the windows files are mounted in linux.</p>



<ol class="wp-block-list" start="3"><li>Try it (fill in your windows username instead of the square brackets):</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd /mnt/c/Documents\ and\ Settings\[your windows username]
sage --notebook jupyterlab</pre></div>



<p>The list of files should now be the ones in that folder on your windows machine.</p>



<ol class="wp-block-list" start="4"><li>Lets wrap this all in a script for convenience &#8211; Create a file called ~/<code>sage_nb.sh</code> and put these lines into it:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">#!/bin/bash
cd /mnt/c/Documents\ and\ Settings/[your windows username]
/home/[your linux username]/sage-9.2/sage --notebook jupyterlab</pre></div>



<ol class="wp-block-list" start="5"><li>We need to make it executable &#8211; ie. so linux will run this file like it would run a program:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">chmod ug+x sage_nb.sh</pre></div>



<ol class="wp-block-list" start="6"><li>Now go back to your home directory and try it again:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd ~
./sage_nb.sh</pre></div>



<p>The JupyterLab server should start, showing your windows files in the browser.</p>



<h2 class="wp-block-heading">Create windows shortcut</h2>



<p>This is a final nicety that lets you start the JupyterLab server in one click:</p>



<ol class="wp-block-list"><li>Open Windows explorer, and type %APPDATA%\Microsoft\Windows\Start Menu\Programs</li><li>Make a copy of any of the program icons &#8211; we&#8217;ll customise it to do what we want</li><li>Right-click, and choose properties.</li><li>On the General tab:<ul><li>Change the name to whatever you want.</li></ul></li><li>On the Shortcut tab:<ul><li>Change Target to: <code>ubuntu.exe run ~/sage_nb.sh</code></li><li>Change Start in to: <code>%USERPROFILE%</code></li><li>Change Run to: Minimised</li><li>Change the icon if you want &#8211; there are plenty of pieces of software that can create a <code>.ico</code> icon file one from an image file.</li></ul></li><li>Now hit the start button or key and type the name you gave it. it should appear in the list, and should load the server and fire up your browser when you click on it.</li></ol>



<dl class="wp-block-simple-definition-list-blocks-list"></dl>



<h2 class="wp-block-heading">Software versions:</h2>



<p>This is what I used when I wrote this post &#8211; you might get different results if your versions are significantly different.</p>



<ul class="wp-block-list"><li>Windows 10 Pro Version 2004 (OS Build 19041.264)</li><li>Ubuntu 20.10 (Originally installed 20.04 as 20.10 was not available in the Windows Store)</li><li>Sage 9.2</li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>UniLogic INT/REAL conversion blocks</title>
		<link>https://www.sandyscott.net/2020/09/unilogic-int-real-conversion-blocks/</link>
					<comments>https://www.sandyscott.net/2020/09/unilogic-int-real-conversion-blocks/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Fri, 25 Sep 2020 08:21:58 +0000</pubDate>
				<category><![CDATA[PLCs]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[UniLogic]]></category>
		<category><![CDATA[UniStream]]></category>
		<category><![CDATA[Unitronics]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=726</guid>

					<description><![CDATA[I don&#8217;t think the documentation for the Real to Int and Int to Real blocks in Unitronics UniLogic is very clear, so here&#8217;s my explanation: Real to Int There&#8217;s a special case when r2i_Precision_in is 0 (ie. round to the nearest integer): when the magnitude of th fractional part is...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/09/unilogic-int-real-conversion-blocks/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>I don&#8217;t think the documentation for the <strong>Real to Int</strong> and <strong>Int to Real</strong> blocks in Unitronics UniLogic is very clear, so here&#8217;s my explanation:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="678" height="236" src="https://www.sandyscott.net/wp-content/uploads/2020/09/image.png" alt="" class="wp-image-727" srcset="https://www.sandyscott.net/wp-content/uploads/2020/09/image.png 678w, https://www.sandyscott.net/wp-content/uploads/2020/09/image-300x104.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/09/image-150x52.png 150w" sizes="(max-width: 678px) 100vw, 678px" /></figure>



<h2 class="wp-block-heading">Real to Int</h2>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="321" height="147" src="https://www.sandyscott.net/wp-content/uploads/2020/09/image-1.png" alt="" class="wp-image-738" srcset="https://www.sandyscott.net/wp-content/uploads/2020/09/image-1.png 321w, https://www.sandyscott.net/wp-content/uploads/2020/09/image-1-300x137.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/09/image-1-150x69.png 150w" sizes="(max-width: 321px) 100vw, 321px" /></figure>



<dl class="wp-block-simple-definition-list-blocks-list">
<dt class="wp-block-simple-definition-list-blocks-term">r2i_REAL_in (Data type: REAL):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">The real number to convert.</dd>



<dt class="wp-block-simple-definition-list-blocks-term">r2i_Precision_in (Data Types: UINT8, UINT16, UINT32):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">Number of decimal places to add to the fractional part.</dd>



<dt class="wp-block-simple-definition-list-blocks-term">r2i_INT_out (Data Types: INT8, INT16, INT32):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">this is the integer part of <strong>r2i_REAL_in</strong>, no matter what the value of <strong>r2i_Precision_in</strong> is.</dd>



<dt class="wp-block-simple-definition-list-blocks-term">r2i_frac_out: (Data Types: INT8, INT16, INT32):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">This is the fractional part of r2i_REAL_in, rounded to the specified number of decimal places, multiplied by 10^( r2i_Precision_in ).</dd>
</dl>



<p>There&#8217;s a special case when <strong>r2i_Precision_in</strong> is 0 (ie. round to the nearest integer): when the magnitude of th fractional part is less than 0.5, it will be 0, otherwise it will be 1 or -1, (the same sign as <strong>r2i_REAL_in</strong>). To get the correctly rounded number, you need to add <strong>r2i_frac_out</strong> to <strong>r2i_INT_out</strong></p>



<p>The behaviour when the number is too big to fit into either of the integers seems to be inconsistent. If r2i_INT_out is an INT32, then it will 2 147 483 647 if <strong>r2i_REAL_in</strong> is bigger than that, or -2147483648 if <strong>r2i_REAL_in</strong> is smaller than that. INT16s and INT8s sometimes overflow instead. (i.e. 128 becomes -128 if   <strong>r2i_INT_out</strong> is an INT8), but it doesn&#8217;t do this for all values). I&#8217;d avoid using this function in this situation if at all possible.</p>



<p>Examples:</p>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td><strong>r2i_REAL_in</strong></td><td><strong>r2i_Precision_in</strong></td><td><strong>r2i_INT_out</strong></td><td><strong>r2i_frac_out</strong></td></tr><tr><td>123.456</td><td>3</td><td>123</td><td>456</td></tr><tr><td>123.500</td><td>1</td><td>123</td><td>5</td></tr><tr><td>123.500</td><td>0</td><td>123</td><td>1</td></tr><tr><td>-0.03</td><td>2</td><td>0</td><td>-3</td></tr><tr><td>-12.75</td><td>3</td><td>-12</td><td>-750</td></tr><tr><td>-12.75</td><td>0</td><td>-12</td><td>-1</td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Int to Real</h2>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="318" height="187" src="https://www.sandyscott.net/wp-content/uploads/2020/09/image-2.png" alt="" class="wp-image-739" srcset="https://www.sandyscott.net/wp-content/uploads/2020/09/image-2.png 318w, https://www.sandyscott.net/wp-content/uploads/2020/09/image-2-300x176.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/09/image-2-150x88.png 150w" sizes="(max-width: 318px) 100vw, 318px" /></figure>



<dl class="wp-block-simple-definition-list-blocks-list">
<dt class="wp-block-simple-definition-list-blocks-term">i2r_INT_in (Data Types: INT8, INT16, INT32):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">Integer part of value. Not actually necessary, because you can do everything without it.</dd>



<dt class="wp-block-simple-definition-list-blocks-term">i2r_FRAC_in (Data Types: INT8, INT16, INT32):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">This is the only way to populate it the fractional part of the output, but it will also contribute to the fractional part.</dd>



<dt class="wp-block-simple-definition-list-blocks-term">i2r_DECPOS_in (Data Types: UINT8, UINT16, UINT32):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">This controls how <strong>i2r_FRAC_in</strong> is intepreted. Values above 7 result in the fractional part being ignored.</dd>



<dt class="wp-block-simple-definition-list-blocks-term">i2r_REAL_out (Data type: REAL):</dt>



<dd class="wp-block-simple-definition-list-blocks-details">The Real output value. This is calculated as:<br><strong>i2r_INT_in </strong>+ <strong>i2r_FRAC_in </strong>/ 10 ^ ( <strong>i2r_DECPOS_in </strong>)</dd>
</dl>



<p>Examples</p>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td><strong>i2r_INT_in</strong></td><td><strong>i2r_FRAC_in</strong></td><td><strong>i2r_DECPOS_in</strong></td><td><strong>i2r_REAL_out</strong></td></tr><tr><td>156</td><td>456</td><td>3</td><td>156.456000</td></tr><tr><td>0</td><td>456</td><td>2</td><td>4.560000</td></tr><tr><td>13</td><td>214</td><td>2</td><td>15.140000</td></tr><tr><td>0</td><td>2147483647</td><td>7</td><td>214.748400</td></tr><tr><td>0</td><td>2147483647</td><td>8</td><td>0</td></tr></tbody></table></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/09/unilogic-int-real-conversion-blocks/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MusicBrainz Classical Style Guide &#8211; Quick Reference</title>
		<link>https://www.sandyscott.net/2016/04/musicbrainz-classical-style-guide-quick-reference/</link>
					<comments>https://www.sandyscott.net/2016/04/musicbrainz-classical-style-guide-quick-reference/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Mon, 11 Apr 2016 20:21:49 +0000</pubDate>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Classical]]></category>
		<category><![CDATA[MusicBrainz]]></category>
		<guid isPermaLink="false">http://www.sandyscott.net/?p=183</guid>

					<description><![CDATA[Editing MusicBrainz data can be intimidating at the best of times, but Classical recordings can be particularly tricky, as the 4 different &#8220;Artist&#8221; fields can all be different. Hopefully this quick reference guide should avoid a few more mistakes in future. Alternatively, check out the full Classical Style Guide<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2016/04/musicbrainz-classical-style-guide-quick-reference/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[<p>Editing <a href="http://musicbrainz.org">MusicBrainz</a> data can be intimidating at the best of times, but Classical recordings can be particularly tricky, as the 4 different &#8220;Artist&#8221; fields can all be different.</p>
<p>Hopefully this quick reference guide should avoid a few more mistakes in future.</p>
<p><a href="http://www.sandyscott.net/wp-content/uploads/2017/06/MB-CSG-QR.png"><img loading="lazy" decoding="async" class="aligncenter  wp-image-216" src="http://www.sandyscott.net/wp-content/uploads/2017/06/MB-CSG-QR-1024x633.png" alt="" width="558" height="345" srcset="https://www.sandyscott.net/wp-content/uploads/2017/06/MB-CSG-QR-1024x633.png 1024w, https://www.sandyscott.net/wp-content/uploads/2017/06/MB-CSG-QR-300x185.png 300w, https://www.sandyscott.net/wp-content/uploads/2017/06/MB-CSG-QR-768x475.png 768w, https://www.sandyscott.net/wp-content/uploads/2017/06/MB-CSG-QR.png 1179w" sizes="(max-width: 558px) 100vw, 558px" /></a></p>
<p>Alternatively, check out the full <a href="https://musicbrainz.org/doc/Style/Classical">Classical Style Guide</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2016/04/musicbrainz-classical-style-guide-quick-reference/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
