<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>dotnet &amp;mdash; Attach to Process</title>
    <link>https://devblog.dinobansigan.com/tag:dotnet</link>
    <description>Thoughts and Notes on Software Development</description>
    <pubDate>Mon, 26 Oct 2026 10:00:55 +0000</pubDate>
    <image>
      <url>https://i.snap.as/4wmUdb6N.png</url>
      <title>dotnet &amp;mdash; Attach to Process</title>
      <link>https://devblog.dinobansigan.com/tag:dotnet</link>
    </image>
    <item>
      <title>DevLog – 005: The Write.as Archive Page Generator Is Back</title>
      <link>https://devblog.dinobansigan.com/devlog-005-the-write-as-archive-page-generator-is-back?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[In my last DevLog, I mentioned that I took down apps.dinobansigan.com, and with it, the Write.as Archive Page Generator. I said I was letting it go. Well, that lasted about two months.&#xA;&#xA;So, I went to update one of my other blogs recently, and realized the archive page on it was way out of date. The tool I used to update it was gone. Turns out I still needed it after all.&#xA;&#xA;Why it can&#39;t just be a website&#xA;&#xA;The old version was a Blazor WASM app. Since it ran in the browser, it couldn&#39;t call the Write.as API directly because of CORS. My workaround was to write my own API for the Blazor app to call, running as an Azure App Service. That API ran on free Azure credits that I&#39;ve since lost access to.&#xA;&#xA;I didn&#39;t want to host something again, since that means paying for it. And I didn&#39;t want to fight CORS again either. So this time around, the answer was an app that runs locally on my own machine. CORS only applies to browsers, so a regular app can call the Write.as API just fine.&#xA;&#xA;Rebuilding it with Claude Code&#xA;&#xA;I rebuilt this one with Claude Code. I treated it like pairing with another developer. Claude wrote most of the code, and I reviewed every change before it went in. Good news was, I still had the source code for both the old Blazor app and the API on my machine, so we had something to work off of. We ended up with a simple .NET console app. You run it with your blog&#39;s alias, and it spits out the HTML for your archive page. Same output as before, same CSS classes, so if you customized the look of your archive page, it should still work.&#xA;&#xA;It still uses my WriteAs.NET library to talk to the Write.as API. But we swapped out CommonMark.NET and HtmlAgilityPack for Markdig, which turns the Markdown of untitled posts into plain text in a single line of code. CommonMark.NET hasn&#39;t been updated in years, so it was time anyway. Going through my old code also turned up a few bugs, like the app crashing on short untitled posts. Oops.&#xA;&#xA;From reading through the old code to having a working app up on GitHub, the whole thing took one afternoon.&#xA;&#xA;Rate limiting&#xA;&#xA;The biggest surprise was that Write.as now heavily rate limits calls to its API. And because of how I wrote WriteAs.NET, a rate limited call just comes back empty instead of throwing an error. So the first test run fetched 20 out of 55 posts, and would have happily given me an incomplete archive page without me knowing.&#xA;&#xA;The fix was to slow things down. The app now waits 10 seconds between each page of posts, retries if it still gets rate limited, and checks the number of posts it got against what the blog says it has. It&#39;s slow, but it gets all of them. Funny enough, that&#39;s an improvement over the old version, which used to time out on blogs with a lot of posts. An API key would probably help with the rate limiting, but I don&#39;t have one set up right now.&#xA;&#xA;There was also a bug in the new version where some emojis in post titles showed up as code instead of the actual emoji. That one got fixed real quick.&#xA;&#xA;It&#39;s on GitHub&#xA;&#xA;Back in 2022, I said I&#39;d share the source code for the WPF version of this tool if there was enough interest. This time around, I&#39;m just putting it out there: writeas-archive-generator. It&#39;s a console app, so no pretty UI, but it does the job. You&#39;ll need the .NET 10 SDK to run it, and the README has all the details.&#xA;&#xA;Eventually, I want to build a Windows desktop app with a UI for it. But for now, this works, and my archive page is up to date again. Thanks for reading, and I&#39;ll catch you in the next DevLog.&#xA;&#xA;Tags: #DevLog #ClaudeCode #DotNet #CSharp #WriteAs #WriteAsNet&#xA;&#xA;!--emailsub--&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/devlog-005-the-write-as-archive-page-generator-is-back&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>In my <a href="https://devblog.dinobansigan.com/devlog-004">last DevLog</a>, I mentioned that I took down apps.dinobansigan.com, and with it, the Write.as Archive Page Generator. I said I was letting it go. Well, that lasted about two months.</p>

<p>So, I went to update one of my other blogs recently, and realized the archive page on it was way out of date. The tool I used to update it was gone. Turns out I still needed it after all.</p>

<h2 id="why-it-can-t-just-be-a-website">Why it can&#39;t just be a website</h2>

<p>The old version was a Blazor WASM app. Since it ran in the browser, it couldn&#39;t call the Write.as API directly because of CORS. My workaround was to write my own API for the Blazor app to call, running as an Azure App Service. That API ran on free Azure credits that I&#39;ve since lost access to.</p>

<p>I didn&#39;t want to host something again, since that means paying for it. And I didn&#39;t want to fight CORS again either. So this time around, the answer was an app that runs locally on my own machine. CORS only applies to browsers, so a regular app can call the Write.as API just fine.</p>

<h2 id="rebuilding-it-with-claude-code">Rebuilding it with Claude Code</h2>

<p>I rebuilt this one with Claude Code. I treated it like pairing with another developer. Claude wrote most of the code, and I reviewed every change before it went in. Good news was, I still had the source code for both the old Blazor app and the API on my machine, so we had something to work off of. We ended up with a simple .NET console app. You run it with your blog&#39;s alias, and it spits out the HTML for your archive page. Same output as before, same CSS classes, so if you customized the look of your archive page, it should still work.</p>

<p>It still uses my <a href="https://github.com/DinoBansigan/WriteAs.NET">WriteAs.NET</a> library to talk to the Write.as API. But we swapped out CommonMark.NET and HtmlAgilityPack for Markdig, which turns the Markdown of untitled posts into plain text in a single line of code. CommonMark.NET hasn&#39;t been updated in years, so it was time anyway. Going through my old code also turned up a few bugs, like the app crashing on short untitled posts. Oops.</p>

<p>From reading through the old code to having a working app up on GitHub, the whole thing took one afternoon.</p>

<h2 id="rate-limiting">Rate limiting</h2>

<p>The biggest surprise was that Write.as now heavily rate limits calls to its API. And because of how I wrote WriteAs.NET, a rate limited call just comes back empty instead of throwing an error. So the first test run fetched 20 out of 55 posts, and would have happily given me an incomplete archive page without me knowing.</p>

<p>The fix was to slow things down. The app now waits 10 seconds between each page of posts, retries if it still gets rate limited, and checks the number of posts it got against what the blog says it has. It&#39;s slow, but it gets all of them. Funny enough, that&#39;s an improvement over the old version, which used to time out on blogs with a lot of posts. An API key would probably help with the rate limiting, but I don&#39;t have one set up right now.</p>

<p>There was also a bug in the new version where some emojis in post titles showed up as code instead of the actual emoji. That one got fixed real quick.</p>

<h2 id="it-s-on-github">It&#39;s on GitHub</h2>

<p>Back in 2022, I said I&#39;d share the source code for the WPF version of this tool if there was enough interest. This time around, I&#39;m just putting it out there: <a href="https://github.com/DinoBansigan/writeas-archive-generator">writeas-archive-generator</a>. It&#39;s a console app, so no pretty UI, but it does the job. You&#39;ll need the .NET 10 SDK to run it, and the README has all the details.</p>

<p>Eventually, I want to build a Windows desktop app with a UI for it. But for now, this works, and my archive page is up to date again. Thanks for reading, and I&#39;ll catch you in the next DevLog.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DevLog" class="hashtag"><span>#</span><span class="p-category">DevLog</span></a> <a href="https://devblog.dinobansigan.com/tag:ClaudeCode" class="hashtag"><span>#</span><span class="p-category">ClaudeCode</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:CSharp" class="hashtag"><span>#</span><span class="p-category">CSharp</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAs" class="hashtag"><span>#</span><span class="p-category">WriteAs</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAsNet" class="hashtag"><span>#</span><span class="p-category">WriteAsNet</span></a></em></p>



<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/devlog-005-the-write-as-archive-page-generator-is-back">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/devlog-005-the-write-as-archive-page-generator-is-back</guid>
      <pubDate>Wed, 14 Oct 2026 21:30:31 +0000</pubDate>
    </item>
    <item>
      <title>DevNotes - 005</title>
      <link>https://devblog.dinobansigan.com/devnotes-005?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Fire and forget template for C#/.NET to run something that you don&#39;t need to wait on and don&#39;t care about the results.&#xA;Task.Run(() =  {&#xA;&#x9;//code goes here&#xA;});&#xA;---&#xA;&#xA;In ReactJS, if ESLint says you cannot use inline arrow functions to pass in props in JSX, a solution is to wrap them with the useCallback hook.&#xA;&#xA;Reference: https://stackoverflow.com/a/36677798/5041911&#xA;&#xA;---&#xA;&#xA;Modals -- can be used to add dialog or popup info boxes on your ReactJS app.&#xA;&#xA;---&#xA;&#xA;So using this library actually helped me solve my Azure Application Insights logging issue. The issue being, since I had a dateOfBirth object in my formData object, app insights would save it as an object, as opposed to something like dateOfBirth: 2024-04-16. The solution was to flatten the formData object so it will get logged properly in Azure App Insights.&#xA;&#xA;---&#xA;&#xA;Rendering the HTML string in React -- short tutorial on how to render an HTML string in ReactJS/Gatsby.&#xA;&#xA;---&#xA;&#xA;Series: #DevNotes&#xA;Tags: #CSharp #DotNet #Template #ReactJS #Azure #ApplicationInsights #Gatsby&#xA;&#xA;!--emailsub--&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/devnotes-005&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>Fire and forget template for C#/.NET to run something that you don&#39;t need to wait on and don&#39;t care about the results.</p>

<pre><code class="language-csharp">Task.Run(() =&gt;
{
	//code goes here
});
</code></pre>

<hr/>

<p>In ReactJS, if ESLint says you cannot use inline arrow functions to pass in props in JSX, a solution is to wrap them with the <code>useCallback</code> hook.</p>

<p>Reference: <a href="https://stackoverflow.com/a/36677798/5041911">https://stackoverflow.com/a/36677798/5041911</a></p>

<hr/>

<p><a href="https://react-bootstrap.netlify.app/docs/components/modal/">Modals</a> — can be used to add dialog or popup info boxes on your ReactJS app.</p>

<hr/>

<p>So using <a href="https://www.npmjs.com/package/flat">this library</a> actually helped me solve my Azure Application Insights logging issue. The issue being, since I had a <code>dateOfBirth</code> object in my <code>formData</code> object, app insights would save it as an object, as opposed to something like <code>dateOfBirth: 2024-04-16</code>. The solution was to flatten the <code>formData</code> object so it will get logged properly in Azure App Insights.</p>

<hr/>

<p><a href="https://reactgo.com/react-render-html/">Rendering the HTML string in React</a> — short tutorial on how to render an HTML string in ReactJS/Gatsby.</p>

<hr/>

<p><strong>Series:</strong> <a href="https://devblog.dinobansigan.com/tag:DevNotes" class="hashtag"><span>#</span><span class="p-category">DevNotes</span></a>
<strong>Tags:</strong> <a href="https://devblog.dinobansigan.com/tag:CSharp" class="hashtag"><span>#</span><span class="p-category">CSharp</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:Template" class="hashtag"><span>#</span><span class="p-category">Template</span></a> <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a> <a href="https://devblog.dinobansigan.com/tag:Azure" class="hashtag"><span>#</span><span class="p-category">Azure</span></a> <a href="https://devblog.dinobansigan.com/tag:ApplicationInsights" class="hashtag"><span>#</span><span class="p-category">ApplicationInsights</span></a> <a href="https://devblog.dinobansigan.com/tag:Gatsby" class="hashtag"><span>#</span><span class="p-category">Gatsby</span></a></p>



<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/devnotes-005">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/devnotes-005</guid>
      <pubDate>Tue, 23 Apr 2024 17:18:27 +0000</pubDate>
    </item>
    <item>
      <title>WriteAs.Net 1.2.1</title>
      <link>https://devblog.dinobansigan.com/writeas-net-1-2-1?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Version 1.2.1 of WriteAs.Net has been released. &#xA;&#xA;This very minor update adds an interface for the WriteAsClient class, which opens it up for use with dependency injection in ASP.NET Core. This allows you to create a single WriteAsClient instance and re-use it when needed, making the caching additions from Version 1.2.0 much more useful.&#xA;&#xA;This also frees me up to make better use of it in the API I&#39;m working on.&#xA;&#xA;You can install it via nuget:&#xA;Install-Package WriteAs.NET -Version 1.2.1&#xA;&#xA;Or via the .NET Core command line interface:&#xA;dotnet add package WriteAs.NET --version 1.2.1&#xA;&#xA;If you find any bugs or issues with it, please let me know. Thanks and y&#39;all have a good night.&#xA;&#xA;Tags: #DotNet #WriteAs #WriteAsNet&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/writeas-net-1-2-1&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>Version 1.2.1 of <a href="https://github.com/DinoBansigan/WriteAs.NET">WriteAs.Net</a> has been released.</p>

<p>This very minor update adds an interface for the <code>WriteAsClient</code> class, which opens it up for use with dependency injection in ASP.NET Core. This allows you to create a single <code>WriteAsClient</code> instance and re-use it when needed, making the caching additions from <a href="https://write.as/attach-to-process/writeas-net-1-2-0">Version 1.2.0</a> much more useful.</p>

<p><em>This also frees me up to make better use of it in the <a href="https://write.as/attach-to-process/devlog-001">API</a> I&#39;m working on.</em></p>

<p>You can install it via nuget:
<code>Install-Package WriteAs.NET -Version 1.2.1</code></p>

<p>Or via the .NET Core command line interface:
<code>dotnet add package WriteAs.NET --version 1.2.1</code></p>

<p>If you find any bugs or issues with it, <a href="https://write.as/attach-to-process/contact">please let me know</a>. Thanks and y&#39;all have a good night.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAs" class="hashtag"><span>#</span><span class="p-category">WriteAs</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAsNet" class="hashtag"><span>#</span><span class="p-category">WriteAsNet</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/writeas-net-1-2-1">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/writeas-net-1-2-1</guid>
      <pubDate>Wed, 01 Feb 2023 05:30:17 +0000</pubDate>
    </item>
    <item>
      <title>DevNotes - 003</title>
      <link>https://devblog.dinobansigan.com/devnotes-003?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Cache Implementations in C# .NET -- good blog post on implementing caching with .NET.&#xA;&#xA;---&#xA;&#xA;You&#39;re using HttpClient wrong and it is destabilizing your software -- great blog post that told me that we should avoid the use of the &#34;using statement&#34; when working with an HttpClient instance. And that&#39;s because disposing it after say a one time use, like doing one API call and then immediately disposing, will leave open/pending socket connections. Do this often enough and you&#39;ll accumulate a number of those open/pending socket connections and that will slow down your app. The better approach is to use a single static HttpClient instance in your app.&#xA;&#xA;---&#xA;&#xA;The always-recent guide to creating a development environment for Node and React (with Babel and Webpack) -- good guide to setting up a full-stack JavaScript development environment on your local, with an eye toward ReactJS.!--more--&#xA;&#xA;---&#xA;&#xA;Good blog posts on how to create Windows Services using .NET Core:&#xA;&#xA;Creating Windows Services In .NET Core – Part 1 – The “Microsoft” Way&#xA;Creating Windows Services In .NET Core – Part 2 – The “Topshelf” Way&#xA;&#xA;---&#xA;&#xA;Combining multiple changes into one commit is a bad idea, because then you cannot revert the single change that you want to revert, without reverting all the other changes that came along with it.&#xA;&#xA;---&#xA;&#xA;Inadvertently discovered a way to find out who is running a specific process on a server. This is useful if you cannot remote into the server, like say because the connections are full. Using Visual Studio, you can do &#34;Attach to Process&#34; on a server. Assuming that server is setup with remote debugging, doing so will get you a listing of the apps/processes running on that server, plus which user are running those apps/processes.&#xA;&#xA;And now you know where I got the name for this blog as well.&#xA;&#xA;---&#xA;&#xA;Tags: #DevNotes #Bookmarks #DotNet #Caching #HttpClient #ReactJS  #WindowsServices #SourceControlBestPractices #TroubleshootingWindowsProcesses&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/devnotes-003&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://michaelscodingspot.com/cache-implementations-in-csharp-net/">Cache Implementations in C# .NET</a> — good blog post on implementing caching with .NET.</p>

<hr/>

<p><a href="https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/">You&#39;re using HttpClient wrong and it is destabilizing your software</a> — great blog post that told me that we should avoid the use of the “using statement” when working with an <code>HttpClient</code> instance. And that&#39;s because disposing it after say a one time use, like doing one API call and then immediately disposing, will leave open/pending socket connections. Do this often enough and you&#39;ll accumulate a number of those open/pending socket connections and that will slow down your app. The better approach is to use a single static <code>HttpClient</code> instance in your app.</p>

<hr/>

<p><a href="https://jscomplete.com/learn/1rd-reactful">The always-recent guide to creating a development environment for Node and React (with Babel and Webpack)</a> — good guide to setting up a full-stack JavaScript development environment on your local, with an eye toward ReactJS.</p>

<hr/>

<p>Good blog posts on how to create Windows Services using .NET Core:</p>
<ul><li><a href="https://dotnetcoretutorials.com/2019/09/19/creating-windows-services-in-net-core-part-1-the-microsoft-way/">Creating Windows Services In .NET Core – Part 1 – The “Microsoft” Way</a></li>
<li><a href="https://dotnetcoretutorials.com/2019/09/27/creating-windows-services-in-net-core-part-2-the-topshelf-way/">Creating Windows Services In .NET Core – Part 2 – The “Topshelf” Way</a></li></ul>

<hr/>

<p>Combining multiple changes into one commit is a bad idea, because then you cannot revert the single change that you want to revert, without reverting all the other changes that came along with it.</p>

<hr/>

<p>Inadvertently discovered a way to find out who is running a specific process on a server. This is useful if you cannot remote into the server, like say because the connections are full. Using Visual Studio, you can do <strong>“Attach to Process”</strong> on a server. Assuming that server is setup with remote debugging, doing so will get you a listing of the apps/processes running on that server, plus which user are running those apps/processes.</p>

<p><em>And now you know where I got the name for this blog as well.</em></p>

<hr/>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DevNotes" class="hashtag"><span>#</span><span class="p-category">DevNotes</span></a> <a href="https://devblog.dinobansigan.com/tag:Bookmarks" class="hashtag"><span>#</span><span class="p-category">Bookmarks</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:Caching" class="hashtag"><span>#</span><span class="p-category">Caching</span></a> <a href="https://devblog.dinobansigan.com/tag:HttpClient" class="hashtag"><span>#</span><span class="p-category">HttpClient</span></a> <a href="https://devblog.dinobansigan.com/tag:ReactJS" class="hashtag"><span>#</span><span class="p-category">ReactJS</span></a>  <a href="https://devblog.dinobansigan.com/tag:WindowsServices" class="hashtag"><span>#</span><span class="p-category">WindowsServices</span></a> <a href="https://devblog.dinobansigan.com/tag:SourceControlBestPractices" class="hashtag"><span>#</span><span class="p-category">SourceControlBestPractices</span></a> <a href="https://devblog.dinobansigan.com/tag:TroubleshootingWindowsProcesses" class="hashtag"><span>#</span><span class="p-category">TroubleshootingWindowsProcesses</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/devnotes-003">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/devnotes-003</guid>
      <pubDate>Mon, 26 Sep 2022 02:41:14 +0000</pubDate>
    </item>
    <item>
      <title>Useful Array Functions in JavaScript and C#</title>
      <link>https://devblog.dinobansigan.com/useful-array-functions-in-javascript-and-csharp?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[How to check if array contains a specific item&#xA;&#xA;To check if an object or item is contained in a JavaScript array, you can use the includes function, like so:&#xA;const customerIds = [1, 2, 3, 4, 5];&#xA;console.log(&#39;IsIncludedInArray&#39;, customerIds.includes(3));&#xA;&#xA;To do the same thing in C#, you can use the Contains or Any LINQ method, like so:&#xA;var customerIds = new int[5] { 1, 2, 3, 4, 5};&#xA;Console.WriteLine(&#34;IsIncludedInArray &#34; + customerIds.Contains(3));&#xA;Console.WriteLine(&#34;IsIncludedInArray &#34; + customerIds.Any(n =  n == 3));&#xA;&#xA;---&#xA;&#xA;How to filter out contents in an array&#xA;&#xA;To filter out the contents of an array in JavaScript, you can use the filter function., like so:&#xA;const customerIds = [1, 2, 3, 4, 5];&#xA;const filteredCustomerIds = customerIds.filter(n =  n &lt;= 3);&#xA;console.log(&#39;Filtered CustomerIds&#39;, filteredCustomerIds);&#xA;&#xA;To do the same thing in C#, you can use the Where LINQ method.&#xA;var customerIds = new int[5] { 1, 2, 3, 4, 5};&#xA;var filteredCustomerIds = customerIds.Where(n =  n &lt;= 3);&#xA;&#xA;foreach (var n in filteredCustomerIds)&#xA;{&#xA;  Console.WriteLine(n);&#xA;}&#xA;&#xA;Tags: #JavaScript #CSharp #DotNet&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/useful-array-functions-in-javascript-and-csharp&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<h3 id="how-to-check-if-array-contains-a-specific-item">How to check if array contains a specific item</h3>

<p>To check if an object or item is contained in a JavaScript array, you can use the <code>includes</code> function, like so:</p>

<pre><code class="language-js">const customerIds = [1, 2, 3, 4, 5];
console.log(&#39;IsIncludedInArray&#39;, customerIds.includes(3));
</code></pre>

<p>To do the same thing in C#, you can use the <code>Contains</code> or <code>Any</code> LINQ method, like so:</p>

<pre><code class="language-cs">var customerIds = new int[5] { 1, 2, 3, 4, 5};
Console.WriteLine(&#34;IsIncludedInArray &#34; + customerIds.Contains(3));
Console.WriteLine(&#34;IsIncludedInArray &#34; + customerIds.Any(n =&gt; n == 3));
</code></pre>

<hr/>

<h3 id="how-to-filter-out-contents-in-an-array">How to filter out contents in an array</h3>

<p>To filter out the contents of an array in JavaScript, you can use the <code>filter</code> function., like so:</p>

<pre><code class="language-js">const customerIds = [1, 2, 3, 4, 5];
const filteredCustomerIds = customerIds.filter(n =&gt; n &lt;= 3);
console.log(&#39;Filtered CustomerIds&#39;, filteredCustomerIds);
</code></pre>

<p>To do the same thing in C#, you can use the <code>Where</code> LINQ method.</p>

<pre><code class="language-cs">var customerIds = new int[5] { 1, 2, 3, 4, 5};
var filteredCustomerIds = customerIds.Where(n =&gt; n &lt;= 3);

foreach (var n in filteredCustomerIds)
{
  Console.WriteLine(n);
}
</code></pre>

<p>Tags: <a href="https://devblog.dinobansigan.com/tag:JavaScript" class="hashtag"><span>#</span><span class="p-category">JavaScript</span></a> <a href="https://devblog.dinobansigan.com/tag:CSharp" class="hashtag"><span>#</span><span class="p-category">CSharp</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/useful-array-functions-in-javascript-and-csharp">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/useful-array-functions-in-javascript-and-csharp</guid>
      <pubDate>Sat, 05 Feb 2022 13:46:15 +0000</pubDate>
    </item>
    <item>
      <title>WriteAs.Net 1.2.0</title>
      <link>https://devblog.dinobansigan.com/writeas-net-1-2-0?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Version 1.2.0 of WriteAs.Net has been released. &#xA;&#xA;This latest version now allows you to enter an API key when initializing a WriteAsClient instance. This API key will allow you to bypass the rate limiting checks on the Write.as API.&#xA;&#xA;Some basic in-memory caching has also been added to the client. You can configure some of the cache settings when initializing a WriteAsClient instance. The new settings are described below:&#xA;&#xA;cacheExpirationInSeconds determines how long data will stay in the cache before it expires. The default value for this setting is 300 seconds.&#xA;cacheSize determines how many objects it can store in the cache. Note that a collection of posts (ListPost) and a single post each count as 1 item. The default value for this setting is 4.&#xA;&#xA;You can install it via nuget:&#xA;Install-Package WriteAs.NET -Version 1.2.0&#xA;&#xA;Or via the .NET Core command line interface:&#xA;dotnet add package WriteAs.NET --version 1.2.0&#xA;&#xA;If you find any bugs or issues with it, please let me know. Thanks and y&#39;all have a good weekend.&#xA;&#xA;Tags: #DotNet #WriteAs #WriteAsNet&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/writeas-net-1-2-0&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>Version 1.2.0 of <a href="https://github.com/DinoBansigan/WriteAs.NET">WriteAs.Net</a> has been released.</p>

<p>This latest version now allows you to enter an API key when initializing a <code>WriteAsClient</code> instance. This API key will allow you to bypass the rate limiting checks on the Write.as API.</p>

<p>Some basic in-memory caching has also been added to the client. You can configure some of the cache settings when initializing a <code>WriteAsClient</code> instance. The new settings are described below:</p>
<ul><li><code>cacheExpirationInSeconds</code> determines how long data will stay in the cache before it expires. The default value for this setting is 300 seconds.</li>
<li><code>cacheSize</code> determines how many objects it can store in the cache. Note that a collection of posts (<code>List&lt;Post&gt;</code>) and a single post each count as 1 item. The default value for this setting is 4.</li></ul>

<p>You can install it via nuget:
<code>Install-Package WriteAs.NET -Version 1.2.0</code></p>

<p>Or via the .NET Core command line interface:
<code>dotnet add package WriteAs.NET --version 1.2.0</code></p>

<p>If you find any bugs or issues with it, <a href="https://write.as/attach-to-process/contact">please let me know</a>. Thanks and y&#39;all have a good weekend.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAs" class="hashtag"><span>#</span><span class="p-category">WriteAs</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAsNet" class="hashtag"><span>#</span><span class="p-category">WriteAsNet</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/writeas-net-1-2-0">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/writeas-net-1-2-0</guid>
      <pubDate>Sun, 29 Aug 2021 00:01:31 +0000</pubDate>
    </item>
    <item>
      <title>Working on Update to WriteAs.Net</title>
      <link>https://devblog.dinobansigan.com/working-on-update-to-writeas-net?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[I&#39;m working on an update to the WriteAs.Net client/wrapper library. In a previous post I talked about adding caching to it before I release a new version. I ran into some road-blocks that derailed me. I ended up pushing it off to the side to focus my time somewhere else.&#xA;&#xA;The two issues that I ran into were: figuring out what the cache key was going to be for the cached object and removing the oldest object in the cache. I now have solutions for those issues. &#xA;&#xA;For the cache keys, I figured I could use the method name plus the parameter values. &#xA;&#xA;For clearing out the oldest cached object, I decided to make use of a generic Queue collection that could accept the cache key values. Then I could just pop-off the oldest value from the Queue and use that to remove the associated object in the cache.&#xA;&#xA;And so anyway, I should have the updated version of the client/wrapper library out soon. I just need to do some more testing on it.&#xA;&#xA;Tags: #DotNet #WriteAs #WriteAsNet&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/working-on-update-to-writeas-net&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>I&#39;m working on an update to the <a href="https://github.com/DinoBansigan/WriteAs.NET">WriteAs.Net</a> client/wrapper library. In a <a href="https://devblog.dinobansigan.com/writeas-net-update">previous post</a> I talked about adding caching to it before I release a new version. I ran into some road-blocks that derailed me. I ended up pushing it off to the side to focus my time somewhere else.</p>

<p>The two issues that I ran into were: figuring out what the cache key was going to be for the cached object and removing the oldest object in the cache. I now have solutions for those issues.</p>

<p>For the cache keys, I figured I could use the method name plus the parameter values.</p>

<p>For clearing out the oldest cached object, I decided to make use of a generic <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.queue-1?view=net-5.0">Queue</a> collection that could accept the cache key values. Then I could just pop-off the oldest value from the Queue and use that to remove the associated object in the cache.</p>

<p>And so anyway, I should have the updated version of the client/wrapper library out soon. I just need to do some more testing on it.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAs" class="hashtag"><span>#</span><span class="p-category">WriteAs</span></a> <a href="https://devblog.dinobansigan.com/tag:WriteAsNet" class="hashtag"><span>#</span><span class="p-category">WriteAsNet</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/working-on-update-to-writeas-net">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/working-on-update-to-writeas-net</guid>
      <pubDate>Wed, 11 Aug 2021 02:19:11 +0000</pubDate>
    </item>
    <item>
      <title>Update Contents of Windows Form TextBox Periodically</title>
      <link>https://devblog.dinobansigan.com/update-contents-of-windows-form-textbox-periodically?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[When working with a Windows Forms TextBox, yes I was working with a Windows Forms TextBox 😀, and you want to display updates periodically while a long task is running, you can make use of the Application.DoEvents() method.&#xA;&#xA;I think a better solution is to use a BackgroundWorker class for this. But, if you&#39;re working on an unimportant utility tool or a throwaway app, using Application.DoEvents() should be good enough.&#xA;&#xA;Tags: #DotNet #WindowsForms&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/update-contents-of-windows-form-textbox-periodically&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>When working with a Windows Forms TextBox, <em>yes I was working with a Windows Forms TextBox</em> 😀, and you want to display updates periodically while a long task is running, you can make use of the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.application.doevents?view=net-5.0">Application.DoEvents()</a> method.</p>

<p>I think a better solution is to use a <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.backgroundworker?view=net-5.0">BackgroundWorker</a> class for this. But, if you&#39;re working on an unimportant utility tool or a throwaway app, using <a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.application.doevents?view=net-5.0">Application.DoEvents()</a> should be good enough.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:WindowsForms" class="hashtag"><span>#</span><span class="p-category">WindowsForms</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/update-contents-of-windows-form-textbox-periodically">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/update-contents-of-windows-form-textbox-periodically</guid>
      <pubDate>Tue, 19 Jan 2021 02:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Where to find the WCF TestClient Application</title>
      <link>https://devblog.dinobansigan.com/where-to-find-the-wcf-testclient-application?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[When you just want to do a simple WCF service test, you don&#39;t need to download third party tools. You can use the WCF Test Client app that usually comes as part of a Visual Studio installation. I keep forgetting where to find it, so I&#39;m writing it down on here to remind myself. &#xA;&#xA;I had Visual Studio 2017 installed on my PC. Here is where I found the WCF Test Client app (WcfTestClient.exe):&#xA;&#xA;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE&#xA;&#xA;Tags: #WCF #DotNet #VisualStudio&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/where-to-find-the-wcf-testclient-application&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>When you just want to do a simple WCF service test, you don&#39;t need to download third party tools. You can use the WCF Test Client app that usually comes as part of a Visual Studio installation. I keep forgetting where to find it, so I&#39;m writing it down on here to remind myself.</p>

<p>I had Visual Studio 2017 installed on my PC. Here is where I found the WCF Test Client app (WcfTestClient.exe):</p>

<p><code>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE</code></p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:WCF" class="hashtag"><span>#</span><span class="p-category">WCF</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a> <a href="https://devblog.dinobansigan.com/tag:VisualStudio" class="hashtag"><span>#</span><span class="p-category">VisualStudio</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/where-to-find-the-wcf-testclient-application">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/where-to-find-the-wcf-testclient-application</guid>
      <pubDate>Sat, 22 Aug 2020 23:00:00 +0000</pubDate>
    </item>
    <item>
      <title>WCF BindingConfiguration Error</title>
      <link>https://devblog.dinobansigan.com/wcf-bindingconfiguration-error?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[A week ago I was running a test and kept running into a WCF BindingConfiguration Error. I would not allow myself to check-in my code unless my tests passed. So, I battled with this error for over an hour.&#xA;&#xA;  The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named ‘BasicHttpBinding_IXXXXXX’. This is an invalid value for bindingConfiguration.&#xA;&#xA;It&#39;s your basic, run of the mill, WCF BasicHttpBinding configuration error.&#xA;&#xA;I double-checked my test project&#39;s app.config file and the relevant client.config files - everything looked right. I know it was a configuration issue. The error message itself made it obvious that it was a configuration issue. But everything looked right. I didn&#39;t see any issues with the config files I was looking at.&#xA;&#xA;It must be noted that it was already close to midnight at this point. I was working late that day and decided to push myself by resolving to check-in my changes before the night ends. I have no doubt that being tired and sleepy didn&#39;t help.&#xA;&#xA;Anyway, after awhile I realized that the service method that I was trying to test, was running inside another service. So, in addition to the test project’s app.config file, I also needed to double-check that other service’s Web.config file. When I ran into this error earlier that night, I actually updated that other Web.config file. I added the entry it needed just to cover my bases. I didn&#39;t know then that it was the Web.config file that was causing the error. &#xA;&#xA;For some reason, possibly due to fatigue and needing sleep, I didn&#39;t think about checking that Web.config file again. Out of frustration, I decided to take a break and headed to the kitchen to drink a glass of water. After hanging out in the kitchen for a bit, then listening to some good music, I finally had the bright idea to check this other Web.config file again. And there it was, a typo on the BasicHttpBinding entry I added. Can&#39;t believe I didn&#39;t check on it sooner.&#xA;&#xA;Lesson learned here is to take a break whenever you&#39;re stuck with a problem. Give your mind time to rest. Chances are, your subconscious will kick in and tell you what to try next. And if the problem points to a configuration issue, with WCF, it most likely is. So, check all the config files, again.&#xA;&#xA;Tags: #WCF #CSharp #DotNet&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/wcf-bindingconfiguration-error&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>A week ago I was running a test and kept running into a WCF BindingConfiguration Error. I would not allow myself to check-in my code unless my tests passed. So, I battled with this error for over an hour.</p>

<blockquote><p>The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named ‘BasicHttpBinding_IXXXXXX’. This is an invalid value for bindingConfiguration.</p></blockquote>

<p><em>It&#39;s your basic, run of the mill, WCF BasicHttpBinding configuration error.</em></p>

<p>I double-checked my test project&#39;s app.config file and the relevant client.config files – everything looked right. I know it was a configuration issue. The error message itself made it obvious that it was a configuration issue. But everything looked right. I didn&#39;t see any issues with the config files I was looking at.</p>

<p><em>It must be noted that it was already close to midnight at this point. I was working late that day and decided to push myself by resolving to check-in my changes before the night ends. I have no doubt that being tired and sleepy didn&#39;t help.</em></p>

<p>Anyway, after awhile I realized that the service method that I was trying to test, was running inside another service. So, in addition to the test project’s app.config file, I also needed to double-check that other service’s Web.config file. When I ran into this error earlier that night, I actually updated that other Web.config file. I added the entry it needed just to cover my bases. I didn&#39;t know then that it was the Web.config file that was causing the error.</p>

<p>For some reason, possibly due to fatigue and needing sleep, I didn&#39;t think about checking that Web.config file again. Out of frustration, I decided to take a break and headed to the kitchen to drink a glass of water. After hanging out in the kitchen for a bit, then listening to some good music, I finally had the bright idea to check this other Web.config file again. And there it was, a typo on the BasicHttpBinding entry I added. Can&#39;t believe I didn&#39;t check on it sooner.</p>

<p>Lesson learned here is to take a break whenever you&#39;re stuck with a problem. Give your mind time to rest. Chances are, your subconscious will kick in and tell you what to try next. And if the problem points to a configuration issue, with WCF, it most likely is. So, check all the config files, again.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:WCF" class="hashtag"><span>#</span><span class="p-category">WCF</span></a> <a href="https://devblog.dinobansigan.com/tag:CSharp" class="hashtag"><span>#</span><span class="p-category">CSharp</span></a> <a href="https://devblog.dinobansigan.com/tag:DotNet" class="hashtag"><span>#</span><span class="p-category">DotNet</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/wcf-bindingconfiguration-error">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/wcf-bindingconfiguration-error</guid>
      <pubDate>Tue, 18 Aug 2020 23:00:00 +0000</pubDate>
    </item>
  </channel>
</rss>