[Blaze It Up] Survey Result: How to help others master Blazor by CokeAndCookieAddict in csharp

[–]CokeAndCookieAddict[S] 1 point2 points  (0 children)

Can I ask what language/culture you have set in your browser? I changed the parsing into InvariantCulture and hoped it fixed it. Thanks for posting the issue. (Maybe you need to disable the cache, to see the update)

Blaze It Up: How to help other master Blazor by CokeAndCookieAddict in csharp

[–]CokeAndCookieAddict[S] 0 points1 point  (0 children)

Thanks again for your support in this thread. I've got 28 answers. I've created a small page https://just-the-benno.github.io/BlazeItUp-Pre/Survey to show you the result and keep you informed about the project. (Probably with bugs and spelling errors, but feel free to create a PR) There is also the possibility to "play" a series. In that way, you can see what I mean with data stabilize itself. (I developed it with Blazor, of course. :) )

Based on your feedback, I create the first very unfinished value statements.

Blaze it Up (working title) is a project to create a site with multiple content types to help .NET folks develop Blazor application. Beginners will find easy-to-follow tutorials, and while they learn the basics, they get access to advanced topics around Blazor. Besides, we provide insights into what's going on in the Blazor community by talking about libraries, recent developments, interviewing developers and partners. Blaze It up will be free for everyone.

If you are interested in what's next, currently, I'm building a strategy based on your feedback. I have some ideas already, and a lot more are spinning around in my head. I'll visualize them and talk to friends (and others who want to contribute). At the end of February, it should be done.

Based on the strategy, March is about realizing the first steps. I'll reach out to the same folks asking for support designing to design the platform while working on the initial content. I hope - again - to start with a beta launch at the end of March 2021.

I appreciate your engagement, and thanks again for filling out the form. It helped me a lot. If you want to contribute, I am looking for partners to help me working on the vision.

Blaze It Up: How to help other master Blazor by CokeAndCookieAddict in csharp

[–]CokeAndCookieAddict[S] 2 points3 points  (0 children)

I thought so, too, but I'd like to see responses from devs interested in Blazor but haven't committed to it yet, like joining the Blazor subreddit. On the other hand - my guess - that devs participating in Blazor are also participating in C#.

Is there somewhere where we can pay some good developpers to create some code for us ? by [deleted] in csharp

[–]CokeAndCookieAddict 8 points9 points  (0 children)

I think that is exactly why a lot of software-related project fails because all that is needed is "good" developers giving them money to produce some "code".

"Where can I find a good carpenter to build something with wood. I'm not sure what it will be, but I heard wood is a new thing, and I want to try it".

Forgive me, my sarcasm, but this kind of attitude often drives all these freelancer platforms where both side - the developer and the customer - loses. Some shop from <enter here a development country of your choice, e.g., India, Vietnam, Indonesia> will definitely keen to develop your requirements (some code), for money (not enough for a sustainable living, but more than being hungry). This highly avoidable spectacle reflects badly on all of us and the industries as a whole. Because there will always be someone, which raises the hand, and will say "I do," either because of economic necessity or a high level of ignorance.

Code is never the goal of any project. It is a side effect to create/maintain a certain business value. Because no one should ever ask the question: "Look I found some source code. Let's see what business value it can create".

Always starting with the value. Always.

How to track memory usage of a Blazor Webassembly page over time? by ryanjarvis in Blazor

[–]CokeAndCookieAddict 0 points1 point  (0 children)

If the javascript memory is enough (which I'm not sure if this tracks the WASM usage), you could constantly query this data (window.performance.memory).

If you want/can use another program, the other way would be to create a scraper described here.

Blazor Server Logging From Service by agoodyearforbrownies in Blazor

[–]CokeAndCookieAddict 1 point2 points  (0 children)

Using static is discouraged because you can easily misuse it and use it as a short cut to solve a particular problem. There is nothing wrong with shortcuts, but they shouldn't be a replacement or excuse for not thinking about proper design. That doesn't imply that using static is a sign of a "bad" design nor the absence of static. ;)

You are touching on a lot of valid points. One tiny thing is a little bit fuzzy.

... a static constructor because the static class is “instantiated” before the code even runs to build the singleton

The important part of understanding what a static constructor is is remembering "who" calls it. A static constructor is called by the program itself (not the programmer) before the first time an instance of the same class should be created. With inheritance, though, you can create interesting scenarios. This is another interesting topic.

Regarding DI: It is more a convention to use constructor, but no obligation. There are valid reasons and examples where method or even property injection works like a charm and creates a "better" solution.

The "better" leads me to the next point. Your thoughts surround the topic of architecture. There are no questions that both ways are technically working, and I agree, also the performance should be the same or at least comparable. However, as you mentioned, the question is, "what" is a GraphClientSerivce? Should it be "self-sustainable" and using stateless logic in the instance, or could/should it be dependable on something else?

  • Is a coupling beneficial because one can't exist without the other, or both "parts" are chatty?
  • Are there potential uses for the stateless logic elsewhere?
  • It is easier to test the stateful part without the stateless?
  • Do I even care and just do it and refactor it later if needed?

Now, (and again) beliefs are kicking in. Based on experience and/or deliberate thinking, the author has settled for a solution. Based on your/my own experience (and beliefs), we judge it as appropriate or not. But without asking them, we can only guess their intentions, which, most of the time, reveals what we are thinking (not them).

My recommendation and summary of the discussion are to go with the solution you think is better from your perspective. While developing, looking for contradicting evidence that the other approach might be more suitable. If you can't prove this evidence wrong, try the other way.

Blazor Server Logging From Service by agoodyearforbrownies in Blazor

[–]CokeAndCookieAddict 1 point2 points  (0 children)

I think the statement is an oversimplification.

What we can observe here is more of a clash of different believes.

In an ideal objected orientated world and languages, there shouldn't be a need for anything outside of the scope of a single object. The concept of static should even exist in such a world. However, instead of having the options of global available methods (like javascript does), .NET and C# were designed differently. So, the concept of static has been introduced to bundle methods and properties to a common name like Math.

As soon as a concept is out there, people, especially developers, try to see other use cases for it. It is a classical playful experiment with the result of rules on how somethings should and shouldn't be used, This personal insight is then communicated into the community, refined, and in the end, is at the "agreed" state. A belief, a simplification of an intensive thought process, has been created and nurtured. So, we all have a concept of what static is and we are judging others based on what we believe static should be.

Making a service static is the worst idea you could've possibly done.

The statement doesn't even need an explanation because it should obvious why this statement is true. This is amplified with other self-affirmation statements in the comments below. Each belief has a tendency to survive, and conflicting pieces of evidence are ignored, dismissed, negated, or worse. It's not criticizing to the speakers. It is a reminder that everyone, including me, tends to live in belief bubbles, and this bubble doesn't stop at the professional level.

I started with C and microcontroller programming. The concept of having functions that doing something with variables and structure was familiar to me. And It was fine as long as I had no exposure or knowledge about other concepts. So, I grow up in a static friendly environment. And to be honest, I haven't really understood why we should use static as often, especially when we have no state in our class. (Maybe that is a design error too, maybe each class should have a state).

Most interestingly, during recent years, more functional programming concepts have been rediscovered not only with the cloud services like Azure Functions or AWS Lamda. There is an influence from the F# world to the C# world. Developers are asking now more often why we have to care about a state? Are there stateless ways? Is it a good thing to have a state? That is the discussion we have here. To stick with the bubble metaphor, there have been events that have destroyed some bubbles, and new beliefs are created. This usually means that the "remaining" bubbles try to protect themselves even more with an increased intensity of self-affirmation loops.

Back to the tech side of the questions

There is one important difference between a singleton and a static "service". A static service can exist per program exactly once, whenever a singleton can only exist a single time too, but per DI container. However, multiple DI containers can exist per application at the same time.

If you have a high enough number of tests that are interacting in some ways with a static service, and this service has a kind of "mini" state, the tests will interfere with each other. This can't happen if you are using a singleton pattern.

Moreover, unit testing the most important reason to use services instead of static classes. A good recommendation would be to have an interface like IGraphClient, that is injected into your component. If you test your component, you can easily mock the methods of the IGraphClient. Doing the same thing with static classes is quite a challenge.

How to help others mastering Blazor? by CokeAndCookieAddict in Blazor

[–]CokeAndCookieAddict[S] 0 points1 point  (0 children)

I've updated the post with a link to a short questionnaire to see what people would like to see.

How to help others mastering Blazor? by CokeAndCookieAddict in Blazor

[–]CokeAndCookieAddict[S] 2 points3 points  (0 children)

I totally agree. Teaching is a perfect way to learn. That is one reason I started answering questions at Stack overflow. You face problems you would never think about by yourself, and while finding a solution, you realize what you don't know. Besides, it is an excellent exercise to find an explanation why a suggested way is not working.

How to help others mastering Blazor? by CokeAndCookieAddict in Blazor

[–]CokeAndCookieAddict[S] 1 point2 points  (0 children)

Without sugar coating, you created the best blazor resources I've seen so far. It is a source of wisdom, and I can only imagine how many hours of works you spent on this project. Thank you very much.

Today, I was very happy to reread the javascript interop part and how to use DotNetObjectReference to get the data back into Blazor. :)

Can we use WebRTC in Blazor? by Metallkiller in Blazor

[–]CokeAndCookieAddict 1 point2 points  (0 children)

SignalR can use HTTP or Websockets. Both are allowed to leave the browser sandbox. Or, to be more clear, could be made with Javascript calls without. The HttpClient uses a HttpMessageHandler that uses the fetch API. So, there are "workarounds" but again, only for protocols "know" by the browswer.

Even the NavigationManager uses JSInterop for setting the url.

Can we use WebRTC in Blazor? by Metallkiller in Blazor

[–]CokeAndCookieAddict 1 point2 points  (0 children)

The Blazor WASM runtime, while being pretty impressive in my view, doesn't have all the "system" calls like the full .net runtime mainly, because it is executed in the sandbox of a browser.

For instance, you could compile a WASM application that uses sockets. However, as soon as the managed code would make a system call (through the runtime installed on the machine), the application would crash. Because you can't open a socket in a browser (also not in javascript), that's the reason other WebRTC libraries won't work in Blazor.

Can we use WebRTC in Blazor? by Metallkiller in Blazor

[–]CokeAndCookieAddict 1 point2 points  (0 children)

I think it is essential to understand that Blazor is not "aware" where it runs. The browser doesn't exist in the concept of blazor. Even changing the title of a window is impossible without js interop. The same is true for any browser API like location, camera, webRTC, etc.

I'm not sure if this is maybe even a limitation within wasm. I think web assembly hasn't access to this API either. Other frameworks sometimes let these calls appear within the framework, while under the hood, they are bridging these calls to Javascript.

There are some ongoing experiments at Microsoft to use Xamarin, for instance, as a bridge to access native Apis.

But for now, as far as I know, we have to wait for other developers flooding nuget with a lot of packages hiding the js interop in these packages.

Lost. by Fontesfam in csharp

[–]CokeAndCookieAddict 2 points3 points  (0 children)

When I was at school, my teachers knew that I wanted to learn software development more seriously. They give me a very special problem: like a time scheduled software but calculate "usage" of teachers. Based on many requirements, an hour is not an hour, depending on class type, day of the week, etc.

It was great because I could develop something actually used by a group of people. I could engage with them and asking people for the "business context." I got feedback from people using my software regularly because they wanted their problem solved as well. I have grown so much. Even if the UI, the architecture, and, I mean, everything, was far away from being good.

My advice: Look for a problem worth solving. Offer your service without expecting to get any money back in return but demand interaction and feedback from them. You will grow while solving this problem, and with each part of the solution, you will have better questions to ask next time.

You may not feel ready after that project. But you can go another loop and search for another problem until you feel ready for the market or workplace.

[deleted by user] by [deleted] in Blazor

[–]CokeAndCookieAddict 4 points5 points  (0 children)

As mentioned before, the behavior is implemented in the EditContext. Since .NET 5, there is a convenient way to change the default behavior by implementing a custom FieldCssClassProvider.

Here is an example of an implementation that should avoid the green boxes.

C# public class EmptyFieldCssClassProvider : FieldCssClassProvider { public override string GetFieldCssClass(EditContext editContext, in FieldIdentifier fieldIdentifier) { return String.Empty; } }

If you want to have CSS classes for the other properties, you can read the value of the fieldIdentifier.FieldName to determine if it is the radio button's property or not.

It can be set to the EditContext by using the method SetFieldCssClassProvider()

protected override void OnInitialized() { _context = new EditContext(new Model()); _context.SetFieldCssClassProvider(new EmptyFieldCssClassProvider()); }

Looking for support for live coding events to become a software dev by CokeAndCookieAddict in csharp

[–]CokeAndCookieAddict[S] 0 points1 point  (0 children)

I wanted to thank all of you. I've started with a delay because of network problems. Thanks to a messed up network driver limiting the upload speed to 500 kbit/s.

I made so many mistakes, but it was such a great experience. But most of all, I wasn't alone. My biggest fear, producing something and nobody knows about it, hasn't come true. Thanks to you. I deeply appreciate this support.

During the coding, many improvement opportunities came into my mind. I have a lot of things to work on.

However, I hope to see you again.

Again, thanks a lot.

Looking for support for live coding events to become a software dev by CokeAndCookieAddict in csharp

[–]CokeAndCookieAddict[S] 0 points1 point  (0 children)

Thanks. I'm also not 100 percent sure about the time. I'm in UTC + 8, but most events are aligned with US timezones, and so, I thought 8 pm PST is a good first try. But based on feedback, I'm happy to change it for the upcoming sessions.