teleren/devto huggingface dataset:
Node JS HTTP server example
Tags: javascript, node, http, webdev
Published: 2022-11-17 11:42:50

Hi friends, in this tutorial, you will learn how to create a Node JS HTTP server. Before getting started with the HTTP server creation, you must know that HTTP is a built-in module in node js, and a module in node js acts like a javascript function or library. By using this HTTP module, we can transfer the data over the web browser.

To include a module in node js, we can do so with the help of require() as shown below

var http = require('http');

whereas

- http inside require is the name of the module and
- http with var is the object reference variable which will be used later to create the server object or any other object etc.

## Create a Node JS HTTP server object

When you create a node js HTTP server object then the node js file acts like a web server and listens to the server port such as 8080 for localhost etc and gives the response to the browser or client.

Below is an example:- (test.js)

```
var http = require('http');

http.createServer(function (req, res) {
   res.writeHead(200, {'Content-Type': 'text/html'});
   res.end('Hi this is my first program in node js');
 }).listen(8080);
```
**Explanation of the above code:-
**
On the above code, you have noticed that the function inside the createServer() is added with port listen(8080) that means if you type http://locahost:8080 in your browser then the browser will return the function executed written inside the createServer(). Save the above javascript code with the .js extension.

Also read, **[Text slideshow HTML with images using w3 CSS and javascript](https://pbphpsolutions.com/text-slideshow-html-with-images-using-w3-css-and-javascript.html)**

### Run the node js file using the terminal

- open the command terminal of your computer and go to the path or location where the JavaScript file is stored.
-  write node filname.js and press enter.
-  Now, open the browser and hit the URL http://localhost:8080
-  Now the file will be executed and the result will be displayed to the browser.

**Conclusion:-** I hope this tutorial will help you to understand the concept. If there is any doubt then please leave a comment below.
Fix: Cannot find module '@nomicfoundation/hardhat-toolbox' Solidity
Tags: testing, web3, hardhat, solidity
Published: 2022-11-17 11:34:48

When you are trying to compile a Solidity contract with `npx hardhat compile` you may experience getting the error **Cannot find module '@nomicfoundation/hardhat-toolbox'**.

To fix the error **"Cannot find module '@nomicfoundation/hardhat-toolbox'"**, ensure you install the package by running `npm install --save-dev @nomicfoundation/hardhat-toolbox` on your project terminal. If an error persist (probably due to dependencies) then install all packages required by the plugin. You can also use **yarn** to install it.

Open your terminal and install **Hardhat Toolbox** by running the following command:

```
npm install --save-dev @nomicfoundation/hardhat-toolbox
```

> If the **"Cannot find module '@nomicfoundation/hardhat-toolbox"** error is not resolved, try installing all dependencies.

Run the following command to install all dependencies:

```
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
```
If you prefer to use **yarn**, the following command will also install all dependencies:

```
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
```

You can then go ahead compiling your Solidity smart contract.

## Conclusion
As explained above, to fix the error **"Cannot find module '@nomicfoundation/hardhat-toolbox'"**, ensure you install the package by running `npm install --save-dev @nomicfoundation/hardhat-toolbox` on your project terminal. If it still throws an error (probably due to dependencies) then install all packages required by the plugin. You can also use yarn to install all the dependencies.
Reversing a string
Tags: javascript, freecodecamp, newbie, beginners
Published: 2022-11-17 11:27:39

I'm currently working through freeCodeCamp's 300h javascript course. One of the algorithm challenges is to reverse a string. I solved this with a `for` loop, `unshift()` and `join()` like this: 

```
function reverseString(str) {
  let arr = [];
  for (let i = 0; i < str.length; i++) {
    arr.unshift(str[i]);
  }
  return arr.join(""); 
}

reverseString("Hello")

```


1. I declared an empty array to store the separate characters.

2. I wrote your usual FOR loop to iterate through the input string characters. 

3. I used the unshift method because this pushes each new letter to the front, starting with H into my empty `arr` variable. It iterates though it like this: 

```
[ 'H' ]
[ 'e', 'H' ]
[ 'l', 'e', 'H' ]
[ 'l', 'l', 'e', 'H' ]
[ 'o', 'l', 'l', 'e', 'H' ]
```
 so by the end of the loop you end up with this array of letters which are in the reverse order.

4 . Now I have an array with the desired order, however, the challenge wants a single string. A quick google search provided me with the `.join()` method, which I then use on my `arr` variable. The result is `olleH`

When I finished I looked up a few other ways of doing this. I'll post them another day!

Love, RP
The difference between Data Science, Artificial Intelligence and Machine Learning
Tags: datascience, machinelearning, programming, computerscience
Published: 2022-11-17 10:50:57

It is very common for data science, or data science, to be seen in association with artificial intelligence and machine learning, as they are often worked together.
But, make no mistake, each one is responsible for a different function.
Machine learning:
It is a set of methods used for the automatic identification of patterns, by an algorithm, which can be used to make decisions or carry out actions, such as identification of paths, facial recognition, among others.
Artificial intelligence:
Artificial intelligence is the use of computers and algorithms to perform mundane tasks typically performed by humans, such as driving cars, approving credit applications, or controlling enemy characters in a video game.
Data Science:
Area of study in which we can obtain insights through data using data analysis and visualization, machine learning and artificial intelligence resources. We may identify information such as purchase patterns, in-app behavior patterns, and more.
Who are data professionals?
There is often a certain confusion regarding the professionals who are part of the data area.
Data scientist.
The professional who works as a data scientist has knowledge and experience in computer science, statistics and mathematics, as one of the broadest activities in the data area. His responsibilities are very focused on analyzing large volumes of data and gaining insights.
Data Analyst.
The professional who works as a data analyst is responsible for collecting, analyzing and interpreting the information and insights obtained through the data. Its recommendations are critical to data-based decisions made by other sectors of the company.
Git cheat sheet (Part 1)
Tags: writing, github, tutorial
Published: 2022-11-17 10:49:05

Have you ever been stucked while using git🤔? If your answer is yes, This article is for you. You dont need to memorize  all of git command. Here is a cheat sheet that will simply  your life.

## What is Git?
Git is a free, open-source version control software. It was created by Linus Torvalds in 2005.
Therefore, Git is essentially a content tracker. Git can therefore be used to store content; however, due to its other features, it is primarily used to store code.

## GIT CHEAT SHEET

Initialze a local repository: 
```
git init <directory>
```

Set configuration value for your usernmae and email:
```  
git config --global user.name <your name> 
```
```
git config --global user.email <your email>
```

Clone a repository:
```
git clone <repository-url>
```

Add a file to the staging area:
```
git add <file>
```
Add all files changes to the staging area:
```
git add .
```
Check the unstaged changes:
```
git diff
```
Commit the staged changes:
```
git commit -m "Your Message"
```

Add changes made to track files and commit:
```
git commit -a -m "Your Message"
```

Reset staging area from last commit:
```
git reset <file>
```

Check the status of the working directory:
```
git status
```

Remove a file from the index and working directory
```
git rm <file>
```

List the commit history:
```
git log
```

To display branches:
```
git branch
```

To create a branch:
```
git branch <branch name>
```

To switch to a branch:
```
git checkout <branch name>
```

To delete a branch:
```
git branch -d <branch name>
```

To merge a branch:
```
git merge <branch name>
```

Pull changes from a remote repository:
```
git pull <remote name>
```

Push changes to a remote repository:
```
git push  <remote name>
```
### Conclusion

Git is  used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently. Git is used to tracking changes in the source code, enabling multiple developers to work together on non-linear development.

I hope you found this article helpful in understanding Git command. Follow me here on [Dev](dev.to/comfortdeola) or [Twitter](https://www.twitter.com/dde_olla) for more updates 😊
Use TailwindCSS with Next.JS & TypeScript
Tags: webdev, nextjs, typescript, tailwindcss
Published: 2022-11-17 10:01:15

Next.JS has been one of the most powerful and popular fullStack web frameworks which is based on ReactJS, combined with TailwindCSS and TypeScript it gives us a better and a faster way for building fast and modern web applications, and in this post we will learn how to create your project using these technologies.  

1. First way is to install it all when creating project using "npx" :

```cmd
npx create-next-app -e with-tailwindcss --ts
```



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


- you type "y" for yes and it will demand the name of your project like this:

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

after naming your project and everything is downloaded you're left with a basic Next.JS x TailwindCSS x TypeScript Project.

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



2. Second case is that you have an existing Next.JS project and you want to add TypeScript and/or TailwindCSS to it:

2.1. For TypeScript you need to create tsconfig.json you can do that by the usual way or by typing this in the command line of your choice in your project directory :

- if you're using git Bash (which i recommend) or linux terminal you can use:
```
touch tsconfig.json
```

-if you're using CMD for Windows or Powershell then you can use:
```
type [<drive>:][<path>] tsconfig.json
```
or
```cmd
echo [content] > [<path>\tsconfig.json]
```

- and then execute this command:
```cmd
npm install --save typescript @types/node @types/react
```

2.2. For TailwindCSS you just need to run few commands and modify a couple of files:

- first thing you need to do is to run the following commands:
```
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
```

-then in the tailwind.config.js you copy this lines:

```js
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    './pages/**/*.{js,ts,jsx,tsx}',
    './components/**/*.{js,ts,jsx,tsx}',
    './app/**/*.{js,ts,jsx,tsx}',
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

```

- and also for the file "styles\globals.css" you add on top these three imports:

```js
@tailwind base;
@tailwind components;
@tailwind utilities;
```

- And the last thing you wanna do is to import golbals.css in your main project folder pages\_app.tsx or (app\layout.tsx in Next.JS 13):


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

```js
import '../styles/globals.css'
```

And that's it now after migrating you're project from js to ts you're good to go..
Observer design pattern
Tags: csharp, opensource, programming
Published: 2022-11-17 09:55:00

Observer is a behavioral design pattern that allows some objects to notify other objects about changes in their state.

Usage examples: The Observer pattern is pretty common in C# code, especially in the GUI components. It provides a way to react to events happening in other objects without coupling to their classes.

Identification: The pattern can be recognized by subscription methods, that store objects in a list and by calls to the update method issued to objects in that list.

Check how to implement Observer Design Pattern in https://github.com/HeyBaldur/ObserverDesignPattern
Get a FREE API key for full NODEs
Tags: node, api, blockchain, web3
Published: 2022-11-17 09:30:52

Guys, you can get a FREE API key for 60 full nodes in this service [Nownodes](http://account.nownodes.io/auth/signup?utm_source=twitter&utm_medium=social&utm_campaign=post_dev&utm_content=magic_link&utm_term=1+1_pro)
ERORR:org.apache.ibatis.binding.BindingException: Parameter 'result2' not found, 2022-11-17
Tags: springboot, errors
Published: 2022-11-17 09:24:42

> org.apache.ibatis.binding.BindingException: Parameter 'result2' not found. Available parameters are [arg1, arg0, param1, param2]

Mapper.java에 파라미터가 2개 이상인 경우

```
@Param("value")String value
```
를 붙여준다
My first SQL Query
Published: 2022-11-17 09:22:24

This is my first Microsoft server SQL, I can't believe it! I really longed for this opportunity .I must thank BlackTech Academy for giving me the opportunity to join 'The free SQL cohort2 training'.
How can I forget to thank the 'DEV COMMUNITY ' for giving me a platform to document my projects and learn more !! #Thank your ,THE DEV COMMUNITY.


**Database Overview.**
The database was AdventureWorks2017 database with several tables and https://learn.microsoft.com/en-us/sql/samples/adventureworks-install-configure is the link to access the database




1.#SELECT STATEMENT
-Is  a built-in function used to select  entire table or column in a table.

a. Showing  person from Person. Person  table with the first name  Rob or Roberto
I applied the following  select query command :. Person from person. Person table with the firstname as  Rob or Roberto
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yc374rnyhoq64uz5v479.png)
yarn: command not found on Windows 10
Tags: yarn, git, testing
Published: 2022-11-17 09:12:33

**I recently got this error after installing yarn on my Windows 10 PC. The reason is that the yarn installation PATH wasn't added to my system environmental variables.**

To solve this error, I simply added the **yarn** PATH to my system environmental variables.

Here is how you can solve it.

## Step 1: Ensure yarn is installed globally

Run the following command to installed yarn globally.

```
npm install -g yarn
```

This will download and install **yarn** globally (remember you will need to have Node.js installed).

**Confirm the installation.**

```
yarn -v
```

If the command above returns the **yarn** version, then you are good to go. No need to proceed to the next step.

However, if you get the error **"yarn: command not found"**, you will need to add the correct PATH to your system environmental variables.

## Step 2: Add yarn to your path

Open your terminal and run the command:

```
npm config get prefix
```

This command output the path where **npm** puts your globally installed packages. The path will look something like `C:\Users\Your_User_Name\AppData\Roaming\npm`.

**Copy this path from your terminal and add it to your system environment variables.**

After adding the path to your system environments, you will have to restart the terminal for the changes to take effect.

**Run the following command to confirm yarn is working fine.**

```
yarn -v
```

## Conclusion

To solve the error **"yarn: command not found"** on windows 10, install the **yarn** package globally by running `npm install -g yarn` and restarting your terminal. Confirm the command `yarn -v`. If the command fails, make sure the correct PATH is set in your system's environment variable.
Pass Azure AZ-900 Dumps in First Attempt Guaranteed!
Tags: webdev
Published: 2022-11-17 09:04:34

Definitely, the sheep at five, 6, 7... Paws do now no longer exist and it's far unthinkable for a unmarried person to grasp all of the elements associated with the deployment of Azure cloud answers. **Azure AZ-900 Dumps** However, understanding positive standards may be very beneficial in order now no longer to overlook a critical step in the course of a task requiring a cloud structure.

If you need to take the flip of the Cloud and specifically that of Microsoft, I strongly suggest you to address the Azure AZ-900 Dumps certification.

Training content material is to be had at the Microsoft Learn platform. You may also opt to examine it in French; however I suggest which you realize the English phrases associated with the exclusive standards in addition to Azure offerings.

LIMITED OFFER: https://dumpsarena.com/microsoft-dumps/az-900/
To Do
Tags: jetbrains, go, workflow, beginners
Published: 2022-11-17 09:55:43

---
title: To Do
published: true
date: 2022-11-17 09:03:44 UTC
tags: #jetbrains #go #workflow #beginners
canonical_url: https://alexsaezm.com/posts/todo/
---

I love `TODO` comments. And also `FIXME` comments. Well, I love any piece of non-code text that helps me with my tasks.
I know some people consider them smelly, and you must never use them or, at least, commit them.
I encountered many teachers at my university who always tell this to the students. And I think it is awful advice.

As far as I know, there are two main motivations against `TODO` comments.

- First, you should track these kinds of things in a bug or issue tracker.
- Second, if you collaborate with multiple users, and everybody uses `TODO` comments, they lose all of the significance because you can't track what is yours and what is not.


The first is a little more tricky to answer, and I can understand the sentiment, but only some things are worth the time, and some of the projects behave differently.
Generally, a `FIXME` or a `TODO` is usually smaller than a real issue or bug. A genuine issue should be tracked in a proper tool that allows a conversation among the developers at least. If it's a small thing like "I need to check this later", use a `TODO` comment. Apart from that, they are totally ok if you are working on a pull request. You can remove them later if they are not meaningful.

The second is true. But not using comments is not the solution. The solution is to make them right! I'm going to tell you the most simple and stupid thing I added to my workflow in the last months (I think I've been doing this for a year now).

Instead of doing something like this:

```go
func hello() {
	// TODO I need to change the text later
	fmt.Println("Hello world!")
}
```

Try using your **username** in the control version system, in my case:

```go
func hello() {
	// TODO(alexsaezm) I need to change the text later
	fmt.Println("Hello world!")
}
```

And then, here's the trick. **A lot of IDE and editors allow filtering comments based on regular expressions!**

In my case, I mostly use Goland nowadays, but it works in all JetBrains products.

Go to the TODO tab, click on the filter icon, and select *Edit filters*:

![Go to the TODO tab](https://alexsaezm.com/img/jetbrains_todo_0.png "The TODO tab")

Then, add something like this:

![My TODO filters](https://alexsaezm.com/img/jetbrains_todo_1.png "My TODO filters")

And enjoy your useful comments!
Sharing quick tips on Product of the Day for Product Hunt
Tags: abotwrotethis, producthunt, frontend, developer
Published: 2022-11-17 09:02:14

Hey everyone, this is Shawn, CEO of FUNCTION12 and our team made #1 on Product of the Day.


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

Our counts
- Upvotes 1,162
- Comments: 512
- Day rank: #1

📝How we prepared it:

1. Started the preparation a month prior to the launch
2. Drafted a to-do list and assigned who would be doing what
3. Sent emails, shared on social media, and let our friends and colleagues know about our launch 2-7 days prior to the launch

🚀On the launch day:

1. Make sure the whole team is on Product Hunt for the next 24 hours constantly
2. Let everyone know about your launch on social media and communities
3. Send emails to your users to let them know about the launch
4. Engage in the Product Hunt community and talk to different makers


Some of the extra tips I would like to share are:

**Let your audience know about your launch**
It’s important to gather and announce the launch to as many supporters as possible that know your product well in advance. Although new hunters and makers will show interest, it’s also important for your audience to engage as well and show their support too. We've sent D-7, D-1, D-Day emails along with many, many social media posts and DMs to let everyone know about it.

**Be prepared for everything, anything**
Once your product is on top of the page, great traffic will naturally be engaged to your website and product. Make sure your server is ready for such visitors and along with various questions left on customer service answered immediately. It’s important to have these new audiences have their curiosities answered and fully test our product smoothly.

**Engage, actively**
Not only have your team actively engaged in the product page’s comment section, but also engage in posts that you upload on your social media, and community posts so that more audiences can visit your product page. It’s also great to actively participate in the discussion community in Product Hunt where you can discuss and share great tips related to the Product Hunt launch!

You can check out FUNCTION12 product page here:

[producthunt.com/posts/function12](url)

Good luck to all the makers out there!

FUNCTION12 agrees to [dev.to's policy](https://dev.to/devteam/guidelines-for-ai-assisted-articles-on-dev-17n6) on posts assisted by artificial intelligence.
This article was created with the help of AI.