teleren/devto huggingface dataset:
Programming.
Tags: programming, beginners, discuss
Published: 2022-07-23 19:56:00


**Is programming innate or acquired?**
A fellow Dev asked me this question and... Well here are my thoughts:
It's both.

- By innate we mean something natural, right? And in this context programming, I'm considering those geniuses you hear. People who are naturally good at solving maths and logic problems will understand and solidify programming concepts faster in comparison to those inclined towards theoretical perspectives. I say this because programming is all interactive i.e solving by doing, finding solutions to problems with increasing difficulty grows one minds and develops the grit to want to solve even more.

- Acquired - these two terms seem contradictory but work better when coupled together, by acquired I mean learning programming through class lectures or something of that sort. Programming classic are just as important as you might think. There's much to programming than one can ever know thus some sort of direction is needed for the track. One can be naturally smart, but without proper direction s/he wouldn't know what to do as programming is broad. It's for the same reason people read online tutorials and videos. Thus programming is both innate and Acquired.

**How would you have answered this question?**

Follow me on [GitHub](https://github.com/Namukuru254)
Why I code
Published: 2022-07-23 17:54:53

## Reasons why I code

- I had a bot idea
- Use tools to solve problems
- Create some neat things like web apps/sites
- Do something that not many others can do

### The Bot Idea

In 2017 I became a very active user of Discord, and with that I was led to find myself interacting with bots of all sorts. Something that would talk with you, some that would pull information down for a game, or just a basic calculator.

About a year later after messing with several bots I decided to create my own and I was onto the self-taught coding path. 

I was able gain a reasonable understanding of Python and took to the Discord.py library for coding my bot. I learned many things along the way. Throughout this journey I was able to talk with my peers and users of the bot in how it would better serve them, and with that I was able to bring the bot into a more usable state with the server I was the admin of.

### Problem Solving

I enjoy figuring out hard problems. To fantasize, I came across the [Millennium Prize Problems](https://en.wikipedia.org/wiki/Millennium_Prize_Problems), which are much harder to figure than I could ever hope to but was fun to read. These problems are some of the world's hardest to solve and only 1 out of the 7 have been solved.

With that said, when I hear someone telling me about how they wish they need to have a website created I can immediately reply with "how soon?".

Listening to their needs and being able to write the code required to meet these needs gives me a ton of joy when I find they are happy with what I have built for them.

### Creating Apps

The feeling of creating a web page that has interactivity and good presentation makes me want to start a whole new project so that I can get the same feeling over and over again.

Not all apps are fully featured which gives it some novelty and becomes humbling when HTML/CSS can look and feel better than some older React projects.

### Special Skills

Coding is definitely something not everyone will attempt or continue if they do. Coding has given me opportunities not only with creating code projects, but also a new way to look at reality.

Perhaps it's a little fantastic to think about coding as magic, but I've thought this way ever since my first "Hello World". 

Creating automation and working with Machine Learning is where I would like to end up someday, creating the thing that will be able to think for you.

I have many aspirations ahead of myself, and through code I will see how far that can get me.
Explain Aws API Gateway vulnerabilities Like I'm Five
Tags: api, vulnerabilities, javascript
Published: 2022-07-23 19:34:16

I have used API gateway to build business logic for my app that invokes lambda function. For security assurance, I have generated a VAT report of the base URL of API from my cyber security expert. A total of 9 Vulnerabilities have been detected including Four Medium, three low-level, and two informational-level vulnerabilities have been identified.

1. (CSP) Wild Card Directive
2. Content Security Policy (CSP) Header Not Set
3. Cross-Domain Misconfiguration
4. Missing Anti-clickjacking Header
5. Server Leaks Information via “X-Powered-By” HTTP Response Header Field(s)
6. Timestamp Disclosure – Unix
7. X-Content-Type-Options Header Missing
8. Charset Mismatch
9. Re-examine Cache Directives

how can remove these all Vulnerability ? is there a need to set or define custom headers? ( if yes then where and how I can do that, either be in API Gateway console or lambda script or in my client or app side code where this API Gateway base URL is invoking ) ?
Do you know CSS, but are trying to learn Tailwind? Help is here!
Published: 2022-07-23 19:22:00

Hello everyone!

I come from the world of web design and am moving into dev. I like the concept of utility classes, thus Tailwind. But sometimes it gets overwhelming. I ran across a great tool online that lets you write vanilla CSS, and it converts it to Tailwind classes.

The url for this tool is: https://tailwind-converter.netlify.app/

To use it, simply paste in your vanilla css and it will convert it to tailwind css as well as letting you know if there is not an equivalent tailwind value. I don't know if it can handle SCSS or not. The site loads with the following examples; you can type in and alter it to see what the conversion is. When you first visit the site, the editing screen looks like this:

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

You can either type over the provided example code -- you'll see the Tailwind CSS automatically update on the right-hand side, or you can clear the default examples and you'll see the following:

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

Simply type/paste in your code, and voila--instant Tailwind!
Becoming one percent better everyday.
Tags: productivity, learn, 100daysofcode, challenge
Published: 2022-07-23 19:12:00

## "A journey of a thousand miles begins with a single step."

Accepting this challenge allows me to break the limits of my knowledge and open new doors for growth. Starting is one thing, but being consistent dictates your journey. Being able to pull off this challenges allows you to track your growth and progress over time. 

## I encourage you to do the same! 

According to @allthecode, It's not for you to read. Instead, it serves as a storage of knowledge in which one can go back to! "Don't worry about making it interesting to read or feel like a story, it's a series of notes, events, error messages and solutions from your day that could be useful in the future."

### 100 Days of Productivity
This started as a challenge initially inspired by [Alexander Kallaway](https://github.com/Kallaway) [100-Days-of-Code](https://github.com/Kallaway/100-days-of-code). More info about our own challenge can be found [here](https://github.com/Erutidians/auto-dop)


## Challengers

These people inspired me to start this challenge. You can check my  [progress](https://github.com/daddygi/100-days-of-productivity) and their progress as well:

- [plskz](https://github.com/plskz/100-days-of-productivity)
- [yrnmsk](https://github.com/yrnmsk/100-days-of-productivity)
Simple Swift Challenges
Tags: swift, beginners, programming, ios
Published: 2022-07-23 18:48:13

Greetings 👋,

I've constructed 5 basic Swift challenges and listed them below. First, you'll find the challenges and further down the page you'll find the solutions. If you aren't able to solve them, before looking at the solutions, try to find some help through a Google search or at https://developer.apple.com/documentation/swift

Have fun :) 

1. Create a variable named greeting, assign it to the String hello, and print it to the console

2. Create a constant named pi and assign it to the Double 3.14, and print it to the console

3. Create a multiline string with the sentence - I love to eat, eat, eat, apples and bananas

4. Count the amount of characters in the multiline string

5. Print the multiline string in uppercase letters


*
*
*
*
*
*
*
*
*
*

1. Create a variable named greeting, assign it to the String hello, and print it to the console

   **var greeting = "hello"
    print(greeting)**

2. Create a constant named pi and assign it to the Double 3.14, and print it to the console

    **let pi = 3.14
    print(pi)**

3. Create a multiline string with the sentence - I love to eat, eat, eat, apples and bananas

    **var eatWhat = """
        I love to
        eat, eat, eat,
        apples and bananas.
    """**

4. Count the amount of characters in the multiline string

    **print(eatWhat.count)**

5. Print the multiline string in uppercase letters

    **print(eatWhat.uppercased())**
GraphQL Nextjs Help
Tags: graphql, node, nextjs, react
Published: 2022-07-23 18:37:50

Hey,
I have a problem here. I have searched alot to find the solution for this issue but didnt found any helpful solution for my problem 
let's get straight into the point

I have a nextJs app that's connected to the graphql api ,when I connect the Nextjs with the websockets link it generate an error :(

here's the client code 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zdx9no3ht02gnwsbqf01.png)


and here's the error 

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

here's the subscription query

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

I tried a lot and I have built this app in ReactJs and I it's worked perfectly I guess the problem in the SSR 
 
thanks in advance
Promise.all() - JavaScript Function
Tags: javascript, programming, webdev, tutorial
Published: 2022-07-23 18:37:37

In simple words, a promise is a placeholder for a value that's going to be available sometime later.

The Promise.all() method takes an iterable of promises as an input, and returns a single Promise that resolves to an array of the results of the input promises. This returned promise will fulfill when all of the input's promises have fulfilled, or if the input iterable contains no promises. It rejects immediately upon any of the input promises rejecting or non-promises throwing an error, and will reject with this first rejection message / error.

Try it at - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all

Promises are useful when handling asynchoronous operations.

`Promise.all()` is a built-in helper that accepts an array of promises (or generally an iterable). The function returns a promise:

```js
const allPromise = Promise.all([promise1, promise2, ...]); 
```

Then you can extract promises resolved values using a `then`-able syntax:

```js
allPromise.then(values => {

values; // [valueOfPromise1, valueOfPromise2, ...]

}).catch(error => {

error; // rejectReason of any first rejected promise

});
```


or `async/await` syntax:

```js
try {    const values = await allPromise;    
	 values; // [valueOfPromise1, valueOfPromise2, ...]  
} catch (error) {    
	 error;  // rejectReason of any first rejected promise  
	 }
```

If all promises are resolved successfully, then `allPromise` fulfills with an array containing fulfilled values of individual promises. The order of promises in the array does matter — you'll get the fulfilled values in that order.
But if at least one promise rejects, then `allPromise` rejects right away (without waiting for other promises to resolve) with the same reason.
Graphql requests with CURL
Tags: graphql, webdev, programming, tutorial
Published: 2022-07-23 18:29:21

### Make a GraphQL query request 
```jsx
curl 'https://countries.trevorblades.com/' \

-X POST \

-H 'content-type: application/json' \

--data '{

"query": "{ continents { code name } }"

}'
```

### Make a mutation request 

```jsx
curl 'https://graphql-api-url' \

-X POST \

-H 'content-type: application/json' \

--data '{

"query":"mutation { createUser(name: \"John Doe\") }"

}'
```

### Pass additional headers 

If you need to pass authorization in a header, add another `-H` argument:

```
curl 'https://countries.trevorblades.com/' \
  -X POST \
  -H 'Authorization: Token xxxxx' \
  -H 'content-type: application/json' \
  --data '{
    "query": "{ continents { code name } }"
  }'
```

### Printing response headers 

If you want to see response headers, add `-D -` (dump headers to stdout):

```
curl 'https://countries.trevorblades.com/' \
  -X POST \
  -D - \
  -H 'content-type: application/json' \
  --data '{
    "query": "{ continents { code name } }"
  }'
```

### Pretty printing response JSON 

If you want to pretty print the output JSON, add `| python -m json.tool` in the end of the curl call.

```
curl 'https://countries.trevorblades.com/' \
  -X POST \
  -H 'content-type: application/json' \
  --data '{
    "query": "{ continents { code name } }"
  }' | python -m json.tool
```
Origins estrutura básica Front-end
Tags: html, css, php, productivity
Published: 2022-07-23 17:50:46

Meu objetivo foi formar uma estrutura bem simplificada com bibliotecas nativas fonts, icones, animações e etc... E a partir disso você pode iniciar o seu projeto sem dor de cabeça somente com o que tem nos arquivos.

https://github.com/darlisamorim/Origins
Finished my NextJS tailwindcss portfolio!! 💎
Tags: react, nextjs, tailwindcss, portfolio
Published: 2022-07-23 17:27:57

Hey hey hey! Over the past few months I’ve spent some of my spare time building up my new portfolio website!

I built it using React, NextJS, and TailwindCSS. (Pure CSS for the animations)

I had a really fun time building and designing it and I plan to add a blog and other features too.

View it live at https://braydentw.io
It’s open sourced!! https://github.com/BraydenTW/braydentw.io
Starting a new tech journey.
Tags: security, aws, beginners
Published: 2022-07-23 16:55:00

So today I have decided to walk away from incident response it has taken a toll on my mental health and I want a change. Idk what that change is but I am starting with taking 1 step into cloud. 1. Learn linux 2. Learn Python 3. Learn cloud. Since I have adhd paralysis from being burnout in cybersecurity I am only focusing on expanding three areas of tech and see where that journey takes me next.
100 days of SwiftUI - Day 1 & 2
Tags: womenintech, ios, swift
Published: 2022-07-23 16:08:00

**[100 days of SwiftUI - Day 1](https://www.hackingwithswift.com/100/swiftui/1) - Simple Types**

**[100 days of SwiftUI - Day 2](https://www.hackingwithswift.com/100/swiftui/2) - Simple Types Part 2**

**Variables:**

To create a new variable we need to use "var" to initialize and define. 

```
var operatingSystem = "macOS"
```

**Strings and Integers:**

Swift is type safe. 
Strings and Integers can not be mixed. 
If there are larger numbers, we can use underscores as thousand separators making it easier to read. 

```
var str = "Hello"
var age = 25
var population = 8_000_000
```

**Multi-line String:**
Start and end with three double quote marks for multi-line strings, this will include line breaks. 
```
var str1 = """
This goes
over multiple
lines
"""

// This way will not show new line breaks in output
var str2 = """
This goes \
over multiple \
lines
"""
```

**Doubles and booleans:**
Doubles will hold a decimal value:
```
var pi = 3.141
```

Booleans will hold a true or false value:
```
var isCool = true
```

**String interpolation:**
Place any type of variable inside your string by adding a backslash \

```
var score = 85
var str = "Your score was \(score)"
var results = "The test results are here: \(str)"
```

**Constants**
Use the let keyword to create constants. Constants can be set once and never changed. 

```
let taylor = "swift"
```

**Type annotations**
Swift assigns each variable and constant a type based on what value it’s given when it’s created.

To be explicit about the data type, we can assign it:
```
let album: String = "Reputation"
let year: Int = 1989
let height: Double = 1.78
let taylorRocks: Bool = true
```
Setup Android Phone for Web Dev
Tags: android, webdev, termux
Published: 2022-07-22 20:35:27

---
title: Setup Android Phone for Web Dev
published: true
description: 
tags: android, webdev, termux
//cover_image: https://direct_url_to_image.jpg
---

### Install Termux and Nodejs package

For the purpose of this demonstration go to fdroid and download [Termux](https://f-droid.org/en/packages/com.termux/). Scroll to the bottom of the page and get latest Termux APK.

Open termux and run

`$ pkg update && pkg upgrade`

Install nodejs

`$ pkg install nodejs`


### Install Acode editor

From Fdroid download [Acode](https://f-droid.org/packages/com.foxdebug.acode/)

Acode is able to read the internal and external memory of the phone.

### Start building your project

Open Termux app and type

`$ termux-setup-storage`

If you type ls

```
$ ls
storage
$
```

You will see a permalink for folders called storage

Navigate into the internal storage and create folder  

`$ cd storage/shared`

Create project folder

`$ mkdir project`

Enter the folder

`$ cd project`

Create your files

`$ touch index.html style.css`

If you check inside internal storage using files app you will see created folder called project

### Use Acode for your first html project

Navigate to your project folder

Open index.html

Type html

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

Click html5 snippet

Add viewport meta 

`<meta name="viewport" content="width=device-width, initial-scale=1">`
 
 Link html and css
 
 
 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/48tlsdtefrj1yqfqfih6.jpg)
Navigate to `<body>` tag and paste

```
<h1>My First Heading</h1>
<p>My first paragraph.</p>
```

Go to style.css and paste

```
h1{
color: red;
}

p{
color: blue;
}
```

### Installing http-server

To see our first project we need [http-server](https://github.com/http-party/http-server) 

Open termux navigate to project folder and type

`$ cd storage/shared/project`

`$ npx http-server`

copy the given address for localhost I got

`http://127.0.0.1:8080`

Paste inside chrome url bar

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slq1ryebur1sev35voms.png)
Full-remote developers looking for a community!
Tags: remote, community
Published: 2022-07-23 15:42:38

I am a software developer working full-remote and moving around Europe for a bunch of reasons.

I would like to find (or build one!) online community with a real-time chat or something like that: I would like to meet people for a virtual coffee-machine and also share technical ideas, questions and materials with other experienced developers.
A community to refer to when I struggle with my code and where to help others, if I can!

Do you know something like that? Would you like to be part of that if I create one?
java code
Tags: javascript, webdev, beginners, programming
Published: 2022-07-23 15:12:00


```java
`/**
 * @author John Smith <john.smith@example.com>
*/
package l2f.gameserver.model;

public abstract strictfp class L2Char extends L2Object {
  public static final Short ERROR = 0x0001;

  public void moveTo(int x, int y, int z) {
    _ai = null;
    log("Should not be called");
    if (1 > 5) { // wtf!?
      return;
    }
  }
}`
```
Deploy Angular app to GitHub Pages
Tags: angular, github, githubpages
Published: 2022-07-23 15:06:30

Create new repository with name :

```jsx
Repo Name : USERNAME.github.io

// example
Repo Name : manthanank.github.io
```

Clone repository to the code editor

```jsx
git clone https://github.com/<username>/<username>.github.io.git

// example
git clone https://github.com/manthanank/manthanank.github.io.git
```

Navigate to the project using cd

```jsx
cd project-name/

// example
cd manthanank.github.io
```

Make sure angular is installed if not

```jsx
npm i -g @angular/cli
```

Create angular app using cli command

```jsx
ng new project-name --directory ./

// example
ng new angular-app --directory ./
```

Go to code

```jsx
code .
```

Next navigate to `angular.json` and make changes in 

```jsx
"outputpath": "dist/angular-app" => "outputpath": "any-name"

// example
"outputpath": "docs"
```

Build project

```jsx
npm run build
```

Push changes to GitHub :

```jsx
git add .
git commit -m "Initial commit"
git push
```

Go to repository in browser and refresh it, changes will reflect in repository 

Next Click on Repository Setting ⇒ Pages ⇒ In Source change folder and save

```jsx
/root => /docs
```

In few seconds your site will be live :

```
Your site is pubished at https://username.github.io

// example
[https://manthanank.github.io](https://manthanank.github.io)
```

Reference : 

[https://github.com/angular-schule/angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages)
Advanced logging in Javascript
Published: 2022-07-23 14:59:32

For advanced logging, use 𝗰𝗼𝗻𝘀𝗼𝗹𝗲.𝗴𝗿𝗼𝘂𝗽. It allows you create nested logging groups, with each group logs indented by an additional level.

You could also color your groups to make them even more visible.

Follow for more tips from the 𝗻𝗼𝗱𝗲𝗷𝘀 world :)



![console groups](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1iuqo676o28ga4nh209k.png)
Markdown notation in Hugo
Tags: hugo, markdown, jamstack
Published: 2022-07-23 14:57:47

This section shows how to write Markdown manuscripts in Hugo.

## Basic Markdown

For more information on how to write Markdown, see [Hugo - Markdown Guide](https://www.markdownguide.org/tools/hugo/).

![Markdown Guide(https://www.markdownguide.org/)](https://ayaco.gitlab.io/zerogravity/en/docs/tips/markdown/feature.png)

## Assign CSS classes to elements written in Markdown

See `attribute` in [Goldmark - Hugo](https://gohugo.io/getting-started/configuration-markup#goldmark) for more information. An overview is given below.

1. Put the following in `/config.toml`.

    ```
    [markup.goldmark.parser.attribute]
    block = true
    ```

1. Write class names such as `{.classA .classB}` on the next line of the block element written in Markdown in the original document.

    ```
    * Fruit
      * Apple
      * Orange
      * Banana
      {.fruits}
    * Dairy
      * Milk
      * Cheese
      {.dairies}
    {.list}
    ```

## Write HTML directly instead of Markdown

See `unsafe` in [Goldmark - Hugo](https://gohugo.io/getting-started/configuration-markup#goldmark) for more information. An overview is given below.

1. Put the following in `/config.toml`.

    ```
    [markup.goldmark.renderer]
    unsafe = true
    ```

1. Write HTML for the manuscript.

    ```
    * Fruit            ← I can write Markdowns and ...
    * Dairy
    {.list}

    <ul class="list">  ← I can write HTML too.
      <li>Fruit</li>
      <li>Dairy</li>
    </ul>
    ```

## Writing with shortcodes

Shortcodes are pre-defined HTML snippets by Hugo and various themes.
They include embedding videos and Instagram/Twitter articles that are difficult to express with Markdown alone, and generating links from manuscript paths that require server processing. See below for details.

| Shortcode provider | URL |
| --- | --- |
| Hugo | https://gohugo.io/content-management/shortcodes/#what-a-shortcode-is |
| Theme:Beautiful Hugo | https://github.com/halogenica/beautifulhugo#extra-shortcodes |
| Theme:Docsy | https://www.docsy.dev/docs/adding-content/shortcodes/ |