Giter Site home page Giter Site logo

csharpfritz / csharp_with_csharpfritz Goto Github PK

View Code? Open in Web Editor NEW
660.0 57.0 215.0 15.64 MB

Show notes, slides, and samples from the CSharp with CSharpFritz show

License: MIT License

Jupyter Notebook 18.29% Dockerfile 0.24% C# 31.43% HTML 16.06% CSS 12.52% JavaScript 0.36% PowerShell 1.51% SCSS 6.77% Less 6.71% Stylus 6.12%

csharp_with_csharpfritz's Issues

Social share buttons for Blazor

Hi Jeff, thank you for your lessons and your answers!
How to add social share buttons to Blazor?
So far I've managed to get an active page address and sharing links.
Links are taken from: https://github.com/bradvin/social-share-urls

But I could only get index.html title and meta description tag contents by using JavaScript.
This is my separate Blazor component, Social.razor:

@inject NavigationManager UriManager
@inject IJSRuntime jsRuntime

<a href="https://www.linkedin.com/sharing/share-offsite/?url=@(UriManager.Uri)" title="LinkedIn" target="_blank">LinkedIn</a>
<a href="https://www.facebook.com/sharer.php?u=@(UriManager.Uri)" title="Facebook" target="_blank">Facebook</a>
<a href="https://twitter.com/intent/tweet?url=@(UriManager.Uri)&text=@Title" title="Twitter" target="_blank">Twitter</a>
<a href="http://pinterest.com/pin/create/button/?url=@(UriManager.Uri)" title="Pinterest" target="_blank">Pinterest</a>
<a href="https://web.skype.com/share?url=@(UriManager.Uri)&text=@Title" title="Skype" target="_blank">Skype</a>
<a href="https://social-plugins.line.me/lineit/share?url=@(UriManager.Uri)" title="Line" target="_blank">Line</a>
<a href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=@(UriManager.Uri)&title=@Title&summary=@Description" title="QZone" target="_blank">QZone</a>
<a href="http://service.weibo.com/share/share.php?url=@(UriManager.Uri)" title="Weibo" target="_blank">Weibo</a>
<a href="https://reddit.com/submit?url=@(UriManager.Uri)&title=@Title" title="Reddit" target="_blank">Reddit</a>
<a href="http://www.livejournal.com/update.bml?subject=@Title&event=@(UriManager.Uri)" title="LiveJournal" target="_blank">LiveJournal</a>
<a href="http://vk.com/share.php?url=@(UriManager.Uri)&title=@Title&comment=@Description" title="VKontakte" target="_blank">VK</a>
<a href="https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@(UriManager.Uri)" title="Odnoklassniki" target="_blank">OK</a>
<a href="https://t.me/share/url?url=@(UriManager.Uri)&text=@Title" title="Telegram" target="_blank">Telegram</a>

@code {
    public string Description = "";

    public string Title = "";
    
    protected override async Task OnInitializedAsync()
    {
    Title = await jsRuntime.InvokeAsync<string>("getTitle");
    Description = await jsRuntime.InvokeAsync<string>("getDescription");
    }
}

JavaScript to get an active page title, inserted into index.html
<script>window.getTitle = () => { return document.title; };</script>
JavaScript to get meta description contents, inserted into index.html:

<script>
window.getDescription = () => {
  var metas = document.getElementsByTagName('meta');
  for(var i in metas) {
    if (typeof(metas[i].name) != 'undefined' && metas[i].name.toLowerCase() == "description") {
      return encodeURIComponent(metas[i].content);
    }   
  }
  return '';
}
</script>

My question, how to get t:

  • PageTitle from the active page
  • description from <meta name="description" content="MegaSuperExcellPage"> inside HeadContent
  • primary image url for the active page and image dimensions?

It looks like that it is possible without JavaScript

Collections (Sept 14)

Lists, Arrays, Dictionaries, HashSets, Indexer methods

Intro to using Generics should be covered as well

WASM as an installed app

Hi, Fritz! Can you talk about how when a user visits our page that has our WASM, we can immediately detect if that user has installed our WASM locally, and if not, how we can pop up a window in which they can click a button to install it? Any gotchas we should know about? Thanks!

String Formatting

Need to talk more about operators and string formatting operations

C# 9 Features

Let's talk about the new features of C# 9 as they are released with .NET 5

WPF

Hey I saw someone asking for some WPF series and he didn't make an issue, so.. I did. Totally agreed with this idea, I feel like docs are outdated so would be great to see some series about WPF.

Thanks in advance!

[Question] About Jupyter Notebooks, github, binder and VS Code

Hello Jeff, as you can see in the "header" the "content-length" of my "request" is too long... πŸ˜‰

First, I want to thank you and congratulate for the passion, dedication and tech detail in your live streamings, good job!

Second, if you can at some time in the near future, explain about the end-to-end process for get the same configuration just like your repository: how can I deploy or set the notebooks in github with binder support, and also get the same locally with VS Code with and without docker.
I am a humble instructor of C# in a non-profit organization in my city (Rosario, Argentina) and I wish to replicate your teach technique, at least for the basics concepts of the language

Thanks again!

PS: I originally post the same question in Fritz.LiveStream by mistake. Sorry

Wrong file type .dib for notebook 0209?

I'm viewing the session on Async code with notebook 0209-AsyncAwaitAndMultithreading but it seems like it has the wrong file type .dib, instead of ipynb.
Here's the output when you try to open the notebook either locally or binder:
image

User Interface Frameworks

Let's talk about a user interface next. ... but which one?

Vote with a πŸ‘ on the response that you are interested in seeing first.

Based on the timing of the episodes, this should be a .NET 5 hosted series

docker-compose up is erring out

Getting below error while executing docker-compose up command. I am in the correct directory and running the command. Let me know if it has anything do with any more configuration that is needed before running the docker command or it is something else.

Thanks in advance.
docker-compose up
Traceback (most recent call last):
File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "site-packages/docker/transport/unixconn.py", line 43, in connect
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "site-packages/requests/adapters.py", line 449, in send
File "site-packages/urllib3/connectionpool.py", line 727, in urlopen
File "site-packages/urllib3/util/retry.py", line 403, in increment
File "site-packages/urllib3/packages/six.py", line 734, in reraise
File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "site-packages/docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "site-packages/docker/api/client.py", line 205, in _retrieve_server_version
File "site-packages/docker/api/daemon.py", line 181, in version
File "site-packages/docker/utils/decorators.py", line 46, in inner
File "site-packages/docker/api/client.py", line 228, in _get
File "site-packages/requests/sessions.py", line 543, in get
File "site-packages/requests/sessions.py", line 530, in request
File "site-packages/requests/sessions.py", line 643, in send
File "site-packages/requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "docker-compose", line 3, in
File "compose/cli/main.py", line 67, in main
File "compose/cli/main.py", line 123, in perform_command
File "compose/cli/command.py", line 69, in project_from_options
File "compose/cli/command.py", line 132, in get_project
File "compose/cli/docker_client.py", line 43, in get_client
File "compose/cli/docker_client.py", line 170, in docker_client
File "site-packages/docker/api/client.py", line 188, in init
File "site-packages/docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
[1226] Failed to execute script docker-compose

P

Csharp

Couple of suggestions on notebook 1

Listened to the recording for notebook 1 and felt like there were a few jumps or assumptions that newbies like me might not immediately get so had some suggestions that might make the stepping stones closer together:

// Everything in C# is an object

Can there be a short definition of what it means to be 'an object'? Something like:

_"The idea that there's a series of out-of-the-box (or user designed) specifications / blueprints - known as TYPES. When something new is created to those specifications / blueprints, it's known as an OBJECT.

As a result of being built to those particular blueprints / specifications, the new object will have characteristics (known as properties), and things it can do (known as methods).

A real world example would be if I got a new vehicle (let's call it 'myVehicle') built to 'car' specifications. It has characteristics (properties) such as colour, make, model. It also has things it can do (methods) like go forward, reverse.

The example OBJECT myVehicle is said to be "of TYPE car".

Properties are usually retrieved by adding a .Something after the name of the object. For example car.colour might return 'blue'.

Methods are usually triggered with .Something(). For example car.Goforward()

The brackets allow for extra detail to be added to the instruction. For example, instructing the car to advance a distance of 3 might be car.Goforward(3)"_

// Maybe an introduction to Type Casting

_"Trying to squeeze something that is originally of one shape into another shape. For example squeezing an integer into a hole designed for a decimal. C# can figure that out (implicit conversion) on the basis it fits into the hole with space left over.

However, trying to do the other way round (decimal into something designed for an integer) does not want to go naturally, so needs to be forced (explicit conversion)."_

// Modify and assign at the same time

Worth putting the equivalent code after in a comment?

e.g. // apples = apples + 10;
e.g. // apples = apples - 10;

...

Just thoughts - happy to write up and send over PR if useful. If doesn't work / fit the flow, no worries.

Advanced Roslyn

I would suggest a series on Roslyn including source generators and even combining code fixes with source generators including using IIncremental for performance.

NullReferences features

Introduce and discuss NULL, NullReferenceException.

Tips, tricks, and why you NEED to use this NullReferences and nullability in your C# code

Classes vs Structs πŸ‘€

I've been getting a lot of questions from students on the usage of class vs structs. We have a doc here that discusses the topic.

Personally, I don't think I've ever created a struct for a production application. I'd love to hear/see some practical usage of where one is better suited than the other.

Blazor to Azure sql database

Hi Jeff

Is it possible to teach us How can we Securely connect Blazor to Azure sql database in such a way that can not be hacked.

Thanks in advance.

Web API Series

Hello, as the REST API becomes a standard of today's web communication, I would really love to see an in-deph series about it.
Here are some lesson ideas:

  • User authentication with JWT and secondary providers like google
  • Caching
  • Pagination
  • Deployment (incl. deploying on linux)
  • Clean project architecture
  • File upload
  • Interaction with frontend frameworks
    Let me know what you think :)

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.