Тёмный
The Pragmatic Programmer
The Pragmatic Programmer
The Pragmatic Programmer
Подписаться
I am an IT architect by trade but still a passionate developer. With over 30 years in the IT industry, I have been there and coded in it. From 'back in the day' COBOL, assembly language and C/C++ to modern C#, Java. JavaScript, HTML, CSS and all the frameworks, source control systems, fads, trends in between.
Can you imagine writing and debugging a program by punching holes in cards and feeding them into a reader. Look how far we've come and be grateful you'll never know :D.

On this channel we'll discuss all things IT related. Frontend, backend, tutorials, advice. Anything that I consider will help a fellow developer in the trenches out.

So, if you're a developer in your day job, aspire to be one or just interested in technology, subscribe and come with me and explore weekly short tutorials on any IT related topics to fully functional real world IT solutions that might just help you in your IT understanding.
Not all Material UI frameworks are equal!
6:14
7 месяцев назад
Passkeys - A Passkey Playground
35:03
9 месяцев назад
C# Azure Function - Breakpoints that don't work
1:01
10 месяцев назад
Passkeys? - A Practical Guide
9:21
10 месяцев назад
.Net SOAP Service - Authorisation
19:07
10 месяцев назад
Net SOAP Service - ModelState Errors
5:57
11 месяцев назад
Net SOAP Service   Advanced Parameter Binding
17:20
11 месяцев назад
Net SOAP Service - Input Validation
13:20
11 месяцев назад
Net SOAP Service - WSDL
12:30
Год назад
Net SOAP Service - SOAP Versions
12:49
Год назад
Nuxt3 Unit Testing - Composables
10:12
Год назад
Nuxt3 Unit Testing - Plugins
6:20
Год назад
Комментарии
@eq2home
@eq2home 21 день назад
I am using Net8 and have carefully checked the basic setup. Maybe I am missing something, but when I run and execute the Yak script, it returns 404. Any assistance is greatly appreciated.
@thepragmaticprogrammer
@thepragmaticprogrammer 21 день назад
Please email me and share a repo and I will take a look.
@eq2home
@eq2home 21 день назад
@@thepragmaticprogrammer Hang on ... I think it is me. Cheers
@eq2home
@eq2home 21 день назад
Ok, the default project for .net 8 does not include the Controllers directory and also does not contain WeatherForecast.CS (model.) All the code is run in the program.cs. I created the Controllers directory and added it to the Service1Controller. Also, when I copied the WeatherForecast from another site, I had to edit the datetime to dateonly type. One last note, I deleted all the WeatherForecast code from the program.cs. Works like a charm.
@eq2home
@eq2home 21 день назад
Also add back in MapControllers
@eq2home
@eq2home 21 день назад
Finally, I enjoy your teaching and presentation style...
@AntonOtto
@AntonOtto 27 дней назад
Thank you very much for this. Easy step-by-step instructions. Up and running in no time.
@SciTechEnthusiasts
@SciTechEnthusiasts Месяц назад
thanks for the video. I'm using vps with local container registry with docker, cost me 260$ for two years but I got 200GB storage and 16TB bandwidth so cost comes down to 0.36$ /day. However I have to manage security backups and authorization for which I'm looking into now.
@andreazauli9907
@andreazauli9907 Месяц назад
fuq
@pazzuto
@pazzuto Месяц назад
Interesting take. I'm concerned if too many requests come in, and I have all these queues/threads (creation/disposal). I did something similar, but to avoid exhausting threads, I used a BlockingCollection... on startup, the BG service created as many worker threads from the available cores (16 in my server). In each thread, I attached to the blocking collection through its enumerator, and it managed dequeuing safely for, So at the end, I had 16 threads safely handling any request that came in. I tested it with K6 sending about 5000 requests at its peak. While the collection had to queue up, 16 requests were being processed in parallel. It beat the hell out of the server, but then I could easily scale it out to have more threads available -- haven't done this yet, but so far, the server in production has not caused me any issues.
@remysader4016
@remysader4016 Месяц назад
Please make available your code source, not everything is clear and full in the video, and in my country I don't have access to your website!!
@dotabota
@dotabota 2 месяца назад
Thanks You <3
@jessejohnson529
@jessejohnson529 2 месяца назад
THIS is the video you need if you need to run Linux containers on WSL. Setup Docker on Windows using the docker binaries, and setup docker inside of the default distro running on WSL. setup the json file on windows and place in c:\programdata\docker\config, and then point the IP address within it to the hostIP 127.0.0.X of the WSL-Ubuntu hostIP address... and then BAM you got yourself a Windows Docker daemon service pointing to a Linux Docker backend. My goal is to have a headless Windows 10 machine running my containers, automated so they start as soon as the computer turns back on from a restart without doing things like logging into a user account, or installing NSSM, or auto locking a user account after it logs in. THANK YOU for this video!! I'm about half way thru the video and I'll say this, this is as far as I've gotten on non-Windows server installing and running Docker on Windows without Docker Desktop.
@gavinchigallis
@gavinchigallis 2 месяца назад
Thank you for making this so clear and to the point.
@angelap.8160
@angelap.8160 2 месяца назад
Hi! I am not able to test the layout for the page. I have the exactly same setup but pageMeta is never called. Is this code still working with the latest vitest updates? Do you know what it could be?
@asadbekhoshimov8647
@asadbekhoshimov8647 3 месяца назад
Can you make available your source code?
@selvin_medina
@selvin_medina 3 месяца назад
I can't continue the course because I can't see the full wsdl.xml file.. please provide the file in order to continue the course!
@MaitreBart
@MaitreBart 3 месяца назад
I'd like to see/know if one can use this setup to do container-based sw dev with vscode (i.e. vscode client running in Windows and vscode server running in container), given the necessary vscode extensions are installed?
@himanshu2308
@himanshu2308 3 месяца назад
Which VS Code extensin did you use to run your tests?
@arghasen6535
@arghasen6535 3 месяца назад
What is the actual architectural difference? Whatever you have shown it's present in Microsoft documentation also. But I am not getting what's the actual difference, what was the problem in in-process model which is going to be solved here ?
@thepragmaticprogrammer
@thepragmaticprogrammer 3 месяца назад
This solved a problem for Microsoft to allow the azure function management runtime to run on a different framework version than your azure function that you have written. In reality It means you can adopt the latest framework version earlier.
@jakoon_the_manic
@jakoon_the_manic 3 месяца назад
Instead of using a composable for the GTM, couldn't I just make a global plugin? Seems a bit wasteful that for example on something like a ProductCard I need to do a useGTM
@pauljohnsonbringbackdislik1469
@pauljohnsonbringbackdislik1469 3 месяца назад
Is it some kind of joke? "change 1 line of code" in tile, but in actual video "add hundreds of lines of cryptic XML spec". These custom policies are not documented and even Microsoft's support agents do not have resources to provide except some old GitHub repos full of 4-year old examples.
@pauljohnsonbringbackdislik1469
@pauljohnsonbringbackdislik1469 3 месяца назад
Once you'll try to customize look of the login page you will start to regret choosing Azure B2C. And you will make application admins miserable with Azure AD slowest possible loading times when there is a need to inspect user login audit logs just to see how these logs are incorrect and essentially useless. On top of "no SLA". I regret every day spent on fighting against Azure B2C, especially after learning how many good alternatives there are.
@forrestedwards4354
@forrestedwards4354 4 месяца назад
Thanks for this series... dealing with some new equipment that the vendor doesn't want to bother modernizing the software for so this was very useful.
@peerhenry
@peerhenry 4 месяца назад
You can also just add `environment: 'nuxt'` to your vitest config.
@GameSpreePH
@GameSpreePH 4 месяца назад
Nice tutorial. Do you have github repo for this Azure function?
@shahoriarfahim3679
@shahoriarfahim3679 4 месяца назад
can you share the video how to set it in nuxt 2
@midowazzan
@midowazzan 4 месяца назад
One of the best videos on custom claims. However, this does not work when the user is self-registering. This is because the first time the user registers, their data is not yet in the DB and so the Azure Function won't return any roles yet. To overcome the problem the user will have to log out and back in to refresh the claims which is not ideal. I could not find any solutions for this problem.
@thepragmaticprogrammer
@thepragmaticprogrammer 4 месяца назад
I'm not 100% understanding you scenario. First problem - What permissions will you give a new user? You can only give them some defaults unless in your signup you allow them to tell you what role/permissions they want. if you look here learn.microsoft.com/en-us/azure/active-directory-b2c/add-api-connector?pivots=b2c-user-flow You can see there are different types of API connector that get called at different points in the sign-up/in flow. So for signup could you use the 'before creating the user' connector to create the user. For signup and / or signin the 'before sending the token' will be called. So could you not use this connector to create the user with the default permissions if they dont exist in your db?
@midowazzan
@midowazzan 4 месяца назад
@@thepragmaticprogrammer Thanks for your reply, really appreciate it. I had a feeling I was not being clear. Here is my issue in details: 1. User visits the app and opens the login page (they're not the in the DB yet and so they have roles). 2. User is redirected to B2C page to log in/sign up. 3. User completes sign up in B2C. 4. Behind the scene: B2C calls Azure Function to grab the roles (they don't exist yet) 5. Behind the scene: B2C generates a token, it does not have any roles. 6. User is redirected back to my app (with the token) to fill out their profile information. 7. User is redirected to the Dashboard page. This page requires a role that is not present in the token. 8. User sees a NotAllowed page. The only way around this is to log the user out and ask them to log back in. When they do this the Azure Function will be able to load the roles. I'm going to see if I can resolve this by using your suggestions. Thanks
@midowazzan
@midowazzan 4 месяца назад
Found out that the suggestions above won't fix my issue. :(
@freddiesoft
@freddiesoft 4 месяца назад
But this is for Remote desktop connection, not hyper-v
@GustavoSilveiraBCarvalho
@GustavoSilveiraBCarvalho 4 месяца назад
I developed a .NET MAUI application to consume a SOAP service. Testing this application on emulators on the same machine, connected to the SOAP provider via VPN, I am successful in the request when using the Windows Machine emulator and not successful when using the Android emulator. What am I doing wrong?
@nandyad
@nandyad 4 месяца назад
Thank you for making the series
@codingbloke
@codingbloke 4 месяца назад
Its an interesting approach. That each request gets its own queue of items that are completed sequentially might be useful or convenient. On the other hand this may not be desirable or necessary. What happens in this approach if 300 requests each queue up a items? Do we really want the number of background tasks to also be 300? Might be ok, might not be it would depend on the type of workload, I/O bound load might be ok but CPU bound stuff would be a problem. Perhaps some further control is needed. The deal breaker, though, is the WaitAll. In a set of concurrent requests where one of them has created a queue workload significantly larger than others. The WaitAll will cause the item pump to stall whilst the large load is completed. Meanwhile new requests are busy adding items to their new queue buffers but nothing is being done while the code sits at WaitAll. The premise posed around 55secs into this video is that queue items from multiple requests are just getting queued behind each other and processed sequentially. A better design I think would be to drop the assumption that queue items are processed this way. Instead assume that a set of items can all be processed concurrently even items generated by the same request. Use a single channel (that never completes) and all items are written to that channel. Use `await foreach` to consume the channel `Reader.ReadAllAync` in the BackgoundService ExecuteAsync. IOW this is the infinite loop (because the channel never completes) and 500ms sleep not needed. inside the foreach dispatch a task but do not await it. Before executing the queue item this new task will first Wait on a Semaphore (use `SemaphoreSlim` as an instance field in the BackroundService) and ensure in a finally block that the semaphore is released. The Semaphore will control how many concurrent tasks can be dispatched. In this approach a queue item will immediately begin execution if we haven't saturated the Semaphore and if we have the next item will start immediately any currently running item completes. No Sleeps, no WaitAll. Multiple queues could be created, say one for CPU intensive tasks that has a small Semaphore and I/O bound queue which could have a large Semaphore.
@thepragmaticprogrammer
@thepragmaticprogrammer 4 месяца назад
This is exactly what i was hoping for, a good dialogue on the subject to highlight that background processing is not trivial matter. You have made some excellent points and described a very good alternative. Personally, I had a constraint that meant I could not concurrently process items in the same request. I needed the processed in the order that they were reached in the http request. This just highlights that you really need to understand your requirements and constraints when you design a solution. Many thanks for taking the time to respond.
@KaiLamka
@KaiLamka 4 месяца назад
OMG TY. 1000 Stars
@thepragmaticprogrammer
@thepragmaticprogrammer 4 месяца назад
Thanks for watching. You are most welcome.
@user-me7yi7ln2o
@user-me7yi7ln2o 4 месяца назад
I don't think it's safe to modify the WorkBufferItems list from multiple threads. It's just a List<T> after all. Or am I missing something?
@thepragmaticprogrammer
@thepragmaticprogrammer 4 месяца назад
The only place where this might be a problem is when the background service removes a WorkItemBuffer whilst the background service is still iterating over the WorkItemBuffers list. We want to keep WorkItemBuffer elements to a minimum, process and remove them as quickly as we can. This would minimise this scenario. I agree that a more robust implementation would be to have a lock on both the list iterator and the remove(WorkItemBuffer) - see: theburningmonk.com/2010/03/thread-safe-enumeration-in-csharp/
@miskoralgol575
@miskoralgol575 4 месяца назад
What is it intended for? What about masstransit for ex?
@thepragmaticprogrammer
@thepragmaticprogrammer 4 месяца назад
Masstransit is for distributed applications i.e. separate process. This is all in-process. This presents how to implement a fan-in fan-out pattern for background processing without tying up your http request.
@miskoralgol575
@miskoralgol575 4 месяца назад
@@thepragmaticprogrammer i think simple in memory queue do the job. But if you want proces tasks sequentially, right worker approach is ok. But queue could be configured in the way that it will behave as sync procesu.
@asrajan55
@asrajan55 4 месяца назад
Why can't we just use a service with ConcurrenttQueue as a singleton?
@thepragmaticprogrammer
@thepragmaticprogrammer 4 месяца назад
Thanks for watching. Depends upon your use case and is perfectly valid. But using a queue as the conduit between your http requests and your background service only gives you a fan-in pattern i.e. all your workitems are pushed into a single queue. A List of queues allows for a fan-out to multiple threads in your background service.
@dialecticuss
@dialecticuss 5 месяцев назад
Does SoapCore nuget package make all this easier?
@thepragmaticprogrammer
@thepragmaticprogrammer 5 месяцев назад
It may do, depends upon your requirements and how much control you want over things vs using a framework. Just giving you another option here.
@deejae_music
@deejae_music 5 месяцев назад
How does this goes with flask python?
@Bronzato
@Bronzato 5 месяцев назад
You saved my day. Thanks for sharing this precious information.
@thepragmaticprogrammer
@thepragmaticprogrammer 4 месяца назад
You are welcome!
@HasibulHaque
@HasibulHaque 5 месяцев назад
Any Idea about Application Insight logging? I have found it is not working anymore after moving to "ConfigureFunctionsWebApplication"
@yixu1776
@yixu1776 5 месяцев назад
Hi Thank you for the great video. I have joined your ko-fi page as a member and added my github username, but I don't see where I can access the source code.
@thepragmaticprogrammer
@thepragmaticprogrammer 5 месяцев назад
Thanks for joining. This should now be resolved.
@yixu1776
@yixu1776 5 месяцев назад
Thank you very much. This greatly helped me with creating a SOAP api project.
@thepragmaticprogrammer
@thepragmaticprogrammer 5 месяцев назад
Glad it helped!
@pauljohnsonbringbackdislik1469
@pauljohnsonbringbackdislik1469 5 месяцев назад
What's the point of registration/login without email address? I like this playground overall, but I cannot see any use case for passkey-only workflow. Is it implied that you would ask for an email in the step following registration (making it a 2-step process)?
@thepragmaticprogrammer
@thepragmaticprogrammer 5 месяцев назад
The username/email address of the user creating the passkey is hardcoded in this playground, in the 'User' object of the createCredentialOptions (see it here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-tumEVnhgWO4.html). In the real world you would have your user login as normal with username and password, then give an option to create a passkey, thus when you create the passkey you know all the info about the user. From then on the user can opt to login using the passkey and post login your app would contain the same info about the logged in user. Hope this makes sense.
@pauljohnsonbringbackdislik1469
@pauljohnsonbringbackdislik1469 5 месяцев назад
There are multiple issues with Passkeys and I don't believe the actual adoption will match the hype around them. For starters, privacy-focused browsers do not support them. Ok, let's assume devs usually optimize for whatever is most commonly used by regular users (Chrome/Android) - the initial workflow is convoluted, confusing, and usually not what users expect. Ok, ok, it can be said about every technology in early stages of adoption. My third issue is that users have very good alternatives - like built-in password manager in Chrome (that even suggests randomized passwords). From the devs perspective - we already have "passwordless" login with so called "magic links" and it is trivial to implement. Apps that would theoretically benefit from passkeys need users to have specific needs around cross-device access, otherwise it's just pointless to roll it instead of OAuth or SSO... I can go on and at the end... I like the concept but it is just so easy to doubt in claims of "it will be everywhere soon".
@thepragmaticprogrammer
@thepragmaticprogrammer 5 месяцев назад
Thanks for your feedback and views on the subject. I agree its an emerging area and we need to monitor this to see how it pans out in terms of adoption
@Gaijin101
@Gaijin101 5 месяцев назад
nice video. would be interesting to see nitro running on bun or workers/lamdas
@Gaijin101
@Gaijin101 5 месяцев назад
nitro has been amazing recently. the unjs ecosystem is really nice.
@onemanzu
@onemanzu 6 месяцев назад
Thanks for this! It was the perfect amount of guidance to help me get past a block I’ve had for a few months. ❤
@ezioauditore3019
@ezioauditore3019 6 месяцев назад
U are doing god's work ❤
@user-bf1en1on6p
@user-bf1en1on6p 6 месяцев назад
The POST endpoint, [HttpPost] [Produces("application/xml")] public IActionResult Post(SOAPRequestEnvelope env) doesn't read in the env param, so you don't have a "round trip". Don't want to be a downer but basically a waste of my time without demonstrating the serialization of the incoming SOAP xml request 😞
@thepragmaticprogrammer
@thepragmaticprogrammer 6 месяцев назад
You can see it works for others below. There is most likely some mismatch between your SOAPRequestEnvelope (or nested classes) or namespaces and that of the XML you are sending in your request. If you can share a repo, I will try to assist if possible. As a real fallback you could also use [FromBody] XElement Envelope rather than SOAPRequestEnvelope and this will give you a raw XML document of the payload that you can work with (useful if you don't want to model the whole payload, but just do something like Xslt on it)
@akashgehi9741
@akashgehi9741 6 месяцев назад
How do you write tests for your cms app?
@user-cf1bd8gh2z
@user-cf1bd8gh2z 6 месяцев назад
Thanks for the Gotcha ! couldnt set my NODE_ENV variable ENV fixed it for me 🙌
@marjukerazi1089
@marjukerazi1089 6 месяцев назад
how i hide default xsi xsd namespace?
@marjukerazi1089
@marjukerazi1089 6 месяцев назад
how i hide default xsi xsd namespace?
@thepragmaticprogrammer
@thepragmaticprogrammer 6 месяцев назад
Try this in your program.cs. Uses middleware to manipulate the response body with a regex to remove those namespaces. app.Use(async (context, next) => { // Set the response stream to a Stream we can manipulate using (var buffer = new MemoryStream()) { var stream = context.Response.Body; context.Response.Body = buffer; // Carry on with the request pipeline await next.Invoke(context); //Read the response stream into a string buffer.Seek(0, SeekOrigin.Begin); var reader = new StreamReader(buffer); using (var bufferReader = new StreamReader(buffer)) { string body = await bufferReader.ReadToEndAsync(); //remove the XSI and XSD namespaces body = Regex.Replace(body, @"xmlns:(?:xsi|xsd)=""[a-zA-Z:\/\.0-9-]*""", ""); //create a new UTF8 encoded output stream var outputStream = new MemoryStream(Encoding.UTF8.GetBytes(body)); //set content Length and copy to HttpResponse Stream context.Response.ContentLength = outputStream.Length; await outputStream.CopyToAsync(stream); //reset response to original stream context.Response.Body = stream; } } }); app.MapControllers();
@thepragmaticprogrammer
@thepragmaticprogrammer 6 месяцев назад
That gives you free reign over the payload to do what you want. Alternatively and maybe cleaner, you could, create your own XML Output Formatter: using System.Xml; using System.Xml.Serialization; namespace SOAP.Mvc.Formatters; public class XmlSerializerOutputFormatter : Microsoft.AspNetCore.Mvc.Formatters.XmlSerializerOutputFormatter { protected override void Serialize(XmlSerializer xmlSerializer, XmlWriter xmlWriter, object? value) { XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", ""); xmlSerializer.Serialize(xmlWriter, value, ns); } } Then wire this in in program.cs builder.Services.AddControllers(options => { options.OutputFormatters.Insert(0, new SOAP.Mvc.Formatters.XmlSerializerOutputFormatter()); }) The addition of the blank prefix and namespace passed into the serializer is a well know 'feature' that removes the default namespaces.
@marjukerazi1089
@marjukerazi1089 6 месяцев назад
how i hide default xsi xsd namespace from header?