teleren/devto huggingface dataset:
Recursion in JavaScript
Tags: javascript, beginners
Published: 2021-03-08 06:12:39

Recursion is a common concept in coding and one everyone should understand down the road. I'd like to introduce it to anyone who's heard the term but isn't familiar with what it is or how it works within JavaScript.

So first thing is to talk about what it is. Recursion is where a function calls itself within itself. So when the function is invoked it calls itself. Which then calls itself. Which then calls itself. Which then.. you get the point.
 
``` javascript
const callMyself = () => {
  callMyself();
}

//DONT DO THIS IT WILL INFINITELY RUN
callMyself();

```

Sounds like an infinite loop right? Well that's because it is. So what's the point of doing that? Well there isn't.. unless you enable a way out of the infinite loop. This will come in the form of conditional statements such as our good friends if/else statements. 

You can set this up so it either keeps recurring while a condition is true or it keeps recurring until it isn't true.

``` javascript

const callMyself = () => {
  if(condition){
    callMyself();
  } else {
    //Do something else besides invoking self
  }
}

```

A super common example and one that helps to visualize the concept is counting numbers up or down until a condition is met.

``` javascript

const newYearCountDown = (number) => {

  console.log(number);

  nextNumber = number--;

  if(nextNumber > 0){
    newYearCountDown(nextNumber);
  } else {
    console.log("Happy New Year!!!");
  }
}

```

So that's cool and all but counting can be done a great number of ways. The point is using recursion until a condition is met and using conditionals to exit the loop once the condition is satisfied. 

A second common example when it comes to recursion is finding the factorial of a given number. A factorial is the product of a number and every number preceding it. 

The factorial of 5 would be:

5 x 4 x 3 x 2 x 1 = 120

With recursion this would look like: 

``` javascript
const factorial = (number) => {
  if (number <= 0) {
    return 1;
  } else {
    return number * factorial(number - 1);
  }
};

factorial(5);

//factorial(5) returns 5 * factorial(4)
//factorial(4) returns 5 * 4 * factorial(3)
//factorial(3) returns 5 * 4 * 3 * factorial(2)
//factorial(2) returns 5 * 4 * 3 * 2 * factorial(1)
//factorial(1) returns 5 * 4 * 3 * 2 * 1 * factorial(0)
//factorial(0) returns 120


```

So now that you have a grasp of what recursion is doing you might be thinking this is doing the same thing as a loop. It's true these things could be done with a loop or via iteration and a lot of the time in JavaScript those may be a more fitting solution than recursion. So when is recursion most useful?

Well one advantage is you can make your code a lot more readable if you use recursion. It can also shorten your code in some cases compared to loops. Some downsides with recursion is that it can take up more memory and produce slower code depending on usage. 

That'll be it from me this week.. happy coding!
A curry one-liner
Tags: javascript, functional
Published: 2021-03-08 07:46:16

---
title: A curry one-liner
published: true
description: 
tags: javascript, functional  
---

What did the Indian restaurant manager say when a crowd gathered at the door? One at a time please.

Sorry.

The real question is what came first, the joke or the code? Let's just say they were mutually inspirational. Any excuse for a post and a bit of working stuff out.

```javascript
const curry = (fn, ...args) => (args.length < fn.length) ? (...more) => curry(fn, ...args, ...more) : fn(...args)

function add(a, b, c, d, e, f)  {
    return a + b + c + d + e + f
}

console.log(add(1, 2, 3, 4, 10, 20)) // 40

const korma = curry(add)

console.log(korma(1)(2)(3)(4)(10)(20)) // 40

const vindaloo = curry(add, 10, 20)

console.log(vindaloo(1)(2)(3)(4)) // 40
console.log(vindaloo(1, 2)(3)(4)) // 40

const mixedVegetable = curry(add, 1)(2, 3, 4)

console.log(mixedVegetable(10, 20)) // 40
```

There's probably some edge (or even inner-suburban) cases that are missing, it's all I need at the moment though.
Dang Cap Phai Dep
Published: 2021-03-08 07:37:41

quý phái nữ giới đối với mơ ước mang tới cho KH sự hoàn chỉnh khi mua những SP make up, bảo đảm sức khoẻ, sản phẩm của tóc,… mà gần đây đã từng k xong hoàn thiện quality đáp ứng. không dừng lại ở đó, quý phái phái nữ cũng đang trưng cầu thêm chủ ý từ KH để thu được những đóng góp có thể giá trị về chu trình bán chất làm đẹp làm đẹp, unique SP chăm lo làn da chuyên sâu, tên thương hiệu,…
https://www.linkedin.com/in/dangcapphaidepvn/
https://www.pinterest.com/dangcapphaidepvn
Đẳng Cấp Phái Đẹp
Published: 2021-03-08 07:36:45

Nhờ am hiểu đc chổ chính giữa tư, ước vọng của không ít Cả nhà nữ giới nước ta and bản lĩnh hợp tác với khá nhiều nhãn hàng sản phẩm make up nhưng sang trọng phái nữ có thể đem lại cho bạn các SP cực tốt, đúng với nhu yếu & phù hợp đối với từng cơ địa nói về KH. nếu bạn e sợ về việc sử dụng hóa mỹ phẩm make up bị dị ứng, hãy đến đối với đẳng cấp và sang trọng phái nữ để hoàn thành bỏ nỗi băn khoăn lo lắng này nhé!
https://dangcapphaidep.business.site/
https://twitter.com/DangCapPhaiDep
Nevertheless, jun coded in 2021!
Tags: wecoded, theycoded
Published: 2021-03-08 07:23:52


Happy International Women's Day!✨💖👯

## My most recent achievement was…
My dream goal. One of the reasons I work in tech is because it allows us to work remotely easily. Last year, I got my first full remote position - which is my third and current job. 

I very appreciate the company value non-technical expertise and people skills just as highly as technical expertise. The job was challenging from the beginning but I've learned so much there. If I hadn't been given the opportunity, I wouldn't have all that valuable experience behind me.

## Advocating for myself looks like…
The first would be allowing myself to take a break and rest. Next would be knowing I have a lot to learn and take it one step at a time. I've also learned to make sure I am comfortable with being uncomfortable.


## My biggest goal is…
I am keen to help inspire women from non-tech backgrounds to get into tech. It was really encouraging for me to see women from all kinds of backgrounds who didn’t have a Computer Science degree like me to work in the tech industry. And I always believe there were transferable skills between each other.


## My advice for allies to support underrepresented folks who code is...
Always be kind and support them in every possible way🌻 Be proud of what you achieved and learned in a time even if it is just a small thing.





I have grown so much as a woman and a developer and I am still working on it but despite everything, nevertheless, I coded. 

Thanks to Dev.to, for the extra step of having someone reading the #shecoded posts and inspired other women through women's stories.
Public Proxy Servers vs. Private Proxy Servers for Web Scraping
Published: 2021-03-08 07:23:13

There are a bunch of websites that claim to list hundreds of free public proxy servers.
And you will find some more if you just Google "free public proxies."

Having gone down that road earlier in our careers, we found that if you want to use it in a web scraping project reliably, you will need to be able to be confident of your proxies in the following areas.

Availability: Public proxy servers keep shutting down quite often, so you need to develop algorithms to weed them off and update them almost every few minutes.
Reliability: Public proxy servers are used by thousands of developers and so slow down almost minutes after they are detected and become unresponsive
Speed: Public proxy servers are just individuals browsing, and you mostly don't have any control over their connection plans
Security: It's difficult to certain about whether the individual whose device is used as a proxy has given consent to use their bandwidth for free. In fact, in many cases, its hackers who have taken control of their connections and they might as quickly be logging all the information you send.
Private proxy servers, when rotated well, are reliable, with high-speed returns and much more available.

It's difficult to imagine writing serious web scraping without a private, rotating proxy service.

We developed one to help resolve all the headaches we faced with public proxies.

Our rotating proxy server service Proxies API provides a simple API that can solve all IP Blocking problems instantly.

With millions of high speed rotating proxies located all over the world
With our automatic IP rotation
With our automatic User-Agent-String rotation (which simulates requests from different, valid web browsers and web browser versions)
With our automatic CAPTCHA solving technology
Hundreds of our customers have successfully solved the headache of IP blocks with a simple API.

A simple API can access the whole thing like below in any programming language.
Typescript - Tips & Tricks - readonly modifier
Tags: typescript, webdev
Published: 2021-03-08 07:20:08

How many times we expect an object property to have a value but it isn't?
![Magic gif](https://media.giphy.com/media/3o7TKP9ln2Dr6ze6f6/source.gif)
In these cases, unfortunately, we spend a lot of time searching for who changes the value of this property.
Today I want to show you a special modifier that helps you to prevent this problem and preserve your time.
This modifier is the [readonly](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-func.html#readonly-and-const).
The readonly modifier helps you to prevent someone can change your property, so, the object's property can set only in the object initialization.
A simple example
```ts
type Point = {
  x: number;
  y: number;
};
const point: Point = {
  x: 10,
  y: 10,
};
point.x = 20;
point.y = 20;

type ReadOnlyPoint = {
  readonly x: number;
  readonly y: number;
};
const readOnlyPoint: ReadOnlyPoint = {
  x: 10,
  y: 10,
};
readOnlyPoint.x = 20; // Cannot assign to 'x' because it is a read-only property
readOnlyPoint.y = 20; // Cannot assign to 'y' because it is a read-only property
```
In this example you can see how in the first case you can change the value of the properties 'x' and 'y'; on the contrary, in the second case, you can't change the properties because they are marked as readonly.
As you can see, the readonly modifier can prevent the change of the values of the properties and save your code from annoying bugs.
Typescript also exposes a special type to convert your types to full readonly types; this type is called _ReadOnly_.
So we can review the previous example in this way
```ts
type Point = {
  x: number;
  y: number;
};
const point: Point = {
  x: 10,
  y: 10,
};
point.x = 10;
const readOnlyPoint: ReadOnly<Point> = {
  x: 10,
  y: 10,
};
readOnlyPoint.x = 10; // Cannot assign to 'x' because it is a read-only property
readOnlyPoint.y = 20; // Cannot assign to 'y' because it is a read-only property
```

From the readonly modifier, it's all!
Goodbye guys!
The Front End: S3-E1 - Brian Rinaldi & Raymond Camden
Tags: podcast, frontend, career
Published: 2021-03-08 07:14:51

🚨 NEW SEASON ALERT 🚨

In this very first episode of the brand new season 3, we talk to [Brian Rinaldi](https://twitter.com/remotesynth), a dev advocate from [StepZen](https://twitter.com/stepzen_dev), and his partner in crime, [Raymond Camden](https://twitter.com/raymondcamden), a lead developer evangelist for HERE.  

Listen to the brand new episode here:

- Apple Podcasts > https://podcasts.apple.com/gb/podcast/the-front-end/id1499349107
- Pocket casts > https://pca.st/osul2zsa
- Spotify > https://open.spotify.com/show/4GuAxptrtY8Es5iHwp09dT
- Anchor > https://anchor.fm/the-front-end

## In this episode

This Jamstack-loving pair have co-authored a book called The Jamstack Book, which is published by Manning and dives deep into the Jamstack and helps you build up a portfolio of Jamstack-architectured sites including a full-blown e-commerce store.

Now, as a very special reward for you lovely listeners of the show, Manning have been kind enough to offer some free copies of the book and some permanent discount codes so you can snap up a copy for yourself and learn all about the Jamstack.

## Grabbing your copy of The Jamstack Book (with discounts)

Pop along to this link to grab your own copy of the book, 

[The Jamstack Book](http://mng.bz/MXMQ)

and use the code **podfrontend21** to get a **MASSIVE 35% off!**

## Listening direct

Want to listen directly from here?

{% spotify spotify:episode:1ttYD5ueZz0Vq0AuGt4wuv %}

## Want to be a guest or sponsor the show?

We're always happy to take requests for guests to talk about a range of different development topics from careers to origin stories, learning and professional growth, frameworks and more.

Similarly, we're looking for sponsors to fill promotional slots within the show. 

You can find out more here:

- [Being a guest](https://thefrontendpodcast.site/guests)
- [Sponsorship information](https://thefrontendpodcast.site/sponsorship)

Thanks for listening!
Why is Job Analysis Important?
Published: 2021-03-08 06:56:31

A career review is the most thorough way to comprehend basic "can do" and "will do" aspects of your service, sales, and support job. You will correctly classify job applicants with the greatest potential to become high performers with the aid of a job report.

Your business will benefit from higher customer loyalty, higher sales per call, lower early-stage turnover, and a better company culture by using a job analysis to create a strong talent selection base.

According to Michael J. Jucius, "Job analysis refers to the process of studying the operations, duties and organisational aspects of jobs in order to derive specification or, as they are called by some <a href="https://www.hrhelpboard.com/performance-management/job-description.htm"> Job Description</a>"

<b><H2>What information is included in the job analysis process?</h2></b>

Information that a <a href="https://hrhelpboard.com/performance-management/job-analysis.htm">job analysis process</a> includes:

A list of the competencies needed to be assessed:-
-Examples of behaviors that clarify the competencies
-Suggestions as to the types of exercises that resemble job situations
-Suggestions for problem content to be used in the exercises
An indication of the level of proficiency required for the competencies
-Standards for scoring applicant performance in the exercises
Documentation of job-relatedness of the assessment process (for use in the event of a lawsuit)


<b>Additional outcomes of a job analysis include</b>:

<ul><li>making employee recruiting and hiring plans,</li> <li>position postings and advertisements, and </li> <li>performance development planning within your <a href="https://www.hrhelpboard.com/performance-management/performance-management-system.htm">performance management System</a>.</li> </ul>
#2 Adding graphql to an express server
Tags: javascript, express, graphql, react
Published: 2021-03-08 06:46:40

This post is in continuation of [#1](https://dev.to/mehaksaini11/creating-basic-express-server-and-react-client-and-the-use-of-concurrently-1c60). We'll be adding graphql support to it, so let's get to it.

Navigate to your project's root directory and run the below commands. We will be using body-parser middleware to parse the incoming http requests.
```
npm install graphql express-graphql body-parser
```

Now, go to your server.js and extract the graphqlHTTP from express-graphql using 
```
const {graphqlHTTP}=require('express-graphql')
```
Also, import the body-parser.
```
const bodyParser=require('body-parser');
```
In express, we use the use() function in order to add middleware to our application.
```
app.use(bodyParser.json());
app.use('/graphql',graphqlHTTP({
}));
```
Since graphql is a query language for fetching data, we need to define what type of data we are expecting.
We need to pass schema and resolvers to the graphqlHTTP method, so let's import the buildSchema property of graphql using
```
const {buildSchema}=require('graphql')
```
In graphqlHTTP, the Query type is called RootQuery.
The resolvers property is called rootResolvers. If you're using Yoga, there are much simplified terms there. Anyways, your final code snipped should look like this.
I'm using the query name as hello and the return type as String. The exclamation sign denotes that it cannot be null.
```
    app.use('/graphql',graphqlHTTP({
        schema:buildSchema(`
            type RootQuery{
                hello:String!
            }
            type RootMutation{
                somemutation:String!
            }
            schema{
                query: RootQuery
                mutation:RootMutation
            }
        `),
        rootValue:{
            hello:()=>{
                return "Hello back"
            }
        },
        graphiql:true
    }))
```
You may test it by visiting http://localhost:5000/graphql
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7hvny60gtf62jvuj2ljj.png)
The declarative spirits of React Hooks
Tags: react, javascript, webdev, hooks
Published: 2021-03-08 06:45:24

Suppose the teacher asked you to write a webpage that can show the current time, updated every second, in an exam.

So you wrote 

```js
export default function App() {
  const s = useCurrentTime();

  return (
    <div className="App">
      {s}
    </div>
  );
}
```

So the teacher may say, "wrong, wrong, wrong".  It shows something, and it won't update itself.

If it is plain JavaScript, it would be wrong, because things happen imperatively, and the code above does it once only, not updating the time every second.

So you can explain, "I am sorry, this `useCurrentTime()` is not imperative, but declarative. It is the current time, every second in real time."

How can that be?  That's how React is like: it is declarative, but up to a certain point, the programmer needs to make the declarative become true by imperative actions.

The part that bridges between them is:

```js
function useCurrentTime() {
  const [timeString, setTimeString] = useState("");

  useEffect(() => {
    const intervalID = setInterval(() => {
      setTimeString(new Date().toLocaleTimeString());
    }, 100);
    return () => clearInterval(intervalID);
  }, []);

  return timeString;
}
```
It sets up a repeated action, so that every 100ms, it sets its state to the locale time string. If we don't care about the time off by a bigger fraction of a second, we can use `300`, `500`, or `667` instead. I don't recommend using `1000` because there can be a case where it was 12:01:02.998, and the 1000ms turns out to be 1016ms due to some delay for the interval event, and then the time would go from 12:01:02 to 12:01:04, assuming the time is by flooring the second. 

If that string is the same as before, it won't trigger a re-render of `App`.  When the "state", the string, has changed, then `App` is re-rendered.

Demo: https://codesandbox.io/s/twilight-waterfall-kbrb0?file=/src/App.js

Dan Abramov wrote about how he'd [implement `useInterval()` as something that is declarative using this methodology](https://overreacted.io/making-setinterval-declarative-with-react-hooks/).
How to Insert Superscript and Subscript in Excel in Java
Tags: java, excel, superscript, subscript
Published: 2021-03-08 06:42:25

---
title: How to Insert Superscript and Subscript in Excel in Java
published: true
description: This article shows you how to insert superscript and subscript in Excel in Java.
tags: java,excel,superscript,subscript
//cover_image: https://direct_url_to_image.jpg
---
Superscript is a small letter or number typed above the baseline, while subscript is a small character or string that sits below the line of text. These two are commonly used in writing formulae, basic mathematical expressions, big numbers, footnotes, isotopes and many others.

In this article, we’re going to introduce how to apply superscript effect and subscript effect to text values in Excel documents, using Free Spire.XLS for Java.

##Installing Spire.Xls.jar

If you create a Maven project, you can easily import the jar in your application using the following configurations. For non-Maven projects, download the jar file from [this link](https://www.e-iceblue.com/Download/xls-for-java-free.html) and add it as a dependency in your application.
```java
<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId> e-iceblue </groupId>
        <artifactId>spire.xls.free</artifactId>
        <version>3.9.1</version>
    </dependency>
</dependencies>
```
##Using the code
```java
import com.spire.xls.*;

import java.awt.*;

public class InsertSubscriptSuperscript {

    public static void main(String[] args) {

        //Create a Workbook instance 
        Workbook workbook = new Workbook();

        //Get the first worksheet 
        Worksheet sheet = workbook.getWorksheets().get(0);

        //Insert text to B3 and apply subscript effect to selected text
        CellRange range = sheet.getCellRange("B3");
        range.getRichText().setText("NH3");
        ExcelFont subscriptFont = workbook.createFont();
        subscriptFont.isSubscript(true);
        subscriptFont.setColor(Color.red);
        range.getRichText().setFont(2, 2, subscriptFont);

        //Insert text to B4 and apply superscript effect to selected text
        range = sheet.getCellRange("B4");
        range.getRichText().setText("A2 + B2 = C2");
        ExcelFont  superscriptFont = workbook.createFont();
        superscriptFont.isSuperscript(true);
        range.getRichText().setFont(1, 1, superscriptFont);
        range.getRichText().setFont(6, 6, superscriptFont);
        range.getRichText().setFont(11, 11, superscriptFont);

        //Auto fit column width 
        sheet.getAllocatedRange().autoFitColumns();

        //Save the document 
        workbook.saveToFile("SubSuperScript.xlsx", ExcelVersion.Version2016);
    }
}
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/625ukncj8bxc0ldrue06.png)
Git Good with the Terminal!
Published: 2021-03-08 06:39:57

Git good wit the Terminal!

Let’s talk about some git commands!

Git commands allow for a team to work on different parts of projects at separate times. This I makes it so work can be passed between others, to be checked, revised, added, or deleted. Making it a very powerful tool in a developers toolbox!

As someone who is green to coding, starting git seems very intimidating. But the more I use it, the more I start to see how much can make work easier for me and my team.

Being able to save your code like game checkpoints, and them send those load files to other team members really speeds up the end game process and is crucial to development.

Today I’d like to share some of the things I’ve learn so far along the way!

So! Let’s GIT to it!

Lets Git start with Git clone!

Git Clone allows use to make an identical copy of a project and is saved to your computer. This puts a copy of your project in a local workspace to start working.
 
git clone <name-of-repository-link> 

Git checkout lets us go from one branch to another, thus making this one of the most useful git commands.
In order to switch between branches the changes in your latest branch must be committed.
You don't have to cd into the folder to build the maven project
Tags: java, maven, cli, shell
Published: 2021-03-08 06:20:43

Hello again dear reader! :-)

About two weeks ago i realized a thing about maven, which will come in handy when working on my build scripts again.

The title already says it pretty much. You don't have to cd into the project folder. You can just use the -f parameter and give maven the path to the directory to where the pom can be found.

Example:

```powershell
mvn -f D:\temp\mvnfromafar\ clean install
```

This is also possible but not necessary:
```powershell
mvn -f D:\temp\mvnfromafar\pom.xml clean install
```