<?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: Dan Benitah</title>
    <description>The latest articles on DEV Community by Dan Benitah (@danuw).</description>
    <link>https://dev.to/danuw</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%2F444425%2Fbcbdb821-e88e-43dd-82ce-0dc9959eca1c.png</url>
      <title>DEV Community: Dan Benitah</title>
      <link>https://dev.to/danuw</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/danuw"/>
    <language>en</language>
    <item>
      <title>Git clone - that repo is too big : HELP!</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Tue, 03 Dec 2024 20:54:00 +0000</pubDate>
      <link>https://dev.to/danuw/git-clone-that-repo-is-too-big-help-4chn</link>
      <guid>https://dev.to/danuw/git-clone-that-repo-is-too-big-help-4chn</guid>
      <description>&lt;p&gt;Working with large repositories can be challenging, especially when you only need a specific directory. Instead of wasting time and storage, here's a guide to efficiently clone sub-directories using &lt;a href="https://git-scm.com/docs/git-sparse-checkout" rel="noopener noreferrer"&gt;&lt;code&gt;git-sparse-checkout&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Clone the Repository with Sparse Checkout
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;--depth 1&lt;/code&gt; flag to clone only the latest commit, and &lt;code&gt;--filter=blob:none&lt;/code&gt; to avoid downloading file contents initially:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone &lt;span class="nt"&gt;--depth&lt;/span&gt; 1 &lt;span class="nt"&gt;--filter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;blob:none https://github.com/danuw/azure-docs.git &lt;span class="nt"&gt;--sparse&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Resulted in following (note the size of 307 kiB downloaded when the repo is gigabytes heavy!!)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cloning into 'azure-docs'...
remote: Enumerating objects: 8438, done.
remote: Counting objects: 100% (8438/8438), done.
remote: Compressing objects: 100% (7673/7673), done.
remote: Total 8438 (delta 51), reused 4682 (delta 25), pack-reused 0 (from 0)
Receiving objects: 100% (8438/8438), 2.56 MiB | 16.60 MiB/s, done.
Resolving deltas: 100% (51/51), done.
remote: Enumerating objects: 85, done.
remote: Counting objects: 100% (85/85), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 85 (delta 52), reused 16 (delta 4), pack-reused 0 (from 0)
Receiving objects: 100% (85/85), 307.16 KiB | 5.04 MiB/s, done.
Resolving deltas: 100% (52/52), done.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Navigate to the Cloned Repository
&lt;/h2&gt;

&lt;p&gt;Change your directory to the cloned repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;azure-docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Initialize Sparse Checkout Mode
&lt;/h2&gt;

&lt;p&gt;Enable sparse checkout in cone mode, which simplifies the process of selecting specific directories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git sparse-checkout init &lt;span class="nt"&gt;--cone&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Set the Directory to be Checked Out
&lt;/h2&gt;

&lt;p&gt;Specify the directory you want to check out from the repository. In this example, we are checking out the articles/iot-operations directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git sparse-checkout &lt;span class="nb"&gt;set &lt;/span&gt;articles/iot-operations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: If you encounter an error, ensure that your Git version supports sparse checkout, that the specified directory exists in the repository or that the syntax is adapted to your local system (Windows, MacOS, Linux?...)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After these steps, only the files within the articles/iot-operations directory will be checked out into your local repository, minimizing the data you download and store.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;remote: Enumerating objects: 189, done.
remote: Counting objects: 100% (189/189), done.
remote: Compressing objects: 100% (182/182), done.
remote: Total 189 (delta 10), reused 106 (delta 7), pack-reused 0 (from 0)
Receiving objects: 100% (189/189), 10.96 MiB | 21.30 MiB/s, done.
Resolving deltas: 100% (10/10), done.
Updating files: 100% (190/190), done.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;This method is particularly useful when storage space is limited or when working with a slow connection. Whether you're cloning a specific lab version or just a part of a broader documentation set (e.g., for LLMs or RAG purposes), this guide offers a simple and effective solution.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Additional Notes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Originally published as a &lt;a href="https://gist.github.com/danuw/123960b95ed1dc6c5b5eb4e94dbed158" rel="noopener noreferrer"&gt;GitHub Gist&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For those following Microsoft documentation, this tip may soon be available directly across labs and tutorials, as seen in &lt;a href="https://learn.microsoft.com/en-us/aspnet/core/security/authorization/secure-data?view=aspnetcore-9.0#the-starter-and-completed-app" rel="noopener noreferrer"&gt;this example&lt;/a&gt; and its &lt;a href="https://github.com/dotnet/AspNetCore.Docs/pull/34239" rel="noopener noreferrer"&gt;PR&lt;/a&gt;.&lt;a href="https://github.com/dotnet/AspNetCore.Docs/pull/34239" rel="noopener noreferrer"&gt;https://github.com/dotnet/AspNetCore.Docs/pull/34239&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

</description>
      <category>tutorial</category>
      <category>git</category>
      <category>rag</category>
    </item>
    <item>
      <title>Upgrading Python version for your Microsoft Fabric environment</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Thu, 12 Sep 2024 16:40:00 +0000</pubDate>
      <link>https://dev.to/danuw/upgrading-python-version-for-your-microsoft-fabric-environment-5a94</link>
      <guid>https://dev.to/danuw/upgrading-python-version-for-your-microsoft-fabric-environment-5a94</guid>
      <description>&lt;p&gt;I was recently stuck trying to re-run a python notebook in Fabric using the &lt;a href="https://pypi.org/project/azure-eventhub/" rel="noopener noreferrer"&gt;Azure Event Hub&lt;/a&gt; package to upload data to a KQL database. The script, which had been running smoothly for months, suddenly stopped working after an environment change or update.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;UPDATE: bringing forward this note as it should be a better solution to use&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: I later found a note about my issue in some training training material, which had been my first solution without the &lt;code&gt;--force&lt;/code&gt; parameter. That may be a better solution for you if you needed to keep the Spark Runtime unchanged &lt;a href="https://github.com/microsoft/FabricRTA-in-a-Day/blob/main/Lab3.md#steps" rel="noopener noreferrer"&gt;https://github.com/microsoft/FabricRTA-in-a-Day/blob/main/Lab3.md#steps&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;The first issue I was facing was the following when installing the package in my notebook.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ERROR: pip's dependency resolver does not currently take into account all the packages that are installed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This error indicates that the package dependencies are conflicting, which often occurs due to Python environment version incompatibilities or misaligned dependencies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3iji39tffcqfurh6gdyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3iji39tffcqfurh6gdyv.png" alt="pip's dependency resolver does not currently take into account all the packages that are installed" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When trying to import the package, I could see the environment was set to 3.10 (see below).&lt;br&gt;
And when trying to create my own environment, I could not find &lt;code&gt;azure-eventhub&lt;/code&gt; pypi package either (&lt;a href="https://learn.microsoft.com/en-us/fabric/data-engineering/environment-manage-library#public-libraries" rel="noopener noreferrer"&gt;see here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuunhi489s7ihctc2swr9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuunhi489s7ihctc2swr9.png" alt="Import issues 1" width="800" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgo467dgj3ajw0k40n34g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgo467dgj3ajw0k40n34g.png" alt="Import issues 2" width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Eventually, I tried to figure out how to upgrade the python environment, and with the help of a friend, I was able to do so.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4l8dk1zd666y1t5b05h0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4l8dk1zd666y1t5b05h0.png" alt="Spark Runtimes" width="800" height="526"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The solution was upgrade the PySpark environment.&lt;br&gt;
It resolved the issue by updating the Python runtime to a compatible version with the &lt;code&gt;azure-eventhub&lt;/code&gt; package. Switching to Spark Runtime 1.3 updated Python to version 3.11.x, resolving dependency conflicts.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to change the Spark Runtime to 1.3
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to the Workspace settings.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs18skiwjwegs5u0qrtcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs18skiwjwegs5u0qrtcx.png" alt="Workspace settings" width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the appropriate runtime from the dropdown list.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhzrr1410yjnoag3vuagj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhzrr1410yjnoag3vuagj.png" alt="How to change Spark Runtime to 1.3" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Save and restart your notebook.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Validation of the Environment Upgrade
&lt;/h2&gt;

&lt;p&gt;Now the changes have been apply, create a new notebook ensuring the selected environment uses the Spark Runtime 1.3.&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;# Check if the environment upgrade was successful
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;azure.eventhub&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;Environment setup successful!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Upgrading the Python environment in Fabric by changing the Spark runtime resolved the dependency conflicts I faced with the &lt;code&gt;azure-eventhub&lt;/code&gt; package. If you encounter similar issues, adjusting the runtime version can be a quick fix. Remember to validate your changes and test your script to ensure everything is working smoothly.&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/fabric/data-engineering/runtime" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/fabric/data-engineering/runtime&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/azure-eventhub/" rel="noopener noreferrer"&gt;https://pypi.org/project/azure-eventhub/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py" rel="noopener noreferrer"&gt;https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>microsoftfabric</category>
      <category>notebook</category>
      <category>python</category>
    </item>
    <item>
      <title>Speeding up installation of AIO (Azure IoT Operations) deployment using a script</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Sat, 01 Jun 2024 23:57:05 +0000</pubDate>
      <link>https://dev.to/danuw/re-installing-aio-azure-iot-operations-5f73</link>
      <guid>https://dev.to/danuw/re-installing-aio-azure-iot-operations-5f73</guid>
      <description>&lt;p&gt;If you're eager to learn more about AIO (Azure IoT Operations), which is currently in private preview, it's crucial to start with a fresh install to experiment quickly and efficiently. In this post, I will guide you through the steps to reinstall your cluster using a script, ensuring a smooth learning experience. Let's get started!&lt;/p&gt;

&lt;p&gt;For now, the assumption is that you are using &lt;a href="https://learn.microsoft.com/en-us/azure/iot-operations/get-started/quickstart-deploy#connect-a-kubernetes-cluster-to-azure-arc" rel="noopener noreferrer"&gt;fresh codespace using those steps&lt;/a&gt;. Updated script for physical machines with Ubuntu server coming soon...&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup the cluster again and deploy the AIO extension
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: if your are looking at a &lt;a href="https://github.com/Azure/azure-iot-operations/releases" rel="noopener noreferrer"&gt;new version of AIO&lt;/a&gt;, the script may need adapting - this has been tested with AIO v0.5-preview at the time of writing&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  1. Set up your variables
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1.a RESOURCE_GROUP
&lt;/h4&gt;

&lt;p&gt;When you created your Codespace, you had to provide some variable values such as the resource group, so double check that the resource group variable is what you expect with &lt;code&gt;echo $RESOURCE_GROUP&lt;/code&gt;, and otherwise set it using (update value as needed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;RESOURCE_GROUP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;aio-codespace-rg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  1.b IOT OPS USER_EMAIL
&lt;/h4&gt;

&lt;p&gt;To ensure your user can access the AIO UI, specify your IoT Ops user email with the following command, replacing  with your actual email address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;USER_EMAIL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;your-email&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: Remember that user needs to be a member of the tenant such as &lt;a href="mailto:iotops@YOUTENANT.onmicrosoft.com"&gt;iotops@YOUTENANT.onmicrosoft.com&lt;/a&gt;&lt;br&gt;
If you do not have one, use &lt;code&gt;export USER_EMAIL=$(az ad user create --display-name 'IoT Ops User' --password &amp;lt;PASSOWRD&amp;gt; --user-principal-name iotop@&amp;lt;TENANTNAME&amp;gt;.onmicrosoft.com --force-change-password-next-sign-in false -o tsv --query userPrincipalName)&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  1.c Other Variables (optional)
&lt;/h3&gt;

&lt;p&gt;Consider double checking other environment variables such as the $CLUSTER_NAME to suit your preferences.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Login
&lt;/h3&gt;

&lt;p&gt;Ensure you are signed into your Azure Account by running the following command in your terminal, then follow the instructions in your browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;az login &lt;span class="nt"&gt;--use-device-code&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Run your setup script
&lt;/h3&gt;

&lt;p&gt;Create a file named setup.sh in your Codespace and copy the content from &lt;a href="https://gist.github.com/danuw/37c931341d5cde145564a5bfe05cc4c7/2fb3c5452d273a884da1dd8a28a7100bdfd1a656" rel="noopener noreferrer"&gt;this gist&lt;/a&gt; into it.&lt;/p&gt;

&lt;p&gt;Once you have updated your variables and logged into Azure, you are ready to run the script with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;.&lt;/span&gt; ./setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdwh6tbofk7orfubey7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdwh6tbofk7orfubey7g.png" alt="Running the command in Codespace" width="522" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Currently tested on Codespace, but will soon update with script for Ubuntu server including Az CLI install and other pre-requisites for re-install&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  4. Manual Validation
&lt;/h3&gt;

&lt;p&gt;Based on experience, if your Codespace setup remains unchanged (same number of cores, etc.), you can expect this whole process to take approximately 25 minutes.&lt;/p&gt;

&lt;p&gt;After the process completes, navigate to &lt;a href="https://iotoperations.azure.com" rel="noopener noreferrer"&gt;IoT Operations Portal&lt;/a&gt; and sign in with your member user account. You should see your cluster listed as connected.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywljgzxxrg8odk6eup2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywljgzxxrg8odk6eup2d.png" alt="IoT Operations Portal with your connected cluster" width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next?
&lt;/h2&gt;

&lt;p&gt;Thank you for reading this far. I hope this script helps you experiment faster with AIO. In the future, I plan to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expand the script with new steps: As AIO evolves and more APIs become available, additional processes can be automated. You may also consider improving the script as you explore or revisit the latest features, in which case don't forget to let me know in the gist's comments.&lt;/li&gt;
&lt;li&gt;Cover more scenarios, such as creating assets using CLI.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Azure/azure-iot-ops-cli-extension" rel="noopener noreferrer"&gt;https://github.com/Azure/azure-iot-ops-cli-extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/cli/azure/iot/ops?view=azure-cli-latest" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/cli/azure/iot/ops?view=azure-cli-latest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/custom-locations" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/custom-locations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/iot-operations/get-started/quickstart-deploy" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/iot-operations/get-started/quickstart-deploy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/iot-operations/manage-devices-assets/howto-manage-assets-remotely?tabs=cli" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/iot-operations/manage-devices-assets/howto-manage-assets-remotely?tabs=cli&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aio</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>AIO : Unable to read /etc/rancher/k3s/k3s.yaml, please start server with --write-kubeconfig-mode to modify ... permissions</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Thu, 02 May 2024 16:06:52 +0000</pubDate>
      <link>https://dev.to/danuw/aio-unable-to-read-etcrancherk3sk3syaml-please-start-server-with-write-kubeconfig-mode-to-modify-permissions-3le7</link>
      <guid>https://dev.to/danuw/aio-unable-to-read-etcrancherk3sk3syaml-please-start-server-with-write-kubeconfig-mode-to-modify-permissions-3le7</guid>
      <description>&lt;p&gt;Using Azure IoT Operations (AIO) and found that issue of permissions denied and the cluster not running with the following messages? Here is how I fixed it...&lt;/p&gt;

&lt;p&gt;When I connect to my clusters, my first action is to check if my pods or services are running with the following command, but recently I have at times been getting the subsequent output error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;kubectl get service &lt;span class="nt"&gt;-n&lt;/span&gt; azure-iot-operations
WARN[0000] Unable to &lt;span class="nb"&gt;read&lt;/span&gt; /etc/rancher/k3s/k3s.yaml, please start server with &lt;span class="nt"&gt;--write-kubeconfig-mode&lt;/span&gt; to modify kube config permissions
error: error loading config file &lt;span class="s2"&gt;"/etc/rancher/k3s/k3s.yaml"&lt;/span&gt;: open /etc/rancher/k3s/k3s.yaml: permission denied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tried the following solution using this command, but that was only temporary...&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution 1: Admin Kubeconfig Options
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;k3s server &lt;span class="nt"&gt;--write-kubeconfig-mode&lt;/span&gt; 644
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you encounter the following...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;k3s server &lt;span class="nt"&gt;--write-kubeconfig-mode&lt;/span&gt; 644
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; password &lt;span class="k"&gt;for &lt;/span&gt;dan:
INFO[0000] Starting k3s v1.28.7+k3s1 &lt;span class="o"&gt;(&lt;/span&gt;051b14b2&lt;span class="o"&gt;)&lt;/span&gt;
INFO[0000] Configuring sqlite3 database connection pooling: &lt;span class="nv"&gt;maxIdleConns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2, &lt;span class="nv"&gt;maxOpenConns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0, &lt;span class="nv"&gt;connMaxLifetime&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0s
INFO[0000] Configuring database table schema and indexes, this may take a moment...
INFO[0000] Database tables and indexes are up to &lt;span class="nb"&gt;date
&lt;/span&gt;INFO[0000] Kine available at unix://kine.sock
INFO[0000] Reconciling bootstrap data between datastore and disk
FATA[0000] starting kubernetes: preparing server: init cluster datastore and https: listen tcp :6443: &lt;span class="nb"&gt;bind&lt;/span&gt;: address already &lt;span class="k"&gt;in &lt;/span&gt;use
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...you can just stop the service with this command first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop k3s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution 2: Directly provide access to the file for all users
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo chmod &lt;/span&gt;644 /etc/rancher/k3s/k3s.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your k3s cluster should now start and you will be able to get the list of pods/services confirming everything is running as expected.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pods &lt;span class="nt"&gt;-n&lt;/span&gt; azure-iot-operations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This issue occurred every time I reset my ubuntu server's kubernetes cluster, but I will just apply that going forward to continue testing with my user and run &lt;code&gt;kubectl&lt;/code&gt; commands without &lt;code&gt;sudo&lt;/code&gt; ...&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.k3s.io/cli/server#admin-kubeconfig-options" rel="noopener noreferrer"&gt;https://docs.k3s.io/cli/server#admin-kubeconfig-options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.redhat.com/sysadmin/linux-file-permissions-explained" rel="noopener noreferrer"&gt;https://www.redhat.com/sysadmin/linux-file-permissions-explained&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aio</category>
      <category>azureiot</category>
      <category>troubleshooting</category>
    </item>
    <item>
      <title>Live Average Carbon Intensity rating with Octopus Home Mini in Home Assistant</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Wed, 20 Mar 2024 00:09:20 +0000</pubDate>
      <link>https://dev.to/danuw/live-average-carbon-intensity-rating-with-octopus-home-mini-in-home-assistant-1a1f</link>
      <guid>https://dev.to/danuw/live-average-carbon-intensity-rating-with-octopus-home-mini-in-home-assistant-1a1f</guid>
      <description>&lt;p&gt;As mentioned to Adam Jackson on &lt;a href="https://www.youtube.com/watch?v=fGFeHaYtf5A"&gt;Decarbonize Software 2023&lt;/a&gt; the other day, here is a quick note on how to create a live consumption carbon intensity rating widget (sorry a bit of a mouthful) on your Home Assistant dashboard.&lt;/p&gt;

&lt;p&gt;Pre-requisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have an instance of &lt;a href="https://www.home-assistant.io/installation/"&gt;Home Assistant&lt;/a&gt; already configured&lt;/li&gt;
&lt;li&gt;HACS is already set up on your Home Assistant instance. Otherwise instructions can be found here: &lt;a href="https://hacs.xyz/docs/setup/download"&gt;https://hacs.xyz/docs/setup/download&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You are signed up to Octopus Energy provider and have requested a &lt;a href="https://octopus.energy/blog/octopus-home-mini/"&gt;Octopus Home Mini&lt;/a&gt; - if you are not yet an Octopus Energy customer, feel free to use my referral code &lt;a href="https://share.octopus.energy/iron-sun-306"&gt;iron-sun-306&lt;/a&gt; for £50 off your first bill&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--06vEDCPK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://octoenergy-production-media.s3.amazonaws.com/images/home_mini_banner.width-1200.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--06vEDCPK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://octoenergy-production-media.s3.amazonaws.com/images/home_mini_banner.width-1200.png" alt="Home Mini" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was recently really excited to get an &lt;a href="https://octopus.energy/blog/octopus-home-mini/"&gt;Octopus Home Mini&lt;/a&gt;. Compared to a smart meter that only reports on aggregated readings over 30 minutes blocks, the Home Mini allows for 10 seconds to 1 minute old readings which can significantly help improve smart home automation in the house. Let's face it, there is nearly no automation relevant over 30 minutes old data when it comes to energy. I have solar panels, and in a country like the UK, the sun really comes and goes and automations would need to be based on 1 to 5 minutes averages to stay relevant.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwwm31l90plmfw2hkn9x4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwwm31l90plmfw2hkn9x4.png" alt="Octopus Energy's Live Dashboard enabled by Home Mini" width="800" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Anyway, getting up to 1 minute old consumption carbon rating can be achieve with these simple steps:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install CO2 Signal Home Assistant Integration
&lt;/h2&gt;

&lt;p&gt;This is available via the integration tab in Home Assistant.&lt;br&gt;
&lt;a href="https://www.home-assistant.io/integrations/co2signal/"&gt;CO2 Signal Home Assistant Integration&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Install Octopus Integration and enable the Home Mini
&lt;/h2&gt;

&lt;p&gt;This requires the installation of HACS first. &lt;br&gt;
&lt;a href="https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy"&gt;Octopus Home Assistant Integration&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Set up a template that combines the values from both
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Configuration
&lt;/h3&gt;

&lt;p&gt;In your configuration.yaml, add the following line (to create your templates in a dedicated file - that is neater)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!include&lt;/span&gt; &lt;span class="s"&gt;templates.yaml&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create that &lt;code&gt;template.yaml&lt;/code&gt; file (alongside your &lt;code&gt;configuration.yaml&lt;/code&gt;) and add the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Current&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;hourly&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Electricity&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Carbon&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Emission&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Rating"&lt;/span&gt;
        &lt;span class="na"&gt;unit_of_measurement&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gCO2eq/h"&lt;/span&gt;
        &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="s"&gt;{% set currentco2rating = states('sensor.co2_signal_co2_intensity') | float %}&lt;/span&gt;
            &lt;span class="s"&gt;{% set liveusage = states('sensor.octopus_energy_electricity_22j0484346_1013001886662_current_demand') | float %}&lt;/span&gt;

            &lt;span class="s"&gt;{% set totalRating = currentco2rating * liveusage/1000 %}&lt;/span&gt;
            &lt;span class="s"&gt;{% if totalRating &amp;gt; 0 %}&lt;/span&gt;
            &lt;span class="s"&gt;{{ totalRating | round(1, default=0) }}&lt;/span&gt;
            &lt;span class="s"&gt;{%- else -%}&lt;/span&gt;
              &lt;span class="s"&gt;0&lt;/span&gt;
            &lt;span class="s"&gt;{%- endif %}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note to create your own template, you can use the Template Editor under the template tab of the Developer Tools to test it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Dashboard
&lt;/h3&gt;

&lt;p&gt;You can then set up a dashboard with your current consumption or rating using the sensor card, to help you compare your consumption. The sensor card shows both the current value as well as the history over the past configured period (for me it is set to last 24h).&lt;br&gt;
You could also add gauges to create some red/amber/green zones to at a glance understand how you are &lt;em&gt;currently&lt;/em&gt; doing.&lt;/p&gt;

&lt;p&gt;Here I am starting the battery charging when the power is at its lowest carbon intensity for the day:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1apj2xnwha8far6cepk6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1apj2xnwha8far6cepk6.png" alt="Starting to charge the battery when the power is at its lowest for the day" width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This shows that when the consumption is negative, we are keeping our rating positive to a minimum of zero.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl9ngz8n9lqwfffy3ttky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl9ngz8n9lqwfffy3ttky.png" alt="Defaults to zero when power is negative" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally this show charging the car when the power is at its lowest of the day (similar to charging the battery):&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fys12we78shli9ikybc7i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fys12we78shli9ikybc7i.png" alt="Starting to charge the car when the power is at its lowest for the day" width="800" height="1302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;Adding your carbon intensity to your dashboard and combining it to your consumption makes it easy to see whether our consumption is &lt;a href="https://learn.greensoftware.foundation/carbon-awareness"&gt;carbon aware&lt;/a&gt;, i.e. whether it uses more energy cleaner, in other words, when the electricity production comes primarily from renewable energy.&lt;/p&gt;

&lt;p&gt;EDIT 26/03/24: Thank you Ronan Glemain (&lt;a class="mentioned-user" href="https://dev.to/ronanglemain"&gt;@ronanglemain&lt;/a&gt;) for the correction tips, especially around fixing the unit of measure (from gCO2eq/kWh to gCO2eq/h) - Template has been updated though images still currently the original with the mistaken unit&lt;/p&gt;

</description>
      <category>carbonrating</category>
      <category>tutorial</category>
      <category>homeautomation</category>
      <category>energy</category>
    </item>
    <item>
      <title>Making customised chocolates using 3D printing</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Tue, 19 Mar 2024 14:06:24 +0000</pubDate>
      <link>https://dev.to/danuw/making-customised-chocolates-using-3d-printing-h8g</link>
      <guid>https://dev.to/danuw/making-customised-chocolates-using-3d-printing-h8g</guid>
      <description>&lt;p&gt;I was recently in search for an unusual Valentine's Day idea, came across silicon molds again and decided to give a go in the context of creating custom Valentine's Day chocolates.&lt;/p&gt;

&lt;p&gt;First, I will say that that silicon moulds are a very impressive thing. They reproduce in details shapes, and are easy to use to recreate any object you may already have.&lt;br&gt;
Second, the silicon here does not apply to resin. For I have only focused on FDM printers&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Food safe silicon. I used &lt;a href="https://amzn.to/4bJYewc"&gt;this one&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Mould frame. I recommend using &lt;a href="https://amzn.to/3I3Osaj"&gt;this one&lt;/a&gt; as it offers great flexibility&lt;/li&gt;
&lt;li&gt;Silicon mat. I used &lt;a href="https://amzn.to/49F38sf"&gt;this one&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Optionally you could use &lt;a href="https://amzn.to/3SNkixe"&gt;a heated mat like this one&lt;/a&gt; to accelerate your moulds solidifying. For now, I have placed mine near the radiators overnight (but might reconsider after the winter :) )&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Create the model
&lt;/h2&gt;

&lt;p&gt;3D print the desired shape: I 3D printed some custom shapes. &lt;br&gt;
I also used a coin my son gave me to see how it dealt with intricate details (and it did like a chef! but more on that below)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you are new to 3D modelling, you could start by using tinkercad.com. You could start with a basic shape like below (i.e. a shape and a message)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this article, how about we use some code? Using &lt;a href="https://openscad.org/"&gt;OpenSCAD&lt;/a&gt;, you can use &lt;a href="https://gist.github.com/danuw/a44108aaf514eb64ec1a0e390a65c582"&gt;this gist&lt;/a&gt; code to generate the STL to 3D print.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtq4cy1minbzfxgej7vi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtq4cy1minbzfxgej7vi.png" alt="choco.scad" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4pljdpn8fgy49lqgazy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4pljdpn8fgy49lqgazy.png" alt="3D print your model - this one was built " width="463" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Cast the mould
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prepare the mould frame
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Start here so you can get a better idea of quantities needed to avoid wasting the silicon&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Place the pieces you would like to print and assemble the mould frame around them. Make sure to arrange pieces in the space to optimise the size of the frame and overall layout (such as leaving sufficient space between pieces).&lt;br&gt;
As a base at first, I used a plastic bag which leaves slight bumpy marks.&lt;/p&gt;

&lt;p&gt;Now make sure to use the provided double sided sellotape to stick the frame, as well as each piece to the base. This will ensure the silicon does not escape outside the frame before it dries, and that the pieces will not move during the solidification process of the silicon. (The first time, some of the 3D printed pieces did move/ float, but generally did not stay stuck to the bottom and ended up with a layer of silicon in between).&lt;/p&gt;

&lt;h3&gt;
  
  
  Prepare the silicon
&lt;/h3&gt;

&lt;p&gt;The silicon linked above is a 1:1 by volume, so you need the same amount of each liquid (part A and part B).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbsi1m154q8rru84b6gtx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbsi1m154q8rru84b6gtx.png" alt="1:1 by volume" width="402" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure to mix it properly using the provided wooden piece. Stirring for some extra time, and every so often scraping the sides to ensure no liquid has been left unmixed may help get the most homogeneous substance possible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftvdweoygi9xohq1gwagf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftvdweoygi9xohq1gwagf.gif" alt="mix properly" width="480" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the mould
&lt;/h3&gt;

&lt;p&gt;Pour the silicon mixture slowly to ensure no bubbles get trapped, or the risk to move some of the pieces (although taped should be good enough)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowkxf2bpx1l4z7iojpeq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowkxf2bpx1l4z7iojpeq.gif" alt="pour the silicon in slowly to ensure no bubbles or risk of misplacing the pieces/models" width="360" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let it set for a few hours. When finished, gently remove the models from the silicon and let it rest for 24h (I saw the latter in the silicon's instructions and I assume this is part of keeping it food-safe, so I would encourage to do so to be extra safe).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Recreate your model in chocolate
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prepare the chocolate
&lt;/h3&gt;

&lt;p&gt;For optimal texture results, it is advised to "temper" the chocolate. See instructions I followed &lt;a href="https://www.bbcgoodfood.com/howto/guide/how-temper-chocolate"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pour the chocolate and let it set
&lt;/h3&gt;

&lt;p&gt;By now, your chocolate is creamy.&lt;br&gt;
As for the silicon, go slowly when pouring to reduce the amount of bubbles. You may even want to push a tiny bit at first into the nuts and crannies of your mould so that the details definitely come out fine (bubbles where the key features are, could really impact the look of the final result).&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Final result
&lt;/h2&gt;

&lt;p&gt;Once the chocolate has set, gently remove from the silicon, show it to get the effect it deserves and enjoy...&lt;/p&gt;

&lt;p&gt;Here are some examples of the final result&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnz7x5ktt41al8sr7k56o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnz7x5ktt41al8sr7k56o.png" alt="The coin my son gave me for the experiment and the intricate details showing in the mould" width="223" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feas3e5k4v2igj39m0qji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feas3e5k4v2igj39m0qji.png" alt="The 3d printed model from further up now in chocolate" width="479" height="643"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next steps?
&lt;/h2&gt;

&lt;p&gt;So first, some lessons learnt from my first attempts include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;use sellotape to stick the models to the base&lt;/li&gt;
&lt;li&gt;if 3D printing multiple models, it may be worth grouping as one piece (like a chocolate tablet) so everything keeps in place&lt;/li&gt;
&lt;li&gt;sand the 3D prints for a smoother finish&lt;/li&gt;
&lt;li&gt;use a spatula (or more generally proper utensils!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Going forward, it would be interesting to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;find food safe silicon compatible with resin and experiment with new shapes to allow for finer details (e.g. it is hard to print a logo on a small piece that would retain the correct level of details)&lt;/li&gt;
&lt;li&gt;try deeper chocolates shapes (the ones we are used to get from chocolate shop with more volume) as well as experiment with fillings such as praline, or crushed nuts/almonds etc...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short, fun has only just began and please do not hesitate to share your creations below ...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks to &lt;a class="mentioned-user" href="https://dev.to/fergusk"&gt;@fergusk&lt;/a&gt; for some of the tips mentioned above&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>tutorial</category>
      <category>3dprinting</category>
      <category>diy</category>
    </item>
    <item>
      <title>Your organization has enabled or enforced SAML SSO ... you must re-authorize the OAuth Application `GitHub for VS Code`</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Sun, 10 Mar 2024 00:53:40 +0000</pubDate>
      <link>https://dev.to/danuw/your-organization-has-enabled-or-enforced-saml-sso-you-must-re-authorize-the-oauth-application-github-for-vs-code-mlg</link>
      <guid>https://dev.to/danuw/your-organization-has-enabled-or-enforced-saml-sso-you-must-re-authorize-the-oauth-application-github-for-vs-code-mlg</guid>
      <description>&lt;p&gt;I just came across the following while trying to clone a repo:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The "contoso" organization has enabled or enforced SAML SSO. To access this repository, you must re-authorize the OAuth Application &lt;code&gt;GitHub for VS Code&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ojv29pbin87shc6xak3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ojv29pbin87shc6xak3.png" alt="Terminal screenshot of the Error message" width="800" height="67"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I searched how to enable per folder authentication for git.&lt;/p&gt;

&lt;p&gt;The easiest solution was to simply run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gh auth login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv883crn0g7syo972kn1f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv883crn0g7syo972kn1f.png" alt="Terminal screenshot of the login steps" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy cloning...&lt;/p&gt;

</description>
      <category>github</category>
      <category>auth</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Fixing Power BI report's credentials details error in Microsoft Fabric</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Mon, 05 Feb 2024 23:20:41 +0000</pubDate>
      <link>https://dev.to/danuw/fixing-power-bi-reports-credentials-details-error-in-microsoft-fabric-102n</link>
      <guid>https://dev.to/danuw/fixing-power-bi-reports-credentials-details-error-in-microsoft-fabric-102n</guid>
      <description>&lt;p&gt;&lt;em&gt;After publishing the Power BI report from the &lt;a href="https://github.com/microsoft/FabricCAT/tree/main/QueenOfTheSkies"&gt;QueenOfTheSky demo&lt;/a&gt;, I encountered an issue in Fabric. Despite being directed to my Power BI workspace homepage, it wasn't clear how to proceed next.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Issue Summary
&lt;/h2&gt;

&lt;p&gt;Following the steps in the &lt;a href="https://github.com/microsoft/FabricCAT/tree/main/QueenOfTheSkies#build-the-power-bi-report"&gt;build Power BI report section&lt;/a&gt;, I encountered an error post-publishing. The Power BI desktop app was used to open and fill in the report (.pibt), which was then published. However, upon accessing the report, an error banner indicated a connection issue and provided a link to edit settings. This link redirected me to the Power BI homepage without clear instructions on updating the connection settings.&lt;/p&gt;

&lt;p&gt;The solution involves three seperate methods to update the connection settings for the report, identified as QueensOfTheSky_rpt:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;via the setting menu&lt;/li&gt;
&lt;li&gt;through workspace's lineage view&lt;/li&gt;
&lt;li&gt;semantic model using the workspace list view&lt;/li&gt;
&lt;li&gt;accessing the semantic model settings directly from the report&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All methods are detailed below, with steps to guide you through updating your credentials.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Update Your Credentials
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Update your credentials using the settings menu
&lt;/h3&gt;

&lt;p&gt;From anywhere, select the Settings Menu &amp;gt; Power BI Settings &amp;gt; Semantic model tab &amp;gt; Select your report (&lt;em&gt;QueensOfTheSky_rpt&lt;/em&gt; in our case) &amp;gt; Datasource credentials&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8u6a8d9vt05un4h2ios6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8u6a8d9vt05un4h2ios6.png" alt="Through the settings menu" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Update your credentials using the workspace's lineage view
&lt;/h3&gt;

&lt;p&gt;On your workspace page, select the ellipsis on your report's semantic model card and go to settings. You can now update your datasource credentials.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh44hj288ol04xqi7nlmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh44hj288ol04xqi7nlmh.png" alt="Through the lineage view" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using the list view
&lt;/h3&gt;

&lt;p&gt;In your workspace, look for your semantic model (I filtered by "rpt"). Click the ellipsis and select settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6ttwp2gsv3hlzrds5bz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6ttwp2gsv3hlzrds5bz.png" alt="Through the list view" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Semantic model settings from the report
&lt;/h3&gt;

&lt;p&gt;While on your report:&lt;/p&gt;

&lt;p&gt;(1) Select the 3 dots &amp;gt; view Semantic model&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0aegce0eozf27hlgyc5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0aegce0eozf27hlgyc5e.png" alt="Through the report" width="800" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(2) File &amp;gt; Settings&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdy7a2dg5v5r1k030ied.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdy7a2dg5v5r1k030ied.png" alt="File settings on the semantic model" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  That's it for now
&lt;/h2&gt;

&lt;p&gt;Additional guidance might be provided as Microsoft continues to refine and address these navigational challenges.&lt;/p&gt;

&lt;p&gt;This guide aims to help you navigate and resolve connectivity issues in Power BI, ensuring a smoother experience with the QueenOfTheSky demo.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And a big THANK YOU to the contributors who created that cool demo!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;EDIT late Feb : added 4th method&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>microsoftfabric</category>
      <category>powerplatform</category>
    </item>
    <item>
      <title>Running out of space on a developer's machine</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Wed, 20 Dec 2023 15:21:00 +0000</pubDate>
      <link>https://dev.to/danuw/running-out-of-space-on-a-developers-machine-4a6b</link>
      <guid>https://dev.to/danuw/running-out-of-space-on-a-developers-machine-4a6b</guid>
      <description>&lt;p&gt;As developers, we often find our hard drives mysteriously filling up, slowing down our workflow. &lt;br&gt;
First reflex is often to remove the waste and for developers, that includes downloaded packages that linger until we return our unused projects.&lt;br&gt;
Let's explore a simple, yet powerful command-line I came across to reclaim hat precious disk space, making room for more coding and less clutter.&lt;/p&gt;

&lt;p&gt;So I started with a 250 GB SD full&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2F6nw4qfem42oyr741mdfc.png" class="article-body-image-wrapper"&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%2Farticles%2F6nw4qfem42oyr741mdfc.png" alt="256GB full SD card"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The commands we will need
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Disk space
&lt;/h3&gt;

&lt;p&gt;Command to get the disk space (I used an SD card smaller than my project folder until full).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; diskutil info &lt;span class="nt"&gt;-all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use&lt;/p&gt;

&lt;h3&gt;
  
  
  Remove a child folder from a directory
&lt;/h3&gt;

&lt;p&gt;Looking for a command to recursively remove child node_module folder, I found the following command at &lt;a href="https://stackoverflow.com/a/70549487/4819888" rel="noopener noreferrer"&gt;https://stackoverflow.com/a/70549487/4819888&lt;/a&gt; (it seems to have equivalents for Windows and Linux too)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;folder to remove&amp;gt;'&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-prune&lt;/span&gt; &lt;span class="nt"&gt;-print&lt;/span&gt; &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="s1"&gt;'{}'&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cleaning up node_modules folders
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s1"&gt;'node_modules'&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-prune&lt;/span&gt; &lt;span class="nt"&gt;-print&lt;/span&gt; &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="s1"&gt;'{}'&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running this command and clearing 22 node_module folders, it went down to 76GB&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Foibbwgys8zhdplar3zff.png" class="article-body-image-wrapper"&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%2Farticles%2Foibbwgys8zhdplar3zff.png" alt="70% reduction disk space removing node_module folders"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Cleaning up bin folders
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s1"&gt;'node_modules'&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-prune&lt;/span&gt; &lt;span class="nt"&gt;-print&lt;/span&gt; &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="s1"&gt;'{}'&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running this command and clearing down 490 bin folders, I had a further 20 GB of additional free space.&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Flco0bkm730dazfj7ds3n.png" class="article-body-image-wrapper"&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%2Farticles%2Flco0bkm730dazfj7ds3n.png" alt="space left after removing node_module folders and bin folders"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was thinking next we could tackle python packages but I could not find consistent naming convention though "pip" was what brought back most results. Also more on dangling docker images &lt;a href="https://docs.docker.com/engine/reference/commandline/system_prune/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Anyway...&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;So here we are with a reduction of 78.43% of the space my projects took in no time.&lt;br&gt;
What other folders shall we look to remove? Have you noticed similar savings? &lt;br&gt;
What other tips might you have to share?&lt;/p&gt;

</description>
      <category>tip</category>
      <category>productivity</category>
      <category>cleanup</category>
    </item>
    <item>
      <title>Troubleshooting Environment Errors while following Edge Impulse's walkthrough of End-To-End Keyword Spotting with Synthetic Data</title>
      <dc:creator>Dan Benitah</dc:creator>
      <pubDate>Fri, 17 Mar 2023 15:17:28 +0000</pubDate>
      <link>https://dev.to/danuw/troubleshooting-environment-errors-while-following-edge-impulses-walkthrough-of-end-to-end-keyword-spotting-with-synthetic-data-k0a</link>
      <guid>https://dev.to/danuw/troubleshooting-environment-errors-while-following-edge-impulses-walkthrough-of-end-to-end-keyword-spotting-with-synthetic-data-k0a</guid>
      <description>&lt;p&gt;Are you struggling to create a model that can detect the keyword "R2D2"? I faced a similar challenge until I came across a helpful video on &lt;a href="https://youtu.be/AoTB7eRjRiw?t=105" rel="noopener noreferrer"&gt;Training Models with Synthetic Data: End-to-End Keyword Spotting Walkthrough with Edge Impulse&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;However, I encountered some issues while following the video tutorial and had to troubleshoot them. &lt;/p&gt;

&lt;p&gt;In this article, I will share the steps I took to overcome these obstacles, in case you run into the same problems.&lt;/p&gt;

&lt;p&gt;Here's a quick summary of the issues I faced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hidden files not accessible warning: &lt;em&gt;jupyter lab Refusing to serve hidden file, via 404 Error, use flag 'ContentsManager.allow_hidden' to enable&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;ffmpeg and ffprobe not recognised&lt;/li&gt;
&lt;li&gt;DefaultCredentialsError&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Fm5hibw9zk02kzwb3ho2k.png" class="article-body-image-wrapper"&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%2Farticles%2Fm5hibw9zk02kzwb3ho2k.png" alt="Couldn't find ffmpeg or avconv and later ffprobe"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Fue2mvj6of26xsbpeiuwy.png" class="article-body-image-wrapper"&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%2Farticles%2Fue2mvj6of26xsbpeiuwy.png" alt="Couldn't find ffmpeg or avconv and later ffprobe"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Fyuoj22q62tavrd0pi2cd.png" class="article-body-image-wrapper"&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%2Farticles%2Fyuoj22q62tavrd0pi2cd.png" alt="DefaultCredentialsError"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Some pre-requisites
&lt;/h2&gt;

&lt;p&gt;First, ensure that you have node installed. If not, you can follow &lt;a href="https://tecadmin.net/install-nvm-macos-with-homebrew/" rel="noopener noreferrer"&gt;this tutorial&lt;/a&gt; to install it. &lt;br&gt;
If &lt;code&gt;npm&lt;/code&gt; is not recognised, run &lt;code&gt;source ~/.bash_profile&lt;/code&gt; to load it into the current shell.&lt;/p&gt;

&lt;p&gt;Next, install Python using &lt;code&gt;pyenv&lt;/code&gt; by following &lt;a href="https://realpython.com/intro-to-pyenv/" rel="noopener noreferrer"&gt;that tutorial&lt;/a&gt;. Once installed, you can install version 3.10.8 by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pyenv &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; 3.10.8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting up the Environment
&lt;/h2&gt;

&lt;p&gt;Clone the Edge Impulse notebooks repository by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/edgeimpulse/notebooks.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to the notebooks folder inside it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;notebooks/notebooks/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a virtual environment for Python 3.10.8:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pyenv virtualenv 3.10.8 edgeimpulsenotebooks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Activate the new virtual environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pyenv &lt;span class="nb"&gt;local &lt;/span&gt;edgeimpulsenotebooks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the required dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;requests
pip &lt;span class="nb"&gt;install &lt;/span&gt;pydub
pip &lt;span class="nb"&gt;install &lt;/span&gt;google-cloud-texttospeech
pip &lt;span class="nb"&gt;install &lt;/span&gt;jupyterlab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I ran the notebook, I encountered issues with ffmpeg and ffprobe not being found. To resolve this, I followed the instructions outlined here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;ffmpeg-downloader
ffdl &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--add-path&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the installation completes, you will be prompted to ensure that ffmpeg is in your path. Copy and paste the provided line into your ~/.zsh_profile (or ~/.bash_profile if you're using that instead) and save the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/Users/dan.benitah/Library/Application Support/ffmpeg-downloader/ffmpeg:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To ensure that ffmpeg is loaded, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zsh_profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;... and test the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffmpeg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;NOTE: I found it useful to test my commands directly in the jupiter-labs' terminal window to confirm what was not recognised or erroring more clearly.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;One last thing before we can launch the lab. I kept on getting a warning that hidden files were not accessible and using &lt;code&gt;--ContentsManager.allow_hidden=True&lt;/code&gt; seems to have solved it.&lt;/p&gt;

&lt;p&gt;You should now be able to launch the Jupyter Lab environment &lt;em&gt;from the shell where all these commands are available&lt;/em&gt; (npm, ffmpeg, ffprobe...) :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jupyter-lab &lt;span class="nt"&gt;--ContentsManager&lt;/span&gt;.allow_hidden&lt;span class="o"&gt;=&lt;/span&gt;True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, to follow along with the Google instructions from the video, enable the API in the Google Console at &lt;a href="https://console.cloud.google.com/speech/text-to-speech" rel="noopener noreferrer"&gt;https://console.cloud.google.com/speech/text-to-speech&lt;/a&gt;. It's worth noting that enabling the Text-to-Speech API alone might not be sufficient. In my case, I also needed to enable this API for it to work (may have been a combination of things).&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Fz7sjvfkzti0j6k4zaggz.png" class="article-body-image-wrapper"&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%2Farticles%2Fz7sjvfkzti0j6k4zaggz.png" alt="Is your API enabled? Select 'Enable API' to do so"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check if your APIs are enabled, look at the notification bar for notifications like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Frkt3dj1wjsd2yfzd2i53.png" class="article-body-image-wrapper"&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%2Farticles%2Frkt3dj1wjsd2yfzd2i53.png" alt="Ensure Text-to-Speech service is enabled"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've completed these steps, you should be able to resume watching &lt;a href="https://youtu.be/AoTB7eRjRiw?t=105" rel="noopener noreferrer"&gt;the video&lt;/a&gt; and follow along with the instructions. If you encounter any issues or have any questions, feel free to leave a comment below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next:
&lt;/h2&gt;

&lt;p&gt;Now the model detects when I say "R2D2" (yes that was my word :) ), I will need to look at these next steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;embed the library into a new project to act on detected keywords&lt;/li&gt;
&lt;li&gt;iterate on the model to improve its detection&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>tutorial</category>
      <category>tinyml</category>
      <category>machinelearning</category>
      <category>edgeimpulse</category>
    </item>
  </channel>
</rss>
