teleren/devto huggingface dataset:
Restful API for Wordpress website about baseball
Published: 2022-09-24 08:46:20


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/muws4kvc51stoy8gb4o8.jpg)
Hi everyone,
I are developping a website in Wordpress framework. Everything is Ok until I need to build a API (Restful API) to get some data to another Website (asp.net)

See more details about: [What is a hold in baseball](https://baseballhub.net/what-is-a-hold-in-baseball/)?

However, I receiver Wordpress APIs are not similar to with ASP.NET and I didn't push data from my baseball site.

How to I Call Restfull API from Wordpress? 

Thank you so much
This week’s newsletter is out! (24-09-2022) - The Infiniti Book Club
Tags: javascript, tech, webdev
Published: 2022-09-24 08:36:01

---
title: This week’s newsletter is out! (24-09-2022) - The Infiniti Book Club
published: true
description: Another week of great javascript, tech and web development links.
tags: javascript, tech, webdev, discuss
---

The Infiniti Book Club

https://markjgsmith.substack.com/p/mark-smiths-newsletter-24-09-2022

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
[Typescript] Study TS with me (1) - basic type
Published: 2022-09-24 07:24:11

 평소 일하면서 Typescript를 쓰면서도, type/enum/interface 등 왜 저런 코드로 쓰는지를 생각하지 않고 그냥 사용한 적이 많았다. 이렇게 코드를 작성한 이유가 있겠지 하면서 이전 코드를 복붙하거나 의문을  가졌던 적이 별로 없다.
 
최근에 팀에 새로 합류한 분의 온보딩 스터디 프로젝트를 같이 리뷰하는 시간을 가졌는데, class 구현부터 Typescript를 적극적으로 사용한 걸 보면서 그 동안의 나를 반성하게 되었다.😂 

 다시 기초부터 차근차근 공부하면서, type 선언 정도로만 ts를 쓰는 수준이 아닌 ts의 장점을 제대로 활용하는 코드를 쓰고 싶어 이렇게 ts스터디를 시작하게 되었다.

##### String Literal Types
- 문자열 자체를 type으로 선언해서 사용

```typescript
type All = 'all';

let selectAll: All = 'all';
selectAll = 'other'; //error
```

##### Union Types
- 2개 이상의 선언된 type을 사용할 수 있음

Union Type은 평소에 익숙하게 사용중이다. 보통 여러개 string type을 가질 때 사용했다. 아래 예제처럼 서로 다른 type들도 Union Type으로 선언해 사용할 수 있다는 걸 알았다.

```typescript
type Id = number | string;

function printId(id: Id) {
 if (typeof id === "string") {
    console.log(id.toUpperCase());
 } else {
    console.log(id);
 }
}
```

##### Discriminated Union Types
- 각각 다른 Type별로 동일한 property 이름을 가지고 있음
- 해당 property로 Type별로 구분이 가능함

```typescript
 type Circle = {
  kind: 'circle',
  radius: number
 }

 type Square = {
  kind: 'square',
  x: number
 }

 type Triangle = {
  kind: 'triangle',
  x: number,
  y: number
 }

 type Shape = Circle | Square | Triangle;
 
 function area(s: Shape) {
  if (s.kind === "circle") { // discriminate type
    return Math.PI * s.radius * s.radius;
  } else if (s.kind === "square") { // discriminate type
    return s.x * s.x;
  } else {
    return (s.x * s.y) / 2;
  }
 }
```

##### Enum Types
- 여러개의 상수를 하나의 type으로 묶어 관리할 수 있음.

```typescript
enum Direction {
  Up = 1, // 시작하는 숫자를 할당해 줄 수 있음(default는 0) 
  Down,
  Left,
  Right,
}
```

구글링 하다보니, Enum typ은 안정성이 떨어진다는 얘기가 꽤 많았다.

[이유]
1. transfile 되면서, bundler(rollup)에서 TreeShaking을 할 수 없음. 
[관련 링크](https://engineering.linecorp.com/ko/blog/typescript-enum-tree-shaking/)
`Tree-Shaking`, `const enum` 등 설명할 개념이 많아서 이건 다음편으로..

2. number일 경우, type이 보장되지 않음
```typescript
 type enum DAYS = {
  Mon,
  Tue,
  Wed,
  Thur,
  Fri,
  Sat,
  Sun
 }
 
 let day = DAYS.Mon;
 day = DAYS.Wed;
 day = 10; // error지만 compile시 error가 발생하지 않음!(= type이 보장되지 않는다)
```

Enum type은 Union Type으로 대체 가능하기 때문에 Union Type을 사용하는 것이 권장되는 분위기 였다.

 하지만 팀의 개발 환경이나 가독성 측면에서 Enum을 사용하는 것이 더 나을 때도 있으니 충분히 설명 가능한 이유가 있다면 채택해서 사용해도 큰 문제는 없다는 글도 봤다. 

TMI:
 사실 우리 팀에서도 Enum Type을 꽤 사용중이다.😅😅 팀에서 굉장히 논리적인 이유로 뭐든 것을 설명하시는 시니어 개발자 분이 계신데, 다음에 출근해서 물어봐야겠다. (엄청난 합리적인 이유가 있을 것으로 예상되는...)
🗓 If you missed the news, Luos will be attending the NuttX conference today at 7 PM GMT.
Tags: opensource, microservices, nuttx, luos
Published: 2022-09-24 08:29:30

🗓 If you missed the news, Luos will be attending the NuttX conference today at 7 PM GMT.

⏩ https://nuttx.events/

🎥 A youtube link will soon be available on their website.
Nicolas Rabault will present what the Luos engine is technically with these features, how Luos and NuttX share the same vision, our upcoming projects connecting the Luos technology with NuttX and our latest news.

Thanks to Alan Carvalho de Assis for the invitation and for his confidence, see you in few hours! 🙂

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/swgl4738nwmrdz0uhped.png)
Go struct to SQL web tool.
Tags: go, sql, database
Published: 2022-09-24 08:26:34

A tool to convert your Go struct into a CREATE TABLE query, with the specified fields as column names. It also has a feature to specify the column type of a Go field type.

[https://cheikhshift.github.io/struct-to-sql/](https://cheikhshift.github.io/struct-to-sql/)
JavaScript Scopes Explained
Tags: javascript, webdev, beginners, programming
Published: 2022-09-24 08:12:00

## What is a scope anyway?

Fortunately defining what scope isn't super complicated to explain. A scope just refers to how variables can be seen or accessed from within your code/program.
 Scopes in JavaScript have three levels:

- Global
- Local
- Block

## 1. Global Scope

All variables that are declared outside of functions are considered to have a global scope. This means they can be accessed anywhere by all functions within your program.

## 2. Local Scope

If a variable is declared within a function then that variable is considered to have a local scope. That variable only exists within that function and only sub-functions have access to it.

Let's take a look at some examples:

```JavaScript
var myName = "Sheldon";

console.log(myName);
```
Since myName is a global variable this should work just fine and print "Sheldon" on the console.

Let's look at another one:

```JavaScript
function printMiddleName(){

    var middleName = "Lee";

}

console.log(middleName)
```
Now if you tried running this piece of code you would run into an error: _"Uncaught ReferenceError: middleName is not defined"_. Because middleName is defined inside a function we have to ask the function to print out or return the name for us like this:

```JavaScript
function printMiddleName(){

    var middleName = "Lee";

    return middleName;
}

console.log(printMiddleName());
```
And this piece of code should run just fine.

Just keep in mind if you had nested functions (A function inside a function) and you tried accessing a variable from within a sub-function you would get that same error from before.

```JavaScript
var myName = "Sheldon"

function printMiddleName(){

    var middleName = "Lee";

    function printLastName(){

        var lastName = "Cooper";

    }

    console.log(myName,middleName,lastName)
}

printMiddleName()
```
This code above just wouldn't work because we're trying to access a local variable where it doesn't exist.

```JavaScript
var myName = "Sheldon"

function printMiddleName(){

    var middleName = "Lee";

    function printLastName(){

        var lastName = "Cooper";

        return lastName
    }

    console.log(myName,middleName,printLastName())
}

printMiddleName()
```
This should work fine and print out "Sheldon Lee Cooper".

## 3. Block Scope
The block is pretty new and wasn't really a thing until ES6 (2015). Variables declared within curly brackets get the block scope. The only keywords that can have a block scope are the _let_ and _const_. 

```JavaScript
{
  var name = "Sheldon";
  let middleName = "Lee";
  const lastName = "Cooper";
}

console.log(name); ✔ //this will print out "Sheldon"
console.log(middleName);❌  //will throw an error
console.log(lastName); ❌ //will also throw an error
```
Variables with a block scope can't be accessed outside their block.

## Conclusion

I hope you liked and found this blog useful. If there is any missing or inaccurate information I would really appreciate your feedback. Thanks for reading till the end.
DAY 4: Print in order
Tags: java, beginners, programming
Published: 2022-09-24 08:09:17

Hey! It's day 4 of I4G 10 days of coding challenge. Today's task was to implement a code that prints in order.

**Thought process:** 

- **Understanding of problem:** My first approach in solving this challenge was to understand the problem. Understanding of the problem paved way for me to brainstorm on possible solutions. The way an operating system schedules a thread varies; we cannot predict the order in which the thread can be executed. The task here is to modify a code such that the first thread is always executed first, the second executed second and so on.

- **Solution:** To achieve this, I utilized one of the Java classes called Semaphore. Semaphore helps to restrict the number of threads that can access some (physical or logical) resource. The Semaphore class maintains a set of permits. It utilizes the acquire() method to block further executions until a permit is available. It uses the release() method to give a permit, thus releasing a potentially blocking acquirer. 

- **Algorithm:**

1. Create two instances of the Semaphore class: semaphore1 and semaphore2
2. Add semaphore1.release() to the end of the first thread
3. Add semaphore1.acquire() to the beginning of the second thread
4. Add semaphore2.release() to the end of the second thread
5. Add semaphore2.acquire() to the beginning of the third thread


Check out the full java code here: Print in Order - LeetCode https://leetcode.com/problems/print-in-order/submissions/
Today's Daily Dose of Programming Humor
Tags: jokes, dailydeveloperjokes
Published: 2022-09-24 08:00:02

---
title: "Today's Daily Dose of Programming Humor"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258dc381cf.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ How do programming shepherds count their flock?

___A:___ With lambda functions
 -->
5 features that an IP geolocation API for business must have
Tags: api, geolocation, business
Published: 2022-09-24 07:27:49

## 5 features that an IP geolocation API for business must have

IP geolocation APIs have grown in popularity among companies in recent years. There are many advantages to being able to track an IP address location, including increased security and fraud protection. There are a few essential features you should look for when selecting an IP geolocation API for business.

These are the top 5 requirements:

API must be accurate and consistent.

For businesses, an accurate IP geolocation API is crucial. Businesses can customize their content and target their marketing campaigns to particular geographic areas by determining the location of an IP address. Businesses will be able to increase the reach of their campaigns and improve connections with potential customers with the help of an accurate IP geolocation API.

## API should have a high success rate

If you're in business, then you know that one of the most important aspects is location. Whether you're targeting a specific region or trying to reach a global audience, understanding where your users are located is key. That's why an [IP geolocation API](https://ipstack.com/) can be so valuable for businesses. By providing accurate location data for IP addresses, businesses can more effectively target their marketing and advertising efforts. And when it comes to choosing an IP geolocation API, it's important to choose one with a high success rate. Otherwise, you may end up with incomplete or inaccurate data.
React Default Export Vs Named Export? #Beginners
Tags: react, javascript, beginners, tutorial
Published: 2022-09-24 07:19:35

We have our component file.
When we export it like below.
```javascript
//MyFunc.js file 
const MyFunc = () => <h1>Default Export<h1/>
export default MyFunc;
```
Than we can import that component with different name like belwo.

```javascript
import MyChoiceOfName from "./MyFunc"
//so we can use 
<MyChoiceOfName /> //here.
```
But when we don't use export default and directly export our component as below.
```javascript
//NameExpo.js file 
export const NameExpo = () => <h1>Named Export<h1/>
//As we did not specify name here and so it has to take some name to export, so it will take componenet name.
```
And while importing it we must need to import using it's name.\
```javascript
import NameExpo from "./NameExpo" //Notice here we have both file and delcared name same i.e. NameExpo
//so we can use 
<NameExpo /> //here.
```

**What if you want to export multiple components from one single** `.js` **file?**

It is possible using `Named export`.
```javascript
//NameExpo.js file 
export const MyNameExpo1 = () => <h1>Named Export 1<h1/>
export const MyNameExpo2 = () => <h1>Named Export 2<h1/>
export const MyNameExpo3 = () => <h1>Named Export 3<h1/>
```
And in importing
```javascript
import MyNameExpo1 from "./NameExpo" 
import MyNameExpo2 from "./NameExpo" 
import MyNameExpo3 from "./NameExpo" 
//so we can use 
<MyNameExpo1 /> //here.
<MyNameExpo2 /> //here.
<MyNameExpo3 /> //here.
```
Name is the Leftmost Part of Semver
Tags: semver
Published: 2022-09-24 19:02:34

---
title: Name is the Leftmost Part of Semver
published: true
date: 2022-09-24 07:18:22 UTC
tags: semver
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*g_R-P0Fg9yBgLQKl1d0gTw.png)

Sorry, this is a bit of a rant. My preferred routing library for React has been [Raviger](https://kyeotic.github.io/raviger/) for a while but recently I needed to figure out how the most recent version of React Router works. It turns out that there are plenty of answers on StackOverflow and elsewhere that explain how to do things, many for outdated versions of the API.

I know that the React Router developers have taken flak for changing things throughout the years and I don’t mean to single them out. They have created great value for the community which I have capitalized on for free. I am grateful and they owe me absolutely nothing.

The small point I want to make, though, is this: if you are changing your API so much that it’s not just a “major breaking change”, but rather a complete redesign, consider changing the name of your library rather than just the version. For ecosystem related reasons as well as pedantic ones.
A phone number verification API: what is it?
Tags: api, verify, number
Published: 2022-09-24 07:08:48

## A phone number verification API: what is it?

As the name implies, phone confirmation APIs are used to verify contact information. Phone numbers are checked for validity and continued use by verification APIs and services (i.e., they exist). They can also be used to identify geographic data and standardize phone numbers for regulatory purposes. The phrase [phone verification API](https://numverify.com/) is extremely broad.

Since a lot of APIs are web-based, they cannot be downloaded. They must be programmed into your website, databases, or some other program, though. Although this might at first seem intimidating, Quick Start Guides are available and make the process as simple as possible. Additionally, internet-based, adaptable APIs are preferred because they can be tailored to a business's unique advertising and promotion objectives.

## Process of Number Verification 

The first step in verifying a phone number is integrating your chosen verification API. Make sure that each company has undergone a thorough investigation to determine whether or not their API can meet your needs. Scalability and cost are two of the most important factors. Will the API be cost-effective and able to handle both current and upcoming validation requirements?

After you've chosen and incorporated a reliable phone verification API, submit your phone numbers via address books. These databases will be checked by the API for valid and functional phone numbers.
You can remove faulty and out-of-date numbers from existing contact lists by using the API, which will inform you which numbers will work and which won't. Your advertising's effectiveness increases as a result, and you have more choices.
Beginner Thought about JavaScript
Published: 2022-09-24 06:57:43

When I started web development, i thought javascript is too much hard to learn. And yeah, its gave me goosbumps. If you watch tutorial for the first time on youtube about js, they will say yeah javascript is actually hard. But i say, no, its not that much hard you think.

JavaScript is a language, just treat it like you are learning new native language to talk with computer or browser. Sounds good? lets have more

As i said, most of the beginners thought javascript is the most hardest language to learn. Its common, yeah when i started development i also thought its hard, even when i began writing code i thought no, its not for me, but suddenly i realise why not to learn like we learn our native language? It doesn't matter if its  Arabic, Hindi, Bangla language. If you are able to lean Chinese or Korean, I also know Korean language lmao. Then why you cant learn javascript? I always treat js like its an language and i badly need js for web development. And yeah you can't start web development without js, Make sense.

You learn A B C D, in programming you learn variable, boolean, condition that's it!

My learning process are totally different from other and I learn fast by following this. You should make your own way to learn anything faster. And obviously, it doesn't mean just learn and learn, After few week you forgot everything you learned, That's make no sense.

```javascript
console.log("When you know better you do better.")
```


If you are able to find your **ACTUAL** thought or what are you thinking about you worry, only then, you can solve your problem otherwise no one can't help you.

Don't make complicated, Make it's easier,  Give your best. And it's really FUN to code!
How React serves?
Tags: react, javascript, beginners, tutorial
Published: 2022-09-24 06:47:43

When you do.
```javascript
npm start
```
`index.html` will be served in web browser.

Now, `index.html` contains root dom node and as it served the control goes to it's javascript file which is `index.js`.

Now, the `index.js` having below rander function.

```javascript
ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);
```
As you can see above `<App />` is rendered.

Now, `<App />` component exported from `App.js` file.

So, this how we do changes in `App.js` and it reflects on web browser.
Show your last saved MEME
Tags: memes, funny, webdev, programming
Published: 2022-09-24 06:20:41

Meme: 01 sub: devvsakib
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fn1m1dnmiidzhwurarev.jpg)

Let's drop the meme you saved. I will add your meme up here!
Become a freelance software developer
Tags: beginners, tutorial
Published: 2022-09-24 06:15:37

Once you've spent some time with [Aista Magic Cloud](https://aista.com) the way I show in [the following article](https://aista.com/blog/become-a-professional-software-developer-in-20-minutes/), you’ll need to hunt down jobs. The way you need to approach this is by registering at sites such as [Fiverr](https://www.fiverr.com/) or [FreeLancer](https://www.freelancer.com/). There are hundreds of similar sites out there, but you should choose one or two and spend most of your energy polishing your profile at your selected sites. In addition you should be actively using [LinkedIn](https://linkedin.com/) to chase potential clients.

Think about your profiles on all sites such as the above as _“your brand”_, and that you need to _“sell the belief in that you can do the job”_. Make sure you use photos that are of an optimistic character, where you’re smiling, or somehow creates confidence in that you can deliver whatever job some clients in North America or Europe might be looking to have you deliver. You’ll need to “sell yourself” at these sites. If you can, take profile photos of yourself wearing a suit, or a nice dress, where you look professional. Make sure you use a nice background. Worst case scenario you can put on nice clothes and go find a hotel lobby and take a photo. The idea is to create confidence in that you’re a professional, and that you can deliver whatever the client needs.

When you find a client, and it’s time to communicate with the client, try to use [Google Meet](https://meet.google.com/). The reason is that Google Meet allows you to manipulate your background using “green screen techniques”. This allows you to hide your background, making the client focus on you, and not whatever is behind you in your room. As you are meeting with the client, make sure you use a close headset, and that you have a silent environment. This is important for the client to build trust in you. Sit straight up, have your laptop on a table, and make sure your back is straight. If you’re laying down while you talk to the client you might as well be telling him

> I don’t like to work, I just want to get paid for sleeping

If you’re doing this with friends, you can practice on each other, and create “mock meetings” where you get to watch each other and practice meetings. Remember, the objective of everything you do is to make the client believe that you can **fix his problems**.
Let's try Asciinema
Tags: tooling, dev, opensource, bash
Published: 2022-09-24 05:48:23

## Why Asciinema ?

[Asciinema](https://asciinema.org/) is a very simple tool to record a terminal session, this could be useful to write an article or during a technical presentation, let's see how it works.

## Installation

```bash
brew install asciinema

asciinema -h
# to see the available commands
```

If you have the same problem than me, it will ask you to configure the locale, this can be fixed by this line in your .bashrc :
```bash
alias asciinema='LC_ALL=en_US.UTF-8 asciinema'
```

## Usage

```bash
asciinema rec
<< type the commands you want to record >>
```
Then, simply type "Ctrl-d" to exit and "Enter" to save the file on https://asciinema.org/,  
you just have to type your email to have a free account.

There are several ways for integration :

![asciinema share](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ismp2ncjhc5fliv3htp.png)

I took the Embed image link option, for markdown,  
you can hit "Make public" to allow public access : 
[![asciicast](https://asciinema.org/a/k8QSlFUL3lZU7RiUWEFA5MWcx.svg)](https://asciinema.org/a/k8QSlFUL3lZU7RiUWEFA5MWcx)

This is a link to access to the player, that allows to go forward or backward in the presentation, and to make copy/paste !

# My feedback

Unfortunately if you want to have the player directly in the webpage, you have to make some html/css/js configuration on your page (so it's not possible on dev.to for instance, unless it's integrated, perhaps in the future).

There is also the tool [asciicast2gif](https://github.com/asciinema/asciicast2gif) that allows to export to a gif file, so it can be integrated anywhere, but I don't think it's convenient, because you don't have the player, it's just a loop, and it takes time to process.

The link option is still a great option because it's easy to use, and can be integrated in any html or markdown document (directly in Dev.to or Google Slides for instance).

Asciinema works well, is pretty fast and can be used for some demos you want to do on terminal, feel free to try it too !