teleren/devto huggingface dataset:
Resolve Open Generics with ASP.NET Cores DI-Container
Tags: dotnet, aspnetcore, webdev, dependencyinjection
Published: 2020-11-10 20:08:33

ASP .NET Core already has quite a decent di-container built in. However, there are some quirks you might need to be aware of. In one of my applications, I've been using a factory pattern to register my views by using open generics. To be more clear about that: I have an Interface *IView&lt;TView&gt;*, and I want to register all of this interfaces implementations.

As I found out, Microsofts DI-Container currently doesn't support that by default (text me if I'm wrong!), but there's a solution for this problem.
[Scrutor](https://github.com/khellang/Scrutor) is a package that adds more complex di-features - specifically *scanning*. This means that, using this library, you now have the ability to scan through your assemblies and perform registrations based on your findings.

Now, for my case, this was quite simple: All I had to do was to add the following snippet to my startup-class:

```csharp
services.Scan(scan =>
  scan.FromAssembliesOf(typeof(IView<>))
    .AddClasses(classes =>
    classes.AssignableTo(typeof(IView<>)).Where(x => !x.IsGenericType))
        .AsImplementedInterfaces()
        .WithTransientLifetime());
```

And that's it! Now, all the implementations of the interface find their way into my di container and I can easily retrieve new instances by utilizing the following factory class:

```csharp
public class ViewFactory : IViewFactory
{
    private readonly IServiceProvider _services;
    public ViewFactory(IServiceProvider services)
    {
        _services = services;
    }

    public Task<TView> CreateViewAsync<TView>()
    {
        var builder = _services.GetService<IView<TView>>();

        if (builder == null) 
        {
          throw new Exception($"View {typeof(TView)} not registered");
        }
          
        return builder.BuildAsync();
    }
}
```

If needed, you could easily extend this by a second type parameter to specify e.g. arguments to pass to the view. Those would then be passed to the *CreateViewAsync*-Method, which in turn would forward them to the builders *BuildAsync*-Method.
Little handy crontab helper tool
Tags: crontab, javascript, node, shell
Published: 2020-11-10 19:45:48

Cronify is a litte handy tool that i have developed, it can help you to schedule shell scripts and then check execution status of your script.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8afa3gr3eimreyij7oag.PNG)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9tz65275yp84n2pk5l95.PNG)

A form where you can enter your script and another card in the right to see what you have already scheduled.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uwzbi2qusyluxjqx4l2o.PNG)

In bottom another part where you can see your script execution results.

This tool is in development, you can get it from github and contribute in if you want :)

https://github.com/tkhadir/cronify

Thank you
Open Finance
Tags: discuss, opensource, finance, trading
Published: 2020-11-10 19:40:37

We started an initiative to make an open finance protocol for simplifying the connection of institutions (server to server) and the interoperability of bots (client to server).

Please share your thoughts: [Open Finance](https://open-finance.org/)

Github link: [https://github.com/openware/open-finance-protocol](https://github.com/openware/open-finance-protocol)
Desplegar app de React.js en Netlify (en menos de 5 min)
Tags: javascript, netlify, deploy, react
Published: 2020-11-10 19:23:05

Para desplegar una app desarrollada en React.js en Netlify de manera sencilla y rápida bastará seguir los siguientes pasos:

1.Entra a la web oficial de [Netlify](https://www.netlify.com/) y crea un cuenta, puedes crear la misma con tu cuenta de: 
-GitHub
-GitLab
-Bitbucket
-Simple email

2.En tu app de React.js genera los archivos de producción ejecutando:

```cmd
npm run build
```

3.Para subir el proyecto desde una terminal es necesario instalar el paquete **netlify-cli** de manera global, para ello ejecuta: 

```cmd
npm install netlify-cli -g
```

4.Ejecuta: 

```cmd
netlify deploy
```

5.Selecciona la opción: `+  Create & configure a new site`

6.Dale un nombre al deploy (opcional)

7.En la configuración **Publish directory** indica la carpeta build de tu proyecto, bastara con escribir: 

```cmd
./build
```

8.Espera unos segundos y la terminal devolverá una salida incliuida la opción `Website Draft URL` que es el link en internet donde estará alojado nuestro proyecto. C'est fini! (Eso es todo)

## **Referencias**
* https://www.youtube.com/watch?v=Ltfnij1pSVE

![img](https://media.giphy.com/media/3ohs86vZAWiJXWvQI0/giphy.gif)
Program for Compile function in python
Published: 2020-11-10 19:18:22

 The complie() function in python is used to return python code object from a source like (string,AST object,byte string).
Syntax For Complie(): -

compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)


Well the return object from the compile function in python can be called by exec() and eval() method.
Parameter : -

   
A source that can be used in compile function that can be normal string, a byte string, or an AST object.

A code that can be read from a file. If it doesn't read form a file then you give a name according to you.

Either exec,eval or signal method can be used to call a function.

Well eval accept only a single expression.

exec take block of code with python statement like class function.

it contain single interactive statement.



Example program for compile() function in python : -

```python
codeInString = 'a = 5\nb=6\nsum=a+b\nprint("sum =",sum)'
codeObejct = compile(codeInString, 'sumstring', 'exec')

exec(codeObejct)
```
OUTPUT

sum = 11


Read the article here: [Tutorial for function](https://www.functioninc.in/2020/11/example-program-for-complie-function-in-python.html)
Making Vaporwave graphics for my Twitch Channel
Tags: vaporwave, photoshop, graphics, design
Published: 2020-11-10 19:09:42

---
title: Making Vaporwave graphics for my Twitch Channel
published: true
description: A quick photoshop tutorial for how I make vaporwave graphics using basic Photoshop tools
tags: vaporwave, photoshop, graphics, design
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/0az380nme6it4pyyw9oa.jpg
---
In this video I use Photoshop to create vaporwave graphics using some creative commons images, color channel selection, and text graphic manipulation.

Most of the tools here will work with older versions of Photoshop except for the smart lasso tool, which isn't really necessary but 'nice to have'
{% youtube 4ZwTfyzepTM %}

You can see my new channel graphics on [my Twitch channel!](twitch.tv/serverlessmom)
[8] Mastering Zsh & The University’s Fall Semester
Tags: webdev, codenewbie, linux, career
Published: 2020-11-10 19:02:23

Recently my second year at the University started, and I am happy to have some well-known routine in my study life. Nevertheless, in the first part of autumn, I will have only two courses: [Orientation to Sustainability Thinking (2 ECTS)](https://opinto-opas.lab.fi/en/realization/A300CE13-3001), which is more about the sustainable picture in general and [Technical Mathematics (3 ECTS)](https://opinto-opas.lab.fi/en/realization/AT00BT69-3001), which is just a regular theoretical course in math. The first one is completely independent, and on my part, is almost done and is waiting for evaluation. The math course is a regular lecture course and will run until the end of the year. Since the end of September, I will also start another [University module](https://create-react-app.com/my-studies-at-the-university/) dedicated to web development. I am looking forward to starting this particular module since web development is what interests me most at the moment.

By the way, I keep watching some FrontendMasters courses, and recently I went through the [Complete Intro to Linux and the Command-Line](https://frontendmasters.com/courses/linux-command-line/) named course by Brian Holt. This course was a lot of fun, and Brian is definitely one of the best teachers I have ever seen. I learned a lot about Zsh and Bash commands, such as *less, Touch file{1..10..2}.txt, rm -rf, ls -lsah, kill -9, whoami, ps aux, wget, curl*, and so on. I refreshed my knowledge about using sudo and manipulating user permissions. There was as well a whole part of the course related to Vim and Nano, and yes, now I even know how to get out of Vim. I have also learned to create and use my own simple shell scripts, like: 

```zsh
read -p "Enter a folder name: " FOLDER

DESTINATION=~/Desktop/$FOLDER

read -p "Enter a file prefix: " FILE_PREFIX

mkdir -p $DESTINATION
cd $DESTINATION
touch ${FILE_PREFIX}{1..10}.txt
echo done
```

I have also made some changes to the basic Zsh settings on my terminal. For example, I installed the oh-my-zsh framework, which is just outstanding. It allows you to simply add plugins to Zsh. There is my list of plugins: *plugins=(git history osx web-search)*. I have also made some changes to the *.zshrc* file, which allows the terminal to randomly choose one of my favorite Zsh themes on every boot (spaceship, robbyrussell, amuse, avit, norm, pygmalion, sunrise, wezm, ys).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/73arm9ri03fm9467mruq.png)

[Original post 13.09.20 @ create-react-app.com](https://create-react-app.com/8-university-zsh/)

Site https://proj.create-react-app.com/
GitHub https://github.com/villivald
9 Digital Trends for Real Estate to Watch in 2021
Tags: mobile, webdev
Published: 2020-11-10 18:55:14

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/o9u84g6l8fs26pumjbq0.png)

Real estate is becoming a digital asset too. The technology trends are disrupting the industry and changing the way we buy and sell homes. 

Discover the key digital trends and how they can transform your real estate business in this guide.
[https://apiko.com/blog/9-digital-trends-for-real-estate/](https://apiko.com/blog/9-digital-trends-for-real-estate/)
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2020-11-10 18:54:06

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round-up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
Every Tuesday, we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week. ❤️

### Getting a handle on state management

As @zalithka [said](https://dev.to/zalithka/comment/17hcb), “Careful Ankit, you might just make people actually start enjoying state management if you carry on like this..” 
😂

Great job with this post, @dabalyan!

{% link https://dev.to/dabalyan/state-management-with-a-single-line-of-code-2llg %} 

### A shared design vocabulary

In this post, @mayruiz27 provides a really solid overview of design patterns with the goal of helping dev teams communicate about solutions-design better. Great work!

{% link https://dev.to/mayruiz27/design-patterns-for-frontend-developers-2ii3 %} 

### Reign victorious over tricky bugs!

@lxkuz says that the harder the bug is, the more pleasure you will get when you win. This post will help you get to the “winning” part faster. 

{% link https://dev.to/lxkuz/the-art-of-war-how-to-beat-the-bugs-faster-and-harder-2e4g %}

### Writing an OS from scratch

@frosnerd set a goal of writing an x86, 32 bit operating system and blogging about the journey. Thanks for sharing this with us, Frank!
{% link https://dev.to/frosnerd/writing-my-own-boot-loader-3mld %}

### Hacktoberfest is over… keep contributing!

Hacktoberfest might be over, but that certainly doesn’t mean open source newbies should stop contributing. Thanks for this motivational post, @metamoni!

{% link https://dev.to/metamoni/how-to-start-contributing-to-open-source-as-a-junior-1c9l %}

### Beating the winter blues

In many parts of the world, it’s about to get colder, darker, and harder to prioritize mental health. @annika_h came through with some great tips about how to handle your emotional needs during a global pandemic when you’re short on vitamin D.

{% link https://dev.to/s2engineers/self-care-isn-t-selfish-mental-health-tips-for-the-winter-months-in-a-global-pandemic-25kd %}

### The test of time (estimations)

Getting time estimations for building features is indeed a _super_ tricky thing for engineers and their teams to accomplish. This post by @carmenhchung can help!


{% link https://dev.to/carmenhchung/how-to-nail-time-estimations-gio %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
New M1 chip in the Mac.  How do you think it's going to change the development experience?
Tags: ios, apple, development, macbook
Published: 2020-11-10 18:51:08

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/oxxja837fmfjxtpndkah.jpg)

Never been so excited for an apple upgrade. Is it only me? 😅👨‍💻
Magento 2 Node JS NVM MacOS (Node Version Manager) Setup 
Published: 2020-11-10 18:50:08

Modern Web end Magento is not possible without the NodeJS. More and more merchants using NodeJS over PHP. To have proper LTS node version is really important. 

# Install NVM

To install or update nvm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL or Wget command:

```
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.37.0/install.sh | bash
```

Running either of the above commands downloads a script and runs it. The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

```
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
```

# Install Node

Now go over to https://nodejs.org where I see it’s telling me the latest stable release is v10.15.0 LTS. I see there is a v11.8 Current with all the latest features, but I’m not using that one today.

So I simply use the terminal and nvm to install it with

```
nvm install 10.15.0
```

I’ll set the current version I want to use to the same
```
nvm use 10.15.0
```

Check node version 

```
node -v
```

output:

```
yehor.shytikov % node -v
v14.15.0
```
New Discord Server for Art4Coding.icu
Published: 2020-11-10 18:36:09

I have created a new discord server for the opensource project https://www.art4coding.icu which is hosted on github, the discord server is specifically for Artist & Coders to collaborate on various different projects, upload your assets, ask questions, help others with coding issues, find an artist or a developer, post jobs or urls to your projects and assets.. Help build a community. the invite link is below => https://discord.gg/9NbYJSqfsy
Ajustando fuso horário no PHP
Published: 2020-11-10 18:15:18

---
title: Ajustando fuso horário no PHP
published: true
description: php
tags: 
//cover_image: https://direct_url_to_image.jpg
---

# Ajustando fuso horário no PHP
> Algumas aplicações precisam saber o fuso horário para realizar algumas ações específicas e pode ser uma boa ideia ajustar o date.timezone[1] nas configurações do PHP para essas aplicações.

> Se o comando abaixo não exibir nenhuma saída, provavelmente o date.timezone não está configurado.

```
$ php -r "echo ini_get('date.timezone');"
```

>>>
É possível verificar a string que será exibida pela aplicação com o comando date[2] e o corrente fuso horário usando o comando abaixo.
```
$ php -r "echo date('r');"
>>> Fri, 22 Nov 2019 14:28:03 +0000
```
O +0000 indica que o fuso horário atual é o UTC, que é padrão do PHP quando o date.timezone não está configurado.

Depois de pegar uma opção de fuso horário a partir da documentação[3] do PHP, o teste para verificar se esta opção dará o resultado esperado pode ser feito com o comando abaixo, supondo que a opção escolhida seja America/Sao_Paulo.
```
$ php -d date.timezone=America/Sao_Paulo -r "echo date('r');"
>>> Fri, 22 Nov 2019 11:35:38 -0300
```
O -0300 indica o fuso horário America/Sao_Paulo. Para persistir esta configuração devemos definir date.timezone no arquivo php.ini. O lugar deste arquivo pode variar conforme a distro usada.

No Archlinux, todos os arquivos com extensão .ini presentes no diretório /etc/php/conf.d vão fazer parte do php.ini. O comando abaixo adiciona a configuração de fuso horário às configurações do PHP.

# echo date.timezone=America/Sao_Paulo >> /etc/php/conf.d/my-customs.ini
Feito isto, é possível rodar os mesmos comandos acima para verificar se as configurações de fuso horário estão funcionando corretamente.
```
$ php -r "echo ini_get('date.timezone');"
>>> America/Sao_Paulo

$ php -r "echo date('r');"
>>> Fri, 22 Nov 2019 11:51:25 -0300
```

Referências
https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
https://www.php.net/manual/en/function.date.php
https://www.php.net/manual/en/timezones.php
JavaScript Deck Redesign With Blender
Tags: javascript, html, webdev, css
Published: 2020-11-10 18:11:25

Last week I have been working with Blender to redesign Summon The JSON: Javascript  deck page. Here is the final result. Do you like it?
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/c0hu06uk9fke3m0ytr1h.jpg)
Daily Challenge #299 - Time to Grille!
Tags: challenge
Published: 2020-10-26 15:51:04

---
title: Daily Challenge #299 - Time to Grille!
published: true
series: Daily Challenge
description: Use a grille cypher to decode a hidden message!
tags: challenge
//cover_image: https://direct_url_to_image.jpg
---

A grille cipher was a technique for encrypting plaintext by writing it onto a sheet of paper through a pierced sheet. The earliest known use is from the mathematician Girolamo Cardano in 1550. His proposal was for a rectangular stencil allowing single letters, syllables, or words to be written, then later read. The written fragments of the plaintext could be further disguised by filling the gaps between the fragments with benign words or letters. 

Wikipedia: https://en.wikipedia.org/wiki/Grille_(cryptography)

Write a function that accepts two inputs: `message` and `code`. Code is a non-negative integer and should be converted to binary. Overlay the code converted to binary and the message to reveal the result.

###Example
```
Grille("abcdef", 5)  => "df"

* convert 5 to binary:
 000101

* overlay message and code:
message : abcdef
code    : 000101
----------------
result  : df
```


###Tests
`Grille("0abc", 2)`

`Grille("abcde", 32)`

`Grille("abcd", 1)`

Good luck!

***
_This [challenge](https://www.codewars.com/kata/595b3f0ad26b2d817400002a) comes from dcieslak on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
The Complete Guide to Angular User Authentication with Auth0
Tags: angular, javascript, authentication
Published: 2020-11-10 18:07:20

Learn how to add user authentication to Angular using Observables and HTTP Interceptors.
[Read more...](https://auth0.com/blog/complete-guide-to-angular-user-authentication/?utm_source=content_synd&utm_medium=sc&utm_campaign=angular_guide)
What if I don't use Jekyll?
Tags: netlify, deploy, ssg, githubactions
Published: 2020-11-10 17:58:10

What if you are reading this post and you want to host  a static site without Jekyll?

Note that this post series is specifically focused on Jekyll sites, which get built for your on GitHub Pages. If you have another flow without Jekyll such as with a Node app (React, Next, Vue.js), then you can't use plain GitHub Pages. You need to use GitHub Pages integration GitHub Actions, or you need Netlify. Either flow will support many languages to build with.

I have a post series on GitHub Actions aimed at beginners and Node app developers. So you can check that out.

- [Intro to GitHub Actions](https://dev.to/michaelcurrin/beginner-s-guide-to-github-actions-49aa)
- [CI/CD tutorial using GitHub Actions](https://dev.to/michaelcurrin/intro-tutorial-to-ci-cd-with-github-actions-2ba8)

And as with Jekyll, again I want to highlight that Netlify is really simple to configure.

Your Netlify setup can be:

```yaml
commmand: npm run build
publish: build
```

And that would build to and serve from your `build` directory. You don't even need to specify an install step or NPM vs Yarn as Netlify takes care of that for you.

I have some recommended Netlify config setups in my [Code Cookbook](https://michaelcurrin.github.io/code-cookbook/recipes/ci-cd/netlify/configure.html) project.


## Conclusion

I hope you have learnt a lot about Netlify, GitHub Pages and GitHub Actions and feel like you can make a good decision for what to use for your next Jekyll site.


## Credits

<span>Cover photo by <a href="https://unsplash.com/@garciasaldana_?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Pablo García Saldaña</a> on <a href="https://unsplash.com/s/photos/direction?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>
Jekyll on Netlify
Tags: jekyll, staticsitegenerator, netlify, ci
Published: 2020-11-10 17:56:34

Reasons to use Netlify

## Custom builds

Easy custom builds that use `npm run build` before Jekyll build, or custom gems or a custom Ruby plugin you wrote. 

A custom build setup is possible on GitHub Pages using GitHub Actions. But that is much more complicated to understand and configure and you have to handle installing and caching dependencies yourself, which Netlify does for you. I cover some GitHub Actions links at the end of this post.

Netlify will auto build a preview URL, like a staging site, on each Pull Request or branch created (depending how your configure it).

### Debugging with logs

Netlify logs are way more detailed - GitHub Pages errors are often very generic ("there was an error with your build"), so I have to run the build locally to see what the full error is. 

Or use GitHub Actions - which is unnecessary for the majority of my simple Jekyll sites where I want less to manage.

## Repo hosting 

It allows building from a private repo, if you so choose. Or even a GitLab or BitBucket repo.

## Plugins

Netlify has a lot of free add-ons which you can enable per site with a choice in the UI or one line in a config file. For example, generate a sitemap file, do an accessibility check, render your Single-Page App as a static site (this means that Google SEO scoring will like your React app now) or optimize and compress assets.

- [Netlify build plugine](https://www.netlify.com/products/build/plugins/)
- [Top 10 Netlify build plugins](https://www.netlify.com/blog/2020/06/22/top-10-netlify-build-plugins/)

These plugins are not available on GitHub Pages. You can do something similar on GitHub Actions but you have to choose from the marketplace and setup your workflow.

## Lambdas

Did you know what you can use Netlify to run serverless code for free?

- [Netlify Functions](https://www.netlify.com/products/functions/) homepage

They are called Functions and they similar to the serverless endpoints or "Lambdas" you'll know from AWS. But Netlify is much simpler to setup.

A reason to use a Lambda is if you have data in a database or want to do server-side requests internally to an API, then you can make that data available on an endpoint that could say return JSON data. Which can get used by your frontend code.

## CMS

Netlify also supports a CMS.

- [Netlify CMS](https://www.netlifycms.org/) homepage.

This allows you to setup an admin config file and have `my-app.netlify.app/admin` available for you and invited users to log in and manage content.