teleren/devto huggingface dataset:
Enabling CORS in Dotnet Core
Tags: dotnetcore, api, security, webdev
Published: 2019-07-07 11:18:08

[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) - Cross Origin Resource Sharing, basically helps our application from Cross site scripting attacks. This will restrict a website from access or sending data to another origin( web app).

This post will help look into enabling CORS in dotnet core application. Every POST request before posting the actual requests will send an [Preflighted requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Preflighted_requests) using the OPTION method like the below sample.

```
            OPTIONS {{apiendpoint}}/api/web/incoming HTTP/1.1
            Access-Control-Request-Method: POST
            Origin: http://localhost:4200
```
This is to check if the actual request method in this case POST is allowed or not.

So to enable this in dotnet core we use [AddCors](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.mvccorsmvccorebuilderextensions.addcors?view=aspnetcore-2.2) of the IServiceCollection in `StartUp.cs` like below.

```csharp
            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                    builder => builder.AllowAnyOrigin()
                    .AllowAnyMethod()
                    .AllowAnyHeader()
                    .AllowCredentials());
            });
```

We have created the policy as per our requirements now need to use this in our MVC application, make sure you add `UseCors` before `UseMvc`.

```csharp
            app.UseCors("CorsPolicy");
            app.UseMvc();
```

Now your application CORS enabled. This approach is to add CorsPolicy globally. you also refer this [guide](https://docs.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-2.2#enable-cors-with-attributes) to enable CORS using attributes.

- Photo by Banter Snaps on Unsplash

- originally posted on [BitsMonkey](https://unrealnerd.github.io/blog/2019/07/07/cors-dotnetcore-webapi)
What is your´s worst experience with recruiters?
Tags: recruiting, discuss
Published: 2019-07-07 11:07:27

---
title: What is your´s worst experience with recruiters?
published: true
description: A rant about recruiting in the tech world
tags: recruiting, discuss
---

If you work in tech and have a Linkedin account, the probability that you receive daily messages from recruiters is pretty high. 

While a few might be interesting and realistic proposals, I would say most of them could be considered close to SPAM and show a lack of preparation and understanding of the field. (Like saying that are looking for Java devs, for someone who has Javascript in their profile).

This morning, I was reading my Twitter feed and saw this tweet:

{% twitter 1146779523310084096 %}

A guy who was contacted by a recruiter via a Pull Request in one of his Open source repos!

It seems that recruiters are getting more and more "creative" and start using all the possible means just to get your attention! 

While I understand creativity is important to get noticed in a very crowded field like tech, some actions might be too much invasive.

This inspired me to write this post and to talk about which was probably my worst experience ever with a recruiter.

Some years ago, It was another normal working day at my company when the receptionist came to me saying I had a phone call from someone saying claiming to be from the University where I graduated some years ago.

I was very surprised but went to the phone. 

When I pick it up, the guy starts talking that he had an opportunity for me and if I want to schedule an interview and so on. 

I ended up not understanding If he really worked at the university or not, but I believe it was a just bait to get my attention. He probably got that info as well as the company info by looking at my Linkedin profile. 

He also gave me a name that I couldn't find anywhere on Linkedin, so I believe it was fake too.

And by his voice, seemed very anxious and not really secure of himself.

What can lead to someone to have this kind of behavior? Calling to your work with a bunch of lies just to grab your attention?

I believe there are good and professional recruiters out there and that they have an important role, but I think the image of the field is getting very damaged by examples like these.

So, What are your experiences with recruiters?

If you work in the recruiting field and are reading this, please also feel free to share your opinion on the topic.
Why thunk,sagas and so many middlewares for Redux?
Tags: react, redux, vue, vuex
Published: 2019-07-07 11:06:07

---
title: Why thunk,sagas and so many middlewares for Redux?
published: true
description: 
tags: React,Redux,Vue,VueX
---

Why do we have to use thunk sagas etc to hanlde async state chnages in React. Was it an after tought to Redux. VueX seems to handles these things well without additional middlewares.
Manfaat Dan Pentingnya Website Perusahaan Company Profile
Tags: companyprofile
Published: 2019-07-13 05:31:41

---
title: Manfaat Dan Pentingnya Website Perusahaan Company Profile
published: true
tags: company profile
canonical_url: https://www.okabrionz.com/post/manfaat-dan-pentingnya-website-perusahaan-company-profile/
---

Manfaat dan Pentingnya Website Company Profile Untuk Perusahaan Anda Perkembangan internet yang semakin pesat telah menyadarkan banyak orang akan pentingnya sebuah layanan yang mudah. Dengan hal itu, tak kita tidak akan kesulitan lagi dalam mencari sebuah informasi. Kini sebuah perusahaan sudah selayaknya memiliki sebuah website yang menjadi ruang untuk calon klien mengetahui tentang perusahaan itu. Dalam website tersebut bisa mencantumkan berbagai hal yang berkaitan dengan perusahaan Anda. Ada banyak manfaat yang bisa didapatkan sebuah perusaan jika mereka memiliki website yang biasa disebut company profile.
Let Yarn Resolve Your Conflicts
Tags: todayilearned, yarn, javascript
Published: 2019-07-03 08:45:11

---
title: Let Yarn Resolve Your Conflicts
published: true
description: I had no idea that yarn could resolve merge conflicts in yarn.lock 
tags: til, yarn, javascript
---

_Filing under: "How did I not know this?!?"_

***

I am, generally speaking, conflict-averse.

But engineering, like life, guarantees the occasional conflict. And sometimes, this conflict occurs in the jungle that is your package manager's lock file. 

To resolve a merge conflict in `yarn.lock`, I usually just delete it and run `yarn` again. This is the developer's equivalent of yelling "Tiny smoke bomb!" and running away.

Is this best practice? Probs not. Does it work? Pretty much always.

Well, today, I accidentally ran `yarn` before deleting my conflict-ridden `yarn.lock`.

To my delight, I got this message:

![](https://thepracticaldev.s3.amazonaws.com/i/2j6qy3g1jrwd2hqw14oh.png)

This is a thing! And I want the world to know it!!!

**Yarn will try to resolve the merge conflicts in your lock file!**

This feature was introduced with Yarn 1.0, it seems. Basically two years ago. 

Sometimes it feels like I'm a little behind the times :grimacing:
Full Stack Web Development with Angular and Spring MVC
Tags: webdev, javascript, angular, tutorial
Published: 2019-07-07 08:37:09

Welcome to the Full Stack Development with Angular and Spring MVC. For those of you, who don't know Angular and Spring MVC, i would like give a quick introduction about these two technologies.

Angular is one of the most popular front end Javascript framework for building web application, on the other hand, Spring MVC is also one of most popular Java framework for building Java Web Applications, using which we can build industry standard Java/J2EE Enterprise Applications.

So in this course we are taking an advantage of these two technologies and we are going to build a web application. The application that we are going to build is not a simple Hello World application, we are going to build an End-to-End Database Application, we are going to perform all the CRUD operations, like CREATE, READ, UPDATE, DELETE.

What are we going to build in this course ?

In this course we are going to build a Book Management System, where the user can,

CREATE a book
READ a book
UPDATE a book
DELETE a book
How do we start this course?

We will begin this course by Creating a REST API which is a BOOK API and we are going to build this API using Spring MVC and we will make use of Hibernate as our ORM. The BOOK API provide a bunch of service end points which we are going to make HTTP calls on those service end points using Angular

Basic knowledge

Basic knowledge of HTML, CSS and Javascript
Basic knowledge of Core Java
Basic knowledge of Spring MVC
Basic knowledge of Hibernate
Basic knwoledge of RESTful web services
What you will learn

So by the end of this course, you will have a better knowledge of Angular and Spring MVC. You will have a better understanding of how to integrate Angular and Spring MVC. You are able to create your own API and making a HTTP calls using Angular

What you’ll learn

You are able to create a web application using Angular and Spring MVC
You are able to make HTTP calls using Angular
You are able to create a RESTful API using Spring MVC
You are able to create a fully fledged Database application using Spring MVC and Hibernate

{% youtube PQmu752Ifn8 %}

**Thanks for reading** ❤
If you liked this post, share it with all of your programming buddies!
Follow us on **[Facebook](https://www.facebook.com/angular4u)** | **[Twitter]( https://twitter.com/moriohdotcom)**

### Further reading 
☞ [Angular 8 (formerly Angular 2) - The Complete Guide](http://learnstartup.net/p/H1jE_tD3l "Angular 8 (formerly Angular 2) - The Complete Guide")
☞ [Spring Boot vs. Spring MVC vs. Spring: How Do They Compare?](https://morioh.com/p/4838afbc3e07 "")
☞ [Angular 8 + Spring Boot 2.2: Build a CRUD App Today!](https://morioh.com/p/aa758b26c5d2)
☞ [Build a Simple CRUD App with Spring Boot and Vue.js](https://morioh.com/p/d80e04170d2e)
☞ [How to build a CRUD Web App with Angular 8.0](https://morioh.com/p/f1893bcb9db8 "")
What is your biggest frustration about how work is managed at your workplace?
Tags: discuss, healthydebate, management, workplace
Published: 2019-07-07 08:18:32

What makes you shake your head on how your manager or team or company manage work/project at your workplace. What things or practices will you change if you get the chance.

What does your ideal workplace will look like?

Some of the things that bother me-
- Lack of trust on employee
- Not enough transparency on decisions or policies
- Constant interruption. Always be present or response at real time, no opportunity for deep concentrated work.
- Punishing everyone for one individual wrongdoing.
- Unnecessary meetings

Please, share your experience and opinions on this matter.
Markdown anchor in dev.to post links properly but element ends up behind the top nav-bar.
Tags: discuss, question, devto
Published: 2019-07-07 08:14:23

In markdown, you can use an anchor to link specific sections of your post this naturally also works here in Dev.to posts but when trying to use it  the title of the anchored section ends up hidden behind the navbar, just like like this example below: 

 [Anchor to section below](#relatedposts).





 

<a name="relatedposts"></a># This Title will end up hidden behind the nav-bar

From here it's visible.

What's the best solution or workaround for this while writing here at dev.to?

For clarity, the `code` for how to replicate it: 

to create the link: 

```markdown
[Anchor to section below](#anchorname)
```
Linked markdown section: 

```html
<a name="anchorname"></a> # Normal Markdown Title Here(ends up hidden)
```
Poll: Your reasons for NOT giving feedback on (conference) talks
Tags: discuss, feedback, speaking, conference
Published: 2019-07-07 07:10:02

---
title: Poll: Your reasons for NOT giving feedback on (conference) talks
published: true
description: I notice that in general only ~5% of attendees leave feedback on conference talks. I'd like to find out why most people don't, and maybe how to fix that.
tags: discuss, feedback, speaking, conference
---

Most conferences and some meetups offer a way to offer feedback on each individual talk, either through feedback platforms such as [joind.in](https://joind.in/) or through a custom feedback form. This feedback is vital for speakers (to improve their talks) and conference organizers (to aid in talk selections and evaluation) alike. 

I notice that in general only ~5% of attendees leave feedback on conference talks though. I'd like to find out why most people don't (and maybe how to fix that). Please help out by **answering the poll in the tweet below** and/or by leaving a reply with your ideas to improve the feedback process.

{% twitter 1146787789620555779 %}
Help with designing a CMS
Tags: python, webdev, help
Published: 2019-07-07 06:41:36

Hey there! I want to build a content management system/blogging engine with Flask as a side project and I aim to migrate my blog (currently hosted on Ghost) to it when it's done.

I'm currently a student with some experience working with python and web. But I'm not so confident with how to design this system. (E.g. what API is needed, how to build a secure system? should I use an ORM? A frontend framework?)

If anyone have more experience in this area please give me some pointers so I don't start off on the wrong foot. Thanks! :)
how do notification in laravel
Tags: laravel
Published: 2019-07-07 05:04:37

i use documentation of laravel https://laravel.com/docs/5.8/notifications
but there is some issue 
it is work notification if you have one class what if you tow class 
class for Invoicepaid and another is Repliedcomment the notification not work if you have multiple notification ..??
can any one please help me here
What not to say to someone's personal code project
Published: 2019-07-07 04:25:00

---
title: What not to say to someone's personal code project
published: true
description: 
tags: 
---

While I have been working in the tech field for just about the past decade, I am not a coder. I can understand code - I would never have worked my way up to a "QA Engineer I" title if I absolutely could not make heads or tails of code that I saw - but I can not write original code. The extent of my coding ability is to read what someone else wrote and then adjust it to meet my needs. 

I realized the other day that I am starting upon a new phase of my career. I have a few presentations coming up, in addition to some trainings that I have given, and I'm involved in leadership roles on three different committees at my workplace. In other words, I should really have a website.

As I thought about how to do this, I considered using a CMS like Wordpress or Drupal, but ultimately decided that this would be a great opportunity for me to learn a new skill. So, I decided to fully code my website and style it using CSS, which I have never done. A portfolio website is primarily static content, so I won't be doing anything too fancy, but it will be something I made all by myself, for the first time.

As I've discussed this project with friends, there is one interaction that stands out. One of my friends, when I told him about my plans, said, "You do know that there are platforms out there that do this for you, right?"

This is not what you say to someone who is talking about a personal project. Of course I know that! I supported a few of them in my last role. You wouldn't say "You know you can buy that at Target, right?" to someone who told you they wanted to learn how to make a coffee mug using a pottery wheel.

In the moment, I felt fierce and protective, but thinking back to a few years ago when I was less confident in myself, I can easily see myself apologizing and stopping the project, doing it instead the more (maybe?) efficient way with a full CMS. Please don't be the reason someone chooses not to pursue doing or learning something just for the intention of learning it. You never know if it will spark something more innovative.
About SSL bumping
Tags: squid, ssl, tls, https
Published: 2019-07-07 04:05:41

---
title: About SSL bumping
series: squid-cache
published: true
description: three different versions of SSL bumping
cover_image: https://thepracticaldev.s3.amazonaws.com/i/gb0c98rrinzghg13f39f.png
tags: squid,ssl,tls,https
---

### Prefix

All previous two posts talk about _SSL bumping_, and the previous post talks about google might not be your friend for this, because some of those you found may be outdated. 

What could be wrong?  
Let's focus on the _SSL bumping_ this time. 

### SSL bumping

[SSL bumping](https://wiki.squid-cache.org/Features/SslPeekAndSplice) has actually evolved and formed into three different versions:

- The https://wiki.squid-cache.org/Features/SslBump, which was the _first_ hit in my google search, actually points to the "_Squid-in-the-middle SSL Bump_" method, which is the _oldest_ of the three versions. It enables ICAP inspection of SSL traffic. 
- The next version is the [SslBump using Bump-Server-First](https://wiki.squid-cache.org/Features/BumpSslServerFirst) method. It enhances on mimicking server certificates details.
- The latest version is [SslBump Peek and Splice](https://wiki.squid-cache.org/Features/SslPeekAndSplice). This is the actual _transparently intercepting TLS/SSL_ bumping.

It'll be quite obvious when you visit each of the three different versions on their official page, but I think it is nice to point them out, because merely looking at the urls might give you another impression. 

### Conclusion

This is part of my fact-collecting blog of the [squid caching server](http://www.squid-cache.org/) series, focusing on _SSL bumping_ part. Next we'll be looking at more SSL bumping articles in details.
Any easy way to include tags in dev.to posts
Tags: question, help, tag
Published: 2019-07-07 03:50:10

---
title: Any easy way to include tags in dev.to posts
published: true
description: Any easy way to include tags in dev.to posts
tags: question,help,tag
---

Any easy way to include tags in dev.to posts? 

With dev.to trying to incorporate other media into its own, including gist, twitter, or even youtube, is there any easy way to link to its own tags in dev.to posts? Like #question and #help?

thx
I NEED mentorship to land a job within the next 120 days becaue my father is dying...
Tags: beginners
Published: 2019-07-07 03:01:14

Hey all, so very new to this communtiy and, kind of at a loss. I've been putting off trying to land a developer career because life keeps getting in the way. Well, today the biggest obstacle to this journey has just been put in front of me. This morning at 11:15 am, my father was diagnosed with cancer of the lungs, liver and colon. The shock and sadness are still prevalent, I'm hurting, my mother and brother are hurting. I'm sad and angry because even all three of our jobs right now won't enough. So I need build my portfolio starting right now.

I need to get one of these jobs but I don't know what to build to even get my foot in the door. I've been putting it off over and over again, but this is my wake up call. I have to land a job in the next 4 months(projection from doctors).So I reach out to you those who are already in tech for guidance and what to add. I'll link my github and linkedin profiles here, I just don't know how to focus. Please, any advice or guidance would be greatly appreciated as I take things one day at a time.I have to make this work for my family's sake

github: https://github.com/JonathanMKPT
linkedin: https://www.linkedin.com/in/jonathan-thomas-5b5135114

Thanks in advance,
Jonathan Thomas
Quicker Qwiklabs for GCP
Tags: qwiklabs, gcp
Published: 2019-07-07 01:36:42

GCP Qwiklabs don't record user information between learning sessions, forcing the user to type the same Bash commands or the same Python code in Jupyter notebooks again and again.

For the Bash commands, you can save your typing by using a local GCloud SDK installation.

{% gist https://gist.github.com/vochicong/09911a9d3fac12aa32635db656815afa %}

After starting a Qwiklabs session, on local you also login using the new GCP credential created for that session.

    gcloud auth login

And then you can type the commands specified by the lab, and record the history, so that it will be much easier for you to use the same command later.

For the Jupyter notebooks, I hope that they will find a way to save my work between sessions, or alternatively initialize each learning session with more proper data.
What's the connection between Debian and Toy Story?
Tags: linux, debian, opensource
Published: 2019-07-07 00:24:17

[Debian](https://www.debian.org/) is a popular Linux distribution. [Ubuntu](https://ubuntu.com/), which is the first choice of many Linux new-comers, is based on Debian.

Debian 10, which was just [released](https://www.debian.org/News/2019/20190706) today, is code-named Buster. Debian 9 is Stretch, Debian 8 is Jessie, and the earlier ones Wheezy, Squeeze, Lenny... which are all Pixar's Toy Story characters!

## But why Toy Story code names?

It turns out, at the time Debian made its first release with a code name, Debian 1.1 Buzz (yes, Buzz Lightyear), the project leader at the time (Bruce Perens) was working at Pixar.

You may find the other Debian code names in [A Brief History of Debian](https://www.debian.org/doc/manuals/project-history/ch-releases.en.html).

[![Buster and Woody](https://media.giphy.com/media/1Xzny4XvE6heE/giphy.gif)](http://gph.is/21I4qOp)

If you look closer to the [Debian 10 wallpaper](https://wiki.debian.org/DebianArt/Themes/futurePrototype), which is the cover image of this post, you will notice there is a hidden shape of Buster, Andy's pet dog.
Generate Words Logo with Python
Tags: python, image
Published: 2019-07-07 00:16:07

---
title: Generate Words Logo with Python
published: true
description: python, image, logo
tags: python, image
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rn6uwguyoijujpryp72x.png
---
You can create a logo with just word. The module to use is "wordcloud". Then create a mask of the logo (black and white shape). 

Why would you want to do this? Just for fun. You can take any list of words and any logo that is a black and white mask.

Lets say the windows logo:

![](https://thepracticaldev.s3.amazonaws.com/i/eol7homyp8p5g4gtitk4.png)

## Generate a logo with Python

As said before need several things:

* any font, say <a href="https://github.com/azhon/Python/blob/master/wechat/SimHei.ttf?raw=true">SimHei</a>
* mask (black and white)
* word list
* the program below
* modules installed (matplotlib, wordcloud). You can do that with **pip**

The mask:

![](https://thepracticaldev.s3.amazonaws.com/i/u6otn211fuhgzwtpuivb.png)

You will need a list of words. I use the dictionary available on Ubuntu Linux, but any word list will do. The list of words should be less than 5000 words.

Run the program below to create the logo:


    #!/usr/bin/python3
    from wordcloud import WordCloud
    import numpy as np
    from PIL import Image
    import os
    
    with open('/usr/share/dict/american-english') as f:
        wordList = f.read().splitlines()
    
    text = " ".join(wordList)
    print(text)
    
    src_dir = os.getcwd()
    imagePath = src_dir + "/apple.png"
    font = src_dir + "/SimHei.ttf"
    resultPath = src_dir + "/output.png"
    
    bg = np.array(Image.open(imagePath))
    wc = WordCloud(
        mask=bg,
        background_color="white",
        max_font_size=150,
        min_font_size=5,
        max_words=5000,
        random_state=40,
        font_path=font,
    ).generate(text)
    wc.to_file(resultPath)

Output:

![](https://thepracticaldev.s3.amazonaws.com/i/rn6uwguyoijujpryp72x.png)

Learn Python:
* https://pythonbasics.org
* https://pythonprogramminglanguage.com