Giter Site home page Giter Site logo

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 9 edition of my best selling book, C# 13 and .NET 9 - Modern Cross-Platform Development Fundamentals, scheduled to publish on November 12, 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."

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 the South Cotswolds constituency of England, UK.
  • 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  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

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.

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)

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>

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;
        });

Shipper Action Incorrect

On page 649, step-16, another anchor tag is used to pass dictionary to current page:
Shipper

However, this produces the error:
An unhandled exception occurred while processing the request.
InvalidOperationException: The view 'Shipper' was not found. The following locations were searched:
/Views/Home/Shipper.en-US.cshtml
/Views/Home/Shipper.en.cshtml
/Views/Home/Shipper.cshtml
...

So I modified the asp-action="asp-action="Index" instead and I get no issues. Is that what is expected?

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"].

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

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.

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);

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);
}

Program.cs for Minimal Web Services in Chapter 15.

On page 695, in Step-7, Configuring HttpJsonOptions, the added first letter in "Options" should be lowercase instead of uppercase.

On page 696. in Step-8, app.MapGet("api/employees/{id:int}, the first letter should be uppercase instead of lowercase for "employee" in:

  • if: "if (employee" and
  • else: "else { return Results.Json(employee"

gRPC Error in Chapter13

Self-healing code apparently is the new paradigm. I wanted to give you my steps on this and let you decide if it is an issue (or bug in gRPC).

After getting to step-10 on page 580 I received an error that I could not resolve. After revisiting the code from the beginning, I could still not resolve it, so I tore everything down and restarted, but again got the same error message.
Page-580
Step-10:
"In Program.cs, in the section for configuring services, write a statement to add the GreeterClient
as a named gRPC client that will be communicating with a service that is listening on port
5131, as shown in the following code:
builder.Services.AddGrpcClient<Greeter.GreeterClient>("Greeter",
options =>
{
options.Address = new Uri("https://localhost:5131");
});"

ISSUE: When I looked at [GreetGrp.cs] generated file in step-8 (same page),
I found the following instead:
using grpc = global::Grpc.Core;
I am using VS2022, version 17.10.0.
STEP-10_ERROR: The line beginning, { builder.Services.AddGrpcClient<Greeter.GreeterClient>("Greeter"...}
could not find the Greeter.GreeterClient class.
So I removed the "GreeterClient" dot-searched for "GreeterBase" that iniitially was found and did a build again.
Then it too, was not found after a while.
I again restored the greeter.GreeterClient and then it was found!
RESULT: I was then able to successfully complete the remainder of the steps without issue.

Other notes:
A) On Page-574, Step-3, it was stated to "note" the following:



However, the initial code generated with the project was using:
Version = "2.57.0"
So I changed it to Version = "2.59.0".

B) I am using CoPilot; trying to annotate my files is sometimes spot-on, and sometimes useless. Nevertheless, it seems that gRPC is attempting to self-heal the code in this situation. I did not ever do a "clean".

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.

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

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

Update Survey Link. Chapter 1 page 15

Hello,

I noticed you have published a link https://survey.stackoverflow.co/2023/. to reference the information you given about 73% of professional developers selecting Visual Studio Code as an integrated development environment in Stack Overflow 2023. Maybe you would like to update the link with this link https://survey.stackoverflow.co/2023/#most-popular-technologies-new-collab-tools-prof to navigate the reader to direct page that reader can see that specific reference.

Best regards

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.