teleren/devto huggingface dataset:
Setting up Spring Security with Azure Active Directory
Tags: azure, spring, java
Published: 2019-09-07 10:28:37

Below are the settings to configure a Spring Boot web app to use Azure Active Directory authentication.

App is based on `spring-boot-starter-parent:2.1.4.RELEASE`.

POM dependencies snippet:

```xml
<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-active-directory-spring-boot-starter</artifactId>
    <version>2.1.6</version>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-client</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-jose</artifactId>
</dependency>
```

Snippet of `application.properties`:

```
# Active Directory Authentication
spring.security.oauth2.client.registration.azure.client-id=109a3748-yada-yada-yada-f80c1f30621e
spring.security.oauth2.client.registration.azure.client-secret=OBAYaOKp-HwhateverIxFxY@?
azure.activedirectory.tenant-id=f447e5ca-yada-yada-yada-370ff157fdb6
azure.activedirectory.user-group.allowed-groups=group1, group2
azure.activedirectory.active-directory-groups=group1, group2
```

`AADOAuth2LoginSecurityConfig.java`:

```java
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class AADOAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private OAuth2UserService<OidcUserRequest, OidcUser> oidcUserService;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .csrf().disable()
                .authorizeRequests()
                .antMatchers("/**").hasRole("group1")
                .anyRequest().authenticated()
                .and()
                .exceptionHandling().accessDeniedPage("/browse/403")
                .and()
                .oauth2Login()
                .userInfoEndpoint()
                .oidcUserService(oidcUserService);
    }

}
```

I'm stuck with JSPs, so use taglibs, for example:

```xml
<security:authorize access="hasRole('group1')">
    Authorised users only
</security:authorize>

User's name: <security:authentication property="name"/>
```

The Azure configuration is where it starts getting odd. There is an associated App Registration, with the Authentication configured as below:

![auth](https://thepracticaldev.s3.amazonaws.com/i/8vq22memrva62d1ct4bo.png)

I have a `localhost` setting, which allows the `http` prefix for local development - nothing wrong there.

However for my two app service deployments I have to use `http` rather than `https` (NB. my app is configured to accept only HTTPS), and I can only do this by selecting "Public client (mobile & desktop)".

If I try to use `https` with Type of "Web" I get the following error on authenticating:

![auth error](https://thepracticaldev.s3.amazonaws.com/i/uhbpvclwxl2shwps8mb8.png)
Selfhosted Heroku / node.js app management dashboard
Tags: selfhosted
Published: 2019-09-07 09:36:49

I'm getting more and more interested in running my own server and I want to run a bunch of small node.js sites on it. Is there an easy way go manage node apps, domains and deployments? think the ease of adding sites to heroku.

I've tried running my own dokku server, however dokku seems full of bugs and issues where two simple websites seem to take +20gb of space.

How do you run you node.js apps and experiments on a server?
What would you use as a sortable, globally unique, ID?
Tags: distributedsystems, discuss
Published: 2019-09-07 09:18:05

The objective is to have an ID that has the following two inherent properties:

- globally unique: if two different nodes generate an ID, the possibilities for them to conflict are practically zero (hence no autoincrementing IDs)

- sortable: the IDs, even those generated by two different nodes, can be sorted or partially sorted making it far easier to order events (hence no UUIDs)


What would you use?
Which place is very popular to spend vacations in Nepal?
Tags: nepalvacationpackages
Published: 2019-09-07 08:48:13

Spending vacation in Nepal is really an amazing experience in itself. Nepal is considered as one of the cheap and best vacation destination in the word. I want to spend my college vacation in Nepal. Nepal is very beautiful place, I know very well. But which place is very splendid to spend vacations in Nepal? I want to book Nepal Vacation Packages from an online tour operator, so please help me which place is very popular for spending vacations in Nepal? Waiting for your experience!
Visit us: https://www.travels2nepal.com/nepal-tour-packages
Laravel 6 and Make Auth
Tags: laravel, tutorial, php, help
Published: 2019-09-07 08:43:03

**Laravel 6** came with a hero's welcome this Tuesday. When I started to try to see how the new one is, I was straight away hit at a wall. 

    php artisan make:auth
Make Auth command is not anymore available in Laravel 6. But, don't worry. we are covered with a better solution for this.

**New package - Laravel UI**
Laravel has come up with a new package - Laravel UI which separates UI part of an application apart. This could help developers to create a server only applicaiton (API host) or a Console only application, without having the extra burden of UI attached to it.

Laravel UI can be installed with composer command:

    composer create-project laravel/laravel blog
    cd blog
    composer require laravel/ui
Once this package is installed successfully, it gives a few new artisan commands.

    ➜ php artisan ui --help
    Description:
      Swap the front-end scaffolding for the application
    
    Usage:
      ui [options] [--] <type>
    
    Arguments:
      type                   The preset type (bootstrap, vue, react)
    
    Options:
          --auth             Install authentication UI scaffolding
          --option[=OPTION]  Pass an option to the preset command (multiple values allowed)
      -h, --help             Display this help message
      -q, --quiet            Do not output any message
      -V, --version          Display this application version
          --ansi             Force ANSI output
          --no-ansi          Disable ANSI output
      -n, --no-interaction   Do not ask any interactive question
          --env[=ENV]        The environment the command should run under
      -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

UI can be initiated with either VueJS or with React.

    php artisan ui vue 
    php artisan ui react

For creating authentication scaffolds, add --auth to the ui command. 

    php artisan ui:auth
    php artisan ui:auth --views

Running the first command sets up the routes and scaffolds for authentication and second one sets up the views.

Fun time's up! Let us get back to work...!
Promatia's Digital Government
Tags: node, vue
Published: 2019-09-07 08:38:38

[Promatia](https://promatia.com) is building a digital government/micronation as a political experiment.

We will be using NodeJS for the server backend, VueJS for front-end.

We have also used https://futureaus.github.io/servue/ for server-side rendering.

**Full Stack**
- VueJS
- MongoDB
- NodeJS
- Webpack
- GraphQL
- Moongraph (custom ORM for MongoDB)

**Here are some mockups of what our government portal will look like:**

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ztc0ch4eqy0slu646i3x.png)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/7kjmy053am9evchr9avx.png)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ev30a1cyaiwe33xiludq.png)

and pics of the main site design below:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/mgeo7fy564voe0twxb4x.png)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/osqej2zeapb182br9g03.png)

We will be live-streaming videos at [Promatia's Twitch Channel](https://www.twitch.tv/thedominusvilicus) Or https://www.twitch.tv/promatiagov
Mirror of the Google Chrome User Experience report database
Tags: ux, sitespeed
Published: 2019-09-07 07:28:03

---
title: Mirror of the Google Chrome User Experience report database
published: true
description: Analyze your CrUX for free without relying on Google’s Big Query
tags: ux, site_speed
---
The Chrome User Experience Report (CrUX) provides real world, Real User Metrics gathered from the millions of Google Chrome users who load billions of websites (including yours) each month. It is this data that helps Google determine how fast your website is, and helps Google determine Search and Ad rankings for your website. CrUX.RUN provides you with a fast (~100x faster), simple and FREE way to analyze your CrUX data without using Google BigQuery.

https://crux.run/
The 3 kinds of developers
Published: 2019-09-07 06:51:45

Based on my software development experience over the years I have been able to identify mainly 3 types of developers, independently of seniority level.

### The lazy

All developers are somewhat lazy on their craft, but some belong to "The lazy" class. They do their job, sometimes they do their job well, but you can really identify them by how averse to change they are. Usually not looking for new things to do, following the "if it works, why change it?" mentality that can last for years. Probably the most common developer to find. 

### The curious

They are diametrically opposite of "The lazy". They try to read and implement bleeding edge solutions to problems just for the sake of curiosity. They bring a positive view to the workplace by exploring new stuff every day and talking about it with their team. Usually they deliver quality work, always trying to improve themselves in the process having a great impact on the team and product. You probably met one or two - or belong to this class yourself - but this type is quite rare to encounter.

### The liability

They are a result of a bad hire. It makes the team think "how am I supposed to work with this developer?". Slowing down the team, asking for the most basic advice on well known / well documented things. Producing bad quality code with rookie mistakes even though they have been hired as seniors. They are usually non-communicative, misunderstanding and keep making wrong assumptions, a pain to work with. The worst part is they might not even realize they belong to this class until is too late and the damage is done already.


### Afterthoughts


A developer can transition between the 3 kinds throughout its career. In the end it's a matter of being the least amount of time as a liability to quickly become a valuable asset (the lazy) and maybe a stellar investment (the curious).
Most Affordable Prices of Web Design Company in Delhi/NCR, India
Tags: startup
Published: 2019-09-07 06:45:05

 
Are you searching for the best convenient and result-driven web design services? Well, your search ends up with Aresuno, the unmatched website design and digital marketing company located in Noida. Website design is now a day getting more and more advanced and user-friendly. Website creation takes a lot of doing as you have to develop the design planning, creative imaginary, and most importantly, it should captivate or appeal to the visitor of the site. When you search for the perfect website design company, you can surely approach Aresuno Company for the world-class web design creation. The renowned web design company has been the go-to choice for both domestic as well as overseas clients. To create a professional web design, you need to have a trusted web design service onboard. As now a day web design is getting demanded and hugely popular; therefore, you have to come up with innovative and out of the box design ideas to engage the business customers.
Aresuno, the top-notch web design, and digital marketing service NCR
Aresuno has been the most demanded and premier website Design Company for many reasons. It has fast emerged as an unmatched web design company and online services for esteem clients. When you hire the proven website design company, you can surely bank on Aresuno Company. They have successfully delivered all kind of web design and SEO services to various clientele. Since the incorporation, Aresuno Company is doing the bulk of web design and digital marketing services for overseas clients.
(www.aresuno.com)
A simple discussion on greedy algorithms
Published: 2019-09-07 05:37:41

The ‘Greedy paradigm’ or greedy algorithms are part of a programmers toolbox. The tools include the a.) divide and conquer algorithms, b.) randomized algorithms, c.) dynamic programming and d.) greedy algorithms. The term greedy algorithm is a misnomer, greedy is really a technique rather than an algorithm.


According to Hackearth, “[a] greedy algorithm, as the name suggests, always makes the choice that seems to be the best at that moment. This means that it makes a locally-optimal choice in the hope that this choice will lead to a globally-optimal solution.” This is a very interesting definition, and what makes the greedy algorithm interesting is that it only gets one change to solve the optimal solution, in that it never goes back and reverses the decision.

Interesting advantages include the ease of which a greedy algorithm can be designed, and that analyzing the run time is generally easier than divide and conquer algorithms.

Disadvantages include that it is often more complicated to determine is the algorithm is fast or slow. Due to the recursive nature, the size gets smaller each time; however, the sub-problems increase. Additionally, it often requires more work to determine the ‘correctness’ of the algorithm and it can be very difficult to ‘prove’ correct.

Everything Computers states that, “[i]n general, greedy algorithms have five components:”
1. A candidate (set, list, etc), from which a solution is created
2. A selection function, which chooses the best candidate to be added to the solution
3. A feasibility function, that is used to determine if a candidate can be used to contribute to a solution
4. An objective function, which assigns a value to a solution, or a partial solution, and
5. A solution function, which will indicate when we have discovered a complete solution

Two good examples of a greedy algorithm are Huffman Coding, which is used for data compression and Single-source Short Path using Dijkstra’s algorithm, which applies shortest path weights for all given sources and vertices. 

A simple use case of a greedy algorithm is solving a problem where you have T time to complete a list of items, and you want maximum results. The greedy method would be to first create an Array of the integers, specifically the time required to do an task. Then, recursively you select the items with the minimum T while you have to variables, runningTime and numberOfTasks, then:

1. Sort A in non-decreasing order
2. select each task one-be-one
3. Add the task to the current runningTime
4. add 1 to the numberOfTasks
5. and repeat until the runningTime meets the overall time you are seeking to complete the most tasks in

References

Basics of greedy algorithms tutorials & notes | algorithms | hackerearth. (n.d.). Retrieved from https://www.hackerearth.com/practice/algorithms/gr eedy/basics-of-greedy-algorithms/tutorial/
Freak, C. (n.d.). Top 7 greedy algorithm problems. Retrieved from https://medium.com/@codingfreak/top-7-greedy-algor ithm-problems-3885feaf9430
Angular Elements in Hugo Static Site Generator
Tags: webcomponents, webdev, angular, hugo
Published: 2019-09-07 04:26:36

---
title: Angular Elements in Hugo Static Site Generator
published: true
description: Utilizing Angular Elements within Hugo Static Site Generator, to take Stripe and PayPal payments.
tags: webcomponents, webdev, angular, hugo
cover_image: https://thepracticaldev.s3.amazonaws.com/i/6aig9dxu9woisjpxgx62.jpg
---

{% youtube iyvVtOsMThI %}

# Adding dynamic features to a static site.

## Why
I needed to add payments to https://AJonP.com so we can start supporting longer course tutorials. So I sent out a poll on Twitter to see what we should build the Webcomponents using.

![Twitter Poll](https://thepracticaldev.s3.amazonaws.com/i/xfjzcgib93wjghj5a5a6.png)


I plan to share a more in depth course on how to build all of this! For now I thought it would be cool just to see it all in action. Notice how after the site loads Firebase kicks in and checks to see if you are a pro member then dynamically hides items using a webcomponent that understands user state.

It is as easy as using `<ajonp-allow-if>` to wrap around any element and then use display none within that component.

Let me know what you think!
Around the Web – 20190906
Tags: blog
Published: 2019-09-13 03:50:29

---
title: Around the Web – 20190906
published: true
tags: Blog
canonical_url: https://wipdeveloper.com/around-the-web-20190906/
cover_image: https://wipdeveloper.com/wp-content/uploads/2017/07/WIPDeveloper.com-logo-black-with-white-background.png
series: Around the Web
---

And now for somethings to read (or watch) over the weekend, if you have some spare time that is.

## [Old Day Code](https://www.gooddaysirpodcast.com/228)

**Good Day, Sir! Show**  – Jeremy Ross – In this episode, we discuss some of our highlights from the Winter ’20 Release Notes including Visual Studio Code remote development support, access to the Recycle Bin in Lightning, Lightning Web Components available as open-source, field-level…

## [Building a Set from any field](https://bigassforce.com/field-keysets)

**bigassforce.com**  – The most performant way to get a set of IDs is already well known: We can also build sets from ANY string field, in a one-liner without a loop: The first thing to note is that we are using an Aggregate Query and not just ordinary SOQL. We combine…

## [How to put an HTML page on the internet](https://jvns.ca/blog/2019/09/06/how-to-put-an-html-page-on-the-internet/)

**Julia Evans**  – Sep 6, 3:56 PM – One thing I love about the internet is that it’s SO EASY to put static HTML websites on the internet. Someone asked me today how to do it, so I thought I’d write down how really quickly! All of my sites are just static HTML and CSS. My web design…

## [10 Intriguing Public REST APIs For Your Next Project](https://dev.to/camerenisonfire/10-intriguing-public-rest-apis-for-your-next-project-2gbd)

**Imago Dev**  – The notion of working on side projects gets thrown out a lot amongst the programming community. It can be intimidating sitting in front of a blank code editor wondering what to build. Hosts of blog posts have been written recommending building…

## [Today’s Firefox Blocks Third-Party Tracking Cookies and Cryptomining by Default – The Mozilla Blog](https://blog.mozilla.org/blog/2019/09/03/todays-firefox-blocks-third-party-tracking-cookies-and-cryptomining-by-default/)

**Mozilla**  – Feb 21, 2018, 11:34 AM – Today, Firefox on desktop and Android will — by default — empower and protect all our users by blocking third-party tracking cookies and cryptominers. This milestone marks a major step in our multi-year effort to bring stronger…

## Till Next Week

Want to share something? Let me know by leaving a comment below or emailing [brett@wipdeveloper.com](mailto:brett@wipdeveloper.com)  or following and tell me on [Twitter/BrettMN](https://twitter.com/BrettMN).

Don’t forget to sign up for **[The Weekly Stand-Up!](https://wipdeveloper.com/newsletter/)** to receive free the [WIPDeveloper.com](https://wipdeveloper.com/) weekly newsletter every Sunday

The post [Around the Web – 20190906](https://wipdeveloper.com/around-the-web-20190906/) appeared first on [WIPDeveloper.com](https://wipdeveloper.com).
Devlog #3: Planning
Tags: ionic, angular, mobile, devlog
Published: 2019-09-07 02:32:34

Didn't get much programming done today, but no worries! I have a much clearer vision for what the application will evolve into. So, this post will really just be describing in detail what the app is all about.

Ivy (working title) at it's core, is a house plant tracker. As a user, you'll be able to create a 'profile' of sorts for each of your houseplants. You can give it a name, take a nice picture of it, and then let us know what type of plant it is. Once we know which plant it is, it'll auto-populate a couple of different fields.

First is a synopsis of optimal care techniques for this specific plant (e.g. place it in direct sunlight, keep it in the shade, mist instead of water, etc.). Second is a care-scheduler. The application will automatically determine the optimal times to water the plant, how much water to give it, and then schedule push notifications for those times. Obviously, all of this is also editable by the user.

Another idea that I'm working through is the idea of using this platform as a way to both connect with other houseplant caretakers, but also to connect with botanists/biologists who are able to give direction/diagnoses for when your plants may not be healthy. Still working through how this would function by talking to a number of local botanists, but in the early stages it's looking to be very promising and is a way to bring about a revenue that will help with development costs.

That's all for today, and if you're at all interested in the app, go ahead and follow to keep up to date with development!
Certifications by Career Stage
Tags: discuss, career
Published: 2019-09-07 02:11:28

Are certifications worth the time investment? What types of individuals would you recommend pursue certifications vs holding off?

In my mind, they're best suited for consultants or developers looking to move into a senior or lead developer role, but as a development manager I'm thinking about finally getting some .NET certifications to round out my skillset and add to my credentials as a speaker and writer.

Curious to hear from the community on something that's a bit of a controversial topic.
TDD course with AdonisJs - 1. Let's build a reddit clone
Tags: tdd, testing, node, javascript
Published: 2019-09-07 01:57:16

> Originally posted at [michaelzanggl.com](https://michaelzanggl.com/articles/tdd-with-adonisjs-1). Subscribe to [my newsletter](https://michaelzanggl.com/) to never miss out on new content.

AdonisJs is great for test driven development. Let's build an API for a simple version of reddit using TDD. It will consist of subforums, threads, comments and users. You can find the GitHub for it here: https://github.com/MZanggl/tdd-adonisjs/commit/b2582b286e4da0166f30a8d6a8eee7c3aeb1c8bb.

Without further ado, let's get the project set up!

# Install CLI and framework

```bash
npm i -g @adonisjs/cli
```

In this course we want to focus only on the adonis part and not the frontend, so let's create the project using the "api only" flag.

```bash
adonis new forum --api-only
cd forum
```

# Install testing library

Adonis comes with its own testing library, let's install it with

```bash
adonis install @adonisjs/vow
```

We have to add the vowProvider under "start/app.js" in the aceProviders array to register the adonis test commands.

```javascript
const aceProviders = [
    '@adonisjs/vow/providers/VowProvider',
]
```

---

The installation of vow comes with an example test, run `adonis test`, `npm test` or simply `npm t` to run it.

To make sure things are working, run the project using `adonis serve --dev` and head to the url in your browser!

---

And that's all there is to it, in the next blog post we will create our first test!
D Interop with C++
Tags: d, cpp, interoperability
Published: 2019-09-07 01:34:10

D continues to carry C++ interoperability [forward more than any other language](https://dlang.org/blog/2019/09/06/dmd-2-088-0-released/). I've not dug into it at all, but the latest additions allow you to work with C++'s std::vector and std::string in your D code. Various other libraries let you work with [std::allocator](https://dlang.org/phobos/core_stdcpp_allocator.html) and [the C++ new operator](https://dlang.org/phobos/core_stdcpp_new_.html).