<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Software Development on The Final Artefact</title><link>https://www.thefinalartefact.xyz/categories/software-development/</link><description>Recent content in Software Development on The Final Artefact</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Wed, 16 Mar 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://www.thefinalartefact.xyz/categories/software-development/index.xml" rel="self" type="application/rss+xml"/><item><title>On Structuring Python Projects</title><link>https://www.thefinalartefact.xyz/post/python-project-structure/</link><pubDate>Wed, 16 Mar 2022 00:00:00 +0000</pubDate><guid>https://www.thefinalartefact.xyz/post/python-project-structure/</guid><description>&lt;h2 id="types-of-projects"&gt;Types of Projects&lt;/h2&gt;
&lt;p&gt;The term &lt;em&gt;Python project&lt;/em&gt; can be somewhat misleading. While languages like Swift are designed for specific purposes such as generating macOS/iOS apps, components, and frameworks, Python is used in a much more versatile manner. A &lt;em&gt;Python project&lt;/em&gt; might range from an analytical solution developed across multiple Jupyter notebooks to a standalone script querying a database API and extracting results to an application or package facilitating the deployment of models. Each of these projects has its own key usability requirements. For instance, if end-users will utilize our project through a command-line interface, we will focus on argument parsing and other elements facilitating user-friendly execution.&lt;/p&gt;</description></item><item><title>Beauty of R and Big-O</title><link>https://www.thefinalartefact.xyz/post/beauty-of-r-and-big-o/</link><pubDate>Thu, 09 Dec 2021 00:00:00 +0000</pubDate><guid>https://www.thefinalartefact.xyz/post/beauty-of-r-and-big-o/</guid><description>&lt;script src="index_files/kePrint/kePrint.js"&gt;&lt;/script&gt;
&lt;link href="index_files/lightable/lightable.css" rel="stylesheet" /&gt;
&lt;h2 id="big-o"&gt;Big-O&lt;/h2&gt;
&lt;p&gt;The purpose of this is not to provide yet another primer on the Big-O/$\Omega$/$\Theta$ notation but to share my enduring appreciation for working with R. I will introduce Big-O only briefly to provide context but I would refer all of those who are interested to the linked materials.&lt;/p&gt;
&lt;h2 id="what-is-big-sth-notation"&gt;What is Big-sth notation&lt;/h2&gt;
&lt;p&gt;When analysing functions, we may be interested in knowing how fast a function grows. For instance, for function &lt;code&gt;\(T(n)=4n^2-2n+2\)&lt;/code&gt;, after ignoring constants, we would say that &lt;code&gt;\(T(n)\)&lt;/code&gt; grows at the order of &lt;code&gt;\(n^2\)&lt;/code&gt;. With respect to the &lt;em&gt;Big-O&lt;/em&gt; notation we would write &lt;code&gt;\(T(n)=O(n^2)\)&lt;/code&gt;^[MIT. (2021, December 9). Big O notation. Introduction to Computers and Programming. Retrieved December 26, 2021, from &lt;a href="https://web.mit.edu/16.070/www/lecture/big_o.pdf"&gt;https://web.mit.edu/16.070/www/lecture/big_o.pdf&lt;/a&gt;]. Most commonly, in computer science, we would differentiate between Big O, Big Theta &lt;code&gt;\((\Theta)\)&lt;/code&gt; and Big Omega &lt;code&gt;\((\Omega)\)&lt;/code&gt;. In a nutshell, the differences between those common notations can be summarised as follows:&lt;/p&gt;</description></item><item><title>Why regex is not fuzzy matching</title><link>https://www.thefinalartefact.xyz/post/why-regex-is-not-fuzzy-matching/</link><pubDate>Tue, 29 Jun 2021 00:00:00 +0000</pubDate><guid>https://www.thefinalartefact.xyz/post/why-regex-is-not-fuzzy-matching/</guid><description>&lt;p&gt;Recently, I cam across an interesting discussion on StackOverflow^[SO discussion on: &lt;a href="https://stackoverflow.com/a/68182330/1655567"&gt;&lt;em&gt;Fuzzy Join with Partial String Match in R&lt;/em&gt;&lt;/a&gt;] pertaining to approach to fuzzy matching tables in R. Good answer contributed by one of the most resilient and excellent contributors to whom I owe a lot of thanks for help suggested relying on regular expression, combining this with basic string removal and transformations like &lt;code&gt;toupper&lt;/code&gt; to deterministically match the tables. The solution solved the problem and was accepted.&lt;/p&gt;</description></item><item><title>On Sorting Arrays...or why it's good to read the actual assignment</title><link>https://www.thefinalartefact.xyz/post/fun-with-sortting-arrays/</link><pubDate>Sun, 23 May 2021 00:00:00 +0000</pubDate><guid>https://www.thefinalartefact.xyz/post/fun-with-sortting-arrays/</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;Solving challenges on &lt;a href="https://projecteuler.net"&gt;project Euler&lt;/a&gt; or &lt;a href="https://www.hackerrank.com/"&gt;HackerRank&lt;/a&gt; is a good past time. For folks working in the wider analaytical / data science field, places like project Euler provide an excellent opportunity to work with academic programming concepts that do not frequently appear in real-life. I was looking at common problem:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;You are given an unordered array consisting of consecutive integers [1, 2, 3, &amp;hellip;, n] without any duplicates. You are allowed to swap any two elements. Find the minimum number of swaps required to sort the array in ascending order.&lt;br&gt;
Example
Perform the following steps:&lt;/p&gt;</description></item><item><title>Three-Way Operator in R</title><link>https://www.thefinalartefact.xyz/post/three-way-operator-in-r/</link><pubDate>Fri, 08 May 2020 00:00:00 +0000</pubDate><guid>https://www.thefinalartefact.xyz/post/three-way-operator-in-r/</guid><description>&lt;p&gt;Is there a merit for a three-way operator in R?&lt;/p&gt;
&lt;h2 id="background"&gt;Background&lt;/h2&gt;
&lt;p&gt;In C++20 revision added &amp;ldquo;spaceship operator&amp;rdquo;, &lt;a href="https://en.cppreference.com/w/cpp/language/operator_comparison#Three-way_comparison"&gt;which is defined as follows&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-r" data-lang="r"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;# if lhs &amp;lt; rhs&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;# if lhs &amp;gt; rhs&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;# if lhs and rhs are equal/equivalent.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="r-implementation"&gt;R implementation&lt;/h2&gt;
&lt;p&gt;The behaviour can be achieved in R in multiple ways. A one straightforward approach would involve making use of the &lt;code&gt;ifelse&lt;/code&gt; statement&lt;/p&gt;
&lt;h2 id="ifelse-implementation"&gt;&lt;code&gt;ifelse&lt;/code&gt; implementation&lt;/h2&gt;
&lt;p&gt;Basic approach would involve comparing the two figures and respectively returning &lt;code&gt;-1&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; consistently with the definition above.&lt;/p&gt;</description></item><item><title>Amusing way to get user input windows in R</title><link>https://www.thefinalartefact.xyz/post/amusing-way-to-get-user-input-windows-in-r/</link><pubDate>Wed, 01 Feb 2012 00:00:00 +0000</pubDate><guid>https://www.thefinalartefact.xyz/post/amusing-way-to-get-user-input-windows-in-r/</guid><description>&lt;p&gt;In an unlikely scenario that beautiful &lt;a href="http://shiny.rstudio.com/" target="_blank" rel="noopener"&gt;Shiny &lt;/a&gt;apps do not meet your analytical requirements and developing a full-blown user interface. in &lt;a href="http://www.ggobi.org/rgtk2/"&gt;RGtk2&lt;/a&gt; may seem to be a little too much, there is a third, often overlooked solution, - package &lt;a href="https://cran.r-project.org/web/packages/svDialogs/index.html"&gt;svDialogs&lt;/a&gt; by Philippe Grosjean. The package in a convenient way enables user to create various interface gadgets. For example the code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-r" data-lang="r"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;svDialogs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;## Let&amp;#39;s keep some data in one place&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;user_figure&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;svDialogs&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;dlg_input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;would result in the following window being presented to the user:&lt;/p&gt;</description></item></channel></rss>