<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hugo Dahl</title>
    <description>The latest articles on DEV Community by Hugo Dahl (@hugodahl).</description>
    <link>https://dev.to/hugodahl</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%2F280767%2F51fece39-ac97-4caa-ae97-e673718b3f06.jpeg</url>
      <title>DEV Community: Hugo Dahl</title>
      <link>https://dev.to/hugodahl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hugodahl"/>
    <language>en</language>
    <item>
      <title>Some Helpful Git Commands</title>
      <dc:creator>Hugo Dahl</dc:creator>
      <pubDate>Sat, 06 Feb 2021 20:19:56 +0000</pubDate>
      <link>https://dev.to/hugodahl/some-helpful-git-commands-2kn6</link>
      <guid>https://dev.to/hugodahl/some-helpful-git-commands-2kn6</guid>
      <description>&lt;h1&gt;
  
  
  (Re)naming Things is Hard!
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What's the deal?
&lt;/h2&gt;

&lt;p&gt;Working through a few things while following along with &lt;a href="https://github.com/foamyguy"&gt;@foamyguy&lt;/a&gt; from the &lt;a href="https://adafruit.com"&gt;Adafruit&lt;/a&gt; community, who was streaming some pull request reviews &lt;a href="https://www.youtube.com/watch?v=bLYdzeOxG1U"&gt;on YouTube&lt;/a&gt;, a few git "gotchas" were mentioned. A few of these have to do with the order of operations, others are a personal preference, so I thought I'd share the various configurations and commands used, and to help me remember when I next need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  git clone, origin, upstream fork you up
&lt;/h2&gt;

&lt;p&gt;Depending on your personal workflow when working with a repository that isn't yours, you might or might not run into this issue. In this case, @foamyguy (and me, and others I know) run into this issue where we clone the original repository, hack away and do some work, commit and try to push our changes, only to realize, we're trying to push to a repository where we don't have access... or worse, where we DO have access (like the principal one), and mess things up for everyone. In this case, if we want to name our default remote something other than "origin", there are a few options...&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Set the remote name when you clone it&lt;br&gt;
&lt;code&gt;git clone myownremote https://github.com/.....&lt;/code&gt;&lt;br&gt;
This will name the remote "myownremote" instead of "origin"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rename the remote after you clone it when you remember.&lt;br&gt;
&lt;code&gt;git remote rename origin montypython&lt;/code&gt;&lt;br&gt;
This will rename the remote called "origin" for the current repository to "montypython".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set the default remote name in git's configuration. WUT???&lt;br&gt;
&lt;code&gt;git config --global --clone.defaultRemoteName source&lt;/code&gt;&lt;br&gt;
That's right, if you're not fond of the default name "origin", you can choose a default name that you prefer. So if you prefer to name your default remote "source", you can tell git to name it so by default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Bonus Round - GitHub Edition!&lt;br&gt;
If you use GitHub as your main repository, you can use their recently released &lt;a href="https://github.com/cli/cli"&gt;command line tool&lt;/a&gt;, "gh". If you use their "repo" functionality with the "fork" verb, it will automatically perform the following tasks for you&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create your own fork of the repository on GitHub&lt;/li&gt;
&lt;li&gt;Clone the repository to your local system&lt;/li&gt;
&lt;li&gt;Setup your fork on GitHub as "origin"&lt;/li&gt;
&lt;li&gt;Setup the original source as "upstream"
To do this for a project owned by the account called "projectowner" with the repository name "super-project", the command is this simple...
&lt;code&gt;gh repo fork projectowner/super-project&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;


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

&lt;p&gt;&lt;em&gt;Edit to add&lt;/em&gt;: I just happened to clone another repository using the &lt;a href="https://github.com/cli/cli"&gt;GitHub CLI&lt;/a&gt;, using the &lt;code&gt;gh repo clone&lt;/code&gt; (since I didn't need a fork), and since it's ultimately using &lt;code&gt;git&lt;/code&gt; for any of git operations, if set your configuration as in step #3, your default remote name configuration will be applied.&lt;/p&gt;

&lt;h2&gt;
  
  
  Branches have names too, you know!
&lt;/h2&gt;

&lt;p&gt;Branches behave in a similar manner to remotes, but the syntax to change them is significantly different. But it's worth knowing how to name or rename them to how you want them.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Renaming an existing branch&lt;br&gt;
&lt;code&gt;git branch -m old-and-busted bugfix/This-shall-not-fail&lt;/code&gt;&lt;br&gt;
In this case, we're calling the "move" (-m) command for branch "old-and-busted" and changing it to "bugfix/This-shall-not-fail". A way to help remember is that this follows the pattern to rename items in Unix and Linux based systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Giving it a name at checkout&lt;br&gt;
&lt;code&gt;git checkout -b feature/I-name-things-good&lt;/code&gt;&lt;br&gt;
This will checkout a new branch called "I-name-things-good", based either on the current branch and commit (HEAD) where you are now or based on a branch in the remote with the same name if there is one based on the &lt;a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-checkoutdefaultRemote"&gt;checkout.defaultRemote&lt;/a&gt; configuration value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Greet it a nickname&lt;br&gt;
&lt;code&gt;git checkout -b ralph feature/I-name-things-good&lt;/code&gt;&lt;br&gt;
What this will do is nearly a duplicate of option #2 above, with the exception that you're a) explicitly specifying a source branch, and b) explicitly naming your branch something different. In this case, we're checking out the branch identified as "feature/I-name-things-good" on the remote to our local repository with the name "ralph".&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The End/Fin/Closing Credits/Final Curtain
&lt;/h2&gt;

&lt;p&gt;So those are the two &lt;em&gt;major&lt;/em&gt; renaming activities that are done in git. Sure, there are others, but in my experience, the need to use them is so rare, I don't actually remember quite when the last time happened to be! &lt;/p&gt;

</description>
      <category>git</category>
      <category>cli</category>
      <category>configuration</category>
    </item>
    <item>
      <title>CircuitPython 2021</title>
      <dc:creator>Hugo Dahl</dc:creator>
      <pubDate>Mon, 04 Jan 2021 02:37:53 +0000</pubDate>
      <link>https://dev.to/hugodahl/circuitpython-20213-355m</link>
      <guid>https://dev.to/hugodahl/circuitpython-20213-355m</guid>
      <description>&lt;h1&gt;
  
  
  Where Do I Think CircuitPython Should Focus for 2021
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What &lt;strong&gt;IS&lt;/strong&gt; a CircuitPython Anyway?
&lt;/h2&gt;

&lt;p&gt;No, it's not some sort of snake or reptile. Nor is it some sort of SteamPunked techno-jazzed &lt;a href="https://en.wikipedia.org/wiki/Ouroboros"&gt;Ourobouros&lt;/a&gt;. CircuitPython is an adaptation of the &lt;a href="https://python.org"&gt;Python&lt;/a&gt; programming language with a focus on &lt;a href="https://en.wikipedia.org/wiki/Microcontroller"&gt;MicroControllers&lt;/a&gt;. These can be used for all sorts of purposes, such as monitoring air quality, making blinky lights, operating garage doors, automatically feeding pets, etc. Pretty much anything to which you would say "It would be nice to have a gadget that ...", you're likely thinking about something that uses a MicroController.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do I Care About CircuitPython Anyway?
&lt;/h2&gt;

&lt;p&gt;This past year, particularly the last 5-6 months, I've started &lt;em&gt;REALLY&lt;/em&gt; getting into the hardware side of technology. I've had a more than mild interest in it for quite some time, but things never seemed to line up for me to really do more than just dip the proverbial toe in.&lt;/p&gt;

&lt;p&gt;This past year, like for so many other people out there, hobbies and mental distractions, such as reading, really helped keep things in some form of perspective. And so, I started investing more of my time in reading, learning, and really forging ahead with my hardware interest.&lt;/p&gt;

&lt;p&gt;I've been following the work, projects and community of an incredible hardware company, &lt;a href="https://adafruit.com"&gt;Adafruit&lt;/a&gt;, for quite some time. What makes them incredible? Glad you asked, I made a list, albeit incomplete:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are an open-source hardware company&lt;/li&gt;
&lt;li&gt;They support the community in so many ways&lt;/li&gt;
&lt;li&gt;Their code of ethics is well laid out (see their &lt;a href="https://www.adafruit.com/editorialstandards"&gt;editorial standards&lt;/a&gt; to get a good idea)&lt;/li&gt;
&lt;li&gt;Their focus on education and enriching lives is HUGE, and at the core of their principles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While I could go on, and elaborate on many of those items and many more, that's not what's on my mind today. Today, they shared a &lt;a href="https://blog.adafruit.com/2021/01/01/where-should-circuitpython-go-in-2021-circuitpython2021-circuitpython/"&gt;blog post&lt;/a&gt; regarding where their programming language, &lt;a href="https://circuitpython.org"&gt;CircuitPython&lt;/a&gt; should focus for this year. Being such a community focussed organization, they're seeking, like they do every year, input from the community of CircuitPython users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ok, Genius. What Are Your "Great" Ideas?
&lt;/h2&gt;

&lt;p&gt;Since I've really been neck-deep in it lately, I had a few ideas which I thought I would contribute, in case others out there also thought of, or raise pain points which others have either accepted or found alternate workarounds for.&lt;/p&gt;

&lt;p&gt;As such, here are some of the things I've had ideas about doing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Managing libraries, and their dependencies&lt;/li&gt;
&lt;li&gt;Localization(ability?) of the platform&lt;/li&gt;
&lt;li&gt;"Build" tool&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Ok. Tell Me More...
&lt;/h2&gt;

&lt;h3&gt;
  
  
  #1 - Library Management
&lt;/h3&gt;

&lt;p&gt;One of the biggest pain points I've run into, and that I've noticed other users have as well, is making sure that all the required libraries for a given project, as well as their dependencies, are included and copied to the microcontroller. Having a tool that can manage the libraries and dependencies would make ensuring that nothing gets missed when testing the project on actual hardware.&lt;/p&gt;

&lt;p&gt;Another benefit is that the base image for each board could be made much smaller so that only the libraries necessary are installed. For example, if you're using a board that has audio capabilities, but don't intend to have any audio as part of your project, that library can be left out. The benefits of this would likely be minimal since the CircuitPython language and framework exist in a different section of storage on the board - at least, that's my understanding of it. However, it might allow for simpler builds of CircuitPython across various boards based on the same platform.&lt;/p&gt;




&lt;h3&gt;
  
  
  #2 - Localizationability..ness of the platform
&lt;/h3&gt;

&lt;p&gt;Another addition that might be nice for the platform and its wider adoption, is having the libraries be set up in a manner that would allow them to be localizable. The core framework and language are already localizable, and there are already &lt;a href="https://hosted.weblate.org/projects/circuitpython/"&gt;many translations&lt;/a&gt; underway.&lt;/p&gt;

&lt;p&gt;However, with the various libraries for the huge assortment of peripherals and sensors from both Adafruit and others in the community or developed by 3rd parties, most aren't localized, and there isn't a pattern or technique defined for localization. Part of the issue might also be that there's no way, at least that I've seen, to know which locale (language) is deployed to the board. Perhaps someplace helpful to put that, if not as part of the global memory space, would be to read it from the &lt;code&gt;boot_out.txt&lt;/code&gt; file, as I've seen done for information regarding the version of CircuitPython installed on the board.&lt;/p&gt;

&lt;p&gt;Being able to select either a &lt;code&gt;.mpy&lt;/code&gt; file to copy to the board or better yet, a specific file-per-language which can be copied to the board, next to the &lt;code&gt;.mpy&lt;/code&gt; file. Something like a &lt;code&gt;.cpl&lt;/code&gt; for [C]ircuit[P]ython [L]ocale, or whatever would be determined to suit the community.&lt;/p&gt;




&lt;h3&gt;
  
  
  #3 A "Build" &amp;amp; Deploy Utility
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;note&lt;/em&gt;: This one turned out going on much longer than the previous two, and I detailed maybe a bit too much. Maybe it's a sign of putting too much functionality into it. So maybe it's a "suite"? Either way, it's a jumping-off point.&lt;/p&gt;

&lt;p&gt;The final thought I had, which also quite nicely ties into the first to, is a type of packaging and deployment tool so that development can be done locally on a system that is separate from the microcontroller device, without the need to be connected to said device.&lt;/p&gt;

&lt;p&gt;This tool could incorporate a few helpful features related to developing detached from the device. Features such as trimming excessive storage use within the code, by (optionally) stripping comments, reducing extra and simplifying whitespace (replace &lt;em&gt;x&lt;/em&gt; spaces with a single tab, spaces within parenthesis), and other options similar to modification in Javascript.&lt;/p&gt;

&lt;p&gt;This would also provide a uniform manner in which a linter could be used, with default "best practices" rules. These would be applied to the development code, that is, the code on the computer, and not the code pushed to the microcontroller.&lt;/p&gt;

&lt;p&gt;Additionally, given that using &lt;code&gt;print()&lt;/code&gt; statements for debugging is such a standard technique, it could allow stripping those calls from the code. Alternatively, it could lead to adding one or more similar methods, such as &lt;code&gt;log()&lt;/code&gt;, &lt;code&gt;debug()&lt;/code&gt;, &lt;code&gt;warn()&lt;/code&gt; and the likes, or possibly a separate module. That module, or the calls to the debugging methods, could optionally be stripped out of the "release" code, so that the &lt;code&gt;print()&lt;/code&gt; calls remain. Or to keep it more in line with the root Python language, making use of &lt;a href="https://wiki.python.org/moin/PythonDecorators"&gt;python decorators&lt;/a&gt; for debugging output? It would avoid the need to add and remove these debugging statements (if leaving them in but commented out takes too much storage space) after the problem has been isolated and rectified.&lt;/p&gt;

&lt;p&gt;So this utility, combined with the functionality I described above in #1, would ensure that only the libraries necessary for the project, given the target board, would be copied. And when combined with what I've described with localization in #2, would ensure that the correct resources/files are deployed for the specified locale.&lt;/p&gt;

&lt;p&gt;It could also, in the longer term, be used for updating the version of CircuitPython on the target board with ease for newer users, who are either unsure of themselves and their abilities or have a harder time getting the devices in boot-loader mode.&lt;/p&gt;

&lt;p&gt;The final benefit of such a tool is to allow for the full copy of all files to the target device, without triggering a soft-reboot mid-copy. There are issues with editors who do not write files in a single block to CircuitPython devices, causing them to reboot mid-copy. There are also external utilities, such as operating system services/daemons, backup utilities, antivirus scanners, malware detectors, and their likes, which have caused issues rebooting boards unexpectedly due to a misguided "write".&lt;/p&gt;

&lt;p&gt;Having a way such as this utility, that prevents the untimely occurrence of a soft-reboot, could be beneficial. In essence, a polite utility, which will hold the metaphorical door open for someone moving something heavy into a building.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are We There Yet?
&lt;/h2&gt;

&lt;p&gt;So there you have it, things that I believe would be of value to the CircuitPython ecosystem and community, that could be explored and developed for 2021, and quite possibly expanded upon for a few years thereafter. So how far off into left-field am I with these ideas? Am I in the same ballpark? Am I even playing the same sport??? I guess I'll find out!&lt;/p&gt;

&lt;p&gt;I'm also &lt;em&gt;extremely&lt;/em&gt; curious to hear what others in the community, especially the core developers and maintainers of the ecosystem, have as far as plans and proposals for the year. Regardless of what those are, I for one, &lt;del&gt;welcome our new steam-punked snake overlords&lt;/del&gt; look forward to helping out in any meaningful way that I can!&lt;/p&gt;

</description>
      <category>circuitpython</category>
      <category>hardware</category>
      <category>circuitpython2021</category>
    </item>
  </channel>
</rss>
