teleren/devto huggingface dataset:
Top 10 Trending Technologies to Learn in 2022
Tags: ai, blockchain, machinelearning
Published: 2021-12-28 08:12:44

##Top 10 Trending Technologies to Learn in 2022
In this blog we are going to see top 10 trending Technologies to learn in 2022. Top 10 trending and new technologies in 2022. If you like my post then follow me. Lets Start:-👇

[Top 10 Trending Technologies to Learn in 2022](https://codexashish.blogspot.com/2021/12/top-10-trending-technologies-to-learn.html)

[Top 10 Programming Languages You Must Know In 2022](https://codexashish.blogspot.com/2021/12/top-10-programming-languages-you-must.html)

[Machine Learning Complete Roadmap 2022](https://codexashish.blogspot.com/2021/12/complete-roadmap-of-machine-learning.html)

##Complete Roadmap 2022:-
[Python Complete Roadmap 2022](https://codexashish.blogspot.com/2021/12/complete-roadmap-of-python-programming.html)
[Machine Learning Complete Roadmap 2022](https://codexashish.blogspot.com/2021/12/complete-roadmap-of-machine-learning.html)
[C++ Complete Roadmap 2022](https://codexashish.blogspot.com/2021/12/complete-roadmap-of-c-programming.html)
[Java Complete Roadmap 2022](https://codexashish.blogspot.com/2021/12/java-complete-roadmap-2022.html)
[Data Structure Complete Roadmap 2022](https://codexashish.blogspot.com/2021/12/complete-roadmap-of-data-structure.html)


##Some Laravel Tutorial for developer:
[Laravel 8 Interview Questions and Answers in 2022 (Part #1)](https://codexashish.blogspot.com/2021/12/laravel-8-interview-questions-and.html)
[Laravel 8 Interview Questions and Answers in 2022 (Part #2)](https://codexashish.blogspot.com/2021/12/laravel-8-interview-questions-and_22.html)
[Advance Laravel 8 Interview Questions and Answers 2022](https://codexashish.blogspot.com/2021/12/advance-laravel-8-interview-questions.html)
[Everything About Laravel 8 Composer 2022 | Composer in Laravel 8](https://codexashish.blogspot.com/2021/12/everything-about-laravel-8-composer.html)
[Laravel Jetstream vs Laravel ui  vs Breeze](https://codexashish.blogspot.com/2021/12/laravel-jetstream-vs-laravel-ui-vs.html)

##Python Concept and Projects:-
[10 Best Python Libraries For Machine Learning](https://codexashish.blogspot.com/2021/12/10-best-python-libraries-for-machine.html)
[Alarm Clock in Python with GUI](https://codexashish.blogspot.com/2021/07/alarm-clock-in-python-with-gui.html)
[Tic Tac Toe Game Using Pygame in Python](https://codexashish.blogspot.com/2021/06/tic-tac-toe-game-using-pygame-in-python.html)

**Thankyou for reading my blogs.**
#####My Website:
[CodexAshish](https://codexashish.blogspot.com/)
What is API
Tags: webdev, programming
Published: 2021-12-28 08:02:04

## About API
API stands for “Application Programming Interface”. It is a set of functions. It allows applications to access data and interact with external software components, operating systems, or microservices. 
To simplify, an API  brings the user's response to the system and brings the system’s response to the user. When we click “commend” an API tells the site we commend on that post; the website puts the commend on the post, and our commend box is updated with that commend.

We may hear that “microservices” are related to API. These however, are not the same. Microservices divides functionality in a web application where API is the framework to interact with a web application. Microservices can actually use API to communicate between each other.  
A developer can make “call” or “request” through API in order to send or get information from the server. For this communication there is a programming language called “JSON”. There is a CRUD operation with API:

> POST – Create new data
> GET – Read data
> PUT –  Updates pieces of data
> DELETE – Deleting data
Python basic cheat sheets!
Tags: python, beginners, programming, tutorial
Published: 2021-12-28 08:01:32

hi guys I will give you a cheat sheet for python >:)

1> what is python?
python is an OOP(Object-Oriented-programming) language created by Guido Van Rossum, made in February 20, 1991.


2> info about Guido Van
Guido used to work in Google, he also helped create DropBox

3> basic functions
3.1> Hello World!
```python
#this is a comment
#all you have to do for printing hello world is this:
print("Hello World!")
```
3.2> Variables!
```python
x = "this is a variable!"
#to print the variable do this:
print(x)
```
also you can add the variables!
```python
a = 2
b = 3
#if you want you can do print(a+b)
#but to make it more comfortable you can do this:
print("2 + 3 is " a+b"!")
```
3.3> inputs!
```python
input("hi! ")
print("bye")
```
3.4> if
```
x = "hi!"
if x == "bye!": #the == is important!
   print()
```
3.5 (PROJECT) lets make a chatbot!
```python
name = input("hello! what is your name? ")
print("nice to meet you "name)
color = input("so, what is your favor of color? ")
if color == "green":
   print("mine's too!")
print("") #for some space
print(ok bye")
print("chatbot went offline")
```
4>loops
ok so there are two types of loops one is
```python
for()
```
and one  is while (my favourite)
```python
while()
```
4.1> for() is used for setting up numbers in order for example
```python
words= ["Apple", "Banana", "Car", "Dolphin" ]
for word in words:
    print (word)
```
4.2> while loops are used for making dangerous loops for example
```python
#be careful this is a very dangerous program
n = 0
while n <=5:
   print("the value of n is = " , n)
   n ** 1
```
ok so I couldnt make a whole cheat sheet but please tell in the comments what did I miss but for now like and unicorn this post :)
The main reason why I don't use Redux in my projects
Tags: javascript, react, webdev, redux
Published: 2021-12-28 07:32:26

The main reason why I don't use Redux in my projects

There are several reasons why not to use Redux.

And choose another more modern library like Recoil (see my comparison [here](https://dev.to/nitsancohen770/redux-vs-recoil-423a)).

But the main reason why I don't use Redux has nothing to do with Redux itself. For the same following explanation, I won't use Recoil as well.

I don't use Redux because I want my components to be decoupled from a third-party library.

What do I mean?

When I create a component with Bit, I know these components will be used in dozens or even hundreds of applications.

A component in Bit is independent - it is versioned and built independently and installed in your project like any other package using npm (for instance - `npm i @teambit/base-ui.input.button` also don't forget to configure your npm registry `npm config set '@teambit:registry' https://node.bit.dev`

I don't know what libraries the consumers of my components will want to use. Maybe they will want to use Recoil? Perhaps Redux? Or even the beloved Context!

That is why I have to abstract my components from any third-party library. That way, I enable everyone to use it with ease.

If I have to pass something from a distant parent, I use Context. Context is part of the React library, so I have no problem using it!

 I am sure my consumers will be using React since I am creating a React component.

I will show you how I create agnostic components in the next post. Meanwhile, try making your components and exporting them.

In the attached code block, you will find instructions on quickly starting your own lab to create and export independent components.

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

- For more posts like this [follow me on LinkedIn](https://www.linkedin.com/in/nitsan-cohen/)

- I work as frontend & content developer for [Bit](bit.dev) - a toolchain for component-driven development (Forget monolithic apps and distribute to component-driven software).
Batch generate YouTube playlist thumbnails with custom text using Python
Tags: python, pillow, posters, youtube
Published: 2021-12-28 07:27:58

---
title: Batch generate YouTube playlist thumbnails with custom text using Python
published: true
description: Batch generate posters with custom text
tags: #python #pillow #posters #youtube
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxtzq853ifqrnluns398.jpg
---

{% github vijjusri14/posterMark no-readme %}

Batch generate posters with custom text

Useful to generate YouTube playlist thumbnails

![Sample](https://raw.githubusercontent.com/vijjusri14/posterMark/main/Sample.png)

## Folder Structure

```
assets  
│
└─── fonts
│       Satisfy.ttf
│       ShadowIntoLight.ttf
│
└─── images
        poster.png
```

Place your TrueTypeFonts in the fonts directory and background images in the images directory

## Settings

Update *settings.json* to customize the output

```
{
    "OutputPath": "out",
	"ImagesPath": "./assets/images/",
	"BackgroundImage": "poster.png",
	"FontsPath": "./assets/fonts/",
	"Title": {
		"Font": "ShadowsIntoLight.ttf",
		"Size": 300,
		"Color": "(254, 27, 28)",
		"Position": "(100, 50)"
	},
	"Subtitle": {
		"Font": "Satisfy.ttf",
		"Size": 150,
		"Color": "(85, 30, 138)",
		"Position": "(100, 500)"
	}
}
```

You can also change the background image, title and subtitle fonts

The *color* is represented by (R, G, B) values and *position* by (X, Y)

The fonts used here are [Satisfy](https://fonts.google.com/specimen/Satisfy) and [ShadowsIntoLight](https://fonts.google.com/specimen/Shadows+Into+Light) from Google fonts

## Posters

Update *fileList.json* to specify the titles and subtitles for the posters

```
{
  "Sample": {
    "Title": "PosterMark",
    "Subtitle": "Batch generate posters with custom text"
  }
}
```
Key of the each json object will be the file name of the poster. Here in the above example, the file name will be *Sample.png*

## Usage 

Install [Python3](https://www.python.org/downloads/)

Clone [this](https://github.com/vijjusri14/posterMark) repository

Create a virtual environment(venv) in the cloned repository directory and activate the venv
```
python3 -m venv .\venv
```

Install pip packages
```
pip install -r .\requirements.txt
```

Update *settings.json* and *fileList.json* as required

Run python script
```
python posterMark.py
```
Trim in JavaScript
Tags: javascript, webdev, beginners, programming
Published: 2021-12-28 07:22:12


![trim method in javascript ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rolr7o1j5giu2l41z08z.jpg)

If you want to remove the extra space in your string data type, here is a simple way to do it in JavaScript.

Programming in JavaScript is easy once you know the language's in and out.

JavaScript offer String.trim() method.

trim() method removes the removes all whitespace from both ends of a string,
including tabs, spaces, no-break spaces, and line terminator characters.


**Example of Trim() method in JS:**

`const extraSpaceString = ' Hi This is shyam from cyberncode.com, Please visit cyberncode.com for more awesome blogs. ';
const trimString = extraSpaceString.trim();
console.log(trimString);`

Output: 
![trim in javascript output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1umhcm6qr8d325f65g0.png)

Also Read: [Make your own notepad app with different features in a minute using pure HTML](https://cyberncode.com/how-to-make-your-own-notepad-using-html-textarea/)
An OpenAI Gym docker that can render on Windows
Tags: openai, docker, python, tensorflow
Published: 2021-12-28 07:08:01

---
title: An OpenAI Gym docker that can render on Windows
published: true
description: An OpenAI Gym docker that can render on Windows
tags: #OpenAI #Docker #Python #Tensorflow
cover_image: https://openai.com/content/images/size/w1400/2019/11/safety-gym-cover.png
---
{% github vijjusri14/OpenAI-Gym-Docker no-readme %}

This image starts from the jupyter/tensorflow-notebook, and has atari_py installed. Therefore, many environments can be played.

This image is made for running OpenAI Gym on Windows. But in general, it works on other OS like Linux, MacOS etc. as well.

## Prerequisite
* [Windows Subsystem for Linux WSL](https://docs.microsoft.com/en-us/windows/wsl/install)
* [Docker Desktop](https://www.docker.com/products/docker-desktop)
* [VcXsrv Windows X Server](https://sourceforge.net/projects/vcxsrv/)

## Description
* [Dockerfile](./Dockerfile): Dockerfile to build the OpenAI Gym image
* [example](./example): Some example notebooks for testing
* [example/env_render.ipynb](./example/env_render.ipynb): Test Gym environments rendering
* [example/18_reinforcement_learning.ipynb](./example/18_reinforcement_learning.ipynb): This is a copy from Chapter 18 in Géron, Aurélien's book: Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow.  Source code is [here](https://github.com/ageron/handson-ml2/blob/master/18_reinforcement_learning.ipynb) in GitHub.

## Build the image
```
docker build -t openai_gym_docker:v1.0 .
```

## Create and run the instance of the container

Get the Network InterfaceAlias name using the below command
```
netsh interface ipv4 show interface
```

Customize the number of CPUs and Memory in the below command according to your system specifications. Also update Network InterfaceAlias from previous command
```
docker run -itd --name=openai-gym -p 8888:8888 --cpus='3' --memory='6g' --add-host=dockerhost:$(Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias 'Wi-Fi' | Select-Object -ExpandProperty 'IPAddress';) -e DISPLAY=dockerhost:0.0 openai_gym_docker:v1.0
```

## Get Jupyter token
```
docker exec -it openai-gym bash -c 'jupyter notebook list'
```

Once the docker instance starts running, open browser and visit [http://localhost:8888](http://localhost:8888) and login with the token from above.

Jupyter will promt you to set new password for future logins.

Create/Import Python Notebooks and start exploring Reinforcement Learning 🤖

## Stop the container
```
docker stop openai-gym
```

## Start the container
```
docker start openai-gym
```
It's hard to match the screenshot after disconnecting from the remote desk
Tags: python
Published: 2021-12-28 07:05:50

I use Python to run apps in a remote server, but I find it hard to match the screenshot after disconnecting the remote desk. The code is something like this: pyautogui.locateCenterOnScreen(r'C:\Users\Administrator\desktop\python\bjh_zhijiefabu.png' , grayscale=False, confidence=0.9)
Getting hooked onto React Hooks.
Tags: react, reactnative, javascript, webdev
Published: 2021-12-28 07:02:43

##useState

This hook as the name suggests is used to declare a state variable. This helps **preserve values** between function calls.

Whenever a state variable is changed it causes the **DOM to re-render**.

The first is the *name* of the state variable that is declared and the second is the function that is called to *update the state variable*.

PS- State variable is able to hold any and all types of datatypes.

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


##useEffect

Using this hook, you tell React to do something after rendering the DOM. 

React remembers the function you passed and would call that function after performing the DOM updates.

![useEffect](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97c593yydjr72t496ppo.png)

The array present at the end of the useEffect function is called the **dependency array**.

This dependency array defines how the useEffect would be used.

If no dependency array is provided then it will be called *every time the DOM is updated*.

If an empty array is provided, then the useEffect is only called once, *when the DOM is mounted and is never called again*.

If state variables are passed in the dependency array then useEffect is called when the state variables are updated.

![dependency array](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2cxwpd81mp8u0zl8jqh.png)


##useRef

This React Hook is used to **create reference variables**.

The values stored in useRef are also preserved between different renders, similar to useState.

But unlike useState, a change in the value of **useRef doesn't cause the DOM to render**.

The useRef is completely separate from the render cycle

![useRef](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wjt1v6fdky7bjstjhk9o.png)
 
##useCallback

What to do when a function is being called again and again without any need. You use the useCallback hook

useCallback function will **return a memoized version that of a callback function** that only changes when you changed the dependency array.


This will help prevent unnecessary renders and optimize the child components

![useCallback](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm4qd2jsqcmz5yoxdx0n.png)
 
##useMemo

This hook is similar to the useCallback hook, but here a **memoized value is returned** rather than the entire function.

useMemo also has a dependency array and is called once the state in the dependency array is updated.

useMemo is used to memoize costly functions so they don't have to be called every time they're rendered.

Whereas useCallback is used to improve the rendering behaviour of your React function components. 


![useMemo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5j6a9px6us15g3jiuw7.png)
Switch PHP version on linux
Tags: php, beginners
Published: 2021-12-28 06:45:00

You can list all loaded Apache modules with `apache2ctl -M`

this method is work fine
you can `ls /usr/bin/php*` to see how many php version you have and use this command switch to it
```
update-alternatives --set php /usr/bin/php7.4
```


this method sometime not work like u expected
```
$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart
```
dummy text generator
Tags: dummy, dummytext, textgenerator, text
Published: 2021-12-28 06:32:54

<p>this is a dummy text generator where you can get maximum 9 dummy paragraphs if you go above 9 you will only get 1 paragaraph.</p>

{% codepen https://codepen.io/Abhi7raj/pen/XWeVEQE %}

## CODEPEN LINK:
[projecturl](https://codepen.io/Abhi7raj/pen/XWeVEQE)

for example :
you can write the number of dummy paragraphs you want between 1 to 9 and you will get the result.


![paragraphs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezmwkncswvzia0kyxjip.jpeg)

BYE.
Are Ball Pythons Good Pets - Question Answered
Published: 2021-12-28 06:02:29

When it comes to pets, we can mostly find dogs and cats. But some people have some hobby or passion to take wild animals as pets. For snakes, the number is not large but there are few species which can be kept as pets. Ball pythons are one of them. Read on to know more about are ball pythons good pets. 

Ball pythons generally can be found in the areas in focal and western Africa. Some social practices and religions additionally found in those spaces, especially in the nation of Nigeria, accepted ball pythons were consecrated and never hurt them. The people there even performed burial service functions for any snake who was killed unintentionally.


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

**Some Characteristics of Ball Python**

There are some characteristics of ball pythons which make them good pets. They are-

They lean toward running or stowing away over gnawing when they are worried or terrified. Most snakes will flaunt the conduct that provided them with the normal name of ball python.

If you consider that ball pythons are not friendly creatures. They invest their energy in the wild alone and they like it as such in bondage as well. You should know that on are ball pythons good pets.

Holding your ball python isn't something you'll need to do often either particularly later they've eaten or on the other hand in the event that they are going through a shed. They will climb and slither around you, yet you will not have the option to show it stunts like a canine or feline. 

When the snake ends up being anxious, it will cluster and conceal its weak head under the curls of its body. This implies that the snake is more straightforward to deal with because of liking to roll together instead of gnawing. Remember that more current and more extraordinary transforms will make the expense of your ball python increment. It is important regarding **[are ball pythons good pets](https://parabestate.com/5-irrefutable-reasons-why-ball-pythons-make-good-pets/)**.

Again, if the most superb creature on the planet is out of your value range, it won't help you as a pet. Their basic consideration needs assistance to downplay costs and the actual snakes are modest on account of their broad accessibility. 

**Overview**

So if you are thinking about getting a ball python as a pet, you can go ahead without any hesitation. But you must remember regarding are ball pythons good pets that they are helpless against ailment and wellbeing chances very much like their feline and canine partners. With the legitimate consideration, ball pythons have a future as long as thirty years.
Public Solving: Calculating the wind chill
Tags: javascript
Published: 2021-12-28 06:02:06

Santa's sled is pretty modern. Hey, we even upgraded it to have an [autopilot](https://daily-dev-tips.com/posts/public-solving-making-an-autopilot-navigator/).
But now, the elves want to surprise Santa by adding a wind chill gauge.

The wind chill is the "feel" temperature, you know when it's like 30 degrees, but it feels like 35?

[You can find the complete puzzle here.](https://github.com/devadvent/puzzle-18)

To do this, we can use an already provided mathematical calculation which can be found [here](https://sciencing.com/calculate-wind-chill-factor-5981683.html).

The wind chill can be calculated for English and Metric values.

## Thinking about the solution

The main thing we have to achieve today is to actually make the formula in JavaScript.
This should be a pretty straightforward process.

The formula for English units looks like this:

```js
35.74 + 0.6215T – 35.75 (V^0.16) + 0.4275T (V^0.16)
```

Where `T` = Temperature in degrees Fahrenheit and `V` = wind speed in miles per hour.

In JavaScript this should look similar to this:

```js
35.74 + 0.6215 * temperature - 35.75 * windSpeed ** 0.16 + 0.4275 * temperature * windSpeed ** 0.16
```

Did you note the `(V^0.16)` exponent? We can use `Math.pow` or the shortcut `**` for that.

Then we can simply wrap this in a `Math.round` to get the rounded number.

```js
return Math.round(
  35.74 +
    0.6215 * temperature -
    35.75 * windSpeed ** 0.16 +
    0.4275 * temperature * windSpeed ** 0.16
);
```

However, we also need a way to calculate the metric version.

I decided to just catch and return the English units beforehand.

And if that didn't hit, surely it must be the metric version.

```js
if (units === 'US') {
	return Math.round(
	  35.74 +
	    0.6215 * temperature -
	    35.75 * windSpeed ** 0.16 +
	    0.4275 * temperature * windSpeed ** 0.16
	);
}

return Math.round(
	13.12 +
	  0.6215 * temperature -
	  11.37 * windSpeed ** 0.16 +
	  0.3965 * temperature * windSpeed ** 0.16
);
```

And that's it! We solved the issue.

Let's try it out and see if our test turns green.

![Wind chill test in JavaScript turning green](https://cdn.hashnode.com/res/hashnode/image/upload/v1639835530374/FAKl-22B2.png)

Would love to hear what you would do differently to solve this problem.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)