GithubHelp home page GithubHelp logo

markjprice / apps-services-net8 Goto Github PK

View Code? Open in Web Editor NEW
87.0 87.0 42.0 36.85 MB

Repository for the Packt Publishing book titled "Apps and Services with .NET 8" by Mark J. Price

PowerShell 0.11% C# 74.81% HTML 18.65% CSS 5.11% JavaScript 1.32%

apps-services-net8's Introduction

Hi there 👋, I am Mark J. Price. Author. Programmer. Teacher.

  • 📖 You can get my books from Amazon or my publisher Packt or any good book store.
  • 🤔 I’m currently working on the .NET 8 editions of my best selling books, C# 12 and .NET 8 - Modern Cross-Platform Development Fundamentals, scheduled to publish on November 14, 2023, the 2nd edition of my book, Apps and Services with .NET 8, scheduled to publish on December 12, 2023, and Tools and Skills for .NET 8 Pros, coming in 2024.
  • 🌱 You can read a Q&A with me.
  • 💬 Ask me about any issues that you might be having with the code in my books.
  • 📫 How to reach me: markjprice is also my Gmail account name.
  • ⚡ Michelle McNamara: "It’s chaos. Be kind."
  • 🦣 I am on Mastodon.

What you should know about me

An ex-Microsoft Certified Trainer (MCT) with more than 30 years’ experience in the IT industry, including two years working full-time for Microsoft’s Training and Certification group in Redmond, USA, I specialize in training that leads to developer certifications.

I am eager to lead programming students, both experienced and new, into the challenging worlds of web, cloud, and mobile computing using a rare combination of thirty years’ education experience coupled with real world consulting and developing production systems for enterprises worldwide.

  • I live in Wiltshire, England.
  • I'm experienced in the practical use of Microsoft developer tools and technologies.
  • I'm dedicated to enthusiastic and dynamic training as a means of nurturing a lifelong love of programming.
  • I design, write, and deliver standardized and custom programming courses.
  • I'm adaptable and deal well with ambiguity in organizations of varying sizes and cultures.
  • I hold an Honours Bachelor’s Degree in Computer Science.

I have written a trilogy of guided learning books about C# and .NET:

See all my books on Amazon or Packt's website.

Education and Certification

Highly qualified and experienced.

Microsoft Certified Solutions Developer (MCSD)

Web Applications, Universal Windows Platform, Windows Store Apps Using C#, SharePoint Developer

Microsoft Specialist

Programming in C#, Programming in HTML5 with JavaScript & CSS3, Developing Microsoft Azure Solutions, Architecting Microsoft Azure Solutions

Microsoft Certified Trainer (MCT)

1993 - 2017

Computer Science (BSc. Hons.)

University of Bristol, June 1993

Professional Scrum Master I

Since January 2016

Google App Engine Qualified Developer

One of less than one hundred worldwide.

apps-services-net8's People

Contributors

markjprice avatar scottkuhl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apps-services-net8's Issues

Comments in json docs cause issues for JWT creation.

Creating a JWT token as shown on page 652; dotnet user-jwts create results in '/' is an invalid start of a property name. Expected a '"'. Path: $ | LineNumber: 5 | BytePositionInLine: 6. if you have any comments in appsettings.json, appsettings.Development.json, or launchSettings.json.

page 166 - stored procedures are the only way to ensure ACID

Stored procedures are the only way to ensure ACID (Atomic, Consistent, Isolated, Durable) transactions
that combine multiple discrete activities into a single action that can be committed or rolled back.
You cannot use client-side code to implement transactions.

What about transactional batch operations?
Cosmos DB supports transactional batch operations within a single partition. This means you can execute a set of operations (such as inserts, updates, and deletes) in an atomic batch within a single logical partition.
https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/transactional-batch?tabs=dotnet

QuestPDF License

QuestPDF.Settings.License = LicenseType.Community; is throwing an error saying Settings does not contain a definition for the License. I'm currently using version 2022.12.6. If you comment out that line everything works fine.

Chapter 8 Online section Spaces in http file cause error.

the http file for visual studio 2022 does not accept spaces. Lines like GET {{base_address}}products/?$filter=startswith(ProductName,'Ch') or (UnitPrice gt 50) must be written as GET {{base_address}}products/?$filter=startswith(ProductName,'Ch')%20or%20(UnitPrice%20gt%2050)

Example switches from Model to ViewData change.

On Page 1027-1028 (Kindle is hard to pinpoint) the example shows:

model.ShipperSummary = "Shipper from gRPC service:" +
    $"ID:{shipperReply.ShipperId}, Name:ShipperReply.CompanyName
    ....

however on page 1040 instead of assigning the information to model.ShipperSummary it assigns the data to ViewData["shipper"].

Chapter 8 Online Section http linebreaks not working

*** This is a Visual Studio issue see comment below.***
I'm working through chapter 8's online section for odata when I try the request

###
GET {{base_address}}categories/
  ?$select=CategoryId,CategoryName

it returns

{
  "@odata.context": "https://localhost:5084/catalog/$metadata#Categories",
  "value": [
    {
      "CategoryId": 1,
      "CategoryName": "Beverages",
      "Description": "Soft drinks, coffees, teas, beers, and ales",
       .......

and I have an error stating '?$select=CategoryId,CategoryName' is not a valid http header. Expecting a valid http header or a blank line to separate the header section from the request body.
when I run the request as a single line GET {{base_address}}categories/?$select=CategoryId,CategoryName the output is correct.

{
  "@odata.context": "https://localhost:5084/catalog/$metadata#Categories(CategoryId,CategoryName)",
  "value": [
    {
      "CategoryId": 1,
      "CategoryName": "Beverages"
    },
    {
      "CategoryId": 2,
      "CategoryName": "Condiments"
    },
    ...

I've tried both with and without indent on the the ?$select line.

P.S.
And I know I've done a few issues, but honestly this book and the previous have been really helpful on learning new things and how to do other things better with c#. I've been really enjoying the books.

azurefunctions-scrapeamazon.http missing GET command.

Kindle book has the follow

### Configure a variable for the Azure Functions service base address.
@base_address = http://localhost:5101/
### Get information about the NumbersToWordsFunction function.
{{base_address}}admin/functions/NumbersToWordsFunction
### Get information about the ScrapeAmazonFunction function.

how ever Visual Studio 2022 doesn't recognize it as a request until you add GET in front of {{base_address}}

### Get information about the NumbersToWordsFunction function.
GET {{base_address}}admin/functions/NumbersToWordsFunction

### Get information about the ScrapeAmazonFunction function.
GET {{base_address}}admin/functions/ScrapeAmazonFunction

CosmosDb Product Listing missing currency.

Page 297 Listing all products from the CosmosDB says to set the current culture to french to see the euro symbol. However the output for the unit price is converted to string and not displaying the currency symbol. Removing the ToString from unitPrice fixes this issue.

foreach (ProductCosmos product in products)
{
    WriteLine("id: {0}, productName: {1}, unitPrice: {2}",
    arg0: product.id, arg1: product.productName, 
    arg2: product.unitPrice.ToString());
}

to

foreach (ProductCosmos product in products)
{
    WriteLine("id: {0}, productName: {1}, unitPrice: {2}",
    arg0: product.id, arg1: product.productName, 
    arg2: product.unitPrice);
}

Azure function requires async or AllowSynchronousIO

I got the following error:

[2024-02-19T22:04:57.896Z] Function 'NumbersToWordsFunction', Invocation id '1c7e2c25-32c6-4027-b30b-f29216597cfa': An exception was thrown by the invocation.
[2024-02-19T22:04:57.897Z] Result: Function 'NumbersToWordsFunction', Invocation id '1c7e2c25-32c6-4027-b30b-f29216597cfa': An exception was thrown by the invocation.
Exception: System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
...

Changing the following WriteString to WriteStringAsync fixed the issue.

        if (long.TryParse(amount, out long number))
        {
            response = req.CreateResponse(System.Net.HttpStatusCode.OK);
            //response.WriteString(number.ToWords());
            response.WriteStringAsync(number.ToWords());
        }
        else
        {
            response = req.CreateResponse(
                System.Net.HttpStatusCode.BadRequest);
            
            //response.WriteString($"Failed to parse: {amount}");
            response.WriteStringAsync($"Failed to parse: {amount}");
        }

or adding the following lines to program.cs (this option was found on stack overflow.
https://stackoverflow.com/a/55196057

        services.Configure<KestrelServerOptions>(options =>
        {
            options.AllowSynchronousIO = true;
        });

Broken link

Page 33: Second bullet in Exercise 1.2
Benchmarking Performance and Testing: In this section, you will learn how to use types in
the System.Diagnostics namespace and the Benchmark.NET library to monitor your code
to measure performance and efficiency (https://github.com/markjprice/apps-services
net8/blob/main/docs/ch01-benchmarking.md
).

Easy issue fix: The actual URL has a hyphen between the words "services" and "net8", so the link should be:
https://github.com/markjprice/apps-**services-net8**/blob/main/docs/ch01-benchmarking.md

Missing Form from Products Chapter 13

The form to search for product in chapter 13 page 1061 (Kindle) is missing from the in text version. The repository version has it.

<form asp-action="Products" method="post">
    <input name="minimumPrice" placeholder="Enter a minimum unit price" />
    <input type="submit" value="Filter Products" />
</form>

Errors in CheckGeneratorFunction.cs file

When i copied the CheckGeneratorFunctions from the book I noticed I had missing using references

using SixLabors.ImageSharp; // To use Image Class.
using SixLabors.ImageSharp.PixelFormats; // To use Rgba32 type.
using SixLabors.ImageSharp.Processing; // To use mutate.

I needed to change
public byte[] Run( [QueueTrigger("checksQueue")] string message)
to
public byte[] Run([QueueTrigger("checksQueue")] Azure.Storage.Queues.Models.QueueMessage message)
and the following mislabeled variables.
log.LogInformation($"Blobs folder: {folder}");
to
_logger.LogInformation($"Blobs folder: {folder}");

log.LogError(ex.Message);
to
_logger.LogError(ex.Message);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.