teleren/devto huggingface dataset:
Add JSON LD schema with NextJS in these 2 steps.
Tags: nextjs, javascript
Published: 2022-02-14 11:55:35

We recently upgraded the NextJS version for our CMS portal at [Storeplum](https://storeplum.in) and decided to add structured data for each page. 

Found a npm library but it was kind of outdated. After a lot of searching, I found that the solution was fairly straightforward. 

All I did was added the schema definition into a script tag as below-


1. Get your schema definition - 

```
let schema = {
  "@context": "https://schema.org",
  "@type": "Article",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "example.com/articleURL"
  },
  "headline": "Article title",
  "image": [
    spContent.metaData.twitterCard
   ],
  "datePublished": spContent.created_at,
  "dateModified": spContent.metaData.articleModifiedTime,
  "author": [{
      "@type": "Person",
      "name": "Json Bourne",
      "url": "example.com/jbourne"
    }],
  "publisher": {
      "@type": "Organization",
      "name": "abc",
      "logo": {
        "@type": "ImageObject",
        "url": "example.com/image"
      }
    },
  "description": "some description"
  
};
```

2. Put your data string inside a script tag as below

```
 <script 
            type='application/ld+json'
            dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }} />
```

That's all! You can verify your changes once you deploy using [this](https://search.google.com/test/rich-results) tool by Google.
NestJS Repository DI using @InjectRepository is not working properly
Tags: typescript, nestjs, beginners, codenewbie
Published: 2022-02-14 11:45:00

NestJS 의 Service 에서는 다음과 같이 레포지토리를 연결한다.
```typescript
constructor(
	@InjectRepository(UserRepository)
	private userRepository: UserRepository
	...
	) {}
```

NestJS 공식 도큐먼트에서는 위와같이 사용하는것을 권장하는 듯 하다만,

이렇게 개발하던 도중..

갑자기 `TypeOrm` 에서 기존까지 잘 작업이 되다가 갑자기 띄운 500 에러와 함께 콘솔에 다음과 같은 오류를 띄웠다
> Typeorm Cannot read property 'findOne' of undefined

처음엔 `TypeOrm` 의 설정부분에서 .env 파일의 비동기화 문제로 모듈이나 레포지토리가 `undefined` 일 수 있다고 생각하여 콘솔로 찍어 보았지만, 해당 메소드 (`.findOne`) 와 모듈, 레포지토리는 정상적으로 존재했다.

다음엔 `TypeOrm` 모듈이 문제일 수 있다고 판단하여 `node_modules` 를 싹 지우고 다시 `npm install` 을 해보았지만 증상은 그대로였다.

Stack-Overflow 에 검색 해본 결과 다음과 같은 해결책을 제시받았다.

```typescript

private repository: Repository
constructor(private readonly connection: Connection) {
  this.repository = this.connection.getCustomRepository(Repository);

}
```

데코레이터 `@InjectRepository` 를 사용하지 않고
자바와 같이 private 멤버로 명시적으로 선언하고 생성자에서 직접적으로 인스턴스를 넣어주는 방식을 사용하는 것이다.

적용해 본 결과성공적으로 동작하였다.

이유를 찾아보려고 했지만 쉽지 않아 먼저 스스로 시도했던 방법과 해결책만 간단히 적어둔다.
Get Docker Running Without the Desktop
Tags: docker, sitecore
Published: 2022-02-14 11:38:19

As many of you may know, and I'm sure you find out if you go to download it, Docker Desktop is no longer free. While I don't think they have a mechanism to check these things, technically if you're on a bigger team or your company earns a good chunk in revenue, you're supposed to pay for it now. And a Docker account does get you some benefits. 

But...it's one of those "carpet pulled from under your feet" things, isn't it? Kind of like when Oracle said you had to start paying for JDK, and all us Sitecore developers were using it for Solr, and were like "uh, what?!?" Of course, now everyone knows how to use OpenJDK, and Sitecore even baked that into its setup scripts. So, similar principle.

Fortunately, it's only a few things needed to get Docker running "in the wild" so to speak. Fire up your trusty Powershell prompt and start here:

`choco install docker-engine docker-compose docker-cli
choco install Containers Microsoft-Hyper-V --source windowsfeatures`

This gets the basics of Docker installed for you, including the engine and command structure. Also, for Sitecore folks, it gets Hyper-V installed and ready for Windows containers.

The next bit you may not have to do, but I definitely did. When I tried to fire up my docker-compose process after removing Docker Desktop and using the commands above, I got errors in my solution build trying to hit the Nuget site. The fix is to update the `C:\ProgramData\docker\config\daemon.json` file (which you could do in the settings in Docker Desktop). Our version that worked is as follows (your mileage may vary on this one):

```
{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": false,
  "experimental": false,
  "dns": [
    "10.1.2.3",
    "8.8.8.8"
  ],
  "features": {
    "buildkit": false
  },
  "builder": {
    "gc": {
      "enabled": true,
      "defaultKeepStorage": "20GB"
    }
  }
}

```

Finally, you need to start the Docker Engine service; it was installed above but not started. Again, Powershell, and run this command:

`start-service -displayname "Docker Engine"`

The other nice thing Docker Desktop provided was monitoring of your containers and images, as well as quick access to logs and a terminal prompt. Well, there's another tool that can do that for you...Visual Studio. I believe the "classic" Visual Studio has it, but I use VS Code for this one. If it isn't already installed, check your extensions for the Docker and Docker Explorer ones at the vary least. Once you do this, you'll have a sidebar item for Docker that will give you access to everything you need. The one catch is you may need to either run VS Code as an administrator, or set up your Docker Engine service to run as an administrator. I chose the first option myself, but do what works for you (subject to your company policy of course!).
Application De Contrôle Parental Du Détecteur De Mensonges
Tags: android, ios
Published: 2022-02-14 11:34:08


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xd0zqxpy4ty4e5bpkvye.jpg)
Vos enfants ont commencé à mentir à propos de petites choses ? Ne vous sont-ils pas fidèles depuis longtemps ? Ne t'inquiète pas! Utilisez Spymaster Pro, une [application de contrôle des parents avec détecteur de mensonges](https://www.spymasterpro.com/fr/blog/une-application-detecteur-de-mensonges-pour-les-parents/), pour découvrir la cause première de vos enfants qui mentent. Pour plus de détails, consultez ce billet de blog dès maintenant.
Introduction to JavaScript
Published: 2022-02-14 06:48:11

 
> Now we jumpin to new style of coding easily,fast and awesome stuffs. I know most companies and big organization are in the transition to adopt what's trending, fast and secure. Well i may weird by now ! but after this, you would wish  to stay for more blogs like this.
> Even when you are new to the world of codes, you still have a big opportunity to understand what's going. Hey!!!, i forgot to tell this, am from testing Google's fastest engine, i don't mean a car engine **NO**, guess what, its V8.
i created a function that takes one argument (of type int) and returns a fibonacci number in that index forexample
```
fibonacci(5);
 ```
it does the count from 1,2,3,5,8 and returns 8 because is in position 5. It returned it in 0 seconds.
	Now here is the crazy thing i did, 
```
   fibonacci(1000000000);
```
It thought Google's V8 will spend some good times to complete the task, but i was surprised when i returned the result (Infinity) in just **1.614 minutes**. Yet i wrote the very code in Python but i only heard heat from my laptop, fans doubles the noise, it took Python over 10 minutes without returning the results till it cancelled the action.
	Well don't mind more to the above boring story, the good news are JS,
and in full in Just Stupid, Ooohh  Ooooh nooo !!! its [JavaScript](https://www.javascript.com/)
Meet new versions of dotConnect for MySQL, dotConnect for PostgreSQL and dotConnect for Oracle with significant improvements
Tags: dotconnect
Published: 2022-02-14 11:29:31

---
title: Meet new versions of dotConnect for MySQL, dotConnect for PostgreSQL and dotConnect for Oracle with significant improvements 
published: true
description: Devart announced an updated version of dotConnect data providers with Entity Framework Core support. 
tags: dotconnect
//cover_image: https://direct_url_to_image.jpg
---
Devart, a recognized vendor of world-class data connectivity solutions for various data connection technologies and frameworks, rolled out a new release of [dotConnect for MySQL 8.21](https://www.devart.com/dotconnect/mysql/?utm_source=devto&utm_medium=referral&utm_campaign=pr_dotconnect_14.02.2022), [dotConnect for PostgreSQL 7.24](https://www.devart.com/dotconnect/postgresql/?utm_source=devto&utm_medium=referral&utm_campaign=pr_dotconnect_14.02.2022), and [dotConnect for Oracle 9.16](https://www.devart.com/dotconnect/oracle/?utm_source=devto&utm_medium=referral&utm_campaign=pr_dotconnect_14.02.2022) that support new data types and the other important improvements. 

**The release includes the following enhancements:**
1. For Entity Framework Core 3, 5, and 6, dotConnect for MySQL and dotConnect for Oracle support mapping the internet/intranet System.Uri type to Oracle string data types.
2. For Entity Framework Core 5 and 6, dotConnect for MySQL and dotConnect for Oracle support IPAddress and PhysicalAddress data type mapping.
3. dotConnect for MySQL and dotConnect for Oracle support EF Core LINQ to Entities Improvements.
4. Better support is available for working with data stored in the MySQL JSON data type. 
5. EF Core Spatial Data Mapping and EF Core Spatial Data Queries are available for dotConnect for Oracle. 
6. Load Balancing Support is available for dotConnect for PostgreSQL. 
7. dotConnect for PostgreSQL supports Keep Connected Parameter. 
8. dotConnect for PostgreSQL now includes new assemblies for Entity Framework 5, compiled with .NET Framework 4.7. 

**dotConnect** is an enhanced data connectivity solution built over ADO.NET architecture and a development framework with many innovative technologies. dotConnect includes high-performance data providers for the major databases and popular cloud applications and offers a complete solution for developing data-related applications and websites.

**About Devart** 
 
Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration, and backup solutions. The company also implements Web and Mobile development projects. 
For additional information about Devart, visit https://www.devart.com/.
Copying your http request from browser into Postman
Tags: api, postman
Published: 2022-02-14 11:28:45

Postman is a great tool for examining API calls. 

Here is a quick way to get that call you want from your browser into Postman.

#Copy it from Chrome

Open up the Developer Tools (Ctrl-I), go to the Network tab. Find the call you want. Right click and select Copy as cURL

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rma4xogqrd9lmfweihop.png)

#Import it into Postman

Inside Postman, open up File / Import (or Ctrl+O). 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qb5wojudgcdi69g92aa.png)
 
Paste it into the raw text tab and press Continue

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/755foc7sbb8qw2rrrjd9.png)
 
Once it's in Postman, you can now examine, manipulate, re-send the request as you wish.
Introduction to Modern Python
Published: 2022-02-14 08:43:58

Python is a very popular high level language that is used in many areas including data science, software engineering, web and other applications. 
Python is not difficult to understand as it is not a low level language. Its simplicity makes it highly preferred. It is also open source so anyone interested can use it without having to pay for it. It can also be altered and have snippets of other languages without problems created. Its libraries are also easily accessible.
Especially to beginners, Python is a great problem-solving tool. Once you identify a problem, you can break it down and objectify it then have python code that will solve the problem identified. With the features of the language, code is easily readable and understandable so with intent, focus and proper searches, understanding comes easy.
The language has been around for over 30 years and there have been constant improvements to it to better it. It uses English keywords so if one is familiar with the language they have great benefit. It is a language I would definitely recommend one with interest to delve into.
Why router is used in internet infrastructure?

Tags: http, webdev, networking
Published: 2022-02-14 10:52:58

Let suppose you want to connect two computers, you will need 1 cable and one plug on each computer. Easy right?

But now you want to connect ten computers instead of just two, to do that you will need 45 cables and 9 plugs on each computer. That's too much right?

To build the internet infrastructure we will have to connect hundreds of thousands of computers, and I don't even want to do math for that.

So the solution to this problem is to connect all the computers to 1 central device. In that way to connect ten devices we will need only nine cables instead of 45 with just one plug per computer and the central device with nine plugs.

The central device is known as Router.

There is one more very important job of router, which is to send the various data packets(smaller fragments of a message or file to be sent from one device to another) to their correct destination.
Matplotlib Basic Plots.
Tags: python, beginners, matplotlib
Published: 2022-02-14 10:48:55

Having some understanding of Matplotlib from [this post](https://dev.to/wanguiwaweru/matplotlib-basics-1aao), we can delve deeper into other features that the library has to offer.

**1.Scatter Plot**
Scatter plots represent values in dots where each dot represents a data point.
We use the scatter() method to create scatterplots.

![Scatter Plot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1sersom5bc9q0mjul58p.png)
Scatterplots are useful in clustering and categorizing data into different groups.
The plots also show they how the data is distributed and how they cluster close together.

**2.Line Plot**
The plot connects data points. We use the plot() method to plot line plots.


![Line Plots](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rx6j9kg99plt0lwne8sh.png)

Line charts are useful in examining patterns of a dependent variable over time.

**3.Histogram**
Histograms represent data using bars of different heights.
We create histograms using the hist() method.
A histogram has a title, X-axis, Y-axis and the bars. 
The x-axis shows the intervals represented in the plot. The intervals are also known as bins. 
The y-axis shows the frequency of each interval in the x-axis.
The bars show the number of times values in an interval appear in the data.

![Histogram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xs946tvs83ejy5ltupe8.png)
Histograms are useful in showing the general distribution of features of a dataset.

**4.Bar Plots**
Bar plots are used to represent data with categorical variables.
They can be vertical or horizontal.
We use the bar() method to create vertical bar plots and pass the categorical variables, and specify the color as the arguments.

![Vertical plot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn90rzt13i7px16gf7ik.png)
We use the barh() method to create horizontal bar plots. We pass the categorical variables as the arguments.

![Horizontal plot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h0mpisdqz71dp14gi0gr.png)
**5.Pie Charts**
Pie charts are circular graphs divided into slices that represent numerical portions.
We use the pie() method to create pie charts.
We pass the piece sizes, labels, colors and autopct which controls how the labels are displayed in the wedges as the parameters.

![Pie chart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/irw2los15g12nuftl02f.png)
Pie charts are useful in displaying categorical data.

We can now use these plots for data visualization.
Agent-Based Modeling with NetLogo
Tags: netlogo, modeling
Published: 2022-02-14 10:46:53

Agent-based modeling (ABM) is a bottom-up simulation technique where a system is analyzed by its individual elements that interact with each other. These elements, called agents are identified and given a behavior, such as humans and viruses, trees and spreading fires, etc. ABM is a common approach to studying complex biological and social phenomena.

Earliest example of ABM dates back to the 1940s, with John von Neumann's universal constructor. This non-computerized model described a cellular printer that could print itself with the printing instructions in its own cells. Later on in 1970, John Conway invented The Game of Life. This game is "played" by configuring a grid of cells with rules of interaction and observing after the game is started. Fast forward to 2022 and there are over a dozen ABM softwares. I went with NetLogo, as it is user friendly and quick to work with.

Tutorials: http://ccl.northwestern.edu/netlogo/bind/ 

 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k9xylocsixqbty0qe8w0.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5a5h1uuxcpfn20vc1nvv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vnd818rn72bh1eq54hkn.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8s0t0yty3cwbfahdn157.png)

Sources
https://en.wikipedia.org/wiki/Comparison_of_agent-based_modeling_software

https://towardsdatascience.com/intro-to-agent-based-modeling-3eea6a070b72

http://ccl.northwestern.edu/netlogo/docs/
The Code
Published: 2022-02-14 10:42:16


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vrgmwa3v2qnzta2ch3y7.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9v4asc7ye9j0ufq0ojs2.png)



My first react js project
How to solve fu***** cors?
Tags: cors, react, javascript
Published: 2022-02-14 10:29:49

I will document how to solve cors in a few steps.

Imagine you have an api where you want to POST or GET things but when you post or get something you receive a CORS error policy, if you want a deep understanding of cors i will leave this [link](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).

Imagine you have an api at localhost:9000 and all the different routes related to it.

We will have to create a proxy

```
mkdir proxy
cd proxy
npm init -y
npm i express
npm i http-proxy-middleware nodemon --save-dev
touch index.js
```
Now that we have installed our dependencies we can go to the code.

Inside package.json add the following

```
 "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon index.js"
  },
```

Now inside index.js we add the following code

```
const express = require('express');
const app = express()
const { createProxyMiddleware } = require('http-proxy-middleware');

app.use('/', createProxyMiddleware({target: 'http://localhost:9000', changeOrigin:true}))

app.listen(5000)
```

This way we will be able to make request to the url localhost:5000 and since it is a proxy we will be able to make request to the routes that the original route has for instance the main route is localhost:9000/api/users, but now in order to not get cors policy we will have to make a call to localhost:5000/api/users and it should work just fine.

Thanks.
NextJs Over Plain React
Tags: javascript, nextjs, webdev, react
Published: 2022-02-14 10:24:18

Next.js is a framework created by Vercel ,an open-source based on Node js. Web technologies has came across server-side rendering using PHP then Client-side rendering using React and now back to its origin phase using Next js which provides the best of Both client-side and server-side rendering world.

## Why Next js?
React gave us the option for rendering your application on the client-side, but for that, It also requires more processing power on the client-side. Now to solve this Next js came into the scene which provides server-side rendering, static export, pre-rendering, and has many more nice features.

Next comes with its inbuilt page routing setup. which makes it more convenient to use. As if you want to create a page in react, you have to make a component and then add it to the router whereas in next you can simply add the page to the pages folder created by default for you.

## Launch of Next.js 12
Vercel has launched Next's new version Next.js 12, which comes with a lot of cool features like:

- Rust compiler: 3x faster refresh and 5x faster builds
- React 18 Support: Next js12 supports new API in React18 such as suspense.
- <Image/> component: auto resize and 20% smaller image size.
- React Server component

## Conclusion
Next js apps are fast, thanks to static sites and server-side rendering. It is well documented, tiny and easy to learn also development cost is low. On top of that Vercel provides a great environment for hosting your next apps on their platform which provides a lot of features especially for nextjs. so, with the growing front end tech space its a great choice to use best of both server & client side rendering using Next js.
A Simple PAYONE Integration in Golang
Tags: go, programming
Published: 2022-03-10 07:12:31

---
title: A Simple PAYONE Integration in Golang
published: true
date: 2022-02-14 10:20:00 UTC
tags: Go, programming
canonical_url: https://defer.cc/b/payone/
---

If you want to process payments with Payone, here is a simple package.

## How to use it [#](#how-to-use-it)

```
import "https://github.com/mnlwldr/payone"
```

## Usage [#](#usage)

```
response, err := sendRequest(parameters)
```

### Parameters [#](#parameters)

You can find the documentation for PAYONE [here](https://docs.payone.com/)

```go
parameters := url.Values{}
// classic payone accoint informations.
parameters.Set("aid", "")
parameters.Set("mid", "")
parameters.Set("portalid", "")
parameters.Set("key", "") // the key has to be hashed as md5
parameters.Set("mode", "test") // can be "live" for actual transactions
parameters.Set("api_version", "3.8")
parameters.Set("encoding", "UTF-8")
// payment type parameters
parameters.Set("clearingtype", "wlt")
parameters.Set("wallettype", "PPE")
parameters.Set("request", "authorization")
parameters.Set("narrative_text", "Just a test")
parameters.Set("reference", fmt.Sprintf("%d", rand.Intn(100)))
parameters.Set("currency", "EUR")
parameters.Set("amount", "1234") // in cent
parameters.Set("successurl", "https://example.com/success")
parameters.Set("errorurl", "https://example.com/error")
parameters.Set("backurl", "https://example.com/back")
// personal data. Not everything is mandatory
parameters.Set("salutation", "Frau")
parameters.Set("title", "")
parameters.Set("firstname", "Maraike")
parameters.Set("lastname", "Musterfrau")
parameters.Set("street", "Musterstrasse")
parameters.Set("zip", "12345")
parameters.Set("city", "Somewhere over the rainbow")
parameters.Set("country", "DE")
parameters.Set("email", "maraike.musterfrau@example.com")
parameters.Set("language", "de")
parameters.Set("gender", "f")
```

## Response [#](#response)

```
type Response struct {
   Status string
   TxId string
   UserId string
   RedirectUrl string
   Token string
}
```

[![Go Reference](https://pkg.go.dev/badge/github.com/mnlwldr/payone.svg)](https://pkg.go.dev/github.com/mnlwldr/payone)
How I Learned The Web Development And Made The Professional Websites.
Tags: webdev, web3, html, javascript
Published: 2022-02-14 10:19:51


I've been thinking long days about earn money through making Professional websites. After tons of research, I've got an awesome platform to learn. 

---

[Udemy](https://www.udemy.com/) is an awesome platform for self-learners. They've got plenty of various courses at low cost. The Complete 2022 Web Development Bootcamp(https://www.udemy.com/course/the-complete-web development-bootcamp/)" helped me to become a web developer. 

---

It's an incredible course to become a fully-fledged web developer. The course is taken in an easier way to understand the non-coding peoples. So there is no required programming knowledge to learn this course.

---

Anyone who has basic mathematical skills (like addition, subtraction, division, multiplication) can learn this course and become a professional web developer.