There are times you want ot make updates to a resource on the server without replacing the whole of it. JSON Patch works a great deal in this, lighter and very powerful. To learn more on JSON Patch check out these links below:
ASP.NET Core supports JSON Patch natively using the
HttpPatchAttribute usually decorate on a controller action with
[HttpPath], model binding support for
JsonPatchDocument<T>, and model validation support when applying changes via extension method with the signature
document.ApplyTo(document, ModelState). …
With the introduction of Swift Package Manager (SPM), a number of projects are migrating fully but the majority are keeping SPM alongside Carthage and/or CocoaPods.
Migrating a package from CocoaPods to SPM may be backed with a couple of reasons such as better versioning, better support inside Xcode, etc. Internally, we started migrating some of our reusable code from CocoaPods to SPM. At this time, we can only migrate if some criteria are met:
AspNetCore and Service Fabric, both being relatively new in the market, have become fairly stable in the last couple of months. Usually, when you create a Service Fabric application with a stateless service built atop of AspNetCore, the service would use the HttpSys server (formerly WebListener). This is because the HttpSys driver present on windows is production-grade and can be exposed to the Internet. In fact IIS (commonly used to host AspNetCore apps and also used by Azure Web Apps), makes use of the HttpSys driver. This approach works fine without port sharing across multiple hostnames. …
Recently, as I was trying out Azure Stack (which, by the way, looks promising in my sight), I had to repeat installation more than twice. At one time I had to format the whole machine because only 2 of the 11 required roles (Virtual Machines) could startup. Since the original setup had already succeeded, including the ability to send usage information to Azure using Azure Stack Bridge, there were two things I needed to clean up before a fresh setup; the Azure AD service principals and the Azure Bridge connection.
Disconnecting the Azure Bridge subscription can be done using a PowerShell command
Remove-AzsRegistration as directed here. However, if you cannot run the command because certain roles are not running or do have not access to the host machine at all. …
In my last post, I wrote about validating phone numbers in Kenya and in it introduced very specific regular expressions. If you haven’t read it, you might want to do before proceeding with the rest of this post.
A couple of days after the post, I was presented with millions of records having such numbers. The requirement being able to search through these numbers to get the records and get just one of them. As would other persons in my profession, I uploaded the data into a database on my local machine. I chose MS-SQL and used the SQL Server Management Studio (SMSS). Discussion on the choice of tool deserves a post on its own. …
Many times, I have seen developers write code for validating entries and they write very many if blocks or worse combine them with numerous switch cases. This approach would not have a problem but then more times than not, they need to be updated in certain periods when something new arises or for certain edge scenarios not originally considered.
The final regular expression has recently been updated (see end of post) but the logic remains the same.
One of these situations is validating phone numbers input into a field. For the Americas and Europe, this is not normally a problem because several frameworks will have that already inbuilt. This is not the same for other countries, such as Kenya (where I am from). …
During an application development cycle, we almost always begin by testing locally. Several times, it works locally but not after deployment. But we also do not like deploying directly to the production environment. To solve this, it is common practice to have a Staging environment that works in between.
In Microsoft’s Azure App Service, an App can have several slots from the Standard ties and above (as at the time of writing). I commonly use this feature to implement a Staging slot.
The essence of the Staging slot is to check if everything is okay before making the app version currently running in the staging slot visible in production. Due to this requirement, it is sometimes necessary to have two different sets of resources associated with the app. …
I have written about IoT communication for about 3 months now. It started here. This is the 10th and final blog post on that topic at least for some while. I choose to discuss something with less coding but more about reliable communications. So let’s get right into it.
Not many times people consider the mobile service provider for their IoT data needs because they can change the plan anytime. But does it really matter? Well, it does. Before you disagree let me explain it to you.
Typically, when you choose a mobile carrier, you are charged by the data you consumed either prepaid or postpaid. Normally we call them data bundles in our country, Kenya. On your phone, there are possible connection speeds that you can have, 4G, 3G, EDGE, GPRS and your phone switches between them automatically unless you choose to override. Each of them offers a certain maximum speed but you are still charged for the data you consume. In your IoT project, 2G (GPRS) will largely be enough but there are times you need more. Best example: you are uploading videos or downloading large files. Though the scenario is not common, one would find it a good choice to use 3G by default but fall back on to 2G if 3G is unavailable. The content being downloaded/uploaded can now take a shorter time and hence increase the battery life or reduce the power being constantly consumed. …
Today’s post is rather short as it is the end of the series on IoT communication nears.
As per the previous blog post, a TLS connection was established. A few issues like client-side certificate verification were solved. In this post, all I sort to show was doing the MQTT communication on a secure port.
The changes done to the code are as shown in commit b85db2c9. The MQTT broker used is hosted at
iot.eclipse.org:8883. I printed out the bytes sent and received using a simple hex dump function which I added in commit 82b44fec. The hex dump function gives a print of the ASCII representation where applicable. The results of the communication are shown below. Details about what each non-ASCII byte represents may be found in the MQTT-3.1.1 …
This is the second last post of the series on IoT Communication which has gone on for slightly more than a month now. In this post, I endeavor to connect an IoT device to the Azure IoT Hub without using the provided IoT libraries.
To many, this is a matter of personal preference more than it is of functionality. The Azure IoT Hub is more of a gateway than anything else. It will connect to your IoT devices while your other applications (e.g. management web interface etc.) connect to it.
My reasons for choosing it: