teleren/devto huggingface dataset:
CSV File/Data – Nodejs Express RestAPI – Download/Extract CSV Data/File from MySQL
Tags: csv, mysql, restapi, node
Published: 2021-05-10 13:57:06

https://grokonez.com/node-js/csv-file-data-nodejs-express-restapi-download-extract-csv-data-file-from-mysql

CSV File/Data – Nodejs Express RestAPI – Download/Extract CSV Data/File from MySQL

In the tutorial, I shows how to download & extract CSV File/Data from MySQL with Nodejs Express and <code>json2csv</code> lib.

What will we do?

- Extract data from MySQL database.
- Using <code>json2csv</code> lib to save data from json to CSV file.
- Using Express framework to build restAPI for Nodejs download CSV file.

Related posts:
- <a href="https://grokonez.com/node-js/node-js-extract-mysql-data-to-csv-file-using-json2csv">Node.js Extract MySQL Data to CSV File – using Json2Csv</a>

<!--more-->
<h2 id="technologies">Technologies</h2>
<ul>
<li>nodejs</li>
<li>express</li>
<li><code>json2csv</code>: Converts <code>json</code> into <code>csv</code> with column titles and proper line endings.</li>
<li>mysql</li>
</ul>
<h2 id="goal">Goal</h2>
– We create a Node.js project as below structure:

<img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-express-restapi-download-extract-csv-file-from-mysql-data-project-structure.png" alt="nodejs-express-restapi-download-extract-csv-file-from-mysql-data---project-structure" width="599" height="114" class="alignnone size-full wp-image-17368" />

– MySQL Data:

<img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-express-restapi-download-extract-csv-file-from-mysql-data-mysql-records.png" alt="nodejs-express-restapi-download-extract-csv-file-from-mysql-data---mysql-records" width="734" height="487" class="alignnone size-full wp-image-17369" />

Results:

<img src="https://grokonez.com/wp-content/uploads/2019/03/nodejs-express-restapi-download-extract-csv-file-from-mysql-data-results.png" alt="nodejs-express-restapi-download-extract-csv-file-from-mysql-data---results" width="758" height="371" class="alignnone size-full wp-image-17370" />
<h2 id="practice">Practice</h2>
<h3 id="install-express-mysql-json2csv">Install Express, MySQL & Json2CSV</h3>
Init <code>package.json</code> file by cmd: <code>npm init</code> -> Then install <code>express</code>, <code>mysql</code> & <code>json2csv</code> libs:

More at:

https://grokonez.com/node-js/csv-file-data-nodejs-express-restapi-download-extract-csv-data-file-from-mysql

CSV File/Data – Nodejs Express RestAPI – Download/Extract CSV Data/File from MySQL
How To Handle Infinite Page Scrolls While Web Scraping
Published: 2021-05-10 13:53:58

Websites with infinite page scrolls are rendered using AJAX. It calls back to the server for extra content as the user pages down the page.

One of the ways of scraping data like this is to simulate the browser, allow the javascript to fire the ajax, and also to simulate a page scroll.

Puppeteer is the best tool to do that. It controls the Chromium browser behind the scenes.

Let’s take a Quora answers pages as an example of an infinite scroll page. In this example, we will try to load the page and scroll down till we reach the end of the content and then take a screenshot of the page to our local disk.

Let’s install the puppeteer first.

mkdir quora_scraper
cd quora_scraper
npm install --save puppeteer

Then create a file like this and save it in the quora_scraper folder. Call it quora_scroll.js

const fs = require('fs');
const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch({
        headless: false
    });
    const page = await browser.newPage();
    await page.goto('https://www.quora.com/Which-one-is-the-best-data-scraping-services');
    await page.setViewport({
        width: 1200,
        height: 800
    });

    await autoScroll(page);// keep scrolling till resolution


    await page.screenshot({
        path: 'quora.png',
        fullPage: true
    });

    await browser.close();
})();

async function autoScroll(page){
    await page.evaluate(async () => {
        await new Promise((resolve, reject) => {
            var totalHeight = 0;
            var distance = 100;
            var timer = setInterval(() => {
                var scrollHeight = document.body.scrollHeight;
                window.scrollBy(0, distance);
                totalHeight  = distance;

								//a few of the last scrolling attempts have brought no new 
								//data so the distance we tried to scroll is now greater 
								//than the actual page height itself

                if(totalHeight >= scrollHeight){
                    clearInterval(timer);//reset 
                    resolve();
                }
            }, 100);
        });
    });
}

Now run it by the command.

node quora_scroll.js

It should open the Chromium browser, and you should be able to see the page scroll in action.

Once done, you will find a rather large file called quora.png in your folder.

For further reading read the article How To Scrape Quora Using Puppeteer.

The author is the founder of Proxies API the rotating proxies service.
Removing Items Using splice()
Tags: javascript, devops, tutorial, beginners
Published: 2021-05-10 13:52:11

* What if we want to remove an element from somewhere in the middle? Or remove more than one element at once? Well, that's where `splice()` comes in. `splice()` allows us to do just that: remove any number of consecutive elements from anywhere in an array.
* `splice()` can take up to 3 parameters, but for now, we'll focus on just the first 2. The first two parameters of `splice()` are integers which represent indexes, or positions, of the array that `splice()` is being called upon. And remember, arrays are zero-indexed, so to indicate the first element of an array, we would use 0. `splice()`'s first parameter represents the index on the array from which to begin removing elements, while the second parameter indicates the number of elements to delete
* Ex: We've initialized an array` arr`. Let's use `splice()` to remove elements from `arr`, so that it only contains elements that sum to the value of `10`.
```
const arr = [2, 4, 5, 1, 7, 5, 2, 1];
arr.splice(1, 4);
```
```
console.log(arr); will display [2, 5, 2, 1]
```
* Here we removed 4 elements, beginning with the second element (at index 1). `arr` would have the value `[2, 5, 2, 1]` which sum to the value of 10 respectfully.
Remove Items from an Array with pop() and shift()
Tags: javascript, devops, tutorial, beginners
Published: 2021-05-10 13:42:15

* `pop()` removes an element from the end of an array, while `shift()` removes an element from the beginning. The key difference between `pop()` and `shift()` and their cousins `push()` and `unshift()`, is that neither method takes parameters, and each only allows an array to be modified by a single element at a time.

* Let's take a look:
```
function popShift(arr) {
  let popped = arr.pop(); 
  let shifted = arr.shift(); 
  return [shifted, popped];
}

console.log(popShift(['challenge', 'is', 'not', 'complete']));
console will display ['challenge', 'complete']
```
* We defined a function, `popShift`, which takes an array as an argument and returns a new array. I modified the function, using `pop()` and `shift()`, to remove the first and last elements of the argument array, and assign the removed elements to their corresponding variables, so that the returned array contains their values.
Head Start to Express
Tags: javascript, express, replit, node
Published: 2021-05-09 12:58:24

#Getting started with Express

###what the heck Express is ??

**So the answer is Express.js or Express is backend web application framework for node.js so that you can go and create your backend logic there for your web app or mobile application such as API **

Before creating your first API using express let's know few things that we are going to cover in this post we will learn to create API express.js using [replit](https://replit.com/) that provides you node environment so you can use it.
I learned Express this way and found it very simplest so anyone to pick and can learn it just like that it's my personal opinion might you feel difficult so here it is

### let's create your first API using express in few steps
*open [replit](https://replit.com/) and create an account over there. 
Now you can see there an option for creating repl 
*select for node.js and create your repl.
now you can see you have an environment in which you have files section editor and console over there

*now as you can see at the top of your index.js where something is written as not sure
> Not sure what to do try some [examples]().

or put this code there
```
const express = require('express');

const app = express();

app.get('/', (req, res) => {
  res.send('Hello Express app!')
});

app.listen(3000, () => {
  console.log('server started');
});
```
*click on examples and select for Server (Express) and run it so repl will install dependency for your express server and Voila! your express server is started listening on port 3000

so here you are add express as a dependency when you calling `express()` like this is creating an instance of express.
When you doing `app.get` it takes first on an argument the route in this case route is root `'/'` and second is call back from where we are returning an HTML with the response as `res.send('hello Express app!')`.
If you  want to return data in JSON format you can use `res.json({text:'Hello Express app})'` so it will return data in JSON format.
also, you can create multiple routes using `app.get`


* On your right side of the screen you can see a browser screen in running upside of your console you can copy that URL of your sever and put it where ever you want and because you are using repl your express server is live over the wire.
Add Items to an Array with push() and unshift()
Tags: javascript, devops, tutorial, beginners
Published: 2021-05-10 13:33:24

* An array's length, like the data types it can contain, is not fixed. Arrays can be defined with a length of any number of elements, and elements can be added or removed over time; in other words, arrays are mutable. In this challenge, we will look at two methods with which we can programmatically modify an array: `Array.push()` and `Array.unshift()`.

* Both methods take one or more elements as parameters and add those elements to the array the method is being called on; the `push()` method adds elements to the end of an array
* The `unshift()` adds elements to the beginning. Consider the following:
```
function mixedNumbers(arr) {
let begArray = arr.unshift("I", 2, "three");
let endArray = arr.push(7, "VIII", 9);

  return arr;
}

console.log(mixedNumbers(['IV', 5, 'six'])); console will display 
["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]
```
* Here We have defined a function, `mixedNumbers`, which we are passing an array as an argument. We modified the function by using `push()` and `unshift()` to add `'I', 2, 'three'` to the beginning of the array and `7, 'VIII', 9` to the end so that the returned array contains representations of the numbers 1-9 in order.
What is your daily routine?
Tags: watercooler, discuss, devops
Published: 2021-05-10 13:32:47

I would like to hear what is everyone doing during WFH (Working from Home). Have you established some goals for each day, for example, to exercise or to read a book, take small breaks each hour?

Do you have a to-do list that you follow each day of the week or you just try to stay productive but do not follow a routine?
How to install Java on Ubuntu Remote Server – Vutr Hosting VPS Example
Tags: ubuntu, java, vultr, vps
Published: 2021-05-10 13:18:54

https://grokonez.com/deployment/vultr/how-to-install-java-in-ubuntu-remote-server-vutr-hosting-vps-example

How to install Java on Ubuntu Remote Server – Vutr Hosting VPS Example

In the tutorial, we show you how to install Java in Ubuntu Remote Server with Vutr Hosting VPS.

<!--more-->
<h2>Technology</h2>
- Java 
- Vutr VPS Hosting
<h2>Practice</h2>
<h3>Create Vultr Vps</h3>
Follow the <a href="https://www.vultr.com/?ref=7160246">link</a> to create a Linux Vultr VPS.

<a href="https://www.vultr.com/?ref=7160246"><img src="https://www.vultr.com/media/banner_3.png" width="300" height="250"></a>

<img src="https://grokonez.com/wp-content/uploads/2018/11/Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-Ubuntu-server.png" alt="Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-Ubuntu-server" width="703" height="471" class="alignnone size-full wp-image-15697" />

Use Putty to login Vultr VPS:

<img src="https://grokonez.com/wp-content/uploads/2018/11/Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-putty-login-vp.png" alt="Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-putty-login-vp" width="555" height="320" class="alignnone size-full wp-image-15698" />
<h3>Install Default OpenJDK</h3>
- Update <code>apt</code> package index:

<pre><code class="language-java">
sudo apt update
</code></pre>

- Install the default Java OpenJDK package:

<pre><code class="language-java">
sudo apt install default-jdk
</code></pre>

- Verify the installation:

<pre><code class="language-java">
java -version
</code></pre>

More at:

https://grokonez.com/deployment/vultr/how-to-install-java-in-ubuntu-remote-server-vutr-hosting-vps-example

How to install Java on Ubuntu Remote Server – Vutr Hosting VPS Example
required reading for feely devs
Tags: ruby, books, devjournal
Published: 2021-05-10 13:14:48

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx0htu8he3anktpwvaal.jpg)

Summer for those who can’t afford to go too far for too long -- what often becomes of a dev who took on more than they bargained for -- means reading.

The books featured in this comic (alternately entitled as Required Reading for Summer Feely Devs) do not to the best of my knowledge exist - or at least not yet. Our best alternatives are The Lonely City by Olivia Laing, The Fault in Our Stars by John Green, Letters to a Young Poet by Rainer Maria Rilke, Reasons to Stay Alive by Matt Haig, The Giving Tree by Shel Silverstein, The Art of Racing in the Rain by Garth Stein, and or that book we left on a table to possibly read once upon a time ago.
OhSnap! Handy Terminal & Git Commands
Tags: productivity, beginners, git, webdev
Published: 2021-05-10 12:56:44

*The "OhSnap!" series explores bite-sized tips that you can apply today.*

---

Here is a list of some helpful terminal and git commands for your viewing pleasure and my own future reference. 😉

#Terminal Commands


####Working With Spaces

```
cd Class\ Work
```
```
cd 'Class Work'
```
* Use a backslash (`\`) to make "Class\ Work" equal "Class Work”.

* Encapsulate the phrase with quote marks to preserve spaces between words. 

---

####Open project folder in VS Code 
```
cd my-project-folder-name 

code .
```


---


####Only show directories 
```
ls -d */
```



---


####Clear the terminal 
```
cmd + k
```

```
clear
```

---

####Go back to the main directory 
```
cd ~
```

---

####Show permissions

```
ls -l
```

---


####Create a file
```
touch index.html
```


---

####Create a folder/directory
```
mkdir my-project
```



---

####Removes a file

```
rm index.html
```

---


####Remove a folder
```
rm -r my-project
``` 
`-r` stands for “recursive”. It means to delete this thing and everything in it.

---

####Copy a file/folder

```
cp img images
```
The first value is the original file/folder and the second value is what it is copied as.

---

####Rename a file/folder name 

```
mv old-name.html new-name.html
```
The first value is the original file/folder name and the second value is the new name.

---

####Open folder in Finder

```
open .
```

---


####Getting unstuck from hard-to-exit terminal screens
```
shift + z
shift + z
```

---

#Git Commands

####Show available local branches 

```
git branch
```

---

####Create new branch

```
git checkout -b feature-1
```
* `checkout` moves to the new branch 
* `-b` creates a new branch
* `feature-1` name for branch

---

####Push local branch to remote 

```
git push origin feature-1
```

---

####Switch to a new branch

```
git checkout main
```


---

####Merge changes from one branch to another

```
git merge master
```

1. Navigate to the branch you want to work in
2. After the `merge` keyword, specify the branch that **has the changes to be merged from**  


---

####Grab all remote branches without merging 

```
git fetch --all
```


---


####Reset the local master with the remote version
```
git reset --hard origin/master
```

---

####Remove non-committed changes from all branches and master since 
```
git checkout -f
```


---

####View differences between commits 
```
git diff
```
To leave this view hit `Q` on the keyboard 


---

*Thumbnail designed with [Figma](https://www.figma.com/)*
Tools for learning Perl context
Tags: perl
Published: 2021-05-10 12:41:40

---
title: Tools for learning Perl context
published: true
description: 
tags: perl
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2o09fsq3obm8c685mbo.png
---

There are times when I am confused by the context of Perl. I wrote a tool to reduce this confusion.

{% github kfly8/p5-Contextual-Diag no-readme %}

# Usage

If you plug in the `contextual_diag` subroutine where you want to know Perl context, it will alert you to the context. 

The following code explores the context when evaluating the value of a hash reference:

```perl
use Contextual::Diag;

# Here...
my $a = { key => 'value' };

# Do this...
my $a = { key => contextual_diag 'value' };

# Then this happens!
# => wanted LIST context
```

# Inside Contextual::Diag

In Contextual::Diag, the first step is to use `wantarray` to separate contexts into SCALAR, LIST, and VOID. Then, in the case of SCALAR context, the return value is wrapped in an object, and overload is used to hook into string evaluation, numeric evaluation, and array dereferencing. Only in the case of object reference, overload is not enough to hook, so AUTOLOAD is used. I got this idea from Professor Damian's Contextual::Return.

# List of diagnoses

Contextual::Diag has a total of 11 different diagnoses:

```
1. SCALAR context
   - CASE: Scalar value
      - BOOL e.g. `if ($value)`
      - NUM e.g. `$value + 1`
      - STR e.g. `$value . "hello"`
   - CASE:  Scalar reference
      - SCALARREF e.g. `$$value`
      - ARRAYREF e.g. `$value->[0]`
      - HASHREF e.g. `$value->{key}`
      - CODEREF e.g. `$value->()`
      - GLOBREF e.g. `*{$value}->{CODE}`
      - OBJREF e.g. `$value->hello()`
2. LIST context
3. VOID context
```

# Conclusion

I wrote Contextual::Diag to make it easier to understand Perl context.

You can use it if you like!
Tips to Hire Full Stack Developer for your Web and Mobile Project
Tags: webdev, fullstack, developer, tutorial
Published: 2021-05-10 12:40:56

---
title: Tips to Hire Full Stack Developer for your Web and Mobile Project
published: true
description: Hire a full stack web developer- Learn why, when you should hire them, technical skills they must have, and detailed guide to hiring full stack developers.
tags: webdev, fullstack , developer, tutorial
cover_image: https://www.techtic.com/wp-content/uploads/2021/03/How-to-Hire-Precise-Full-Stack-Web-Developers.png
---

We come across web developers involved with front-end and back-end development for diverse projects. What is the difference between them? Front-ends are more about displaying the data to different users. This scenario is where these users way into the web by using the browser. So, they use various technologies to target end-users.

On the other side, back-end development is more involved with the business logic, and the database components of a web application enabled through technical languages.

<h2>Benefits of Full Stack Developers</h2>
![Benefits of Full Stack Developers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7mas30eduhp6izyziatn.jpg)

Hiring a full stack developer is more expensive when matched to hiring a technology domain expert. But a web application doesn’t merely comprise front-end and back-end; it is a blend of many specializations.

So when matched to hiring a team of domain specialists, at least three to four developers - a Full Stack Developer is a healthier preference.

<h2>How to Hire a Full Stack Web Developer for your Project?</h2>

![Tips to Hire Full Stack Developer for your Web and Mobile Project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ub5l1t594usgq0duqrqg.png)

<li>Step 1: Jot down your Full Stack Development Requirements</li>
 	<li>Step 2: Check the Qualities of a Full Stack Developer
<ul>
 	<li>1. Must be Knowledgeable and have Industry Experience</li>
 	<li>2. Highly Flexible and Approachable</li>
 	<li>3. Make Precise Project Managers</li>
</ul></li>
 	<li>Step 3: Look for the Technical Skills of a Full Stack Developer
<ul>
 	<li>1. HTML and CSS</li>
 	<li>2. JavaScript</li>
 	<li>3. Backend</li>
 	<li>4. Web Architecture</li>
 	<li>5. HTTP and REST</li>
 	<li>6. SourceTree, Git, and GitHub</li>
 	<li>7. Other Skill-sets</li>
</ul></li>
 	<li>Step 4: Assess a Full Stack Developer in detail before Hiring
<ul>
 	<li>1. Diverse Technologies Full Stack Developer Should Grasp</li>
 	<li>2. Must be Smart and Equally Curious</li>
 	<li>3. Full Stack Developers with Extensive Experience</li>
 	<li>4. Must quickly find the Right Paths</li>
 	<li>5. Aable to view the Bigger Picture</li>
</ul></li>
 	<li>Step 5: Analyze and Choose the Best Full Stack Developer</li>

If you want to to know about all tips of how to hire full stack developer for your web and mobile project then visit at <a href="https://www.techtic.com/blog/hire-full-stack-web-developer/">https://www.techtic.com/blog/hire-full-stack-web-developer/</a>