<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sebastian Faltoni on Medium]]></title>
        <description><![CDATA[Stories by Sebastian Faltoni on Medium]]></description>
        <link>https://medium.com/@nukedbit?source=rss-38b368fe2607------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7UbwDOm47GRgk6WFEAro5A.jpeg</url>
            <title>Stories by Sebastian Faltoni on Medium</title>
            <link>https://medium.com/@nukedbit?source=rss-38b368fe2607------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 19:24:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nukedbit/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Getting started with your first Laravel 8 and Jetstream web site]]></title>
            <link>https://nukedbit.medium.com/getting-started-with-your-first-laravel-8-and-jetstream-web-site-8be035414ced?source=rss-38b368fe2607------2</link>
            <guid isPermaLink="false">https://medium.com/p/8be035414ced</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel-livewire]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[laravel-jetstream]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Sebastian Faltoni]]></dc:creator>
            <pubDate>Tue, 18 May 2021 10:14:46 GMT</pubDate>
            <atom:updated>2021-05-18T10:31:31.829Z</atom:updated>
            <content:encoded><![CDATA[<h3>Requirements</h3><ul><li>NodeJS last version</li><li>PHP</li><li>Composer</li></ul><h3>Introduction</h3><p>I’ve been programming for more than 20 years, mostly with .NET. Recently I had to work on a project with PHP. It was a simple project, and because I didn’t touch PHP for ten years apart from a few quick fixes on WordPress. I decided to go and look at how the PHP community evolved, and while looking around for the best web framework, Laravel kept coming up.</p><p>They call it <strong>The PHP Framework For Web Artisans</strong>, and because it has been built with developer happiness in mind and with a solid foundation, you shouldn’t be sweating on the small thing. This a great way to introduce a framework to a new developer. All framework I have tried over the years they all look shiny and fabulous on the surface, but in the end to get a full app you need to stitch a few libraries together with different design and goals. By the end of the day, you wasted a lot of time-fighting to make everything work together, while it would have been better if you could spend that time building your application. Of course, any framework or technology is going to have its issues. When most of my time is spent on framework issues instead of my code issues, I start to question why in 2021 we are still having all these issues. So I decided to give it a try.</p><h3>My own requirements before i even start a simple project</h3><p>But before creating a new Laravel project, I had to check what they usually use for building their web user interfaces. I was looking to start simple. I prefer to avoid complex front-end framework like React and Vue because I’m looking to develop apps with the path of least resistance. Those frameworks tend to make things more convoluted and complex than they need to be, especially for simple control panels where all you need to do is data entry.</p><p>But I also wanted to use Tailwind CSS because I fall in love with it a few weeks before even thinking of using PHP and Laravel. And by simply looking a little deeper at the Laravel web site, I was happily surprised that they work a lot with Tailwind CSS. They have a project called Jetstream witch provides two UI Stacks, one with Livewire + Blade and the other is Inertia + Vue. As you can imagine, I have chosen Livewire + Blade witch is the more straightforward approach for me, and the best part is that both use Tailwind CSS, so they are telling me to download it now!!</p><h3>How to create your first Laravel jetstream project</h3><p>Before you can create a Laravel jetstream project, you need to create an empty Laravel project. To do so, I usually use the Laravel installer, and you need to have composer installed. If you currently don’t have the Laravel command-line installer, you get it on your machine by running the following command.</p><pre>composer global require laravel/installer</pre><p>When the above command finish, you can proceed further by creating an empty Laravel project with the following command.</p><pre>laravel new myjetstreamapp</pre><p>You can specify any name you like in place of myjetstreamapp</p><p>Now we are ready to install the jetstream starter kit with composer. In this example, I will proceed with the livewire version. For more info, check jetstream’s official website. First run composer require.</p><pre>composer require laravel/jetstream</pre><p>Then we need to install Jetstream with livewire support.</p><pre>php artisan jetstream:install livewire</pre><p>Then as per jetstream doc we must finish our installation by running npm and migrations.</p><pre>npm install npm run dev php artisan migrate</pre><p>You have probably noticed that by running the last command php artisan migrate it output an error, this usually happen because you don&#39;t have a connection configure for your database.</p><p>Usually, I would configure a mysql test database, but I will guide you with sqlite, a robust database on a file for this tutorial.</p><p>To enable sqlite you need to edit the .env file. If you don’t see it on your os is because it is a hidden file. On MacOS, you can press CMD + . to show hidden files; if you press it again, it will hide them again. Open the .env file on your editor of choice and first set the DB_CONNECTION setting as:</p><pre>DB_CONNECTION=sqlite</pre><p>Then you need to remove DB_DATABASE setting line. If you don’t remove it, it will prevent database migration. Now create an empty sqlite database with the following command.</p><pre>touch database/database.sqlite</pre><p>Now you can rerun the migration command. The migration command will create the default tables included with jetstream for user management.</p><pre>php artisan migrate</pre><p>Now you should see something like the following output.</p><pre>Migration table created successfully. Migrating: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table (1.32ms) Migrating: 2014_10_12_100000_create_password_resets_table Migrated: 2014_10_12_100000_create_password_resets_table (0.83ms) Migrating: 2014_10_12_200000_add_two_factor_columns_to_users_table Migrated: 2014_10_12_200000_add_two_factor_columns_to_users_table (0.77ms) Migrating: 2019_08_19_000000_create_failed_jobs_table Migrated: 2019_08_19_000000_create_failed_jobs_table (0.81ms) Migrating: 2019_12_14_000001_create_personal_access_tokens_table Migrated: 2019_12_14_000001_create_personal_access_tokens_table (1.08ms) Migrating: 2021_05_17_193135_create_sessions_table Migrated: 2021_05_17_193135_create_sessions_table (1.04ms)</pre><p>Ok it’s time to see how you project looks like, run php artisan serve and navigate on your browser at <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/</a>.</p><p>Your empty project is now ready!</p><h3>Seeding the database with a default user</h3><p>Right now, you can’t log in to your new website because there are no users. But Laravel, for this specific purpose, provides a feature named Database Seeder, which is very useful for providing default data on your database or populating your database with test data. Later, I will show you how to seed some faked users to build a user list, using seeders and fakers to make this trivial. For now, let’s create a default test user. Execute the following command, which will generate a UserSeeder class for you.</p><pre>php artisan make:seeder UserSeeder</pre><p>The UserSeeder.php is located inside the database/seeders folder.</p><p>Replace the file content with the following snippet</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/560cc06355c68a49542c005126c863ce/href">https://medium.com/media/560cc06355c68a49542c005126c863ce/href</a></iframe><p>This will create a new user with admin@localhost as login email and admin@pwd23.</p><p>But before you try to login on your app you need to run the seeder with the following artisan command.</p><pre>php artisan db:seed --class=UserSeeder</pre><p>Try to login to check if everything is running ok.</p><h3>Populating the users table with fake users</h3><p>There are a few steps to make a seeder with randomly generated users. But Laravel makes this very easy trivial. We need to make a few fake users so we can later build a user data table using Livewire, and without a few users, we wouldn’t be able to see a paginated table. In an empty Laravel project, you would have to run the php artisan make:factory UserFactory to create a custom factory for your user model, but you get one for free on the jetstream template. This is what you get on the box.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/369490a87eb00c386c1c6e4c9bd6cb73/href">https://medium.com/media/369490a87eb00c386c1c6e4c9bd6cb73/href</a></iframe><p>Look at the definition function. You can see that it is using $this-&gt;faker to generate a fake name and email; for the email, you can see nicety $this-&gt;faker-&gt;unique()-&gt;safeEmail this will guarantee that you generated email is unique. Now modify the UserSeeder.php run method as per example, notice that now we check if the admin user already exists.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fe49709ef8ed9d5a61cc7c2fcffcbf1/href">https://medium.com/media/8fe49709ef8ed9d5a61cc7c2fcffcbf1/href</a></iframe><p>Now run the seed command again to add 200 users to you database.</p><pre>php artisan db:seed --class=UserSeeder</pre><p>If you open the sqlite database in a db viewer like TablePlus, you should see 201 rows.</p><p>Now we are ready to proceed with the creation of a Livewire users table</p><h3>Creating the user table component with Livewire and an open source component</h3><p>You could easily create your data table with Livewire and Tailwind CSS, but we will use an excellent open-source library. Install the library with the following command.</p><pre>composer require mediconesystems/livewire-datatables</pre><p>As suggested by the package author you should add the following css snippet in your app.css</p><p>which is located inside resources/css , this is necessary to avoid flickers as the package use alpinejs.</p><pre>[x-cloak] { display: none; }</pre><p>Now we need to create our UsersListComponent with the following.</p><pre>php artisan livewire:make UsersListComponent</pre><p>This will create a new livewire component where we are going to add our data table.</p><p>Open the users-list-component.blade.php file and replace the content with the following code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/523f7f28d4bba3615eadbc23c4c2f8da/href">https://medium.com/media/523f7f28d4bba3615eadbc23c4c2f8da/href</a></iframe><p>Most of the code is layout but if you look at the data table part is very trivial to define a simple data table that provides pagination and search! Here only the datable snippet.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dea47ac905d2003cd7ceb348850336f3/href">https://medium.com/media/dea47ac905d2003cd7ceb348850336f3/href</a></iframe><p>But we are not finished! We need to enable a new route in the web.php file to show it! Open the web.php file and remove the dashboard route and replace it with the following code, which embeds the dashboard route and users route inside a group, so both get authenticated, and there is no need to duplicate the middleware part.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6edafd2ac35cf307393266f597517009/href">https://medium.com/media/6edafd2ac35cf307393266f597517009/href</a></iframe><p>Now serve it with php artisan serve and look at your newly create users page!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jlS9-gnwaoPWKL1b" /></figure><h3>Conclusion</h3><p>Building great websites in Laravel and livewire is very trivial. This is a simple example but is a good starting point to see how productive this ecosystem is. Hopefully, you enjoyed this article, and if so, please leave a comment or a clap!</p><h3>Resources</h3><ul><li><a href="https://laravel.com/">Laravel</a></li><li><a href="https://tailwindcss.com/">Tailwind CSS</a></li><li><a href="https://github.com/MedicOneSystems/livewire-datatables">Livewire Datatables</a></li><li><a href="https://jetstream.laravel.com/2.x/introduction.html">Laravel Jetstream</a></li></ul><p><em>Originally published at </em><a href="https://nukedbit.dev/getting-started-with-your-first-laravel-8-and-jetstream-web-site/"><em>https://nukedbit.dev</em></a><em> on May 18, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8be035414ced" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Unique Validation rule on update has already been taken]]></title>
            <link>https://nukedbit.medium.com/laravel-unique-validation-rule-on-update-has-already-been-taken-7835f76f4884?source=rss-38b368fe2607------2</link>
            <guid isPermaLink="false">https://medium.com/p/7835f76f4884</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[validation]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[laravel-development]]></category>
            <dc:creator><![CDATA[Sebastian Faltoni]]></dc:creator>
            <pubDate>Sun, 25 Apr 2021 12:57:55 GMT</pubDate>
            <atom:updated>2021-05-19T20:22:04.147Z</atom:updated>
            <content:encoded><![CDATA[<p>You got the validation rule with unique working on create, but when you are trying to update the same record your get <strong>The name has already been taken</strong> error? this is due to the fact that your validator is checking for uniqueness without taking in account that your trying to update the same record which already own that name.</p><p>Let’s suppose you have your validations rules defined as a class property like so.</p><pre>protected $rules = <br>[ <br>     &quot;name&quot; =&gt;  &#39;required|min:10|max:100|unique:taxonomies&#39;, <br>];</pre><p>What is important for the next example to work is that the unique validator is at the end of the string, so the following will work.</p><pre>public function update(Request $request, Taxonomy $taxonomy) {<br>    $rules = $this-&gt;rules; <br>    $rules[&#39;name&#39;] = $rules[&#39;name&#39;].&#39;,id,&#39;.$taxonomy-&gt;id;<br>    $validator = Validator::make($request-&gt;all(), $rules); <br>..... <br>}</pre><p>As you can see what I did is concat to the name rule the id of the existing record, so the validator will know that we are trying to update it self and there is no conflict.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7835f76f4884" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PowerApps Reusable Modal Dialog Component]]></title>
            <link>https://nukedbit.medium.com/powerapps-reusable-modal-dialog-component-ff9e04ef0406?source=rss-38b368fe2607------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff9e04ef0406</guid>
            <category><![CDATA[microsoft-power-apps]]></category>
            <category><![CDATA[powerapps]]></category>
            <category><![CDATA[microsoft-powerapps]]></category>
            <category><![CDATA[components]]></category>
            <dc:creator><![CDATA[Sebastian Faltoni]]></dc:creator>
            <pubDate>Mon, 23 Nov 2020 14:36:42 GMT</pubDate>
            <atom:updated>2021-04-07T11:03:04.718Z</atom:updated>
            <content:encoded><![CDATA[<p>On this tutorial i’m going to show how you can build a custom reusable dialog component in Power Apps.</p><p>Unfortunately power apps currently dosen’t allow us to expose actions like OnSelect of buttons, so we can’t have buttons in the dialog. <br>While this make our component buttonless it’s not an issue to add our ok cancel buttons later on our view, we still get the benefits to have a reusable modal dialog without resorting to copy and paste and fixings.</p><h3>Creating the Dialog Component</h3><p>So to get start create an app or open an existing one and click on the component tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*pJa3CXom2R38nE82.png" /></figure><p>Now click on New component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/0*99Z8u1eTYo8JN8W7.png" /></figure><p>As you can see a new component is created with the name Component1, we can rename our component to <strong>DialogComponent</strong> by clicking on the three dots on the right, and click on the <strong>Rename</strong> menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/0*F9DLfB5JoAJmHgEX.png" /></figure><h3>Adding the component properties</h3><p>Now that we have our component named correctly we can proceed to create a few custom properties. You can find the custom property panel on the right side.</p><p>We are going to define three properties as following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/0*Q5y1gNd3ClUlbofh.png" /></figure><p>Start by clicking on the <strong>New custom property</strong> button it should open a dialog, and fill it like in the following screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/0*Rx6K1CizFsMLPmSt.png" /></figure><p>Repeat the same think for the following properties, remember that you need to specify the correct <strong>Data Type </strong>for the property, the description field is up to you</p><p>So now you should have all the properties ready, so we can proceed to create our dialog UX.</p><h3>Add a Modal background</h3><p>So back on the canvas of your component, we need to create a background to cover our app when we open our Dialog. To do so create a new rectangle you can call it rcDialogModalBackground.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M93vFHagbSyAMEbY.png" /></figure><p>To make sure our component is correctly filling the screen we need to check it’s Width and Height property are set to match it’s parent size like so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JGgk6wMqqWnsmSxW.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2bEBRoD13aaldqdO.png" /></figure><p>Also make sure X and Y are set to 0.</p><p>We also need to make sure we have no border in our background rectangle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*BnMz3Jn_TAwecUt1.png" /></figure><p>If you want it to be semi transparent so it will show the content underneath, you can change the Fill property of the rectangle like so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*isBJXFVAkzgW_21B.png" /></figure><p>Currently if you test this component when you will mouse over it or click it will probably show a different fill color this is because shapes also react to mouse over and click events and use different’s property to pick the fill color, so add the color value you added on Fill to <strong>HoverFill</strong> and <strong>PressedFill</strong>.</p><h3>Creating the Dialog Content Area</h3><p>Now you can proceed to create a new Rectangle with all <strong>Fill</strong>, <strong>HoverFill</strong> and <strong>PressedFill</strong> set to a white color.</p><p>Right now the Dialog Content Area where we are going to add our buttons later is not resizing or aligning based on our custom properties, to fix that, please fill the properties as follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TOprtIa1M8ptRf-b.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DQB8v7ck1chPq_MN.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T7xIY0GpOv8acZo4.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mMaTViTZO9uWT9uc.png" /></figure><p>As you can see the Y formula is a little more complex, this is because we are using the Center property previously defined to change our vertically alignment behaviour. Basically if the Center is True we center our dialog content in the screen, otherwise we align this on the bottom of the parent size minus 80.</p><p>Change these as you wishes. Our Dialog Component is ready for testing.</p><h3>Testing our Dialog Component</h3><p>Add a new button on the canvas that we are going to use it to show our dialog again. And set the OnSelect Expression as follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K_wmlo6ot9CojTLw.png" /></figure><p>Should look like this now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EbmqgfUsltntqehi.png" /></figure><p>To test our new component we first need to add it to one of our canvas apps screen, to do so click on the custom menu in your power apps toolbar.<br>Then click on Dialog Component to add a new instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CvCY1hjDMp2diz23.png" /></figure><p>Now all you need to do is to resize it to fill the screen, and set the DialogWidth and DialogHeight to a bigger size, i’m going to use 500 for the Width, and 350 for the Height.</p><p>Now add a button on it’s white content Area so we can close the dialog.</p><p>The on the button OnSelect Event add the following expression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NO-ACI3Uyjw7oQww.png" /></figure><p>Now we need to add ShowDialog variable on Both the Button and DialogComponent instance Visible property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2I0fOfMEL0Qv64Qg.png" /></figure><p>Now both the Dialog and the button will disappears, it is expected to do so because by default ShowDialog is going to be set as false.</p><p>Now it play and enjoy you new reusable Dialog. Maybe in a future PowerApps release we can also add buttons as part of the component to maximise reusability!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*jcjRk6M_r23YOJux.gif" /></figure><p><em>Originally published at </em><a href="https://nukedbit.dev/powerapps-reusable-modal-dialog-component/"><em>https://nukedbit.dev</em></a><em> on November 23, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff9e04ef0406" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Develop go with VSCode new Remote Containers Feature — Docker Windows]]></title>
            <link>https://nukedbit.medium.com/develop-go-with-vscode-new-remote-containers-feature-docker-windows-e955f0eb3bd?source=rss-38b368fe2607------2</link>
            <guid isPermaLink="false">https://medium.com/p/e955f0eb3bd</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[containers]]></category>
            <dc:creator><![CDATA[Sebastian Faltoni]]></dc:creator>
            <pubDate>Wed, 15 May 2019 10:50:24 GMT</pubDate>
            <atom:updated>2019-05-22T13:22:03.678Z</atom:updated>
            <content:encoded><![CDATA[<h3>Develop go with VSCode new Remote Containers Feature — Docker Windows</h3><p>Go lang is a very interesting language and ecosystem, while it is very lightweight compared to other languages like C#, Java, etc.. in term of language features, and at first it may look too simple and that is missing features like generics, in reality when you go in it for some time, you will notice that is why a lot of people really enjoy it. Having a stable and simple language allows for working with it easy and simple to maintain code, even if sometimes it means some duplicated code here and there.</p><h3>VSCode New Remote Plugin</h3><p>There is a new wonderful feature that just got released from Microsoft, that will allow you to work with any remote system either Docker, WSL, or just any Linux VM or Machine, as you would be working locally. The extension will let you use your local VSCode as the UI for your coding and it will install a VSCode server on the remote machine, by doing so they can easily reuse all the vast repository of plugins, because for them it would be like working locally, and VSCode take care to stream to your local Instance all the UI Stuff. You even get to run a bash or zsh terminal in the Integrated Terminal as you would today locally. This is basically my new Setup i use since they released it. I use both the containers way and the remote VM, because of i already a Hyper VM with Ubuntu that i move between PCs with an external drive. On this Article, we are going to use the container way.</p><p>This Video from Microsoft show how it works with Rust lang<strong> it has no audio</strong>.</p><h3>Why should I work in a container?</h3><p>While you can easily work with Go on Windows, it could be better for you to work on a Linux environment if you plan to deploy on a Linux server so you can get as close as possible to the real environment you are going to deploy to. On Windows currently, you can achieve this by working inside WSL (Windows Subsystem for Linux) or by running your code inside a container. While the last could look like a good solution having a Dockerfile until now it meant that you used Docker as a runtime environment and not as a development environment, you still compiled your app and then ran for debugging and deployment on Docker, but if you wanted to deploy to a plain Linux box things would looks differently.</p><p>Choosing to work with a Remote Container in VSCode will mean that all your development is done inside the container and the experience is going to be like working on a full Linux box, so you could do your deployment and build scripts in bash! So basically instead of working in a full VM, you will be using a container, with the added benefits that you can easily rebuild it from scratch with a known configuration.</p><h3>Prerequisites</h3><h3>Install Remote Container Feature in VS Code</h3><p>At the time while I’m writing this article you still need to download <a href="https://code.visualstudio.com/insiders/">VSCode Insiders</a> version which you can run side by side with your stable version.</p><p>When you have the VS Code Insiders running you need to install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack">Remote Extension</a> pack that enables development with also WSL and any remote Linux host.</p><p>If you don’t already have Docker configured on your Windows Box follow my guide <a href="https://dockerwindows.com/how-to-setup-docker-on-windows/">How To Setup Docker on Windows</a>. And when you are ready just come back here to proceed further.</p><p>So Open Visual Studio Code and go to the extension section and install it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0wKcpbLPK3mZ3o34.gif" /></figure><h3>Configure a go project to run inside the container</h3><p>For this example you should create a simple main.go hello world file, inside a directory of your choice, but remember it should be in a drive where Docker can have access to.</p><p>So with the folder opened on Visual Studio Code it should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lD6CKNr0JQihI0Yl.jpg" /></figure><p>Now open with the shortcut CTRL+ SHIFT + P the <a href="https://code.visualstudio.com/docs/getstarted/userinterface">command palette</a> and by typing container it should appear the option Create Container Configuration File, selected that as in the following screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sy8eGU_YOZ41YIgq.jpg" /></figure><p>Because you are working on a Go project you need to Choose Go as in the following screenshot, select it as in the picture, and proceed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T4j4sH_6m9X0tPsc.jpg" /></figure><p>You probably noticed that when VSCode as completed it’s background jobs, it created a few configuration files inside a .devcontainer folder. This is very useful and important because if you commit these files inside your git repo, you can get up and running in another machine quickly, of course, you still need to have a docker instance running. Now as on the following picture click on the Reopen in Container Button at the right bottom in VSCode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5pUigyBgrwWfUUyS.jpg" /></figure><p>Now VSCode is going to download the base container image and it will build your custom image created using the VSCode template, in the meantime, you can take a Peek inside the Dockerfile created for you inside the .devcontainer folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JkiEcCBiNyDtB0i9.jpg" /></figure><p>Ok now you should have a fully working container development environment, it was easy right? you can also try it by adding a break point and it F5 as in the following screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*82UfdfXfmEJo9WoZ.jpg" /></figure><p>And voila! you have your portable Go Development environment up and running, you can also customize it by modifying the Dockerfile, when you have done so remember to rebuild the container, by choosing the rebuild options from the Command Palette.</p><p>If you liked this article please share it, so others can find it! You can use the share buttons at the bottom of this page or just copy the link on your social media.</p><h3>REFERENCES</h3><p><em>Originally published at </em><a href="https://dockerwindows.com/develop-go-with-vscode-new-remote-containers-feature/"><em>https://dockerwindows.com</em></a><em> on May 15, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e955f0eb3bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Releasing NRepo, .NET]]></title>
            <link>https://nukedbit.medium.com/releasing-nrepo-net-22ce8a3bb6a6?source=rss-38b368fe2607------2</link>
            <guid isPermaLink="false">https://medium.com/p/22ce8a3bb6a6</guid>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Sebastian Faltoni]]></dc:creator>
            <pubDate>Fri, 08 Mar 2019 17:42:25 GMT</pubDate>
            <atom:updated>2019-03-09T17:49:57.099Z</atom:updated>
            <content:encoded><![CDATA[<h3>Releasing NRepo, .NET Core Global Tool for simplify repository creation with good defaults for C# projects</h3><p><a href="https://nukedbit.io/category/dotnet-core/">.NET Core</a>, <a href="https://nukedbit.io/category/net-core-global-tools/">.NET Core Global Tools</a> Updated March 8th, 2019 at 09:16 pm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qJMTahamXtberlhk" /></figure><p>With the news that GitHub will allow us to have<a href="https://techcrunch.com/2019/01/07/github-free-users-now-get-unlimited-private-repositories/"> private repos</a>, i have moved all of my new stuff over it.</p><p>Because i enjoy the ui and it’s simplicity, and the fact you have to add only a README to welcome your users is simple and nice.</p><p>I find myself doing a lot of POC and while adding/creating new repos both on my local machine and on github is trivial; it is time consuming and annoying if after a day of work you want to push your code in a safe place and go home.</p><p>Also you have to setup some .gitignore, .gitattributes and .editorconfig, so it’s more stuff to do for each repo.</p><p>Therefore, I have created <a href="https://github.com/nukedbit/nrepo">NukedBit.NRepo</a> a simple .NET Core Global Tool, that with an interactive console ui, it will help you get your repository configured and ready to push in matter of seconds.</p><p>It only support C# repositories, but I will look soon on how to add support for multiple languages, maybe with some external templates, and with custom local ones you can define.</p><p>Also at the moment it will only allow you to create public repositories on github, but in the next few days i will be adding an option for making the repository private.</p><p>Beware it’s a new tool and i do not take any responsibility over your data, so be safe and create a local backup of your data.</p><p>To install just use the following command.</p><pre>dotnet tool install --global NukedBit.NRepo --version 0.1.0</pre><p>If you want to enable the remote creation of the github repository you need to setup the environment variable NREPO_GITHUB_TOKEN with your github token you can follow this guide on how to create one, you just need to select the repo permission and it’s children’s setting <a href="https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line">https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line</a></p><p>You can either run with –n:myawesomerepo to create a repository inside a new folder myawesomerepo or with no value with just –n and it will create it in the current folder, but it will ask for confirmation.</p><p>Examples</p><pre>nrepo -n:myawesomerepo</pre><pre>nrepo -n</pre><h3>How it works</h3><p>The configuration is done in a few steps:</p><ol><li>After you have chosen the destination path, it will check if the folder is already a git repository, if not it will initialize a new one.</li><li>Next the defaults files will be downloaded, at this time the files are downloaded from the AspNetCore Repository, if the files already exist it will skip them, the files are:<br><a href="https://raw.githubusercontent.com/aspnet/AspNetCore/master/.editorconfig">.editorconfig</a> <a href="https://raw.githubusercontent.com/aspnet/AspNetCore/master/.gitattributes">.gitattributes</a> <a href="https://raw.githubusercontent.com/aspnet/AspNetCore/master/.gitignore">.gitignore</a></li><li>Now it’s time to choose a license, for this the tool will call the github api to list all the licenses, and when you choose yours it will download the license text and save it as LICENSE.</li><li>At this point you can either create a new repository over github or search for an existing one, or just skip the step, when the repository is selected the correct remote url will be set on your local git repository.</li><li>Now you are done</li></ol><h3>Whats Next</h3><p>I have in mind a few improvements, like enabling the creation of private repositories and providing templates for other projects type, like Angular, ReactJS etc..</p><p>Please give it a try and if you liked it, share it or leave a comment at the bottom of this article. If you find any issue or have a suggestion please send it over <a href="https://github.com/nukedbit/nrepo">github</a>.</p><p><em>Originally published at </em><a href="https://nukedbit.io/dotnet-core/nrepo-a-tool-to-simplify-repository-setup-for-github/"><em>nukedbit.io</em></a><em> on March 8, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22ce8a3bb6a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage Yeelight Lamps with Blazor and ASP.NET Core]]></title>
            <link>https://nukedbit.medium.com/manage-yeelight-lamps-with-blazor-and-asp-net-core-c4e3eb12800e?source=rss-38b368fe2607------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4e3eb12800e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[blazor]]></category>
            <category><![CDATA[single-page-applications]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Sebastian Faltoni]]></dc:creator>
            <pubDate>Tue, 16 Oct 2018 20:43:40 GMT</pubDate>
            <atom:updated>2018-10-16T20:43:40.854Z</atom:updated>
            <content:encoded><![CDATA[<p>For some time had the idea to create my home dashboard, so I could manage my devices including those two lamps I have in my home. But I always kept this idea for the future mostly because I love to make beautiful UI’s and currently to have a nice experience you need something like angular, react or a lot of javascript that I do not enjoy it very much.<br>So if you go single page app route, you also have to create a web API, so it can be consumed from the Admin Panel. This has you can see is getting rapidly a lot of tedious and long work.<br>But now Blazor has come to the rescue us, thanks to its server-side rendering engine which allow for a single page experience thanks to its web socket communication the user doesn’t notice changes are rendered from the web server. Even for us developer the development model look similar in fact you can easily switch from server-side rendering to web assembly (but you can’t use server libraries like EF Core or any other DB connector).<br>Thanks to the server side rendering I can use libraries like YeelightAPI to discover and turn on and off my home lights.<br>This how the panel looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Z725eLVdLfKbVREMqTcRA.jpeg" /></figure><p>The panel currently is very simple and do on/off and rename the device.<br>The code isn’t pretty but for our testing purpose, it will do the job. Let’s look at how devices are discovered.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac4d7f522307b5f9e255c15554fc5f7c/href">https://medium.com/media/ac4d7f522307b5f9e255c15554fc5f7c/href</a></iframe><p>You can easily that inside my Index.cshtml I directly call DeviceLocator.Discover() inside OnInitAsync() and I then loop through them to display them as cards, I had to separate the rendering of each light on a Blazor Component so I could manage the device and it states easily.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/180688fe03eb097f27a4595f1f666863/href">https://medium.com/media/180688fe03eb097f27a4595f1f666863/href</a></iframe><p>The code to toggle the lamp on/off is on the ToggleOnOff and with a few utility methods to reconnect to the device and check device status, all of this done using existing libraries with the skills I already know from more than 15 years of C#.</p><p>In fact, this little UI was developed in less than two hours, on which probably more than 30 minutes wasted because I could connect to my yeelight devices!!</p><p>I then discovered that you need to enable lan discoverability from the Yeelight Mobile App as follow.</p><p>Select the device you want to be discoverable, then when this screen opens click the button on the bottom right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M5PzrwuZlCuo_0hzfzXHgQ.png" /></figure><p>Now select the button Lan Control in the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tj85gPBeG59P2x1nJqr13A.png" /></figure><p>Ok now you are good, and you can continue playing with your devices using Blazor and asp.net core :)</p><p>Here is my example project on github</p><p><a href="https://github.com/sfaltoni/BlazorYeelight">sfaltoni/BlazorYeelight</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4e3eb12800e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Debug a .NET Core Server Side Blazor App on a Raspberry PI]]></title>
            <link>https://nukedbit.medium.com/how-to-debug-a-net-core-server-side-blazor-app-on-a-raspberry-pi-7093fbc11ef4?source=rss-38b368fe2607------2</link>
            <guid isPermaLink="false">https://medium.com/p/7093fbc11ef4</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[blazor]]></category>
            <dc:creator><![CDATA[Sebastian Faltoni]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 12:34:45 GMT</pubDate>
            <atom:updated>2018-10-10T12:35:47.950Z</atom:updated>
            <content:encoded><![CDATA[<h3>How To Debug and Deploy a .NET Core Server Side Blazor App on a Raspberry PI</h3><p>Yesterday Amazon delivered my new RaspBerry PI 3 B+, so while thinking what to do next, I have opted for developing a small admin panel using asp.net core. But before I can start any serious development i thought that at least I should have a sample project running.</p><p><strong>Why blazor?</strong></p><p>While is still experimental I really wanted to give Blazor a try, it is a new full-stack framework, developed by the community &amp; Microsoft employees.</p><blockquote>For more info on Blazor head to <a href="https://blazor.net/">https://blazor.net/</a></blockquote><p>On this example, I’m going to show how to deploy a Server Side App because it is the one going to be supported out of the box on .NET Core 3.</p><blockquote>If you don’t know how to setup a new raspberry pi headless there is a good article <a href="https://hackernoon.com/raspberry-pi-headless-install-462ccabd75d0">https://hackernoon.com/raspberry-pi-headless-install-462ccabd75d0</a></blockquote><p><strong>Install .NET Core 2.1 on the raspberry</strong></p><blockquote>If you are on windows 10 and don’t already have an ssh client you can use the new built in <a href="https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/">https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/</a></blockquote><p>To proceed you have to open a remote ssh connection to your pi.</p><pre>ssh pi@your_ip_address</pre><p>Now run these commands to download .net 2.1 sdk and runtime for arm32.</p><pre><a href="https://download.visualstudio.microsoft.com/download/pr/4d555219-1f04-47c6-90e5-8b3ff8989b9c/0798763e6e4b98a62846116f997d046e/dotnet-runtime-2.1.5-linux-arm.tar.gz">w</a>get <a href="https://download.visualstudio.microsoft.com/download/pr/6253ecc6-4af6-42ac-a965-33a864a79a3b/b4ba7e62c5318106fd55aaa17b4335de/aspnetcore-runtime-2.1.5-linux-arm.tar.gz">https://download.visualstudio.microsoft.com/download/pr/6253ecc6-4af6-42ac-a965-33a864a79a3b/b4ba7e62c5318106fd55aaa17b4335de/aspnetcore-runtime-2.1.5-linux-arm.tar.gz</a></pre><pre>wget <a href="https://download.visualstudio.microsoft.com/download/pr/10b96626-02d8-415a-be85-051a2a48d0c2/5ec51d3d9f092ba558fb5f1f03d26699/dotnet-sdk-2.1.403-linux-arm.tar.gz">https://download.visualstudio.microsoft.com/download/pr/10b96626-02d8-415a-be85-051a2a48d0c2/5ec51d3d9f092ba558fb5f1f03d26699/dotnet-sdk-2.1.403-linux-arm.tar.gz</a></pre><p>Ok now we have to manually install the bits.</p><pre>sudo mkdir /opt/dotnet</pre><pre>sudo tar -xvf dotnet-sdk-2.1.403-linux-arm.tar.gz -C /opt/dotnet/</pre><pre>sudo tar -xvf aspnetcore-runtime-2.1.5-linux-arm.tar.gz -C /opt/dotnet/</pre><pre>sudo ln -s /opt/dotnet/dotnet /usr/local/bin</pre><p>Ok now we can check if it was installed correctly by issuing</p><pre>dotnet --info</pre><p>and your console output should be similar to</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5oWZeZBtruzt0Qd4z-KhDA.png" /></figure><blockquote>If you got some errors before any digging try to install these linux dependencies, for what i have understood these should not be necessary on last .net core 2.1.</blockquote><pre>sudo apt-get -y update</pre><pre>sudo apt-get -y install libunwind8 gettext</pre><p><strong>Install VS Debugger</strong></p><p>Now it’s time to install vs remote debugger for Linux and it couldn’t be simpler than running the following command.</p><pre>curl -sSL <a href="https://aka.ms/getvsdbgsh">https://aka.ms/getvsdbgsh</a> | bash /dev/stdin -r linux-arm -v latest -l ~/vsdbg</pre><p><strong>New Blazor Project and deploying with dotnet-sshdeploy</strong></p><p>The most annoying thing when working with a remote device is deploy part, in the past you would have to roll your own script in either bash or powershell. But now we have a new tool in town and it is dotnet-sshdeploy!</p><blockquote>For more info and options head to <a href="https://github.com/unosquare/sshdeploy">https://github.com/unosquare/sshdeploy</a></blockquote><p>Because it is a .net core global tool, it is very easy to install.</p><pre>dotnet tool install -g dotnet-sshdeploy</pre><blockquote>First time using blazor head to <a href="https://blazor.net/docs/get-started.html">https://blazor.net/docs/get-started.html</a> for info how to setup VS Extension and download the templates.</blockquote><p>Ok now it’s time to create your new Blazor project, run the following commands to get started.</p><p>open a command line and cd on your main projects folder</p><pre>cd c:\Dev\Code\</pre><pre>mkdir blazorpi</pre><pre>cd blazorpi</pre><pre>dotnet new blazorserverside</pre><p>So now to enable deployment with ssh with need to add a few settings to our server side project that should be in this case blazorpi.Server.csproj edit it from visual studio or any text editor and add the following, replace SshDeployHost with your raspberry ip address, username and password with your own</p><pre>&lt;PropertyGroup&gt;<br> &lt;SshDeployHost&gt;192.168.2.194&lt;/SshDeployHost&gt;<br> &lt;SshDeployClean /&gt;<br> &lt;SshDeployTargetPath&gt;/home/pi/blazorpi&lt;/SshDeployTargetPath&gt;<br> &lt;SshDeployUsername&gt;pi&lt;/SshDeployUsername&gt;<br> &lt;SshDeployPassword&gt;raspberry&lt;/SshDeployPassword&gt;<br> &lt;RunPostBuildEvent&gt;OnBuildSuccess&lt;/RunPostBuildEvent&gt;<br>&lt;/PropertyGroup&gt;</pre><pre>&lt;Target Condition=&quot;$(BuildingInsideSshDeploy) ==&#39;&#39;&quot; Name=&quot;PostBuild&quot; AfterTargets=&quot;PostBuildEvent&quot;&gt;<br>   &lt;Exec Command=&quot;cd $(ProjectDir)&quot; /&gt;<br>   &lt;Exec Command=&quot;dotnet-sshdeploy push&quot; /&gt;<br>&lt;/Target&gt;</pre><p>This is how you project file should look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JaddoXl7oGBl8-fVISZfg.png" /></figure><p>Now if you run a build inside visual studio if it is successful, it should have deployed your app over your pi thanks to the Target we specified to run after a successful build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w6LMPXGhmrwa0CxVVpS0yw.png" /></figure><p>Ok now we got to run our app inside the raspberry, but we need to specify on which address and port otherwise by default it will run on localhost, we can do so by specifying the following env var before our dotnet command.</p><pre>cd blazorpi</pre><pre>ASPNETCORE_URLS=”<a href="http://*:5000/">http://*:5000</a>&quot; dotnet blazorpi.Server.dll</pre><p>Ok now you can take a look at your new blazor app by navigating in your browser to http://raspberry_ip_address:5000. Yeah!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BtosIHNAWUgJa6t3Fp_tsg.png" /></figure><p>This is wonderful we got blazor and .net core running inside a raspberry! Wow!</p><p><strong>Ok now it is debug time!</strong></p><p>Debugging is not a simple F5 stroke as we do for our local devlopment, but is not difficult we have just a few more step to do.</p><p>On Visual Studio 2017 menu Debug -&gt; Attach To Process it should open the following Window, set Connection Type to SSH and set Connection Target with your username@raspberry_ipaddress .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TTZfEQMSKP6ql4M0VbBKYw.png" /></figure><p>Pressing find it should open an authentication Window fill it with your ssh password and proceed.</p><p>Now you should have your app listed on the process list as following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*diDUtxIMU_AClZIxlpDnzQ.png" /></figure><p>Select it and press Attach. Now a new Window pop up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*65kzsDTzRRI2aGnrZENCIA.png" /></figure><p>Select the Managed option and click OK.</p><p>Now it’s time to set a breakpoint on WeatherForecastService on GetForecastAsync.</p><p>Refresh the browser and head to Fetch Data section on the left menu of your blazor app. And yes our breakpoint has been hit! Amazing! I don’t know why but the first time it can be very slow! But subsequent hits are faster, so the first time you just have to wait a few seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WdKekOX7x090gR4c6-KWcQ.png" /></figure><p>So now we have completed our setup, with this we a powerfull dev environment and we can reuse our C# skill both on the server side and client side for our raspberry developments!</p><p>Hope that this is as been useful for you! If you have any suggestion please leave a comment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7093fbc11ef4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>