teleren/devto huggingface dataset:
What happens when you enter URL in a browser [Part 1: URI]
Tags: uri, browser, web, video
Published: 2018-11-22 17:35:13

---
title: What happens when you enter URL in a browser [Part 1: URI]
published: true
description: URI vs URL vs URN
tags: 
- uri
- browser
- web
- video
---

{% youtube gtY88BlO7d4 %}

# What really happens,

1. Enter a website link in the browser, `www.example.com`.
2. Browser knows it's a website and adds `https://` in front of it.

## `https://` is one of the many URI Schemes

![](https://thepracticaldev.s3.amazonaws.com/i/eo72prtjugzgdlor2aks.png)
URI = Universal Resource Identifier
URL = Uniform Resource Locator
URN (not that urn 🌝) = Uniform Resource Name

URN and URL are subsets of URI. URN is just a name or a reference, there may not be a way to locate that thingy. URL knows exactly where the resource is located and returns that thingy.

### URL Example (paste on your browser):
- `data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D`
    - Hello, World!
- `tel:+6598765432` 
    - Open facetime in computer, call number in mobile device
- `https://example.com`
    - Open a website, meh
- `file://path`
    - Open a file in your local machine
- `mailto:test@gmail.com`
    - Open email
- `telnet://0.0.0.0`
    - Open terminal to log into remote computer
- and [more over here](https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml)

### URN Example:
- `urn:isan:0000-0000-9E59-0000-O-0000-0000-2`
    - The URN for "Spider-Man (film)", identified by its audiovisual number


This concludes part 1 of "What happens when you enter URL in a browser".

P/S: Current browsers are already using Internationalized Resource Identifiers (IRI), a new protocol which is an extension of URI, which allows unicode character encoding. E.g. https://en.wiktionary.org/wiki/厉害  (Thanks @jxerome for pointing that out)

References:
https://www.immagic.com/eLibrary/ARCHIVES/GENERAL/WIKIPEDI/W110302U.pdf
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml


Talk to me at [Twitter](https://twitter.com/linxea_)

🤦: Thanks for pointing out the mistakes in the post! @joeflateau, @dangtu_work
Thank you so much Dev.to
Tags: meta, community, thanks
Published: 2018-11-22 17:33:18

---
title: Thank you so much Dev.to
published: true
description: 
tags: meta, community, thanks
---
I've been wanting to say thanks for a couple of days but I don't have the right words. Today however seems to be an appropriate day to try. 

Thank you for being the smartest, nicest, most friendly, accommodating, helpful, constructive and supportive community I've ever seen. Thanks for making me feel welcome. 

I've been genuinely amazed that people have been willing to take me on, on everything from a quixotic attempt to write a post a day to answering my basic questions about technology.

I don't know where all the love and support has come from - but it makes this an awesome and unique place to hang out.

I've learnt so much from the conversations and pointers. Stuff like making portraits using wandering salesman is a thing that I can't imagine finding anywhere else.

You all rock - please keep doing what you are doing.
Direct assignment to the reverse side of a many-to-many set is prohibited. Use products.set() instead. Django REST Framework
Tags: help, python, django, drf
Published: 2018-11-22 17:30:41

---
title: Direct assignment to the reverse side of a many-to-many set is prohibited. Use products.set() instead. Django REST Framework
published: true
description: A problem I face when inserting a field in a many-to-many set in a Django REST Framework application
tags: #help #python #django #drf
---

I'm getting this error 
"Direct assignment to the reverse side of a many-to-many set is prohibited. Use products.set() instead"
when I'm trying to insert a field of a tree like structure of a model and don't know what to do ,for help and for more details please have a look at the stackoverflow Question
https://stackoverflow.com/questions/53419386/direct-assignment-to-the-reverse-side-of-a-many-to-many-set-is-prohibited-use-p
Thank you, DEV Contributors 🙏
Tags: meta, opensource, gratitude
Published: 2018-11-22 17:20:35

Since we open sourced in August, we've had 90 community members contribute to the DEV codebase. That is amazing!

We are so thankful and appreciative of everyone who has dedicated their time to supporting the community and improving the platform. The codebase is stronger than ever. Our developer experience is smoother than ever. Our features are more useful than ever. And our bugs are getting squashed faster than ever. And we have an iOS app!

It's been an incredible couple of months and we really just wanted to say thank you to you all. 

Below are the folks who have made 3 or more commits!


{% user chickdan %}
{% user nektro %}
{% user koheisg %}
{% user m0nica %}
{% user nickytonline %}
{% user citizen428 %}
{% user wahyusumartha %}
{% user auua %}
{% user ceri_anneblog %}
{% user xvercruysse %}
{% user rockarts %}
{% user bennypowers %}
{% user yechielk %}
{% user _bigblind %}
{% user araslanove %}
{% user nathansebhastian %}
{% user rhymes %}
{% user nholden %}
{% user dangolant %}
{% user arpitgogia %}

And here are some new features published by those of you who _wrote them_: 

{% link https://dev.to/rhymes/changelog-export-posts-1kdm %}
{% link https://dev.to/johnwoodruff91/changelog-new-stackblitz-liquid-tag-187e %}
{% link https://dev.to/siideemt/changelog-add-gitlab-link-to-your-profile-3fn4 %}
{% link https://dev.to/theoutlander/changelog-updates-to-the-comment-box-3f04 %}

You can see everyone who has contributed on our repositories:

{% github https://github.com/thepracticaldev/dev.to %}
{% github https://github.com/thepracticaldev/DEV-ios %} 

Happy Coding!
Thank you to our 2018 Sponsors
Tags: meta, gratitude
Published: 2018-11-22 17:04:41

---
title: Thank you to our 2018 Sponsors
published: true
description: A thank-you to the companies that supported DEV this year.
tags: meta, gratitude
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7k7vbipbvij83aogwso8.gif
---

On this Thanksgiving, we'd love to give thanks to the DEV Community's sponsors from 2018.

For the past ten months, we've worked with a truly amazing roster of companies.  Without their financial backing, we simply would not have been able to get to this point.  If you're in the market for any of their products or services, be sure to check them out!

Here's the full list of community sponsors, including their tagline, in order of original appearance:
- **[Nylas](https://www.nylas.com/)** — Nylas is an API built by engineers, for engineers
- **[Triplebyte](https://triplebyte.com/)** — Do one coding quiz, get multiple job offers
- **[Algolia](https://www.algolia.com/)** — Fast & relevant search API, now with free read operations
- **[Manifold](https://www.manifold.co/)** — Manifold is the marketplace for independent developer services
- **[DigitalOcean](https://www.digitalocean.com/)** — The all-in-one cloud platform developers & their teams love
- **[Flatiron School](https://flatironschool.com/)** — Learn. Love. Code. Start learning online today
- **[Bugsnag](https://www.bugsnag.com/)** — Powerful error monitoring for web, mobile, and server apps
- **[Pusher](https://pusher.com/)** — Communication and collaboration APIs for app developers
- **[Timber](https://timber.io/)** — Best in class logging for Node, Ruby and Elixir apps
- **[Mapbox](https://www.mapbox.com/)** — The location platform for developers.
- **[Underdog](https://underdog.io/)** — Connecting engineers to jobs at growing NY & SF tech companies
- **[Stream](https://getstream.io/)** — The API for building scalable news feeds and activity feeds
- **[Twilio](https://www.twilio.com/)** — APIs for communicating with anyone on planet Earth
- **[Qlik Branch](https://developer.qlik.com/home)** — Helping developers turn data into their ally with Qlik APIs
- **[Raygun](https://raygun.com/)** — Error, crash, and performance monitoring software for devs

---

An extra-special thank you to DigitalOcean, who has stayed on for 8 months and counting!  That level of consistency is incredibly impactful and important.

A thank you to Pusher, who was our first-ever Platinum sponsor, and who helped make the [first-ever DEV Contest](https://dev.to/devteam/first-ever-dev-contest-build-a-realtime-app-with-pusher-4nhp) possible.

And a final shout-out to Nylas, Algolia, and Triplebyte.  These organizations stepped up before we had even given thought to a "media kit," sponsorship contract, or invoicing system.  They jumped in with both feet out of a pure desire to support this fledgling community.
What Is Data Visualization? Definition, History, and Examples
Tags: dataviz, design, introduction, explainlikeimfive
Published: 2018-11-22 17:02:47

---
title: What Is Data Visualization? Definition, History, and Examples
published: true
description: Let's see what data visualization is (definition) and why it is important, how it has developed (history), and exactly how dataviz can work in real life (examples). It is Data Visualization 101.
tags: #dataviz, #design, #introduction, #explainlikeimfive
canonical_url: https://www.anychart.com/blog/2018/11/20/data-visualization-definition-history-examples/
cover_image: https://i.imgur.com/ELBOlPJ.png
---

[Introduction to data visualization](https://www.anychart.com/blog/2018/11/20/data-visualization-definition-history-examples/), the article formulates its definition and looks into why dataviz is important, how it has developed (history), and exactly how it can work in real life (examples). It is a Data Visualization 101 guide.
How do you learn best?
Tags: discuss, beginners, productivity, learning
Published: 2018-11-22 16:52:21

---
title: How do you learn best?
published: true
description: There are lots of different methods for learning to code. Which ones work for you, and which don't?
cover_image: https://thepracticaldev.s3.amazonaws.com/i/5m4c0h7ru8lboz8mo6m6.jpeg
tags: discuss, beginners, productivity, learning
---

*(Huge thanks to Raj Eiamworakul for the [glorious cover image](https://unsplash.com/photos/o4c2zoVhjSw).)*

---

Hey folks! I want to let you in on a little secret: *Right now, I'm working on building a platform to teach web development.* I'd like to get some feedback on which things work well for you while learning to code, and where the pain points are.

There are two parts to this question: **Focus** and **Format**. I'd love to get answers about both categories (although if you only have feedback on one, that'd be great too!)

# Focus
Do find it most helpful to focus on:
* Theory
* Examples
* Hands-on practice (small problems)
* Full-scale, real-world projects

or something else?

# Format
This is where I really want you to get creative. There are a few well-established formats for teaching programming:
* Text + images/diagrams (reading)
* Video (instructor teaching content)
* Practice problems (checked by computer)

But it also feels like there could be room for more experimentation in this area.

One possibility I've been exploring is a "video" (audio of instructor + animated text editor) which involves a teacher showing something, but which pauses and becomes interactive (you can type in the editor), with a challenge to complete before the video continues.

I'd love to hear feedback on that idea plus anything else you can imagine! Don't be afraid to get zany with this one. If it's crazy enough, I just might do it. ;)
WordPress penetration testing
Tags: wordpress, security, php, kalilinux
Published: 2018-11-22 15:44:52

---
title: WordPress penetration testing
published: true
description: WordPress penetration testing
tags: wordpress, security, php, kali linux
---

Even though I believe that security experts should be the ones to carry out penetration tests, it is always important for us developers to understand how make our web applications more secure.

An article how to test your blog or WordPress installation using Kali Linux.

https://deliciousbrains.com/wordpress-penetration-testing/

There are some tools which are not WordPress focused therefore it is worth reading even if you are not into WP.
Bash Mentors Needed!
Tags: bash, exercism
Published: 2018-11-22 15:44:15

---
title: Bash Mentors Needed!
published: true
description: We have a few thousand students and less than 10 active Bash mentors! Help!
tags: Bash, Exercism
---

Do you like to shell-script? Does the arcane and confusing syntax of Bash make you feel like a wizard? It does for me. 

Exercism is a site where people work on coding exercises, submit solutions, and get mentored by people who are familiar with the idioms of that language. You help the students improve their code and their confidence as they submit iterations and try to keep the automated tests passing. (Yes, even Bash has TDD!) 

And we need your help. 

We have thousands of students trying to get mentored, submitting solutions, and we have 10 registered Bash mentors. I’m not even sure if all the registered mentors are active on the Bash track. Its averaging about a week to respond to a Bash student. Which is lame! And it makes me feel bad. 

So, if you are a Bash guru and want to teach and help people grow, head over to [the mentoring sign up page](https://exercism.io/become-a-mentor).

I encourage students to make full use of current Bash features like associative arrays, arithmetic, string indexing, and the built-in commands. Bonus points if the student can come up with a solution that is pure Bash (built-ins and language features only), since Exercism is all about learning the idioms of a language. Solutions with awk and sed and grep and tr are fine and good, but nothing beats the rush of PURE BASH! (I’m mostly kidding. In real life, use all the tools that are available to you. But I usually suggest pure Bash to help the student learn what’s available.)

If you’re not comfortable with Bash yet, but want to help, then start as a student, work your way along the track, and once you feel comfortable enough (you don’t even have to finish it!) become a mentor and just mentor the easy exercises!

**We need your help!**

Sign up at the link above. Message, DM, tweet at, or email me if you have any questions. There’s a whole Slack of mentors to give you advice. Thanks!

P.S. Python, Rust, and Go need mentors too. Probably other languages. Those are the ones off the top of my head.
IE/Edge-driven features
Tags: ie, edge, discuss, browserapis
Published: 2018-11-22 14:34:48

---
title: IE/Edge-driven features
published: true
description: Features that we enjoy today, thanks to the browsers we hate today. 
tags: IE, edge, discuss, browser APIs
---

_Features that we enjoy today, thanks to the browsers we hate today._


What have been some CSS and JS features that IE or Edge has pushed forward?

I know both get a bad wrap, but I've also heard that some of the things we constantly use today are thanks to Microsoft's browsers implementing them first.

Hoping we can make an extensive list of those features/APIs. 

If you can, please also link a ref/spec link in the comments and I'll be sure to do some more background work (to describe the feature and its history when possible) and I'll be sure to update this post. 

Thanks 🤓
What can I do in terms of architecture?
Tags: help, architecture
Published: 2018-11-22 13:53:22

---
title: What can I do in terms of architecture?
published: true
description: 
tags: #help, #architecture
---

Hello everyone,

We have a monolith application that has authentication and other services like managing the data in the database etc.

We recently checked the statistics of the endpoint calls and discovered that %70 of requests is to only one endpoint. Second most receives %6 of the requests.

In that case, does it make sense continue using same architecture or do you recommend something like microservices architecture, serverless etc. ?

Thanks.
When Not to Add Unit Tests
Published: 2018-11-22 12:54:14

---
title: When Not to Add Unit Tests
published: true
description: 
tags: 
---

Refactoring poorly written code that has little abstraction and does not separate concerns can greatly reduce the risk of defects and speed up future development. Adding unit tests during this small scale redesign process can have all the benefits of unit testing during the initial implementation.

Adding unit tests to poorly written code without any refactoring achieves none of this. Instead it acts as a barrier to refactoring and improving code. If a method or class serves multiple purposes and abstracts no underlying complexities then it serves as an entry point for defects and often expands the cost of adding or refining features. Unit testing such a method or class makes it more difficult to refactor and remove these deficiencies.

Lastly passing unit tests for such code do not provide confidence that the code is working as it should. The passing tests instead act as a false positive. If the code has no clear definition of what it should do then a test that says it is doing what it should does not help.

I could test the ability of a hammer to dig a hole and then use that hammer turn a screw. In this scenario my test gives me false confidence in the ability of the hammer to the job for which it is being used. All the while the intended usage of the hammer is missed. The real answer to this scenario is to use a screw driver. This would be similar to refactoring code. Then test the ability of the screw driver to screw in screws. This would be similar to unit testing.

Check out [my blog](https://www.alexlockhart.me/) for more of my musings upon technology and various other topics.
Generate Multiple SSH Keys for Multiple Remote Accounts
Tags: ssh, repository, git, remote
Published: 2018-11-22 12:32:40

---
title: Generate Multiple SSH Keys for Multiple Remote Accounts
published: true
description: If you have multiple Bitbucket accounts (let's say one for your company and one private one) and additionally one Github account that you all want to authenticate with SSH, you can follow this guide to add all accounts to your local machine so you don't need to struggle with different accounts anymore.
tags: ssh, repository, git, remote
---

If you have multiple Bitbucket accounts (let's say one for your company and one private one) and additionally one Github account that you all want to authenticate with SSH, you can follow this guide to add all accounts to your local machine so you don't need to struggle with different accounts anymore.

## Generate SSH Keys
Open your terminal and navigate to your home directory. Start by generating your first default SSH key.
```
ssh-keygen -t rsa
ssh-add ~/.ssh/id_rsa
```
Store the keys in the default location.
For each additional account generate new SSH keys but be careful not to overwrite the previously generated one by giving it a new name.
```
ssh-keygen -t rsa -C "companyName"
ssh-add ~/.ssh/companyName
```
Store this key under the `companyName` so when you are asked where to store it, enter the location but exchange the filename.
```
/Users/user/.ssh/companyName
```

## Config
Create a config file or alter the existing one.
```
nano ~/.ssh/config
```
In YAML syntax add following entries for your keys.
```YAML
Host bitbucket.org
	HostName bitbucket.org
	IdentityFile ~/.ssh/id_rsa
	IdentitiesOnly yes

Host companyName.bitbucket.org
	HostName bitbucket.org
	IdentityFile ~/.ssh/companyName
	IdentitiesOnly yes
```
Save the configuration file with name `config`.

## Configure Remote Repos
Copy your SSH key for the account you want to use it.
```
pbcopy < ~/.ssh/id_rsa.pub
```
```
pbcopy < ~/.ssh/companyName.pub
```
In Bitbucket, login to your account where you want to add the copied key and navigate to `Bitbucket Settings - Security - SSH Keys` and add the key. Repeat for all accounts that you created a key for.
In Github navigate to `Settings - SSH and GPG keys` and add your Github key there.

## Cloning from Company Account
If you clone from your default account just copy the output when you click `Clone` inside your remote repository.
If you clone from your company account, you need to alter the host with the host you specified in your `config`.
```
git clone git@companyName.bitbucket.org:user/repo.git
```
About dev.to bots
Tags: meta
Published: 2018-11-22 12:22:58

---
title: About dev.to bots
published: true
description: About dev.to bots that try to advertise.
tags: meta
---

So, firstly there is should be an option to mute "x followed you!" notifications.
They can be are annoying sometimes.

Also, there are bots in dev.to, that does nothing and tries to advertise their own sites. I don't want to dev.to became a dud site.
Use Action Filters to cut down your context.SaveChanges calls
Tags: aspnetcore
Published: 2018-11-22 10:55:41

---
title: Use Action Filters to cut down your context.SaveChanges calls
published: true
description: Use ASP.NET Core's action filters to save your keystrokes
tags: aspnetcore
canonical_url: https://jonhilton.net/use-action-filters-to-cut-down-your-context-savechanges-calls/
cover_image: https://jonhilton.net/img/saveChanges.png
---
If you use Entity Framework Core you will probably find yourself writing something like this over and over and over again...

``` csharp
context.SaveChangesAsync();
```

Where context refers to an instance of your Entity Framework Database Context.

This raises a few problems.

First of all it's way too easy to forget and wind up spending minutes (or even hours!) figuring out why your changes aren't being saved.

Secondly it gets everywhere and adds to the overall amount of "infrastructural" code in your code base which isn't actually part of your key business logic.

Thirdly (and perhaps most importantly) it tends to wind up being used in inconsistent ways.

So instead of saving everything logically, in one place, you can easily end up with multiple saves occurring at different times and different layers of your application.

This can make your application somewhat unpredictable and also lead to inconsistent state.

If one part of your code fails, but other code has already saved its state to the DB, you've now got a job to figure out what was saved and what wasn't.

## ASP.NET Core Action Filters to the rescue

Here's an alternative.

Use an Action Filter to always make a single call to `SaveChanges` when any of your  MCV Action methods finish executing.

This way you can be sure that the action will either succeed (and everything will be persisted in a predictable fashion) or fail (and nothing will be persisted, leaving the user free to try again, or complain!)

``` csharp
public class DBSaveChangesFilter : IAsyncActionFilter
{
    private readonly MyContext _dbContext;

    public DBSaveChangesFilter(MyContext dbContext)
    {
        _dbContext = dbContext;
    }

    public async Task OnActionExecutionAsync(
        ActionExecutingContext context,
        ActionExecutionDelegate next) 
    {
        var result = await next();
        if (result.Exception == null || result.ExceptionHandled)
        {
            await _dbContext.SaveChangesAsync();
        }
    }
}
```

You can register this in `startup.cs` and forget all about invoking `SaveChanges()` anywhere else in your code (and focus on your features instead!).

``` csharp
public void ConfigureServices(IServiceCollection services){

    // rest of code omitted

    services
        .AddMvc(opt => opt.Filters.Add(typeof(DBSaveChangesFilter)))
        .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
```

This gives you a handy "transaction per action" and helps avoid your database getting into an inconsistent state.

[Want to get these articles first? Click here to have me email them to you :-)](https://jonhilton.net/devto/next-react-post/)
Using rel=noopener in an anchor tag
Tags: html, security
Published: 2018-11-22 09:40:53

---
title: Using rel=noopener in an anchor tag
published: true
description: What is the importance of noopener in the rel attribute
tags: HTML, security
---

I come across quite a few websites that do not use rel="noopener" and therefore wanted to share an article that explains the importance of having this attribute when creating an <a> anchor tag that links to an external source.

https://mathiasbynens.github.io/rel-noopener/