teleren/devto huggingface dataset:
GraphQL & REST with Typescript, Prisma and Azure SQL: love at first sight!
Tags: javascript, webdev, typescript, database
Published: 2021-10-11 19:07:35

If you're into Typescript and prefer a code-first approach when working with databases, you'll be happy to learn about Prisma! [Prisma](https://www.prisma.io/) is a next-generation Node.js and TypeScript ORM, that allows you to define a schema using a dedicated [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) so that you can then have all the comforts of modern development environments like intellisense, static type checking, automatic scaffolding and more.

To help everyone, even those who just started working as coders - or those who want to start a career as software engineers - we have created a fully working end-to-end full-stack solution that has:

- a frontend written with **Vue.Js**
- a backend, written in **Typescript** and using **Prisma**
- an **Azure SQL** database (for the reasons explained [here](https://devblogs.microsoft.com/azure-sql/10-reasons-to-use-azure-sql-in-your-next-project/))

to make it consumable by really everyone, we also decided to support both **REST** and **GraphQL** protocols and we also decided to make sure that everyone can take advantage of a streamlined CI/CD experience, so we used **Azure Static Web Apps** and **GitHub Actions** to glue everything together.

Last, but not least, the sample also support **Authentication and Authorization** (which is [super simple thanks to Azure Static Web Apps](https://docs.microsoft.com/en-us/azure/static-web-apps/authentication-authorization)!)

I must say I'm happy and proud of what has been done, as this example is a great learning experience and starting point for everyone interested in becoming a better developer.

So, look at the article here to learn more about Prisma:

[Modern application development with Prisma, GraphQL (or REST) and Azure SQL](https://devblogs.microsoft.com/azure-sql/modern-application-development-with-prisma-graphql-rest-and-azure-sql/)

and to the repository hear to deploy the code on your own:

{% github Azure-Samples/azure-sql-db-prisma no-readme %}

The repository is fully documented. You should be easily able to set up your working environment in no time. If you want to see it in action and learn about it before starting to use it, I did a session at the Prima Meetup that you can watch here:

{% youtube -u2CwW40X0k %}

As usual, enjoy!
Cloud Collective: Real-time Data Integration with Webhooks
Tags: webhooks, architecture, security, api
Published: 2021-10-11 19:06:52

Let's talk about ways to integrate and push data out to external systems in near real-time with polling, streaming, and Webhooks.

{% youtube P81aCaqoaCI %}

Cloud Collective is a meetup for technologists interested in the Cloud Native approach towards developing and deploying web & mobile applications, streaming analytics, ETL pipelines, microservices, containers, functions, and applying Infrastructure as Code principles for automating infrastructure on AWS, Azure, and Google Cloud.  In this recorded meetup, we focus on polling, streaming, and Webhooks.

Here are a few things covered in this video:
1. Overview of Polling, Streaming, and Webhook Integrations
2. Webhook Architecture: Registration, Security, API clients
3. A quick demo of Webhook implementation
4. Takeaways

If you enjoyed this talk, join our cloud collective group here ► https://www.meetup.com/cloud-collective/ and participate in our next meetup!
Handling multiple stores in a React-Redux application
Tags: react, redux
Published: 2021-10-11 19:26:58

---
title: Handling multiple stores in a React-Redux application
published: true
date: 2021-10-11 18:57:00 UTC
tags: reactjs, redux
canonical_url: https://www.geekyhub.in/post/handling-multiple-stores-in-react-redux-application/
cover_image: https://www.geekyhub.in/post/handling-multiple-stores-in-react-redux-application/multiple-redux-stores.jpg
---

In a react-redux application, it is a good practice to have only one redux store. But if for some weird/“special” reason if you have to have more than one store, you will face some problems.

The most common problem is that if we wrap a component with a provider and then wrap a child component with another provider, it’s not easy to subscribe to the store of top-level provider.

```react
const Component1 = () => {
  return (
    <Provider store={store1}>
      <Provider store={store2}>
        <Component2 />
      </Provider>
    </Provider>
  );
};

```

It’s so confusing that within a few iterations of development, you’ll find yourself using providers on each component, and not being able to read values from both the stores in a single component will frustrate you.

To manage this elegantly, we can do some setup which will ease the things.

For this, we will need `react-redux 7` or greater. Because versions older than it doesn’t use react’s context API. And we will be using contexts to access multiple stores without wrapping with the providers again and again.

Create a context for each store. You can also import `ReactReduxContext` from `react-redux` and use it for one of the stores, which you want to make default.

```react
const store1Context = React.createContext();
const store2Context = React.createContext();

```

Now wrap the root component of the react application with a provider for each store, passing the contexts as props.

```react
<Provider store={store1} context={store1Context}>
  <Provider store={store2} context={store2Context}>
    <App/>
  </Provider>
</Provider>

```

We also need to create custom dispatch and selector hooks. If you use the default hooks (`useSelector`, `useDispatch`), it will use the store with default context, if any.

```react
export const useStore1Dispatch = createDispatchHook(store1Context);
export const useStore1Selector = createSelectorHook(store1Context);

export const useStore2Dispatch = createDispatchHook(store2Context);
export const useStore2Selector = createSelectorHook(store2Context);

```

From further development, you can use these custom selector and dispatch hooks to use the preferred store in any of the components throughout the application.

If you prefer to connect HOC, then you can do

```react
connect(mapStateToProps, mapDispatchtoProps,mergeProps, {context: store1Context})(Component) 

```

Let me know if you have any suggestions or questions. Thanks
[Video] Running your cloud locally: Opta's Open source Infrastructure as Code
Tags: aws, deployment, cicd
Published: 2021-10-11 18:56:15

---
title: [Video] Running your cloud locally: Opta's Open source Infrastructure as Code
published: true
description: In this quick video, Sachin demonstrates how you can run Opta locally before you deploy to AWS.
tags: AWS, deployment, CICD
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uamvgbajml87ao2aa1xb.png
---
Opta is a way to get started deploying services in the cloud without having to understand the nitty-gritty of permissions and connection settings between components.

In this quick video, Sachin demonstrates how you can run Opta locally before you deploy to AWS.

{% youtube xKIxolcVvTs %}

The goal with Opta Local is to let you preview how your application code is running from your laptop without having to deploy to the cloud for every code change
ML Hyperproductivity with Hugging Face
Tags: automl, machinelearning, frontend, tutorial
Published: 2021-10-12 08:29:01

---
title: ML Hyperproductivity with Hugging Face
published: true
date: 2021-10-11 17:39:12 UTC
tags: automl,machinelearning,frontend,tutorial
canonical_url: https://julsimon.medium.com/ml-hyperproductivity-with-hugging-face-b3efad65815b
---

In this video, I start from a movie review dataset and build sentiment analysis models with [AutoNLP](https://huggingface.co/autonlp), an AutoML product designed by Hugging Face. I then predict with the best model on the Hugging Face website and in a Google Colab notebook.

{% youtube s-6V6HlwX98 %}

In part 2, you’ll see how to quickly build a small web app with [Spaces](https://huggingface.co/spaces) to test and demo your model.

{% youtube 1JVm8yIbEqU %}
Why I decide to use vim in 2021
Published: 2021-10-11 17:37:51

---
title: Why I decide to use vim in 2021
published: true
description: 
tags: 

//cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7k4jl3ctk9htfgl408i.png---
# Why I decide to use vim in 2021 

When I first learn programming my teacher use **vi** to teach us.
That was a horrible experience for me. I see it so difficult and even not obvious:
> why do I need to hit **i** before I can insert text?

I know there is many text editors that makes life easy. So why should I use vi or vim.

## Modern IDE takes a lot of memories

I used so many IDE like Eclipse, Boa and VS Code. VS Code is great and so powerful. These last two years I use it in my daily life as programmer. 
But times come when I need to debug multiple microservices. I need to run at least 4 microservices and a desktop application. In addition to that docker desktop should run some service like database, rabbitMQ, redis. Then my PC start to slow down and time to time it blocked because memory is almost full.

Looking at the task manager I start to kill every process that I don't really need. But not too much progress. Then I notice that VS Code takes really many memories when debugging. I switch to eclipse, but it takes even more memory.
I was so frustrated because I can not get my work done.

## Why I decide to try vim

Questions start to fill my mind: 
> why modern IDE take so many memories on my computer?

> Do I really need to take so much memory to write code?

Peoples in a decade before doesn't even have half of my memory to get their work done.
But they manage to write great software. Some even build OS that we still use nowadays.

Then I remember my teacher using vi for programming.
Is **vi** really lightweight? Can it be used as an IDE?

I start to experiment vim as it is an improved version of vi. And many used it as an IDE.

Vim installed on my PC and with a great surprise it only takes less than 50Mb when debugging. It was configured with plugin like:
* vimspector for debugging
* Nerdtree for file browsing
* FZF coupled with Ag/Rg for search
* vim-fugitive for git.

So I decide to learn and use vim each day I put my hand on computer.
I manged to get my work done as my PC doesn't block anymore.


# Conclusion

Modern IDE are great and can make your daily job easy. But vim is still a tool that programmers should consider.
If you are like me who need to debug multiple program at the same time or need to debug on a server environment vim is probably the tool you need.
Although it takes time to master, believe me it can bring you a comfort you never saw before.
GitUI - v0.18 supports rebase
Tags: github, terminal, productivity, rust
Published: 2021-10-11 17:06:15

[GitUI](https://github.com/extrawurst/gitui) is a terminal UI for git written in Rust. We aim to simplify common git tasks in a fast, keyboard-only and cross platform way without leaving your beloved CLI.

## Release Highlights

* rebase with conflicts
* better visuals when repo is in non-clean state
* supported checkout of hierarchical branchnames
* [much more](https://github.com/extrawurst/gitui/releases/tag/v0.18.0)

Thanks for your interest and support!❤️
Using Draft.js as a single-line input
Tags: react, draftjs
Published: 2021-10-11 17:03:00

---
title: Using Draft.js as a single-line input
published: true
description: Using Draft.js as a single-line input
tags: react,draftjs
//cover_image: https://direct_url_to_image.jpg
---

Hey all 👋🏼 Today I want to share with you a very simple code on how to use [Draft.js](https://draftjs.org/) as a single line input.


```js
import Draft, { Editor, ... } from 'draft-js'

const keyBindingFn = (e) => {
  if (!e.metaKey && e.code === 'Enter') {
    // Function to execute...
    return false
  }

  // Return Draft's default command for this key.
  return Draft.getDefaultKeyBinding(e)
}

<Editor 
  [..]
  keyBindingFn={keyBindingFn}
/>
```
The code above will add line breaks should the user presses the command key (mac) + enter key. Nothing will happen if the enter button alone is pressed. You could then execute a function to save the entered value.

Note the user could copy/paste inside the editor. For my setup, I'm ok with that.

✌🏼
Mistakes To Avoid As A Django Developer
Tags: javascript, webdev, programming
Published: 2021-10-11 14:48:15

Django is a python web framework that deals with the server side. You can use it to develop a complete web portal if you have masters HTML,CSS ad little JavaScript. I cant say am a pro, but one year of experience has made me learn a lot of tricks. But sometimes I have reviewed my friend’s code. Here are the common mistakes I narrowed down:


Building things from scratch

Remember, one of the most important aspects of Django is to speed up the rate of development process. There are a lot of third party libraries like form. Be simple and use the libraries, if necessary. Such includes employing Anymail while sending emails, use django-allauth for registration portal. Also, starting your project with cookiecutter might offer you a lot of privileges such as built in user models.


Writing skinny models

Don’t force data into one model. Let your models be fat and self-explanatory. It will make it easier to query in your view. In short, Django architecture is also called Model-Template_view. Write as many model lines as possible to make it easier to query your database. Remember that the model acts as the heart of the database. If it’s fine, it’s going to be easier to display the data in templates.


Having too many queries in View

This will automatically mean that the model was poorly developed. You must learn the relationship between different models. There is no shortcut. Use of foreignkeys, oneToOne, ManyToMany relationship and others. Optimize your ORM queries as you fix any broken queries. Make sure the while adding a cache, it’s in the right position.
I would suggest you use django-debug-toolbar to investigate the performance of SQL querries, cache, templates and requests.


Avoiding Indexes on Models

This is mistake done by almost every Django developer. Adding an index will accelerate the rate at which data is retrieved. Just go through your querryset to see where the index is needed. If you use too much index they will mess up everything. More indexing will slow down the rate of data access.


Having Inconsistency Form Validation


Of course there are many forms in Django with various valdation format. While working on the form in the model, make sure you use the best constraints possible. Take note of the null and blank values, which at some point might confuse. Any inconsistency in the form will contradict the user. In some points the form might not be submitted.
An easier way to screenshot UAC prompt on windows
Tags: windows
Published: 2021-10-11 16:46:57

---
title: An easier way to screenshot UAC prompt on windows
published: true
description: An easier way to take screenshot UAC prompt on windows without changing security level
tags: windows
canonical_url: https://warabanshi.hatenablog.com/entry/2021/10/12/013607
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgygugeiw97v6o8s05vi.png
---

Usually, print screen key or short cut of taking screenshot like Win+Shift+S don't work while UAC prompt appears. So, I googled it and hit some blog articles that describe the ways to take screenshot as follows

[Take a Screenshot of UAC Dialog (User Account Control)](https://www.winhelponline.com/blog/capture-screenshot-uac-elevation-dialog/)

[How to screenshot UAC prompt on Windows 10](https://www.addictivetips.com/windows-tips/screenshot-uac-prompt-windows-10/)

But I found another way that doesn't need changing security level temporary and it's really easy. And it can snip screenshot range includes gray out background like below.
Please notice that I verified this way in my environment only. This may not work in other environments.

![sample screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/idx447nret35r7io7jno.png)

### Steps

1. Open "snip & sketch" tool
1. Select "Snip in 10 seconds" from pulldown menu under the "New"
1. Do something it displays UAC prompt (let's say opening command prompt as administrator) within 10 seconds
1. Wait few seconds until "Snip & sketch" takes delayed screenshot
1. You will see something action like a yellow frame is shown at the edge of screen that means the tool took a screenshot.
1. Now, you can close UAC prompt. Choose Yes or No as you like.
1. Then, you will see "Snip & sketch" tool is waiting your operation to snip from screenshot.
1. After select it, you can save it as a file.

That's it! A screencast is here (Although, actual UAC prompt wasn't recorded in screencast...)

![UAC screenshot screencast](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fsjc9twbquai4jlyhyz0.gif)
100 algos in 100 days (Day 26)
Published: 2021-10-11 16:46:55

##Happy Monday!

I will be taking on a problem called 'Cake Thief'... sounds fun!

It is just a rehash of the classic puzzle called "the unbounded knapsack problem."

It is solved by using a bottom up programming method. This is an almost improved version of a greedy algo. You fill up an array with previous solutions and then work out the next in the sequence depending on the previous ones.

In this example, you calculate for all the weights up to the one you need. To determine the next max value you loop through all possible weights adding where they would fit (i.e. looking backwards in the array).
Hello.. I am kind a stuck in  how to develop a notification code? plz. help me here i m really pissed off , of this prblm
Tags: dotnet, csharp, beginners
Published: 2021-10-11 16:46:22

I am developing a matrimonial website so in that customer should get notified whenever his profile got a view all by now I used update query as if 

Code:-    
string a = e.CommandArgument.ToString(); 
update viewprofiles set viewprofile='" + Session["id"].ToString() + "' where id='" + a + "'";


but the only prblm here is it the ids get insert in viewedprofile but it get updated or replaced by other id if B views A's Profile so B's ID is getting inserted in A 's data base but if C views A's profile so B's id get replace by C's id. if possible can it get insert in a line like B's id , C's id, D's id, i.e. 1,2,3
100 algos in 100 days (Day 25)
Published: 2021-10-11 16:45:27

[10/10]
###Dynamic programming

####Question
####Compute all the combinations of change that could make a certain amount

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxq9txf0itzueojmypfc.png)
 

I really struggled with this one as surprisingly it is quite a complex solution. I am improving in understanding that in breaking down the problem into simpler problems we can dynamically program. For example in this one the key was to build up from how many coins can we use to make $1, how many for $2, how many for $3.

Also starting with a recursive solution can help your mind to think of the bottom up solution.... Although not quite there yet!
100 algos in 100 days (Day 24)
Published: 2021-10-11 16:36:38

[08/10]

It was Friday so I thought I would work on my process of algo solving.

I watched a video focusing on using visualization and breaking the problem down to improve algo problem solving. [Here it is](https://youtu.be/GBuHSRDGZBY).

Like the tips and will definitely apply this. This seems to be a precursor to TDD as with TDD your aim is to break down the problem.
Las [5 eses] japonesas de un programador 🇯🇵👩🏻‍💻🧑🏻‍💻
Tags: programming, software, codigofacilito, natsumiangel
Published: 2021-10-11 16:29:34

### ¡Hola mundo, hola devs! 👩🏻‍💻🧑🏻‍💻🌎🎌

Les comparto la participación que tuve en #CODIGOFEST por el 10 ANIVERSARIO de Código Facilito.

> Si bien son pasos que prácticamente todos conocemos, no siempre los llevamos a cabo para una mejora continua. Por ello, hice una analogía de la metodología de las 5 eses japonesas aplicadas a la vida de un programador.

Y tú, ¿en qué otros aspectos podrías aplicar esta metodología en tu día a día como programador? Me gustaría leerte.

¡Gracias!

Con amor,
Natsumi.

-

[🎙 Conferencia en #CODIGOFEST] (https://youtu.be/ygyqlyOzcws)

[🖇 Presentación] (https://app.pitch.com/app/presentation/d7ec3281-7935-4e2f-b240-673fbff5aca0/35931594-0790-42e1-8eaf-bb91da283314)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fudl2sh58733kjuwtbsb.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kz3r0mkh83aumor18xs.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xj805b5sbs7id7s89bq.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q0lf3cg9motwndvy06mt.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ysidetxm7wqjmi6ian4.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kvl0mvoca4vso2nwsws.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tbiydak40k263020ci45.png)
  
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqhds7tfy62co5d5xgik.png)

 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mbg511z3ijwp06qg1wtv.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfuxhfj024l6hvwddzzt.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8pobupl7pn183frqol1z.png) 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yrf088thys40k3jptx1w.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mq4fxs2hp4apukndw8of.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ikjypnqvi5f26nwvmqf.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n87z7wqg3oqj5g2vf6ka.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldc6u19vcxnnl7uv9763.png)
Consumer City [0] - Adventuring with dotnet and AWS
Tags: csharp, aws, blog, portfolio
Published: 2021-10-11 16:16:17

This is the start of my journey of learning dotnet development on AWS.

I'll try to detail my journey of learning the AWS ecosystem and practice cloud architecture using c#.

If required I'll also write some python / node scripts, but I'll try to focus more on c#.

I'll be creating what I called **Consumer City** which will be detailed on a later post. 

On this series I'll try to focus on small snippets of code / setup / things I learned when developing this application. 

Like how to create dotnet container, create lambda using c#, network in AWS, CI/CD etc.

I hope I have the patience to create multiple posts like this and they can be useful (for me and others) in the future.
Any devs who also write? We're looking for a few developers to write fun articles on projects to build with our tools! (paid)
Tags: tutorial, writing, database, showdev
Published: 2021-10-11 16:00:55

Hey I'm Andrew. 

I'm buying small SaaS companies at xo.capital. We've bought two developer tools and our growth is mostly driven by developers writing cool tutorials about our products.

I'd love to see if anyone here wants to write for us.

We'll pay $150 per post (+$50 extra for a short video) if it is approved.

https://airtable.com/shrN6S3NMZ7oxRXTt

Here's an example of the type of content we're looking for https://www.youtube.com/watch?v=PM6S27tCvio. The tutorial itself is very simple but practical.

Thanks!