teleren/devto huggingface dataset:
Headless WordPress with GatsbyJS 101
Tags: javascript, wordpress, gatsby, graphql
Published: 2020-08-24 06:36:17

WordPress has built-in support for Rest API. So Making WordPress headless is possible with many tools. In this article, I will show “how you can fetch data from WordPress site with GatsbyJS”.

Why GatsbyJS?
Making dynamic routes are easy and also customizable. Gatsby has some plugins that work out of the box to make WordPress headless easily and their documentation is also amazing. Gatsby also has default support for Graphql.

What do you need to know before you start following this article?
* WordPress, WordPress plugin installation
* Better knowledge of JavaScript
* Familiar with ReactJS, GatsbyJS, Graphql

![captain](https://media.giphy.com/media/85Q7aV4R5bxDO/giphy.gif)
<br>
At first install WordPress on a local environment or on a live server, then install these two plugins: [WP Graphql](https://github.com/wp-graphql/wp-graphql), [WP Graphiql](https://github.com/wp-graphql/wp-graphiql)
WP Graphql will create graphql API for WordPress and WP Graphiql will create a user interface for that. Give some time and get familiar with the interface.

Now install Gatsby CLI globally: `npm install -g gatsby-cli`
Then install a Gatsby starter: 
`gatsby new wp-gatsby https://github.com/gatsbyjs/gatsby-starter-hello-world`
It will install a Gatsby starter project in `wp-gatsby` directory. Now `cd` into that folder and run: `gatsby develop`

Now you can see your new Gatsby site running on: `http://localhost:8000/`
Install “Gatsby Source WordPress” plugin: `npm install gatsby-source-wordpress`. And change `gatsby-config.js` file like below:
```js
module.exports = {
  plugins: [
	{
		resolve: `gatsby-source-wordpress`,
		options: {
			baseUrl: `siteUrl`, // site url without http/https
			protocol: `http`,
			hostingWPCOM: false,
			useACF: false,
		},
	},
  ]
}
```

This Gatsby plugin will help to fetch data from your WordPress site with Graphql. Now again run `gatsby develop`, and go to: `http://localhost:8000/___graphql`. Here you will see almost the same Graphql IDE which you have seen earlier in your WordPress site... ..

**Read the original full article on my [blog](https://blog.abmsourav.com/headless-wordpress-with-gatsbyjs-101/)**
First NPM publication. 
Tags: javascript, node, npm, opensource
Published: 2020-08-24 06:33:34

For all these years, I have used various NPM packages and I have always wanted to create one of my own. Finally I did it. Published my [first NPM package](https://www.npmjs.com/package/validatorswithgenerators).
Its a combination of small helper methods that I use personally for my NodeJS development.
Any one can use this package for `data validations` and generating some helpful data, like `current date` in a specific format or getting the `difference between 2 dates` and so on. 
For more details you can read the documentation from [Github](https://github.com/Pronoy999/ValidatorsWithGenerators). 

What are your thoughts for this package? How can this be improved.
Svelte/Sapper Issue with Switching Components
Tags: javascript, webdev, svelte
Published: 2020-08-24 05:48:34

I ran into what might be my first Svelte bug when working on the [Big2 card game project](/blog/2020-04-22-big-2-card-game-svelte-jam-stack). Very roughly, I have a page setup that looks like this (`<script>` and `<style>` sections omitted, and unrelated component properties omitted):

```js
<main>
  {#if $state === 'game'}
    <GameStageLocal />
  {:else if $state === 'deal'}
    <DealAnimation onDone={dealingDone} />
  {:else}
    <div>Initializing...</div>
  {/if}
</main>
```

The `<DealAnimation>` component plays some game start animation and when it's done, it calls the `onDone` handler passed into it. What it will do is to update `state` (a Writable Store) to `game` so the interactive game UI will start.

As you can deduce from the code above, `$state` is an auto-subscribed store so when its value changes, it would change the DOM on the page such that `<GameStageLocal>` is now what's on the page, and `<DealAnimation>` would be removed from the DOM.

When testing it, the Firefox console gave the following error:

```
TypeError: t.parentNode is null
```

It was a bit baffling since I couldn't really find an error in my Svelte code and there wasn't any error in the Svelte dev build output. Upon searching online, I came across [this StackOverflow post](https://stackoverflow.com/questions/58768701/sapper-how-do-i-fix-parentnode-is-null-when-navigating-away-from-a-page-with) which has exactly my issue. Although the answer mentions that:

> Ran into this error recently. In my case it was due to another library changing the DOM. (In my case fontawesome)

I was not using another library to change the DOM; only Svelte. Either way, though, the described fix in the answer worked for me, which was to wrap my components inside those conditions in another node, like below:

```js
<main>
  {#if $state === 'game'}
    <div>
      <GameStageLocal />
    </div>
  {:else if $state === 'deal'}
    <div>
      <DealAnimation onDone={dealingDone} />
    </div>
  {:else}
    <div>Initializing...</div>
  {/if}
</main>
```

And this worked fine.

## Parting Thoughts

I think this does go to show the relative immaturity of Svelte in general, compared to React or Vue. I remain a fan of Svelte, but nevertheless it's good to keep in mind that when you use a small framework, you're bound to run into actual bugs in the framework.
Awesome JavaScript Resources
Tags: javascript, beginners, 100daysofcode, github
Published: 2020-08-24 05:45:49

>Here is a curated list of awesome JavaScript resources for beginners.

*****

This covers almost every area of JavaScript with enough resources (articles and videos) to learn.

*****

Link to Repository - https://github.com/olawanlejoel/Awesome-Javascript

{% github olawanlejoel/Awesome-Javascript %}

*****

**Endeavor to create a PR if you have any other JavaScript resource that you feel should be part of this awesome list.**

*******

>Don't forget to ⭐ this repository and share with friends if you found it useful.

******

As always, any questions or suggestions, please feel free to leave a response or [tweet me](https://twitter.com/olawanle_joel) 🤭! Be sure to connect with me on socials! 😎
A Web Monetization Story
Tags: webdev, webmonetization, showdev
Published: 2020-08-24 05:38:38

@sharon and I are creating [*A Web Monetization Story*](https://esse-dev.github.io/a-web-monetization-story/), an interactive Web Monetization tutorial for online creators. The tutorial follows along with Auden, a blogger who is experimenting with Web Monetization on their site. If you are interested in setting up Web Monetization on your own site, or want to get others involved in Web Monetization, you may be interested in [*A Web Monetization Story*](https://esse-dev.github.io/a-web-monetization-story/).

We are creating this project for the [BetaHack ‘Fix The Internet’ virtual Hackathon](https://betahack.devpost.com/). There are seven days remaining in the hackathon. We are posting here, on DEV, in order to ask for honest feedback on what we have created.

We hope that you enjoy what we have created. We also hope to keep improving on it, so we want to hear from you! Thank you for reading and supporting us!

# Excerpt

> I run a blog about my adventures with Chicken — my dog!

>Recently, I came across something called Web Monetization. It’s a new way for online creators to monetize their sites and for website visitors to support creators. It seeks to promote a more flexible, inclusive and privacy-respecting way of transferring money.

<hr>
*P.S. vote for @sharon in the [2020 HackerNoon Noonies - Best Web Monetization Innovator Category](https://noonies.tech/award/best-web-monetization-innovator)!*
How to Use Excel LOG Function in Office 365? – (with Examples)
Tags: excelfunctions, excellogfunctioninof
Published: 2020-08-25 03:41:36

---
title: How to Use Excel LOG Function in Office 365? – (with Examples)
published: true
date: 2020-08-24 05:30:44 UTC
tags: ExcelFunctions,ExcelLOGFunctioninOf
canonical_url: https://geekexcel.com/how-to-use-excel-log-function-in-office-365-with-examples/
---

## LOG Function in Excel:

In this article, we are going to see the **Excel LOG Function in Office 365** with its syntax, explanation, and examples. Let’s get into this article!! Get an official version of **MS Excel** from the following link: [https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)



## LOG Function – Explanation:

- This function **returns the logarithm of a given number** using the specified base.
- If you don’t give the base value, it takes 10 as a base value by default.

## Syntax:

**=LOG(number,[base])**

### Argument Explanation:

**Number** – The input number to which you want the logarithm.

**Base** – It is optional. The base of the logarithm. If the base is omitted, it takes **10** by default.

### Note:

- If you give non-numeric values such as letters and special characters to the argument, it will return **#VALUE!** Error.
- If the argument’s value is a negative integer, it returns **#NUM!** Error.

## Examples:

Let’s see some examples to make it clear.

### Example 1:

- Refer to the below example image.
- You can see the input numbers in **Column A** , the base value in **Column B** and their corresponding logarithm values are listed in **Column C**.

![Example 1](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/08/1-60.png)<figcaption id="caption-attachment-12227">Example 1</figcaption>

- If any argument is a non-numeric value such as letters or special symbols, a LOG function will return **#VALUE!** Error.

![Example 2](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/08/2-45.png)<figcaption id="caption-attachment-12228">Example 2</figcaption>

- If the argument’s value is a negative integer, it returns **#NUM!** Error.

![Example 3](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/08/3-37.png)<figcaption id="caption-attachment-12229">Example 3</figcaption>

From the above screenshots, you can clearly understand the usage of the **LOG Function** in Excel.

## Verdict:

In the above article, you can understand how to use **Excel LOG Function in Office 365** with its syntax, explanation, and examples. Share your **feedback** in the below comment section. Thanks for visiting **[Geek Excel.](https://geekexcel.com/)** Keep Learning!!

### Similar Articles:

- [LN Function in Excel 365](https://geekexcel.com/how-to-use-excel-ln-function-in-office-365-with-examples/)

### See Also:

- [How to Use Excel FLOOR.PRECISE Function in Office 365?](https://geekexcel.com/how-to-use-excel-floor-precise-function-in-office-365/)
- [How to Use Excel GCD Function in Office 365? – with Examples](https://geekexcel.com/how-to-use-excel-gcd-function-in-office-365-with-examples/)

{% youtube gFez16nckDw %}
Enumerable Module in Ruby
Tags: ruby, rails, enumerable
Published: 2020-08-24 05:26:26

Ruby's Enumerable module adds magical methods
to classes like `Array` and `Hash`.
In this post, we will learn to implement enumeration with an example.

## Enumeration

Enumeration is a process of traversing over objects one by one.
To make a class enumerable, we can include `Enumerable` module.
Thus, giving access to methods like `#map`, `#filter`, `#count`, `#include?`, `#any?`, `#uniq` and a lot more!

## #each

Enumerable module maily relies on `#each` method on the implementing class.
The `#each` method is implemented such that when a block is passed,
the contents of the collection are evaluated.

```ruby
> [1, 2, 3].each { |a| a }
=> [1, 2, 3]
```

## Enumerator

Enumerator is a class which allows manual iteration over an enumerator object.
When `#each` is called without a block, it returns a new `Enumerator` object
hence allowing to chain multiple enumerators.

```ruby
> enumerator = %w[foo bar baz].each
> enumerator
=> #<Enumerator: ["foo", "bar", "baz"]:each>

> enumerator.map.with_index { |w, i| "#{i}:#{w}" }
=> ["0:foo", "1:bar", "2:baz"]
```


Check out my full post here for an example of a LinkedList with enumerable module.
https://www.sandipmane.dev/exploring-rubys-enumerable-module
Debugging C++ in macOS 
Tags: beginners, codenewbie, cpp, vscode
Published: 2020-08-24 05:04:11

<span>Cover photo by <a href="https://unsplash.com/@clemhlrdt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Clément H</a> on <a href="https://unsplash.com/s/photos/programming?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>

##### Trying to figure out how to add user input while debugging C++ on macOS in VScode? You've come to the right place. I spent a load of time figuring it out so that you don't have to.

###### Aight, I'll make this post a tl;dr and give references for further reading at the bottom. 

## Step #1
##### Update your tasks.json file (In case you don't know what that is, I suggest you head over [here](https://code.visualstudio.com/docs/editor/debugging) and then get back) with the following piece of code.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vd2rsfxhrs5cnguatkkc.png)

<code>{"label": "Open Terminal",
"type": "shell",
"command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'",
"problemMatcher": []
}
</code>
#### Now just run this task before running the c++ file, and in the launch.json, set ```externalConsole: true``` 

##### Your tasks.json should look something like this now.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ivy6e5ic7a6kg301lnwi.png)

## Step #2

#### Now hit ```cmd + shift + P``` and type in ">run tasks" without the quotes of course.

#### And you should see something like this.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p58169ah59wy9bxkgjzq.png)

##### Click on ```open terminal``` 
##### and it launches a terminal. Smash the allow button once twice or as often as it asks and you're set. 
### Boom.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ffyxwz3b0x9i9stvrah0.png)

##### You'll have the terminal launched, and now when you run the actual g++-10 debug and run task, it should work fine.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3dumlimysje683th01q7.png)
##### See how the editor is in debug mode, and the terminal on the left is ready to accept input. 

##### Hopefully this helped :)

###### In case you'd like to know more about this issue, head over [here](https://github.com/microsoft/vscode-cpptools/issues/5079)
Is there a way to analyze What this function is doing so i can understand it better in Python 3.8 ?
Tags: python, beginners, tutorial, ddsry
Published: 2020-08-24 04:47:58

There are many different ways, but try putting an English comment above each
line describing what the line does.


▪ Another trick is to read code loudly.


▪ Yet another way is to print the code out and draw on the paper with pictures
and comments showing what's going on.
Create your first NODE server
Tags: node, server, javascript
Published: 2020-08-24 04:21:42

---
title: Create your first NODE server
published: true
description: Create your first NODE server
tags: nodejs, server, javascript
//cover_image: https://direct_url_to_image.jpg
---

**prerequisite software**
`node, express, npm, yarn, or any code editor`
**Step 1:** create a folder like node-api in desktop or any location in your computer
**Step 2:** open VS Editor > Terminal (keyboard command : Ctrl + ~)
then run `yarn init`. Create a `package.json` file
```{
  "name": "app",
  "version": "1.0.0",
  "license": "MIT",
}```
**Step 3:** create a `index.js` file into `app` folder
```
const express = require('express');
const app = express();

app.get('/', (req, res) => {
    res.send('I am from Node JS!!')
})
app.listen(4000, () =>{
    console.log('server created and listening port 4000')
})
```
Solving CodingSignal's First Duplicate problem
Published: 2020-08-24 04:17:24

Here is the prompt for the question:

> Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. If there are no such elements, return -1.

We'll be taking advantage of the object data structure to solve this problem. The property of the object that will be coming in handy is that object's can only store unique keys. This will allow us to only make 1 pass through the array and keep track of what we have already seen. 

```
const a = [2, 1, 3, 5, 3, 2]

function firstDuplicate(a) {
  let obj = {}
  for (let i = 0; i < a.length; i++) {
      if (obj[a[i]]){
          return a[i]
      } else {
          obj[a[i]] = 1;
      }
  }
  return -1
}

firstDuplicate(a) // 3
```

So taking a look at our code here, we immediately create the object where we will be storing our keys.

To iterate through the array, we'll just be using a for loop. For each item in the array, we will be checking if the value is already a key in our object. If it is not in our object already, we will creating that key. If it is already in our object, we know that we've already seen that number before in our array. At that point, all we have to do is return that number!

It really is that simple to solve this problem. And we've taken advantage of the object to get a linear, O(N), solution.
Rust Programming Language - Error Handling Isn't All About Errors
Tags: rust, webdev
Published: 2020-08-24 03:56:16

Error handling in Rust is incredibly diverse and constantly evolving. As such it is often a source of confusion for new and experienced rustaceans alike. This talk aims to clarify what error handling in rust means, the patterns that exist, when to apply them, and what libraries currently exist to help with the task.

{% youtube 7X59hZ5ZUfc %}
Why is the % character a "modulus" and not a "percent" in Python?
Tags: python, programming, codenewbie, 100daysofcode
Published: 2020-08-24 03:49:25

Mostly that's just how the designers chose to use that symbol. 

▪ In normal writing, we are correct to read it as a "percent."


▪ In programming, this calculation is typically done with simple 
division and the / operator.


▪ The modulus is a different operation that just happens to use the % symbol.
Hello from The Gifted Geek Sebastian Gordon
Tags: thegiftedgeeks, sebastiangordon, sebastiangordonthegiftedgeek
Published: 2020-08-24 03:15:16

This is my first post and my objective is just to say hello and introduce myself. I’m Sebastian Gordon and my friends call me the gifted geek. I’ve adopted this name and feel empowered by it! 

I’m a #codenewbie and I love learning to code using python, HTML, css and Java. I’m obsessed with raspberry pi and Arduino and have about 100 projects on the go.

I’m currently working on coding some games using python specifically, so please stay tuned. 

Check out my YouTube channel, I promise you more videos focused on some of my more interesting projects will be posted soon! 

#sebastiangordon #thegiftedgeek #sebastiangordonthegiftedgeek #thegiftedgeeks
What Do Love About Sir Ken Robinson?
Tags: career, discuss, beginners
Published: 2020-08-24 02:55:22

{% youtube iG9CE55wbtY %}

What I love about him besides his jokes. It is that he is one of the truly rare educators that I know in the education system. Who truly understands the importance of cultivating one's **creativity** and individual **talent** greatly, instead of measuring it through examinations.

He is similar to a lot of my teachers like a [GTO (Great Teacher Onizuka)](https://en.wikipedia.org/wiki/Great_Teacher_Onizuka) while I was growing up. Who imparts life lessons and look at us as individuals. Who sees greatness within us. Who knows that we will be able succeed in our own way, regardless of our academic results.

Please share on what is it that you love about Sir Ken Robinson? how does he resonate with you? I would love to read about it. :)
What is Variable in Python Programming Language ?
Tags: python, codenewbie, ddsry, beginners
Published: 2020-08-24 02:45:54

Variable in Python:


▪ Variable is a Container where you can put your values.

eg: a=3

▪ a is a name of a variable and 3 value is stored in Variable Container.

print() is use to print to value of a variable.

▪ In variable we can change value of a variable.

▪ In Python we do not have to Declare / Define Variable.
VSCode Clean & Minimal Setup
Tags: vscode, setup, webdev, beginners
Published: 2020-08-24 02:41:18

**VSCode ( default Theme )**

![No Theme](https://dev-to-uploads.s3.amazonaws.com/i/y9r66yt6upql4nh2ba9g.png)

**VSCode ( [MonoKai Pro Theme](https://marketplace.visualstudio.com/items?itemName=monokai.theme-monokai-pro-vscode) )**

![Monokai Pro](https://dev-to-uploads.s3.amazonaws.com/i/xaau0qhlcte03sm86fns.png)

**VSCode ( [Noctis Theme variations](https://marketplace.visualstudio.com/items?itemName=liviuschera.noctis) )**

![Noctis theme](https://dev-to-uploads.s3.amazonaws.com/i/kf819e74hqt8hhgct1m4.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jmvey6t3ttvbbht8zyvo.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jcbxzn7vpbf6e7spgrau.png)


# Setup

**settings.json**

```json
{
  "editor.fontSize": 13,
  "editor.fontFamily": "Operator Mono",
  "editor.lineHeight": 40,
  "editor.minimap.enabled": false,
  "editor.scrollbar.horizontal": "hidden",
  "editor.scrollbar.vertical": "hidden",
  "editor.lineNumbers": "off",
  "editor.wordWrap": "on",
  "editor.renderLineHighlight": "none",
  "editor.renderIndentGuides": false,
  "editor.overviewRulerBorder": false,
  "workbench.editor.showTabs": false,
  "editor.hideCursorInOverviewRuler": true,
  "workbench.tree.renderIndentGuides": "none",
  "breadcrumbs.enabled": false,
  "workbench.statusBar.visible": false,
  "workbench.activityBar.visible": false,
  "workbench.startupEditor": "newUntitledFile",
  "window.nativeTabs": true,
  "workbench.iconTheme": "Monokai Pro Icons",
  "workbench.sideBar.location": "right",
  "git.enabled": false,
  "workbench.colorTheme": "Monokai Pro"
}
```


**keybindings.json**

```json
// Place your key bindings in this file to override the defaults
[
  {
    "key": "cmd+t",
    "command": "workbench.action.terminal.toggleTerminal"
  },
  {
    "key": "ctrl+`",
    "command": "-workbench.action.terminal.toggleTerminal"
  },
  {
    "key": "delete",
    "command": "workbench.action.closeAllEditors"
  },
  {
    "key": "cmd+k cmd+w",
    "command": "-workbench.action.closeAllEditors"
  }
]

```

open other file from tabs ( `ctrl` + `Tab` )

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/chfmcg29tjhejr14iii0.gif)

toggle file explorer ( `⌘` + `B`  )

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cl418s5h14f2y7f3iuld.gif)


**Thanks**

> Feel free to ask any questions about my setup & Also share your setup too !!
About Mgbaram Ebuka Joseph
Published: 2020-08-24 02:14:31

My name is Joseph popular known as Josh cause of my love for music "I love to talk about music and I also blog on, <a href="https://litemusics.com/category/Album">Download Music Albums</a> so I use my leisure time to blog new songs on aimloaded.com.ng. My primary duty is music, so my day basically consists of trying to make music accessible to people as quickly and carefully as I can."