teleren/devto huggingface dataset:
Release 0.1 review
Published: 2020-09-25 19:47:52

# Release 0.1 review

Finding someone to work with is easy, I posted a link on the slack channel.
I was amazed that there are several people working on Golang.
 
To work with others' code, I found some different ways to do the same job. Actually, I enjoy reading others' code and excited when I found some improvements. Waiting for Someone reviewing my code is amazing too. It helps me to be a better programmer.
 
## The issues I found.

- [add go module](https://github.com/1jz/WISA/pull/8)

Add go module support to the project, so the source code can be put on anywhere(not only inside `GOPATH`).
 
- [remove duplicate links](https://github.com/isabellaliu77/urlChecker/pull/3)

After extract the links from the file, there are duplicate link in the array. I added a function to remove the duplicate links.
```go
// remove duplicate strings from a slice of strings
func removeDuplicate(urls []string) []string {
	result := make([]string, 0, len(urls))
	temp := map[string]struct{}{}
	for _, item := range urls {
		if _, ok := temp[item]; !ok {
			temp[item] = struct{}{}
			result = append(result, item)
		}
	}
	return result
}
```

- [improve for loops](https://github.com/tonyvugithub/GoURLsCheckerCLI/pull/5)

The for loop in Go is a little bit tricky, I found a tricky way to improve the for loop.

``` go
i := 0
for i < len(links) {
	ls := <-channel
	if ls.GetLiveStatus() == false {
		downLinks = append(downLinks, ls.GetURL())
	} else {
		upLinks = append(upLinks, ls.GetURL())
	}
	i++
}
// After
for range links {
	ls := <-channel
	if ls.GetLiveStatus() == false {
		downLinks = append(downLinks, ls.GetURL())
	} else {
		upLinks = append(upLinks, ls.GetURL())
	}
}
```
## Issues on my repo
- [update readme](https://github.com/yzwdroid/goURL/pull/1)

Some typos are fixed.

- [improve condition](https://github.com/yzwdroid/goURL/pull/2)

```go
// before
if *version == true {}

// after
if *version {}
```

Found an issue is harder than fixed the issue. The open-source world is fun to work with.
Are Coding Standards Inclusive?
Tags: a11y
Published: 2020-09-25 19:34:54

---
title: Are Coding Standards Inclusive?
published: true
description: A look at coding standards and how accessible they are
tags: Accessibility, Discuss
---
#Background
We've all been there; started a job and had the coding standards document passed to us to read.  As developers, it gives us a chance to decide if we *really* want to work with the company. We find out just if a company's thought process aligns with ours.

The standards may be a one page document, or a 100 page thesis, they may even point to a set of standards on the web.

This article isn't about what makes a set of coding standards good or bad from a technical viewpoint or even how long or short they should be.  It's about whether we've considered our colleagues or the community we've working with when we've defined them.  

I want to ask a set of questions based on things we've discussed when we talk about when building accessible websites and applications.

#Before we begin!
If you don't have a visual impairment (or even if you do), I highly recommend [Silk Tied Toolbar](https://silktide.com/resources/toolbar/), its a plugin for Chrome and lets users simulate some of the issues users may have when using applications.  Also download try some [speech recognition software](https://www.nvaccess.org/download/) and navigate around the web using it.

#Why is this important
The [2020 Stackoverflow Survey of developers](https://insights.stackoverflow.com/survey/2020#developer-profile-disability-status)
* showed 1.1% of respondents had difficulting seeing
* 0.7% of respondents of deaf/hard of hearing
* 0.3% can't walk without assistance
* 0.2% find it difficult to type

There are no stats for dyslexia in the figures or colour blindness.  In the UK 1 in 10 people have dyslexia and 1 in 12 men and 1 in 200 women are colour blind.

#Inclusive Code
I recognise the list of questions I ask isn't many;  want to the barriers to onboard for people with different challenges to onboarding in relation to coding standards.

##Speech Recognition Software
Using screen readers is memory intensive.  Does the concept of "self documenting code" help or hinder a screen reader user.  Should we be writing more comments to help screen reader users?

##Dyslexia
Colour contrast and themes can help people with dyslexia.  Tools such as JetBrains can help spell check code.  But does the enforcement of variable prefixes help?  What about camel case or pascal case which is better?

##Coding Standards In The Build Pipeline
Should build tools really be used for checking code when thinking about accessibility? If your build always fails because you can't work the way the tool wants you to, for example, some people really need the "_" prefix in order to be able to read a variable, but the pipeline won't accept that prefix.  If you can't get the build process fixed, are you going to stay in a job where you have to battle the processes?  

#Coding Standards Documentation
Finally don't forget to check that the coding standards documentation itself conforms to accessibility requirements!
How I am managing ton of Issue and Pull request message with Discord-Webhooks?
Tags: opensource, hacktoberfest, github, git
Published: 2020-09-25 19:29:08

Hey Maintainers, 

HacktoberFest is next week and you are getting a lot of issues and Pull request and finding a way to receive every update for that to manage your code.

it may sometimes hard to find issues and Pull request. what if you receive push-notification on your Pc/Mobile.

Have you ever used webhooks or Discord? With the help of Discord webhooks, you can get your GitHub Repository notification directly into your Discord Channel.

### Here I will tell you the step by step guide for that

- Create a person discord server and create a channel for your Github Repository where you will get notifications.

- Click on edit channel and click on `integrations` and make a webhook & copy URL for that

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

- Open your GitHub repository and click on `settings/webhooks`

- Paste your WEBHOOK_URl there in `payload_url` and add `/github` in the last of URL

Example- 
https://discordapp.com/api/webhooks/758896663891935243/ek_EDuBu-w04zy7Ym1GbUWGDACR5xBKvcts6eCYCfFVibY1F34ZQlw_fqiGAxIBb3MyF/github

- select content type to application/json.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s2qtx2p42iygh5609f3q.png)
- Click to send me everything and add webhooks.
- Click on a star to test notification in your Discord-server.

You can Like this Post if It helps you somehow.
Developer Dictionary: API
Tags: beginners, computerscience, codenewbie, firstyearincode
Published: 2020-09-25 19:16:18

This is the first paragraph for the API page on Wikipedia. I love Wikipedia but this is not what I'd want to read:

>An application programming interface (API)  is a computing interface which defines interactions between multiple software intermediaries. It  defines the kinds of calls or requests that can be made, how to make  them, the data formats that should be used, the conventions to follow,  etc. It can also provide extension mechanisms so that users can extend  existing functionality in various ways and to varying degrees.[1] An API can be entirely custom, specific to a component, or it can be  designed based on an industry-standard to ensure interoperability.  Through information hiding, APIs enable modular programming, which allows users to use the interface independently of the implementation.

This description is correct and precise of course but also meaningless to someone trying to quickly get a sense of the Thing called API.
 
Knowing what the acronym stands for is also not very meaningful. You may know the words application, programming, and even interface individually but putting them together doesn't lead to an immediate 'ah I see what it is now'.
So what is an API? Imagine a function. When you call a function in any programming language, you have some input parameters and you have an expected output value. For example if we have a function called sum we may pass in two numbers as input and expect to receive the mathematical sum of those to numbers as the output response.
 
Calling an API works similarly. You pass in some parameters as the input and expect to receive some output.  The difference between APIs and the function call analogy is that calling an API happens over the Internet. And the response usually contains data that is stored and maintained by the owner of the API.
 
It's a way of making a precise request to a server. Instead of requesting a webpage (HTML) we're requesting specific data (aka resource). [keep reading](https://bhumimakes.com/api/)
What is Open AI
Published: 2020-09-25 19:15:32

[OpenAI’s](https://openai.com/) mission is to ensure that artificial general intelligence (AGI)—by which we mean highly autonomous systems that outperform humans at most economically valuable work—benefits all of humanity. We will attempt to directly build safe and beneficial AGI, but will also consider our mission fulfilled if our work aids others to achieve this outcome.

OpenAI is governed by the board of OpenAI Nonprofit, which consists of OpenAI LP employees <a href="https://twitter.com/gdb" target="_blank">Greg Brockman</a> (Chairman & CTO), <a href="https://twitter.com/ilyasut" target="_blank">Ilya Sutskever</a> (Chief Scientist), and <a href="https://twitter.com/sama" target="_blank">Sam Altman</a> (CEO), and non-employees <a href="https://twitter.com/adamdangelo" target="_blank">Adam D’Angelo</a>, Holden Karnofsky, Reid Hoffman, <a href="https://twitter.com/shivon" taregt="_blank">Shivon Zilis</a>, and <a href="https://twitter.com/TashaMcCauley" target="_blank">Tasha McCauley</a>.

Investors include Microsoft, Reid Hoffman’s charitable foundation, and Khosla Ventures.


## Solving Rubik’s Cube with a Robot Hand

OpenAI trained a pair of neural networks to solve the Rubik’s Cube with a human-like robot hand. The neural networks are trained entirely in simulation, using the same reinforcement learning code as[OpenAI Five paired](https://openai.com/blog/openai-five)with a new technique called Automatic Domain Randomization (ADR). The system can handle situations it never saw during training, such as being prodded by a [stuffed giraffe](https://openai.com/blog/solving-rubiks-cube/#perturbations). This shows that reinforcement learning isn’t just a tool for virtual tasks, but can solve physical-world problems requiring unprecedented dexterity.

To continue reading, head over to [Box Piper](https://www.boxpiper.com/posts/open-ai/) source.

To read more such interesting topics, follow and read <a href="https://boxpiper.com/">BoxPiper blog</a>.

Support my work and [buy me a Coffee](https://ko-fi.com/E1E72C2MM). It'll mean the world to me. 😇

<a href="https://ko-fi.com/E1E72C2MM"><img src="https://cdn.ko-fi.com/cdn/kofi1.png?v=2"/></a>
Dealing with async jest tests
Tags: jest, testing, javascript, async
Published: 2020-09-30 22:23:51

---
title: Dealing with async jest tests
published: true
date: 2020-09-25 18:11:28 UTC
tags: jest,testing,JavaScript,async
canonical_url: https://www.jonathancreamer.com/dealing-with-async-jest-tests/
---

 ![Dealing with async jest tests](https://www.jonathancreamer.com/content/images/2020/09/delorean.jpg)

In [jest](https://jestjs.io/), there are a couple of different ways to handle tests which deal with async code.

Let's say way have a test that calls `fetchSomeAsyncThing()`.

```js
it('should call my api', () => {
  const result = fetchSomeAsyncThing();

  expect(result.foo).toBe('hello world')
});
```

This will fail.

Why?

Because of the way JavaScript handles async code.

When you call a function known to be async, whether it's something that returns a `Promise`, calls a `setTimeout`, etc, that function get pushed onto a call stack, and called wayyy after your tests have actually ran.

A stack is a data structure kinda like an array which basically means, the last thing that got put into it, is the first thing to come out. Read more about [stacks](https://github.com/trekhleb/javascript-algorithms/tree/master/src/data-structures/stack) and [async Javacript.](https://blog.bitsrc.io/understanding-asynchronous-javascript-the-event-loop-74cd408419ff)

## Use the done callback

If your async function returns a callback, several of the jest functions provide a done callback which you can use like this...

```js
it('should call my api', (done) => {
  const result = fetchSomeAsyncThing((result) => {
    expect(result.foo).toBe('hello world');
      done();
  });
});
```

As you can see, the callback to the `it` method above returns a `done` function.

This `done` function will tell jest that your async method is done and it will wait for that all to finish before wrapping up that test.

## Use promises

If your async function returns promises you can do one of 2 things.

```js
it('should call my api', (done) => {
  const result = fetchSomeAsyncThing().then((result) => {
    expect(result.foo).toBe('hello world');
      done();
  });
});
```

Similar to above, use the `done` function inside the `.then`.

Or, you can simply return the entire promise.

```js
it('should call my api', () => {
  return fetchSomeAsyncThing((result) => {
    expect(result.foo).toBe('hello world');
  });
});
```

In this case, jest will realize that the return value of the test was itself a promise, and will therefore wait until that promise fully resolves before wrapping up the test.

## Use async / await

Once again, if you know that your async function returns a promise, you can use the `async` and `await` features of [modern Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).

```js
it('should call my api', async () => {
  const result = await fetchSomeAsyncThing();
  expect(result.foo).toBe('hello world');
});
```

The `async` / `await` method is a nice, clean way to read the code.
Vaccines for Common SQL Injection Bugs
Tags: security, sql, database
Published: 2020-09-25 19:06:15

*I chose to connect SQL to the Web through option 2, a more SRA/ security-based approach*

SQL Injection is one of the most common web hacking techniques (w3schools.com). In cases where SQL databases are queried by site visitors, these injections pose a big threat to the database. SQL injections allow a user to send malicious code to a database by inserting a SQL command into a web input field. Without proper defense against them, websites can be left vulnerable, and massive data leaks can occur as a result.

Below, I take a look at some of the most common SQL injection 

##1=1

One of the most common approaches to SQL injection is the 1=1 method. This is often used to gain unauthorized access to a user account. In this case, a false password is entered into the password field, followed by a quote mark and `OR 1=1--`

This allows the unauthorized user to bypass the password field of the login page, because the database reads that it is supposed to allow a login `WHERE Password = ... OR 1=1` Because 1=1 is always true, the user will be allowed in and the rest of the line is commented out. 

##Batched Statements

Another common SQL Injection is the batched statement. These injections finish a legitimate statement with a semicolon **;** before executing their malicious statement. For example, if a user enters details into a search box, and the search is selecting some information where a condition is true, after giving the parameter, a user can insert their malicious code.

##Exploitation through URL

Lastly, if a user can see part of an SQL query via the URL for example `http://widgetshop.com/widget/?id=1`, they are able to understand how the query is formed in order to change manipulate the URL and create malicious queries. In this case, the user can easily append additional SQL statements to the end of the query for example `...OR 1=1` and see more data than intended. 

##Solutions

Clearly, using user input to craft SQL Queries is a big vulnerability. Thus, finding a way to protect your database from malicious requests is essential to maintaining data security. In order to avoid malicious input to your site, you need to use one (*or many*) abstractions so that only valid input is accepted into the SQL command.

One abstraction that can be used to solve this issue is to parameterize the SQL statements outbound for the database so that they are treated properly. In order to do this, the SQL statement string and its associated input parameters are passed to the database separately which allows the database to properly interpret the command. Each parameter has a defined variable type, so the input is sanitized. This is opposed to the full SQL command being constructed on the front end of the website, making it vulnerable to malicious parameters.  


To see how these SQL injections can be used for malicious purposes, check out the video below. 

{% youtube obzeB7jttSU %}
Link Check
Tags: opensource
Published: 2020-09-25 18:58:52

##Introduction
Link Check is a Python program for finding good/dead links in any file type. Check out the code [here](https://github.com/MLJBrackett/link-check).

![Link Check](https://i.gyazo.com/4e7e46ca83fc24950ad70194ab222b63.gif)


## Getting Started

To locally install link-check follow these steps

### Prerequisites
* [Python/Python 3] (https://www.python.org/)
* [Git] (https://git-scm.com/)

### Installation

1. Clone the repo
```bash
git clone https://github.com/MLJBrackett/link-check.git
```
2. Use the package manager [pip](https://pip.pypa.io/en/stable/) to install the requirements.
```bash
pip install -r requirements.txt
```

## How to Use
**For the program to run with a file you must either use the -f or -r flag**

Use the -h/--help flags to see arguements
```bash
python link-check.py -h
```
![Help](https://i.gyazo.com/4f79f6498f592b5da95191d68fc1a01d.png)

Check URLs **without** redirect support
```bash
python link-check.py -f links.txt
```
![File](https://i.gyazo.com/4e7e46ca83fc24950ad70194ab222b63.gif)

Check URLs **with** redirect support (Redirection causes the program to run slower)
```bash
python link-check.py -r links.txt
```
![Redirect]( https://i.gyazo.com/a5642797c002d9bd04b3dd59d4824d5c.gif)

Check version of tool
```bash
python link-check.py -v
```
![Version](https://i.gyazo.com/23be09cff4fb01dccc2ba4178802db2c.png)

##Features
* Colourized output & -v or --version prints name and version
* Redirect support & more HTTP result codes
* Supports timeouts, DNS issues, server errors
* Requests headers instead of full body

##License
Distributed under the [MIT](https://choosealicense.com/licenses/mit/) License.
How to log incoming requests to your REST APIs in a centralized way using Spring Boot?
Tags: springboot, logincomingrequests
Published: 2020-09-25 18:42:34


Experimented with Spring Interceptors and HttpServletRequestWrapper object and figured out how to log incoming requests to REST APIs in a centralized way in Spring Boot:
https://fullstackdeveloper.guru/2020/09/25/how-to-log-incoming-requests-to-all-rest-services-in-spring-boot/
A (secret) way to bypass Chrome's security/privacy error
Tags: security, chrome, privacy, ssl
Published: 2020-09-25 18:34:54

You may notice that recently chrome adopted a strict approach for SSL certificates errors, and it's probably the right thing. Most internet users are should not get into websites with unverified certificates, but does it's the same for developers?
As developers, we sometimes start local servers with self-signed certificated which can be blocked by Google Chrome.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cwesycws4f0lwos9el9j.png)
### So how can I bypass the warning page and continue coding?
Simply type `thisisunsafe` while the browser is focused on that page. That's it 🙂
Day 71: Fixed A bug!
Published: 2020-09-25 18:26:58

Today was an interesting day. I spent 4 hours trying to fix a bug only to discover an easier "bug-less" way at the eleventh hour. I still can decide whether to feel stupid for my previous implementation or happy I finally fixed it. Here is what I had to delete: [my previous shitty code 😂](https://github.com/M-Tee/Weather-App/commit/b3676d3bbec4d9228afdedb7ac71eea8ca9fe46d)

Current implementation:
```javascript
function displayWeeksForecast(data) {
	const nextDayDegree = [document.querySelectorAll('#nextDaydegree')]
	const nextDayIcon = [document.querySelectorAll('#nextWeatherIcon')]
	const nextforeCast = [document.querySelectorAll('#nextforeCast')]

	let weeksTemp = nextDayDegree[0]
	let weeksIcon = nextDayIcon[0]
	let weeksForecast = nextforeCast[0]

	for(i=0; i<7; i++) {
	weeksTemp[i].innerText = `${Math.round(data[i].temp.day - 273.15)}°`;
	weeksIcon[i].setAttribute('src', `https://openweathermap.org/img/wn/${data[i].weather[0].icon}.png`) 
	weeksForecast[i].innerText = data[i].weather[0].main
	}
}
```

😂 I can barely look at my previous code with a straight face. I'm having the "who-the-hell-wrote-that" moment.

_🥂To the small wins_
_That's it for day 71_
_Let's do this again tomorrow_
What was I thinking?!?
Published: 2020-09-25 18:23:30

Release 0.1 required a command-line tool to check for broken Urls.  Originally I chose C++ as my language, and this turned out to be the biggest thorn in my side. 
 
Not sure why I always chose the challenging paths but hey it is in my nature!  My primary release asks the user to input the url and then lets the user know if the url is good, bad or unknown.  The colour application worked at first but then when I made changes to improve the code, the colour no longer worked.  Figuring out the simplest way to implement the colour letters was not as easy as instructed on websites.  As much as I desire to become more acquainted with C++, I was truly not happy with the slow progression and outcome of this version.

 
I made the decision to do a second version by changing the language.  With some help from our classmate Joey, he refreshed my memory in how to start a new project on VScode.  In the winter I had taken an ASP.net course through Seneca and loved it so much that I had forgotten much of how to create in VScode.  So here it is!
 

Features include
• Ability to run the tool with v or version argument to get the 
  version of the tool you are running.
• Checks the file passed through the arguments to check the Urls 
  listed
• The results of the Urls show the “green” ones as being good and 
  “red” ones as being broken 
• Finds which links are broken, working, or unknow in a file
• Can process any file type (txt, html, ext...)
• Alerts user if they entered the wrong number of arguments