<?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: Brian Richardson</title>
    <description>The latest articles on DEV Community by Brian Richardson (@cubikca).</description>
    <link>https://dev.to/cubikca</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%2F736054%2F3687b3d0-dbf4-4015-8c0b-419951ef9394.png</url>
      <title>DEV Community: Brian Richardson</title>
      <link>https://dev.to/cubikca</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cubikca"/>
    <language>en</language>
    <item>
      <title>First Impressions of MongoDB</title>
      <dc:creator>Brian Richardson</dc:creator>
      <pubDate>Thu, 23 Dec 2021 12:17:52 +0000</pubDate>
      <link>https://dev.to/cubikca/first-impressions-of-mongodb-1kbk</link>
      <guid>https://dev.to/cubikca/first-impressions-of-mongodb-1kbk</guid>
      <description>&lt;p&gt;I've been spending a lot of time lately studying DDD and thinking about how to modernize one of the larger business applications I work on. One of the textbooks I've been reading shows the implementation of aggregate persistence using JSON documents in RavenDB. However, the author notes that he probably should have used MongoDB.&lt;/p&gt;

&lt;p&gt;Given the recent hackathon news and a little bit of tinkering with RavenDB, I decided to look into MongoDB and Azure Cosmos DB. I was extremely surprised to find that MongoDB provides complete online courses and certifications for free! The training material is excellent and hands-on, and gave me a great dive into the introductory material.&lt;/p&gt;

&lt;p&gt;First impression, then, is very good. RavenDB was already quite nice as a development database, but the offering from MongoDB is first-class. The free-tier cluster comes with sample data and plenty of horsepower for development. All of the MongoDB products (Charts, Realms, Compass) are available at the free tier, so there's no barriers to start learning.&lt;/p&gt;

&lt;p&gt;It's worth mentioning that Azure Cosmos DB supports the MongoDB wire protocol, and can be used to migrate to Cosmos if it makes sense. At the moment, I can see no compelling reason to do so. MongoDB is supported in all North American AWS and Azure regions, so it's easy to locate it next to your application. The tools provided by MongoDB are second to none.&lt;/p&gt;

&lt;p&gt;I have a lot to learn before actually implementing any of this. But I feel like it should be reasonably well-received by developers, especially if I can demonstrate the power of the MongoDB tools to them. I think Charts should be a hit with senior management and executives. And I think I've found a way to simplify aggregate persistence without sacrificing database performance.&lt;/p&gt;

</description>
      <category>mongodb</category>
    </item>
    <item>
      <title>Using GitHub Codespaces on iPad</title>
      <dc:creator>Brian Richardson</dc:creator>
      <pubDate>Sun, 12 Dec 2021 08:16:42 +0000</pubDate>
      <link>https://dev.to/cubikca/using-github-codespaces-on-ipad-5412</link>
      <guid>https://dev.to/cubikca/using-github-codespaces-on-ipad-5412</guid>
      <description>&lt;p&gt;I only today ran across GitHub Codespaces while lamenting the inability to write code on my iPad, which I've taken to carrying around in place of my larger laptop. Codespaces makes it possible to do some actual development in a coffee shop without lugging around the larger notebook PC. So what is it, exactly?&lt;/p&gt;

&lt;p&gt;Codespaces provides both an IDE back-end in the form of a virtual machine, and a web-based version of Visual Studio Code to work on your code hosted on GitHub. You'll need to have a GitHub Team subscription for your user ($4USD/mo). The following steps must be taken before Codespaces will work properly (check the GitHub documentation for further details):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You need to enable Codespaces globally for your repository&lt;/li&gt;
&lt;li&gt;You need to set a billing limit for Codespaces&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Since Codespaces is a VM, it will bill for usage as per the terms on GitHub website. But, it has a nice feature that by default turns off your Codespace after 30 minutes of inactivity. This will truly get you a pay-as-you-go cloud-based coding environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusions
&lt;/h3&gt;

&lt;p&gt;I've compared this to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Cloud9 (uses its own IDE but requires you to configure all the EC2 components first)&lt;/li&gt;
&lt;li&gt;CodeAnywhere (has ancient Linux images for their build containers)&lt;/li&gt;
&lt;li&gt;code-server running on my own VM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The GitHub environment feels very natural on the iPad Pro. I recommend using Safari to load up your Codespace initially, then use the Share function to add your Codespace to your desktop. Using this shortcut to open your Codespace will put it in full screen mode and give you a little extra screen real estate. I also notice that this is the only mode where the Magic Mouse works as expected.&lt;/p&gt;

&lt;p&gt;The main reason this works is because it is Visual Studio Code powering the development environment. There is no need to learn a new IDE just to have a cloud-based environment. Once the shortcut is created on your desktop, Codespaces behaves exactly like an iOS native app. Mouse and keyboard work properly. I'd recommend opening your web applications in a separate browser, though by copying the link from the Ports tab in VS Code instead of launching the browser automatically. Doing so will make your debugger unavailable, since the web app opens in the same window as the IDE. You won't get the IDE back until you close the browser.&lt;/p&gt;

&lt;p&gt;I fired up the hosted Blazor WASM demo app in .NET 6.0, and very quickly got the application up and running. I was happy to see that WASM runs just fine in Safari, so we don't have to choose between having a native feeling app and a browser that runs WASM. Debugging is a little clunky. I set a breakpoint in the WeatherForecastController, only to find that when I switched back to the browser, it triggered a reload on the data, thus getting into an endless cycle where you can't really debug.&lt;/p&gt;

&lt;p&gt;To get around this, remove your breakpoint once you hit it in the debugger. You can still step through, but this time when you switch back to the browser, it the reload won't hit your breakpoint again. It's kind of a pain to keep setting and unsetting breakpoints, but it's a small inconvenience overall.&lt;/p&gt;

&lt;p&gt;One last quirk that I recall: the demo .NET 6 application runs by default on HTTPS, and redirects the HTTP port to HTTPS. This will produce a very strange result when you click the local link in the Ports tab: it will go through the GitHub port forward, but then redirect to localhost. This is actually evidence that the application is working properly, since it is redirecting to HTTPS. Since GitHub proxies the web connection, the application thinks it is running on localhost. To prevent this from happening, disable the HTTPS redirection in Program.cs.&lt;/p&gt;

&lt;p&gt;If you're like me and have tried every editor in the iOS App Store, and various other cloud-based approaches, I think you'll find this does the trick. It's not seamless, but it's very usable, and will fulfill the stated requirement of hanging out in a coffee shop and coding on your iPad. I am curious about people's experiences with Cloud9 though. I never really got a chance to try it out because I was struggling with my VPC/Subnet configuration. Please comment below if you've used it.&lt;/p&gt;

</description>
      <category>github</category>
      <category>ipad</category>
      <category>codespaces</category>
    </item>
    <item>
      <title>Linux Azure DBA Tools</title>
      <dc:creator>Brian Richardson</dc:creator>
      <pubDate>Tue, 26 Oct 2021 13:56:34 +0000</pubDate>
      <link>https://dev.to/cubikca/linux-azure-dba-tools-de1</link>
      <guid>https://dev.to/cubikca/linux-azure-dba-tools-de1</guid>
      <description>&lt;p&gt;Theoretically, Azure Data Studio is all you need to manage Azure SQL databases on Linux, but it doesn't seem to work that way. I frequently end up with "login failed for token-identified-principal" after being connected for only a few minutes. This makes using Azure Data Studio an exercise in frustration, wondering what combination of operations will result in ADS just conking out on you until your token expires.&lt;/p&gt;

&lt;p&gt;Azure SQL doesn't support the standard T-SQL &lt;code&gt;BACKUP&lt;/code&gt; and &lt;code&gt;RESTORE&lt;/code&gt; commands, so getting a copy of your database for local development is somewhat challenging. The Azure Portal requires the AAD admin credentials, not something I want to give out to developers. Enter SqlPackage, which I have started preferring to both the Azure portal and ADS. SqlPackage for Linux is available at &lt;a href="https://aka.ms/sqlpackage-linux"&gt;https://aka.ms/sqlpackage-linux&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A first attempt at copying the database from Azure might look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sqlpackage /a:export /scs:"Data Source=...Initial Catalog=..." /ua:true /tid:"mytenant.onmicrosoft.com"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Indeed, that's what I attempted. But UniversalAuthentication (required to authenticate with MFA) doesn't seem to work as expected on Linux. You would expect that a browser would be launched to login to the application (since MFA won't work without a browser). However, the command above doesn't work.&lt;/p&gt;

&lt;p&gt;Looking through the SqlPackage help, I see that there is a &lt;code&gt;/AccessToken&lt;/code&gt; option. We can manually obtain an access token and use it to authenticate. Access tokens can be obtained using the Azure CLI, using the command &lt;code&gt;az account get-access token --resource https://database.windows.net/&lt;/code&gt;. This will return a JSON body containing (among other things) the access token to use. Copy and paste this into an environment variable &lt;code&gt;ACCESS_TOKEN&lt;/code&gt;, and then the full sqlpackage invocation becomes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sqlpackage /a:export /at:"$ACCESS_TOKEN" /scs:"Data Source=..." /ua:True ...&lt;/code&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>azure</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
