IT

GSN and dApps: A Novel without gas obstacles

Tags: Ethereum, Gas Station Network, Solidity, evm-blockchains Imagine: you've just created an incredible decentralized application, and it's so cool that even your grandmother wanted to try it. But once users are faced with the need to pay a commission, the entire UX (User Experience) rapidly slides down like a ball down a slide. Blockchain promises a bright future in which decentralization, transparency and security are our best friends, and it makes us pay for daily operations. Imagine if you had to pay every time you like on social networks or send a message in a messenger. It's terrible, isn't it? But dApps users face something like this every day.But now, like a prince on a white horse, GSN (Gas Station Network) appears. With its help, developers can make their applications gas-less, and users will finally be able to forget about commissions like a nightmare.In this article, we will look at what GSN is, how it works, and how to implement it into your projects to please users. Re...

Cloud Communications: Understanding UCaaS, CCaaS, and CPaaS

Tags: ucaas, ccaas, cpaas, koding, communication, community management, sms, telegrambot, telegram bots, telegram In today's world, where businesses increasingly rely on effective communication, cloud technologies offer a wide range of solutions to optimize interactions both within the company and with customers. Three of the most popular options are UCaaS, CCaaS, and CPaaS. While they all fall under the umbrella of cloud communications, their functionality and applications differ significantly. Let's delve into the details.UCaaS (Unified Communications as a Service)UCaaS unifies various communication channels, such as voice calls, video conferencing, messaging, and email, into a single platform. This allows employees to easily communicate and collaborate with each other, regardless of their location.Benefits of UCaaS: Read more

Effective Monitoring with Firebase Performance for Flutter Apps

Tags: Flutter, firebase perfomance, dart Firebase Performance offers a free, comprehensive solution for tracking app performance. As part of the Firebase suite, it provides seamless integration with other Firebase services like Crashlytics, making it easier to manage all performance and crash data in one place. This not only simplifies access but also streamlines team collaboration without the need to manage multiple platforms. Read more

ChatGPT Canvas: Your New Partner in Writing and Coding

Tags: chatgpt, chatgpt 4o, chatgpt with canvas, openai, openai canvas, news from openai OpenAI has recently launched a new feature called Canvas for ChatGPT, designed to enhance users' interactions with AI for writing and coding projects. This new interface aims to provide a more collaborative and interactive experience, moving beyond the traditional chat format. In this article, I'll cover the top features of ChatGPT Canvas and show how to use it. Read more

XML parsing into plain Map in Golang

Tags: go, xml, conversion While in 2024 using XML looks a bit outdated, it still happens. And sometimes it happens we are to deal with XML having "free-structure", i.e. it couldn't be parsed into tree of user-defined structs. For JSON there still is a way to parse it with a single call into map[string]any and work with it using careful type assertions. Regretfully, there is no similar feature for XML (in Golang). Here I'll draft suitable function and demonstrate it - both for others and for myself if I ever need this again (recreating it from scratch may be somewhat painful). Let's see implementation

Add a Property to the Top-level Statements Program class

The evolution of the C# language has introduced us to many new features and probably made a lot of folks re-evaluate how they write their apps. In the latest versions of .NET, nothing has been marked such a stylistic shift as the introduction of top-level statements.In this short post, we’ll examine how to add properties to your Program instance to improve the readability of utility console applications.Top-level statement filesWhen starting a new console application, you can create a Program.cs file and opt into the top-level statements style. The single line below is a valid .NET application.Console.WriteLine("Hello, World");At compile-time, the compiler generates the typical ceremony associated with traditional applications. Looking at our app’s low-level C# version, we’ll see the symbols we typically expect to see in a .NET app.using System;using System.Runtime.CompilerServices;[CompilerGenerated]internal class Program{ private static void $(string[] args) { Console.WriteLine...

Fix .NET MAUI MissingEntitlement and Provisioning Profiles Issues

There are times on this blog when I write posts for the reader’s benefit and times when I need to memorialize my ownpain and suffering to find a solution to a seemingly simple issue. This post is the latter.In this post, we’ll see what it takes to fix the MissingEntitlement and “Could not find any available provisioningprofiles” errors.Also, be warned: You might not like what you see.Ok, let’s go!iOS, Security, and EntitlementsI recently purchased the “.NET MAUI in Action” book and was workingthrough the sample application in Chapter 3. The author’sperspective differs from mine in that their app targets Windows, and I am targeting iOS. As one might expect, thedetails between the two target platforms differ.This difference led to my first issue running the sample application targeting iOS; I got this exception and crashed theapplication.System.Exception: Error adding record: MissingEntitlement at Microsoft.Maui.Storage.KeyChain.SetValueForKey(String value, String key, String service)...

Health Checks for ASP.NET Core and Entity Framework Core

I’ve recently been reading up on .NET Aspire and have found a lot of cool .NET tech underpinning the offering. One ofthe tools that has gotten a glow-up since I last looked at it has been Microsoft.Extensions.Diagnostics.HealthCheckspackage provides you with the infrastructure to perform various types of system health monitoring.In this post, we’ll look at installing the health checks package into existing ASP.NET Core applications and using anadditional package to perform health checks on your databases using Entity Framework Core.Install and Set Up Health ChecksIn an existing ASP.NET Core application, you’ll need to install the following package.dotnet add package Microsoft.Extensions.Diagnostics.HealthChecksOnce the package has been installed, you must do several setup tasks in your Program file.The first step is to register the HealthChecks middleware and services in the services collection.builder.Services.AddHealthChecks();Next, in your ASP.NET Core request pipeline, you’ll need...

How To Fix .NET Nullability Warnings For Guarded Members

Nullability provides developers with development-time warnings that can help reduce dereferencing issues. These errorscan be costly, but with the power of a few additional checks in code, developers can easily avoid them, putting them incontrol of their code’s quality.In this post, we’ll see a code sample that should be “safe” yet continues to give IDE and build-time warnings aboutdereferencing of a possibly null reference. We’ll also see how to adjust your code to remove unnecessary warnings incurrent and future projects.Dereference of a possibly null referenceLet’s look at some basic C# code, which you likely have something similar to in your projects.var database = new Database();// Name cannot be null when Initialize is trueif (database.Initialized){ // This has a warning about Name being null var length = database.Name.Length; Console.WriteLine($"{database.Name} and length is {length}");}Console.WriteLine("Hello, World!");public class Database{ public string? Name...

HTML Datalist for ASP.NET Core Inputs

In my last blog post, I discussed range inputs. This time, we’ll examine a tag helper that adds support for the HTML element of datalist.In this short post, I’ll explain what a datalist is and why you may want to consider using it in your ASP.NET Core applications. Finally, we’ll implement a set of tag helpers to make using the datalist element more straightforward with your ASP.NET Core MVC and Razor Page applications.What is datalist?True to its name, the datalist element allows web developers to create a list of options that are permissible or recommended for form input elements. This allows users to choose from a predefined list the application developer has curated.Let’s look at a quick HTML example pulled from the MDN web docs.Choose a flavor: The ice-cream-choice field will use the datalist options and provide users with a dropdown of potential options but still allow users to type their choices using freeform text.The list attribute supports multiple input t...

HTML Range Inputs with ASP.NET Core TagHelpers

I’ve recently been rediscovering all the input fields that HTML offers and how they can help developers build more straightforward user experiences. The library of native HTML controls is impressive, with 22 HTML input types as of this post.Looking through ASP.NET Core’s InputTagHelper, I counted 14 supported input types based on the .NET common language runtime types you may use in your models. That’s over 8 controls missing from ASP.NET Core. The missing range input is one of the most valuable controls.In this post, we’ll write an ASP.NET Core tag helper that piggybacks on the InputTagHelper and turns a number property into a range input.What is the range Input?The range input is as it sounds. Developers commonly refer to these elements as a “slider” since users typically slide an indicator to set a value. The input allows users to choose a value constrained by a minimum and maximum value. The limitation ensures that users can only choose valid values. When defining a range input, y...

HTML5 Validation for ASP.NET Core Models and Razor Views

I was recently working on an HTMX and ASP.NET Core demo and wanted to limit client-to-server requests to valid requests. This is a built-in feature for HTMX, as long as you utilize HTML5 validators on your forms and inputs. As many ASP.NET Core practitioners know, the default client-side validation in ASP.NET Core is not HTML5 but a mix of custom data-val attributes and JQuery. The current approach is acceptable, but it makes adopting new frameworks, supporting native HTML capabilities, and dropping extraneous dependencies more difficult.Could we drop the JQuery validation dependency in favor of HTML5 validation? Luckily, we can thank OSS author Andrew White for his latest NuGet package, FinBuckle.Html5Validation. This package allows us to disable the default behavior of ASP.NET Core MVC and Razor Pages for a more modern approach.What is HTML5 Validation?Before HTML5, developers wrote all client-side validation using JavaScript code. While JavaScript code allowed for complex scenarios...

What is HSTS and why is it in my ASP.NET Core app?

When creating a new ASP.NET Core application, you get a set of middleware that performs typical web application duties. Some include serving static assets, routing, HTTPS redirection, and exception handling. Folks looking will also notice a middleware registration of the app.UseHsts() found in every ASP.NET Core app.What is HSTS, why would you want it, and how do you configure the HSTS options in ASP.NET Core? Let’s find out.What is HSTS?HSTS (HTTP Strict Transport Security) is a method by which your application server can tell clients to use a secure connection when sending requests. As you may know, HTTP is unsecured communication, while HTTPS uses encryption to improve users’ privacy and security. Applications can transition user sessions from HTTP and HTTPS, and historically, it was very common to move from an unsecured part of a website to a secured section. For example, shopping sites used to display store items over HTTP and then only use HTTPS for the checkout process.This sti...

How To Encrypt ASP.NET Core Route Parameters

I recently read a classic blog post from the RavenDB community recommending developers think twice about exposing primary identifiers in their URLs. There are several reasons for this, which I’ll summarize in this post, but I wanted to revisit the problem and see what the current ASP.NET Core development stack has to offer when it comes to solving this problem.In this post, we’ll see some code that can both encrypt and decrypt sensitive identifiers in the URL path.Why Obscure Identifiers?Many people first think, “Why obscure identifiers in the first place?” I mean, it’s just an ID, right?There are several arguments as to why it may be a “bad” practice.1. URL TamperingWhile we all do our best to secure our applications, there are times when we may forget to properly verify that a user has permission to access a particular resource.https://example.com/?id=1Over the years, we’ve become acutely aware that changing the value of the id in a URL might return a different resource. This may be...

State Machines, Light Switches, and Space Travel with Stateless and .NET 8

State machines are so integral to software development that they often seem invisible to developers. They are used sofrequently yet abstracted away through APIs and syntax that many developers don’t directly deal with them. However, we’dlike to.At their core, state machines are systems with finite inputs and deterministic pathways. While they can be complex, thebasic structure of nodes and vertices makes them more approachable than they may initially seem.In this post, I’ll guide you through the process of building two state machines using the .NETlibrary Stateless. We’llalso discuss effective strategies for incorporating state machines into your code.Getting Started with StatelessTo start using Stateless, you’ll need to install the latest versionof the package using NuGet.dotnet add package StatelessFrom here, you will use the StateMachine class to define the state object and the triggers that mutate the machine’sstate.The example used in the Stateless documentation is that of a phon...

Blazor HTML Forms, Submitting, and Antiforgery Tokens

I love the web and HTML. It’s certainly come a long way since its inception and what it provides as a core experiencefor web developers. While folks can certainly build HTML-exclusive experiences, adding forms on a page inevitably leadsto introducing a backend tech stack. Recently, I’ve been experimenting with Blazor Server-side Rendering (SSR) and howdevelopers can use its component-driven approach while still building the web experience they know and love.In this post, we’ll see how to use the plain-old form tag with a Blazor SSR page, handle form posts, and attachantiforgery tokens.Why not use EditForm?Anyone familiar with Blazor would likely immediately think, “Why not usethe EditFormcomponent?” Well, for my taste, the EditForm component has so many hooks, fields, and requirements that it begins tofeel like a burden compared to the humble HTML form. In my opinion, much of the EditForm functionality is overkill foran SSR scenario.You’re welcome to use EditForm if you find its featu...

Fix Missing OpenAPI Elements From ASP.NET Core Minimal API Apps

When working in .NET, there’s a lot of room for reorganizing a codebase, but sometimes we can organize ourselves into amess of a problem. Recently, when working on an ASP.NET Core Minimal API demo, I seemingly broke an endpoint’s OpenAPIdefinition, and it was no longer in the list of endpoints.In this short post, we’ll compare two endpoints and discuss why one is different than the other, why it might breakOpenAPI integrations, and how to fix it.Let’s start with a typical Minimal API endpoint.app.MapGet("/hello", () => { return new Hello("World"); }) .WithName("Hello") .WithOpenApi(); record Hello(string Target);Our endpoint registration contains enough metadata to determine the parameters, the return type and its structure, andthe name of our endpoint. Great! That’s more than enough for ASP.NET Core to generate an OpenAPI definition entry.Let’s do some refactoring of our handler to a local function.Task Handler(){ return Task.FromResult(new Hello("World"));}a...

ASP.NET Core, SSR Web Components, and Enhance Wasm

Web components are some of the most exciting technology I’ve seen in a long time. They promise to revolutionize how wewrite, maintain, and ship HTML-based applications. With web components, you can extend the set of HTML tags specific toyour site while still providing the functionality you intended with less markup.And then there’s Web Assembly, or Wasm for short, a technology that opens up a world of possibilities. It enables allecosystems to package functionality in a reusable format that can be deployed across a wide range of platforms.Could we combine them to provide ASP.NET Core with brand-new server-side rendering functionality while avoiding theclient-side costs of web components as they attach to the DOM? Sure we can!With Enhance Wasm.What is Enhance WASM?Enhance WASM is an open-source initiative to bring the features of Enhance, a dynamicweb apps framework, to the server for all technology stacks through Wasm. As mentioned in the opening, web componentsare significant but tak...

How to add HTTP headers to Blazor Components with RazorComponentResult

In a previous post, ]I wrote about using RazorComponentResult to render Blazor components](/how-to-use-blazor-server-rendered-components-with-htmx) from ASP.NET Core Minimal APIs. The ability allowsdevelopers to reuse Blazor components in new and exciting scenarios, specifically with JavaScript UI frameworks andlibraries such as React, Vue, Angular, and my favorite library, HTMX.In this concise post, we’ll explore setting HTTP Headers for RazorComponentResult and creating an extension methodthat simplifies this task, making your development process more efficient.RazorComponentResult RecapBlazor is a component-driven development framework inspired by the JavaScript React library.Components aim to encapsulate UI elements into reusable elements to help accelerate development. They can vary in size,from buttons, links, and textboxes to logical components such as detail cards, tables, video elements, and so on.Component trees also help manage a page’s state, and Blazor provides some DOM d...

Working with Rust Libraries from C# .NET Applications

I’ve been on a Rust learning journey lately, and it’s had me thinking about how I can consume Rust libraries fromexisting .NET applications. The .NET team has done much work regarding interoperability during the .NET 6 to .NET 8 era,and .NET 9 seems poised to continue that trend.In this post, we’ll create a Rust library and consume it from a .NET application. This post assumes you have installedthe .NET SDK and Rust SDK (cargo).A Simple Rust LibraryAfter creating a .NET Solution, I first created a new Rust library using cargo. The command is relativelystraightforward.cargo init --lib calculatorThis creates a new calculator library folder with the most critical files: Cargo.toml and lib.rs. Let’s updatethe Cargo.toml file to produce an artifact that our .NET application can consume, a dynamic library.[package]name = "calculator"version = "0.1.0"edition = "2021"[lib]name="calculator"crate-type=["dylib"][dependencies]rand = "0.8.5"I’ve also included the rand dependency for my Rust code l...

Fix Unable To Resolve DbContextOptions For EF Core

I recently hosteda live stream with badass-as-a-service Chris Klug, titled “Stop using Entity Framework Core as a DTO Provider!”.It’s worth a watch, and it gave me, a long-time Entity Framework user, a lot to think about and reevaluate in myworkflows. That said, regardless of whether you agree with Chris’ style, he showed a masterclass of tool usage and anunderstanding that’s easy to admire. In our live stream, one new trick (to me, at least) stood out as something everyEntity Framework Core user should know about.In this post, we’ll explore one strategy to appease the dotnet ef CLI tools regarding design-time configuration andhow it opens up a world of possibilities when dealing with database migrations.Dependencies and ceremonyEntity Framework Core is heavily built around conventions and flexibility. It’s a multi-provider object-relationalmapper (ORM), so it needs to operate under many unknown factors, with you, the developer, filling in the gaps. Whatdatabase are you using? How man...

Faster .NET Database Integration Tests with Respawn and xUnit

The nuances of data access are myriad, so when writing tests around complex data scenarios, I recommend just workingwith the actual database. Over time, you’ll find yourself with more valuable tests but, often, relatively slower testscompared to their in-memory alternatives. Like all things, there are trade-offs, but you can still strategize in makingyour tests faster.In this post, I’ll show you how to take advantage of xUnit class fixtures and the OSS library Respawn to manage thestate of your database across tests. This will help speed up your tests when faster steps replace a few expensive ones.What is Respawn?Respawn is a utility library designed to help developers resetdatabases to an “initial state”. With some configuration, Respawn can intelligently reset a database for testing usecases.Other strategies might employ complete database tear-downs, complex transaction management, or expensive Dockercontainerization strategies. When mixed with your database management strategy arou...

MemoizR - Declarative Structured Concurrency for C#

Recently, I’ve been focusing on the front-end side of building web applications with topics like React Hooks and AngularSignals. It’s a fascinating data model that can make working with data dependency graphs much more straightforward.To my surprise, other folks in the .NET community have also been inspired by the work happening in the frontend space.While scanning NuGet, I found MemoizR, a library that takes inspiration fromthe frontend world to bring the concept of dynamic lazy memoization to .NET developers.In this post, we’ll see a short example using the library and explain the sample output. Let’s go!What is MemoizR?According to the author, Timon Krebs, MemoizR is a declarative structured concurrency implementation for .NET thatsimplifies (and enhances) standard data flow methods across multiple threads. These methods include error handling,branching logic, and data mutation. Doing so helps developers manage concurrency more efficiently for simple to complexmulti-thread scenario...

Subscribe to our newsletter

Subscribe to our newsletter and never miss new stories and promotions.