teleren/devto huggingface dataset:
How to Secure API Token
Tags: todayilearned, security, github
Published: 2020-07-28 09:57:32

If you are into this tech world for a while. I'm sure you heard about the word API. API is **Application Program Interface**. For example, Google has API which gives user details access to third party softwares. So basically API acts as bridge to pass secure information to authenticate third party softwares. To authenticate this third parties API token is required. 

Many contributors use this API tokens to create some unique products like creating Telegram Bot, Slack Bot. Although product was built successfully. Contributors get recognised by showing their code to Dev Community. To do that they need to secure the API token before they publish it to github. 

Table of Contents:
[Securing API tokens on Windows](#chapter-1)
[Securing API tokens on Github](#chapter-2)
[Securing API tokens on Heroku](#chapter-3)

## Securing API tokens on Windows:<a name="chapter-1"></a>

To secure API token you need to define them in the environment variables.

1. Search the `Environment Variables` you will find *Edit the Environment variables,* open it. you will find these
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vq21c4d7ms9cry749glz.png)
2. Then go to Environment Variables. Click on the New button then add the api token with some variable name and note the variable name
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jo6clsnzk8qff5tqwbzv.png)

3. After adding this Variable then Restart it. 

Now you can use this API token across any code in your local system.

## Securing API tokens on Github:<a name="chapter-2"></a>

1. First upload your Repo in the GitHub. Open the Your Repo Settings tab as shown below.

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

2. Then open Secrets on the left side as shown in above picture.

3. Then add new Secret with Var name and API token. 

4. Now this variable works across the Repo.

And Secret Variable won't disclose to any other users or third parties by GitHub. 

## Securing API tokens on Heroku:<a name="chapter-3"></a>

In heroku you can do this in two ways either through Heroku CLI or Dashboard. 

### Heroku CLI

1. Open cmd and login to Heroku with `Heroku login`
2. Go to your Project Folder
3. Then use this command `heroku config:set S3_KEY=8N029N81 S3_SECRET=9s83109d3+583493190`

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

Now you can use variable name anywhere in the Project

### Heroku DashBoard:

1. First Create app in the Heroku
2. Goto App settings tab
3. Goto Config Vars and add your API tokens
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qcqdtf4sp7mzuw9raeh3.png)


This is it. Hope this post is helpful to you!
If you like my post like it, Share it and if you have a doubt comment down below 👇
Contact me: [LinkedIn](https://www.linkedin.com/in/maheshthedev/) · [GitHub](https://github.com/maheshthedev)
401(unauthorized error ) while invoking(consuming) a REST URL from ReactJS
Published: 2020-07-28 09:52:09

  Hi ,
I have following code to invoke a REST URL from React Js .

const encodedString = Buffer.from('password').toString('base64');
handleClick = () => {
axios.post('URL', {
  auth: {
    username: "username",
    password: encodedString
  },
  data: {
    CDO_Office: "Yes"
  },
  headers: {
    accept: 'application/json'
  }
})
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.log(error);
    console.log(encodedString);
  });

But i am getting following error.
Error: Request failed with status code 401
    at createError (createError.js:16)
    at settle (settle.js:17)
    at XMLHttpRequest.handleLoad (xhr.js:59)
How to secure Android application which you are developing.
Tags: android, appdevelopment, security, secureandroidapp
Published: 2020-07-28 09:36:51

https://www.javaoneworld.com/2020/05/how-to-develop-secure-android-app.html

Are you #androiddeveloper ,
How are you on your security knowledge of your app?
May be this article will help you.
#androiddev #androidappdevelopment #androidapps #androidapplication #securityandrisk #secureandroidapp #securitysolutions #securityfirst #sharingiscaring #sharingisthenewlearning #sharingknowledge 

https://www.javaoneworld.com/2020/05/how-to-develop-secure-android-app.html
Different Ways to Redirect User
Tags: laravel, webdev, php
Published: 2020-07-28 09:23:12

redirect() is one of the most used and popular helper function. This function redirects users to different URLs of the website. By using this method, we can redirect the user to pages with or without data.
Redirect to different URL

This is the most and simplest form in which the redirect method is used. We can redirect a user to the homepage by simply using the method below:

```
return redirect('/');
```

Users can also pass parameters inside the redirect method. The parameters given in the method will be added to the URL of the base application.

```
return redirect('contact');
```

Likewise, users can also pass more parameters:

```
return redirect('user/profile');
```

## back() in Laravel

If the user wants to perform some sort of tasks and redirect back to the same page then the user can use back(). This method is also really helpful.

```
return redirect()->back();
```

## Redirect to Route

Users can also name the routes in the application for consistency. Some users call named routes instead of using URLs. Let’s see an example to make this concept clear.

```
return redirect()->route('profile.index');
```

We can also pass the second parameter in route() in the form of an array. Let's see an example of a parameterized route.

```
Route::get('post/{id}', 'PostController@edit')-name('post.edit');
```

We can write the above above in simpler form which is here below:

```
return redirect()->route('post.edit', ['id' => $post->id]);
```

Read the details of the post in https://laravelproject.com/different-ways-to-redirect-user/.
How python append list
Tags: python, machinelearning, datascience
Published: 2020-07-28 08:57:26

 
append() and extend() in Python
Append: Adds its argument as a single element to the end of a list. The length of the list increases by one.
 <a href="https://www.pythonslearning.com/2020/07/python-list-append-multiple-times.html">python append list</a>
syntax:
Adds an object (a number, a string or a
another list) at the end of my_list
mylist.append(object) filternone
edit
play_arrow
brightness4 mylist = ['geeks', 'for']
mylist.append('geeks') print mylist
Output:
['geeks', 'for', 'geeks']
NOTE: A list is an object <a href="https://www.pythonslearning.com/2020/07/tic-tac-project-in-python.html">project</a>. If you append another list onto a list, the parameter list will be a single object at the end of the list.
filternone edit playarrow
brightness4 mylist = ['geeks', 'for', 'geeks']
anotherlist = [6, 0, 4, 1] mylist.append(anotherlist) print mylist
Output:
['geeks', 'for', 'geeks', [6, 0, 4, 1]]
extend(): Iterates over its argument and adding each element to the list and extending the list. The length of the list increases by number of elements in it’s argument.
syntax:
python tic tac game project code
Each element of an iterable gets appended
to my_list
mylist.extend(iterable) filternone
edit
play_arrow
brightness4 mylist = ['geeks', 'for']
anotherlist = [6, 0, 4, 1] mylist.extend(anotherlist) print mylist
Output:
want to <a href="https://www.pythonslearning.com/2020/07/tutorials-point-online-compiler-python.html ">compile</a> program in smart way
['geeks', 'for', 6, 0, 4, 1]
NOTE: A string is an iterable, so if you extend a list with a string, you’ll append each character as you iterate over the string.
filternone edit playarrow
brightness4 mylist = ['geeks', 'for', 6, 0, 4, 1]
mylist.extend('geeks') print mylist
Output:
['geeks', 'for', 6, 0, 4, 1, 'g', 'e', 'e', 'k', 's']
Time Complexity:
Append has constant time complexity i.e.,O(1).
Extend has time complexity of O(k). Where k is the length of list which need to be added.
Reference: https://www.pythonslearning.com/
🤦‍♂️Weekly fail (31/2020)
Tags: fail, lessonslearned, graphiql, json
Published: 2020-07-28 08:54:12

So I was testing out a new GraphQL endpoint to our headless CMS on my local. I used the GraphiQL explorer to compose the GraphQL query and send an Authorization header as the endpoint required valid credentials.

![GraphiQL with invalid header definition](https://dev-to-uploads.s3.amazonaws.com/i/b04d7h8ameahy54mrlat.png)

However, I kept getting a response `401: Unauthorized`. The authorization header was never present on the requests. But why when everything seemed to be correct? I was monitoring the requests using the Network tab, logged headers into the console on the server, nothing. For over an hour I could not figure out why my Authorization header is not being sent.

![GraphiQL shows the JSON is invalid](https://dev-to-uploads.s3.amazonaws.com/i/ixa8h3arogtd3hubvz6h.png)

Then I noticed it! A little red line near the closing bracket of my JSON headers definition. There was a trailing comma hidden behind the long Bearer token which made the whole JSON invalid and GraphiQL omitted it from the request. No alert box, no warning, just this tiny little red line 🤦‍♂️

*Lesson learned:* **If your headers are missing even though you defined them, check that your JSON is valid. You know what - always check your JSON is valid :D**
#100DaysOfCode | Day3,4
Tags: challenge, 100daysofcode, python, codenewbie
Published: 2020-07-28 08:44:04


▄█ █▀█ █▀█ █▀▄ ▄▀█ █▄█ █▀ █▀█ █▀▀ █▀▀ █▀█ █▀▄ █▀▀
░█ █▄█ █▄█ █▄▀ █▀█ ░█░ ▄█ █▄█ █▀░ █▄▄ █▄█ █▄▀ ██▄
__Day 3 and 4__
Hey everyone!
I'm not gonna leave this community .... hahaha
I just wanna share my experience about Day3 and 4.
The reason why I didn't write any post from two days ago was working on a problem which was a little bit confusing for me, I know maybe it can be sooooo easy for some of you but for me as newbie it was not!

so I **googled** a lot and read a lot of blogs and posts to solve that problem that I'm gonna share in the next post!

That problem called hamming!
At first when I was coding I wrote around 25 lines of code for that simple problem, :)   !
but after a day that I got mad, I told myself hey mand wake your lips, Keep Calm and __BeatBox__ cuz I knew that I'll find a solution for it.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zvqa5409t2yg9jkrrgz1.jpg)<figcaption>When a Soldier **BeatBoxing**(What about a Junior dev?)</figcaption>
finally I found Zip() function so helpful for that problem, and Ya know what? 
I danced a lot after solving that simple problem and Beatboxing when I was dancing! 
so trust in the process and Keep moving forward dudes.

Keep it up ツ

__Code with 💛__

__🅑🅐🅝🅙🅘__
FLIGHT SIMULATION SERVICE
Tags: flightsimulation, queppelin, ar, vr
Published: 2020-07-28 08:23:48

Queppelin provides various services for its customers and is developing and broadening its scope simultaneously. As we say, modern situations need advanced services Queppelin’s Flight simulator is one of the best-suited examples. We have the experience of developing the best flight simulator in the market. Queppelin provides services to worldwide aviation schools, airlines, training centres, and more. In this lockdown period, we provide cost-effective VR flight simulators for uncompromised training of your trainee pilots. We use the best software and techniques for developing different types of terrains such as windy, stormy, turbulence, and more, with the help of Virtual reality simulations, which makes the immersive scenarios more realistic and unique. Flight simulators have been used in pilot training since long; they were not realistic or too expensive but now the industry is changing and is infusing itself with immersive technology.
At first in 2019 the US Air force was the first one to launch the VR pilot training for its trainees. The training takes 12 long months to train and certify a batch of pilots but through VR headsets and advanced AI biometrics 13 pilots were trained and certified in a period of 4 months. VR infused pilot training is very beneficial as it costs $1000 per unit instead of millions. Nowadays instead of using a full-size cockpit mockup, the training academies are using VR headsets which are more portable and more effective in training the pilots. VR headsets as a flight simulation device are of great use for militaries as they like to train their pilots in remote areas. Queppelin’s flight simulation devices assist in terrain model creation for efficient and cost-effective training for aviation academies.
Imagine each day is only 12 hours long. What would you cut out?
Tags: watercooler, productivity
Published: 2020-07-28 08:12:15

I have started receiving a [newsletter from James Clear](https://jamesclear.com) and in the end there was the question:
## *"Imagine each day is only 12 hours long. What would you cut out?"*

It made me think, because still you have to sleep and then the rest is for a work or a family. Probably I would cut out eating 3 or more times a day, or social networks, prioritize meetings and concentrate only on one thing in IT.
<br>

**What would you cut out?**
Python
Tags: pythoninstallation
Published: 2020-07-28 08:05:33

Steps to install Python 
Step 1: Download Python 3 Installer
Step 2: Open the browser window and navigate to download page at python.org.
Step 3: Run the installer
Step 4: Download the installer
Step 5: run it and double click the file.

Check here for Python course.
https://www.fita.in/python-training-in-chennai/
Adding a README to your GitHub profile
Tags: github, git, tutorial, design
Published: 2020-07-28 07:57:33

Hello everyone, recently GitHub released a new feature that allows you to personalize your profile on the website in a very simple way, adding a README. You can see how [mine](https://github.com/rafacdomin) looked below:

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


# How to?

As I said before, it's quite simple, all you need to do is create a new repository with the same name as your username and add a `README.md` file to it
![MyProfile](https://dev-to-uploads.s3.amazonaws.com/i/lvjn6kfqva2ps2t3w0fh.png)

Now you only need to add some content (text, images, GIFs, emojis, etc.) to this `README.md` using the markdown syntax and commit the changes to the repo's main branch. Congratulations! This should be visible on your profile now :)
**If you are not familiar with markdown syntax, check this guide:** https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf


## Nice READMEs

Here are some examples of nice profiles that inspired me:

![martins-rafael](https://dev-to-uploads.s3.amazonaws.com/i/73ex4s6ywyu1p2imjn6g.png)
[martins-rafael profile](https://github.com/martins-rafael/)

![M0nica](https://dev-to-uploads.s3.amazonaws.com/i/fju3vvk96yq99ns7tkej.png)
[M0nica profile](https://github.com/M0nica)

![WaylonWalker](https://dev-to-uploads.s3.amazonaws.com/i/cnu583ragd9cd0n0cpcs.png)
[WaylonWalker profile](https://github.com/WaylonWalker)


If you need more inspiration [check this repository](https://github.com/elangosundar/awesome-README-templates) for more README profile examples.

---

I'm curious to see what your GitHub profile looks like, share the link to your profile below!
Java: Arrays!
Tags: java, datastructures, algorithms, tutorial
Published: 2020-07-28 07:53:43

Most interviews for an SDE (software development engineer) role require you to have a good grasp of Data structures and algorithms.

One important data structure is Arrays.

An array is a linear data structure and is famous for storing values at contiguous memory locations.

This article will help you to get started with arrays. 🥳

I will be using Java, but don't worry, you should be able to understand these pseudo-codes irrespective of programming language.

Let us understand the basic manipulation on arrays like insert, delete, sort, etc.

# 1. Create an array.
To create an integer array of size 100,
```java
int[] array = new int[100];
```
# 2. Insert an element into an array.
The following function will insert any element at any position specified by the user and will return the size of the modified array after insertion.
```java
int insert(int array[], int n, int x, int capacity, int position)
{
  if(n==capacity)
    return n; //cannot insert any element since exceeding capacity
  int index = position-1;
  for(int i=n-1; i>=index;i--)
    array[i+1]=array[i];
  array[index]=x;
  return (n+1); //returns the size of the new array.
}
```
# 3. Delete an element from an array.
The following function will delete any element at the position specified by the user and will return the size of the modified array after deletion.
```java
int delete(int array[],int n, int x)
{
  int i;
  for(int i=0;i<n;i++)
    if(array[i]==x)
      break;
    if (i==n)
      return n; // the element is not present in the array
    for(int j=i;j<n-1;j++)
      array[j]=array[j+1];
    return (n-1); // returns the size of array after deletion
}
```
# 4. Sort an array (Ascending order).
Java has an arrays class which can be used to sort arrays by importing java.util.Arrays.
```java
Arrays.sort(array);
```
These were the basic manipulation of arrays that can get you started with. If you want to dive deeper and master them to crack technical interviews, then try to build your logic to solve the following questions:

-> How to reverse an array?
-> How to find leaders in an array?
-> How to left rotate an array?
-> What is kadane's algorithm?
-> What is the sliding window technique?
-> How to solve the Trapping rainwater problem?
-> How to remove duplicate elements in an array?
-> How to find subarrays for a given condition?

If you can explore the above-listed problems and as well as solve the questions on your favorite coding platform, that should give you enough confidence to crack any type of coding question based on arrays. 🎉

To get started with, try [Hackerrank](https://www.hackerrank.com/) or [Hackerearth](https://www.hackerearth.com/). 👩🏻‍💻

Happy learning! happy coding! 💖
What is react router?
Tags: react, beginners, webdev, codenewbie
Published: 2020-07-28 07:51:42

This article was originally published at https://www.blog.duomly.com/6-most-popular-front-end-interview-questions-and-answers-for-beginners-part-2/#what-is-react-router

---

{% youtube kJcKwKM2j48 %}

Most of the applications built with React.js are SPA (single page application), but it doesn't mean your app will have only one view.

It means your app doesn't need to reload to another view, but how can we change views and go into the next page?

We can use a react router for that!

React router is the official and standard routing package that we use in React.js to change views, and move between pages.

With the React router, we can specify the whole routing for our modules that will decide what view should be visible when we enter the specified URL but not only.

React router gives us the possibility to create protected views like, for example, the view that we need to be logged in or have any special requirements to visit.

One more useful feature of the React Router is the routing history, that can keep all of the history of our views, and come back to the specified step when needed.

I couldn't forget to tell about handling the URL params like, for example, the id of element, to render the route that can show specified elements, and give you access to that param.

We can use routing navigation in a few ways. The most popular is to type URL, visit URL by a link inside the menu, or add data to the routing history.

On the example below, you can simple routing:

```
<Switch>
  <Route path="/about">
    <About />
  </Route>
  <Route path="/contact/:id">
    <Contact />
  </Route>
  <Route path="/contact">
    <AllContacts />
  </Route>
  <Route path="/">
    <Home />
  </Route>
</Switch>
```
<a href="https://www.duomly.com/?code=lifetime-80">![Duomly - Programming Online Courses](https://dev-to-uploads.s3.amazonaws.com/i/bde89cw4h64z765g2l4r.png)</a>

Thank you for reading,
Radek from Duomly
Ask Me Anything: Front-End Edition
Tags: javascript, css, ui, graphql
Published: 2020-07-28 07:32:17

---
title: Ask Me Anything: Front-End Edition
published: true
description: What questions do you want to ask a Software Engineer about Frontend Web Development? I will try to answer your questions to help you get started.
tags: JavaScript, CSS, UI, GraphQL
cover_image: https://images.ctfassets.net/f1aa79r6xovt/1YrYwmOFxJPOsn8oUH57L4/d8b4588b17b760c219065e850d2c45ab/jon-tyson-hhq1Lxtuwd8-unsplash.jpg
canonical_url: https://cole.codes/posts/ask-me-anything-front-end-edition
---
  
  
What questions would you like to ask a Software Engineer about Frontend Web Development? I will try to answer your questions via the following URL:

https://cole.codes/posts/ask-me-anything-front-end-edition


Photo by [Jon Tyson](https://unsplash.com/@jontyson).
How to Use TYPO3 Cookies (Helpful GDPR TYPO3 Extensions)
Published: 2020-07-28 07:09:06

As  GDPR applies to every business, large and small, around the world for website visitors to have more control over their personal information and can rest assured that there is enough security for their personal data. 

One should value the initiative and law and take steps to make visitors experience pleasant and data safe. Cookies play an important part in data storage

They are widely used on the web for storing information and providing a personalized browsing experience to users. Do you want to learn how to use TYPO3 Cookies on your TYPO3 website in a safer way? 

In this cookie guide, we will show you everything on TYPO3 cookies from setting to deleting and TYPO3 extensions for TYPO3 Cookies
 
What are TYPO3 Cookies?
How TYPO3 Uses Cookies?
How TYPO3 Extensions Use Cookies?
How to setup TYPO3 Cookie in Custom Extbase Extension?
TYPO3 Extensions to set cookies
 GDPR and TYPO3 Cookies
How to delete TYPO3 Cookie?

Read complete guide at - https://t3terminal.com/blog/typo3-cookie/
CREATE A .NET CORE API USING DAPPER
Published: 2020-07-28 06:58:29

This is part 1 of this tutorial. In this post I will be setting up a .Net Core API app using Visual Studio 2019 that uses Dapper ORM for the data access layer. I will set up DataAbstractions.Dapper to help extract the connection details away to help make the code more unit testable. In part 2, I will hook up a Azure Service Bus Queue to listen for messages. 

[Read more](https://teckstack.io/teck-blog/create-a-net-core-api-using-dapper/)
HOOK UP A .NET CORE APP TO A AZURE SERVICE BUS
Tags: azure, dotnet
Published: 2020-07-28 06:55:22

In [Part 1](https://teckstack.io/teck-blog/create-a-net-core-api-using-dapper/) of this tutorial, I set up a .Net Core API app using Visual Studio 2019 that uses Dapper ORM for the data access layer. I also set up DataAbstractions.Dapper to help extract the connection details away to help make the code more unit testable. This is part 2 of this series. In this tutorial, I will hook up a Azure Service Bus Queue to listen for messages.

[Read more](https://teckstack.io/teck-blog/hook-up-a-net-core-app-to-a-azure-service-bus/)
Elasticsearch MEOW attacks
Tags: elasticsearch, security, cassandra
Published: 2020-07-28 06:54:48

MEOW attackers have disabled thousands of Elasticsearch dependent databases in the last month.  The attack deletes all current indexes and writes new indexes with the suffix of "-meow", thereby disabling the database.

While nobody seems to know the purpose of the attacks since no demands for payment are connected to it, it seems to be targeted at Elasticsearch clusters that are exposed to the public.

A quick fix to protect yourself, particularly if Elasticsearch is part of a BAAS is to DISABLE HTTP in Elasticsearch configuration and to change the transport tcp port from 9300 to some other obscure port number, both in Elasticsearch and in any REST api front-end to your database.

This seems to remediate the problem in the short term.  In the long term, moving to a managed cloud solution seems to be the proper course of action.

Hope this helps!