Running Docker Containers on Cloud Foundry

If you are an experienced developer already familiar with Docker, here's a quick way to just deploy your containers into the cloud without having to worry about setting up and managing a Kubernetes cluster. And also important...it comes for free using Cloud Foundry.

Let's start by creating a simple NodeJS application locally using 'npm init', give your app a name e.g. 'tinyapp' and use 'server.js' as the entry point. 

What Is the Big Data Pyramid? Why Do We Need It?

The big data analytics (BDA) market, which is valued at $10 billion today, is forecasted to grow to $40.6 billion by 2023. There is tremendous growth in the field of big data every day. The most popular ones being Internet of Things, artificial intelligence, cloud computing, and automation.

And this means only one thing.

The Top 5 Redis-Based Java Objects

As the “most loved” database technology by developers, Redis has a lot of features to recommend it, including speed, scalability, and availability. However, one issue is that Redis doesn’t include built-in support for programming languages like Java. Instead, users need to install a third-party Java client for Redis, such as Redisson.

Redisson is a Redis Java client that includes many of the familiar Java objects, interfaces, and collections, making it easier than ever for Java developers to get started with Redis. Below, we’ll discuss 5 of the top Redis-based Java objects that Radisson users have come to rely on.

BuddyPress 6.0.0 Released with New Group and Members Blocks

BuddyPress has entered the world of blocks with the release of version 6.0, the latest major update that has been in development since November 2019. The release, code-named “iovine’s” for a favorite pizza restaurant in Paris, introduces blocks for Groups and Members. It also marks the completion of the BP Rest API, adding the final remaining endpoints for Blogs, Blog avatar, Friends, Group Cover Image, Member Cover Image, and User Signups.

The first set of blocks allow community site owners to insert a specific Member or Group from the editor into any WordPress post or page. More advanced customizations are available to developers who want to make blocks available to (or restricted from) specific custom post types. Developers can also override block output using new filters, disable blocks, and specify a custom stylesheet for a block.

New BP Blocks in action

In a previous WP Tavern review of the 6.0 beta, Justin Tadlock noted that the block settings had each setting is placed within its own tabbed section, which increased the number of clicks required. This feedback was incorporated six weeks ago in a patch from BuddyPress core developer Mathieu Viet, which places all settings into one panel until such a time as more panels become necessary.

Next Up for BuddyPress: Block Versions of Existing Widgets and Community-Requested Blocks

The BuddyPress community has a unique opportunity to shape the future of block development for the plugin. The next blocks are not yet set in stone but Viet said contributors will probably start by adding block versions of the existing widgets, followed by block requests based on community feedback.

“The poll we made about BuddyPress blocks showed there were expectations about a block to share a post or a page into the Activity Stream, so l think we should include such a block,” Viet said. “But we’re are very open to new ideas or contributions to the GitHub repository we use to develop them.”

The poll results indicated that in addition to a block to share a post or a page via the Activity Stream, the community is also strongly interested a block to list the recently published posts from across a network, followed by a block to display Sitewide Notices posted by the site administrator. 

Viet said core contributors have not yet set a roadmap but are working in small steps and carefully following the Gutenberg project to see how they can incorporate it more into community features. A block-based activity posting form is one feature they are considering.

Now is an important time for BuddyPress site owners to give input on the future of the project, whether through block recommendations or via the new 2020 BuddyPress Survey. It includes 17 questions, which take approximately 7-10 minutes to complete. Most of the questions are centered around how you are using BuddyPress on production sites, but one interesting question asks about the prospect of breaking up the plugin’s features to make it more modular:

BuddyPress is a large plugin with optional components (3MB zipped). There’s a proposal to reconstitute BuddyPress as core + members only and improved upon with new functionalities and API’s among others for new BP plugins to hook into. The current optional components like groups, friends, private messaging, etc. can be migrated into separate plugins which can be activated as needed. What do you think?

Survey respondents have the opportunity to choose between keeping BuddyPress as is with core + members and optional components, or break it down to put the components into BP plugins. Feedback on this proposal and other important survey questions will help the BP core team know how to prioritize features for the next release and long-term roadmap.

How Will Facebook's Acquisition of Giphy Impact API Integrations?

Last week, Facebook announced its acquisition of Giphy, one of the most popular GIF sites across the internet. In its announcement, Facebook disclosed that the Facebook family of apps already makes for half of Giphy's traffic, with Instagram making up half of the overall Facebook traffic. Accordingly, the Giphy team will become part of Instagram which has enjoyed API integration with Giphy for quite some time.

Tips for Healthy Page Object Classes

The most popular design pattern used in web UI test codebases is the Page Object Model (POM) design pattern. This pattern suggests modeling a class to represent a single page of your system under test. Using this model, the class would contain properties that represent the elements of the UI page and methods that interact with these elements.

Given this is the Login Page of our application, let’s discuss tips for building a class using POM.

GraphQL With Java Spring Boot and Postgres or MySQL Made Easy!

GraphQL is revolutionising the way developers build APIs. It lets you query precisely what you want. Nothing more, nothing less! It also gives you the flexibility to query related objects in a single round trip, unlike REST APIs. 

In this blog post, we are going to experience GraphQLize, a JVM library for developing a GraphQL API instantly from Postgres and MySQL databases.

What Do We Know About Tomcat 9.0

Apache Tomcat is a very popular and preferred industry choice for web application development as a Servlet/JSP container. Apache Tomcat version 9.0 implements the Servlet 4.0 and Java Server Pages 2.3 specifications from the Java Community Process and includes many additional features that make it a useful platform for developing and deploying web applications and web services.

I take this opportunity to summarize some of the new features in Tomcat 9.0 and steps to keep in mind before upgrading from Tomcat 8.x to Tomcat 9.0.

How to Test Gradle Plugins

In this article, I share my experience of creating functional tests for a custom Gradle plugin and how to configure the plugin project to collect code coverage metrics from tests.

In the previous article, I described how to build a custom Gradle plugin. Here, we will continue to work with it. Before we start, I’d recommend recapping things in the previous article to get a better understanding of where we started.

How To Download and Upload Files Using Selenium With Java

While Selenium testing, you may have come across a requirement where you need to either download or upload a file in Selenium. Almost every web application over the internet may have a feature for allowing users to either download or upload a file. Be it a rich-media platform such as YouTube which lets you upload video files, an online photo collage maker, or an e-commerce web application which allows you to upload images. Even writing assistants like Grammarly and Plagiarism checker like Quetext offer an uploading file functionality.

Similarly, these websites offer downloading functionality, too. YouTube allows offline downloading, and e-commerce platforms such as Amazon will let you download the invoices of your orders. My point is that if you are an automation tester who has a routine set around Selenium testing, there is a good chance for you to run into a requirement where you may have to test a feature around downloading or uploading files in Selenium WebDriver.

WordPress Theme Review Team Changes Name, Now the Themes Team

Last week, the official Theme Review Team (TRT) decided to change its name. The re-branding was mostly about fixing a naming mistake for a team with multiple responsibilities outside of reviews. The hope is that it also shifts the public perception about what the team does.

The idea isn’t new. The team has tossed the concept of a name change around for a few years. It was always going to become the Themes Team unless another naming idea came around and stole the spotlight.

The original concept of changing the name was about inviting others in. To most, the team had been little more than the gatekeepers to the theme directory. However, its members and the work they do for the community reach beyond that scope. Few know or recognize its role outside of reviewing themes, which makes it tougher to bring people on board.

“We realized that we are doing all these theme-related things — work on Twenty Twenty, coding standards, meta stuff, reviews, helping out with full-site editing in any capacity we can, etc. — that being just the Theme Review Team just didn’t make any sense,” said Denis Žoljom, the team’s automation representative. “So we discussed that idea with Josepha [Haden]. In principle, she had nothing against it, so we decided to just go ahead and do the name change.”

The team is in the process of renaming some things, such as its GitHub organization. It will take a little time to get everything in order.

The Themes Team’s primary mission is not changing in terms of reviewing themes. They will continue taking on that role of making sure themes meet coding and security standards, which is a vital and oftentimes thankless task.

“We are reviewing themes as usual, but we are more experimenting with full-site editing,” said Žoljom. “I’m playing with Gutenberg outside of the editor context in my own projects, so that also gives me a perspective to see what things will change. We are still maintaining the WPThemeReview. Theme Check has seen tons of improvements by Carolina [Nymark], which should be merged on .ORG soon. Ari [Stathopoulos] is working on some Gutenberg-related projects. I have the GitHub review flow that I’d like to explore soon.”

Žoljom recently dropped the Theme Sniffer plugin, which was a useful tool for theme authors to check their theme against the WPThemeReview coding standards. He did not have the help from the larger theme developer community to continue working on it. Developers can still use the CLI to check their themes. The plugin was a nice stepping stone for theme authors who are less savvy at typing commands, but projects live and die based on participation.

The team representatives want to bring new contributors to the team. “Reviewing themes is an exhausting and complicated process,” said Žoljom, “and, unfortunately, most people give up very fast.” The team also needs fresh blood so that it can rotate through reps. Few people have the necessary experience to fill this role, and the current reps will eventually burn out.

“We want to work on more interesting projects that will bring new people who are willing to help with them,” said Žoljom. “Especially around full-site editing that is coming to core soon. It’s a big change, and the more contributors we have to help and test things the better.”

The Evolving Team

Ari Stathopoulos, the theme packages representative, pointed out the elephant in the room. The name of the team represented a public perception issue. In part, the team name did not make an appealing case for a newcomer to join the team. On the other side of the aisle, it meant the team was sometimes left out on the .ORG side of things, such as not being brought in on key decisions that affect themes.

“People don’t know that we do all the things we do,” said Stathopoulos. “They believe that all this team does is reviews because that’s what the name of the team was. The truth is that if something has to do with themes, we work on it. There are cases that we don’t, but that’s usually because of miscommunication. People don’t think of consulting with ‘reviewers’ before making changes that have an impact on themes. Hopefully, this re-branding of the team will eventually lead to better communication and understanding. It may take some time, but we’ll get there.”

The Themes Team is beginning to take on even more responsibility. It has been holding block-based themes meetings every two weeks in an attempt to keep everyone updated with the rapid theme-related changes happening in the Gutenberg project. The Make Themes blog will also be receiving weekly updates to help those who are unable to attend the meetings and offer another line of communication.

Arguably, the Themes Team will become one of the most important teams over the next year or so. It must bring in new volunteers to help the community transition to a different theme development experience.

“There is a definite shift of focus, and future themes should be easier to review, leaving this team more time and energy to focus on actions that will have more impact for the community,” said Stathopoulos. “So changing the name was not only correcting an old mistake but also paving the way for future actions we want to take.”

Why API Gateways Still Matter in Service Mesh Deployments

Most of the organizations have become brave enough and spend a lot of time on R&D to convert their underlying business infrastructure to match with the next generation. Most of the time people are focusing on totally revamping their architecture by choosing to go with a microservices model, leaving behind their monolithic architecture.

Tackling Authentication With Vue Using RESTful APIs

Authentication (logging in!) is a crucial part of many websites. Let’s look at how to go about it on a site using Vue, in the same way it can be done with any custom back end. Vue can’t actually do authentication all by itself, —we’ll need another service for that, so we’ll be using another service (Firebase) for that, but then integrating the whole experience in Vue.

Authentication works quite differently on Single Page Applications (SPAs) than it works on sites that reload every page. You don’t have to make an SPA with Vue, but we will in this tutorial. 

Here’s the plan. We’ll build a UI for users to log in and the submitted data will be sent to a server to check if the user exists. If yes, we’ll be sent a token. That’s very useful, because it’s going to be used throughout our site  tocheck if the user is still signed in. If no, the user can always sign up. In other words, it can be used in lots of conditional contexts. Beyond that, if we need any information from the server that requires been logged in, the token is sent to the server through the URL so that information can be only sent to logged in users.

The complete demo of this tutorial is posted on GitHub for those that who are comfortable reading through the code. The rest of us can follow through with the article. The starter file is also on GitHub so you can follow through as we code together. 

After downloading the repo, you’ll run npm install in your terminal. If you’re going to build this application completely on your own, you’ll have to install Vuex, Vue Router, and axios. We’ll also use Firebase for this project, so take a moment to set up a free account and create a new project in there.

After adding the project to Firebase, go to the authentication section, and set up a sign in method where we would be using the traditional email/password provider, that’ll be stored on our Firebase servers.

After that we’ll then go to the Firebase Auth REST API documentation to get our sign up and sign in API endpoints. We’ll need an API key to use those endpoints in our app and it can be found in the Firebase project settings.

Firebase offers authentication over the SDK, but we’re using the Auth API to demonstrate authentication over any custom back end server.

In our stater file, we have the sign up form below. We’re keeping things pretty simple here since we’re focusing on learning the concepts.

<template>
  <div id="signup">
    <div class="signup-form">
      <form @submit.prevent="onSubmit">
        <div class="input">
          <label for="email">Mail</label>
          <input
             type="email"
             id="email"
             v-model="email">
        </div>
        <div class="input">
          <label for="name">Your Name</label>
          <input
            type="text"
            id="name"
            v-model.number="name">
        </div>
        <div class="input">
          <label for="password">Password</label>
          <input
            type="password"
            id="password"
            v-model="password">
        </div>
        <div class="submit">
          <button type="submit">Submit</button>
        </div>
      </form>
    </div>
  </div>
</template>

If we weren’t working with an SPA, we would naturally use axios to send our data inside the script tag like this:

axios.post('https://identitytoolkit.googleapis.com/v1/account
  s:signUp?key=[API_KEY]', {
    email: authData.email,
    password: authData.password,
    returnSecureToken: true
  })
  .then(res => {
    console.log(res)
  })
  .catch(error => console.log(error))        
  }
}

Sign up and log in

Working with an SPA (using Vue in this case) is very different from the above approach. Instead, we’ll be sending our authorization requests using Vuex in our actions in the store.js file. We’re doing it this way because we want the entire app to be aware of any change to the user’s authentication status.

actions: {
  signup ({commit}, authData) {
    axios.post('https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]', {
      email: authData.email,
      password: authData.password,
      returnSecureToken: true
    })
    .then(res => {
      console.log(res)
      router.push("/dashboard")
    })
    .catch(error => console.log(error))
  },
  login ({commit}, authData) {
    axios.post(https://identitytoolkit.googleapis.com/v1/accounts:signIn?key=[API_KEY]', {
      email: authData.email,
      password: authData.password,
      returnSecureToken: true
    })
    .then(res => {
      console.log(res)
      router.push("/dashboard")
    })
    .catch(error => console.log(error))
  }
}

We can use pretty much the same thing for the sign in method, but using the sign in API endpoint instead. We then dispatch both the sign up and log in from the components, to their respective actions in the store.

methods : { 
  onSubmit () {
    const formData = {
      email : this.email,
      name : this.name,     
      password : this.password
    }
    this.$store.dispatch('signup', formData)
    }
  }
}

formData contains the user’s data.

methods : {
  onSubmit () {
    const formData = {
      email : this.email,
      password : this.password
    }
    this.$store.dispatch('login', {email: formData.email, password: formData.password})
  }
}

We’re taking the authentication data (i.e. the token and the user’s ID) that was received from the sign up/log in form, and using them as state with Vuex. It’ll initially result as null.

state: {
  idToken: null,
  userId: null,
  user: null
}

We now create a new method called authUser in the mutations that’ll store the data that’s collected from the response. We need to import the router into the store as we’ll need that later.

import router from '/router'


mutations : {
  authUser (state, userData) {
    state.idToken = userData.token
    state.userId = userData.userId
  }
}

Inside the .then block in the signup/login methods in our actions, we’ll commit our response to the authUser mutation just created and save to local storage.

actions: {
  signup ({commit}, authData) {
    axios.post('https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]'), {
      email: authData.email,
      password: authData.password,
      returnSecureToken: true
    })
    .then(res => {
      console.log(res)
      commit('authUser', {
        token: res.data.idToken,
        userId: res.data.localId
      })
      localStorage.setItem('token', res.data.idToken)
      localStorage.setItem('userId', res.data.localId)
      router.push("/dashboard")
    })
    .catch(error => console.log(error))
  },
  login ({commit}, authData) {
    axios.post('https://identitytoolkit.googleapis.com/v1/accounts:signIn?key=[API_KEY]'), {
      email: authData.email,
      password: authData.password,
      returnSecureToken: true
    })
    .then(res => {
      console.log(res)
      commit('authUser', {
        token: res.data.idToken,
        userId: res.data.localId
      })
        localStorage.setItem('token', res.data.idToken)
        localStorage.setItem('userId', res.data.localId)
        router.push("/dashboard")
      })
    .catch(error => console.log(error))
  }
}

Setting up an Auth guard

Now that we have our token stored within the application, we’re going touse this token while setting up our Auth guard. What’s an Auth guard? It protects the dashboard from unauthenticated users access it without tokens.

First, we’ll go into our route file and import the store. The store is imported because of the token that’ll determine the logged in state of the user.

import store from './store.js'

Then within our routes array, go to the dashboard path and add the method beforeEnter which takes three parameters: to, from and next. Within this method, we’re simply saying that if the tokens are stored (which is automatically done if authenticated), then next, meaning it continues with the designated route. Otherwise, we’re leading the unauthenticated user back to the sign up page.

{
  path: '/dashboard',
  component: DashboardPage,
  beforeEnter (to, from, next) {
    if (store.state.idToken) {
      next()
    } 
    else {
      next('/signin')
    }
  }
}

Creating the UI state

At this point, we can still see the dashboard in the navigation whether we’re logged in or not,  and that’s not what we want. We have to add another method under the getters called ifAuthenticated which checks if the token within our state is null, then update the navigation items accordingly.

getters: {
  user (state) {
    return state.user
  },
  ifAuthenticated (state) {
    return state.idToken !== null
  }
}

Next, let’s open up the header component and create a method called auth inside the computed property. That will dispatch to the ifAuthenticated getters we just created in the store. ifAuthenticated will return false if there’s no token, which automatically means auth would also be null, and vice versa. After that, we add a v-if to check if auth is null or not, determining whether the dashboard option would show in the navigation.

<template>
  <header id="header">
    <div class="logo">
      <router-link to="/">Vue Authenticate</router-link>
    </div>
    <nav>
      <ul>
        <li v-if='auth'>
          <router-link to="/dashboard">Dashboard</router-link>
        </li>
        <li  v-if='!auth'>
          <router-link to="/signup">Register</router-link>
        </li>
        <li  v-if='!auth'>
          <router-link to="/signin">Log In</router-link>
        </li>
      </ul>
    </nav>
  </header>
</template>
<script>
  export default {
    computed: {
      auth () {
        return this.$store.getters.ifAuthenticated
      }
    },
  }
</script>

Logging out

What’s an application without a logout button? Let’s create a new mutation called clearAuth, which sets both the token and userId to null.

mutations: {
  authUser (state, userData) {
    state.idToken = userData.token
    state.userId = userData.userId
  },
  clearAuth (state) {
    state.idToken = null
    state.userId = null
  }
}

Then, in our logout action , we commit to clearAuth, delete local storage and add router.replace('/') to properly redirect the user following logout.

Back to the header component. We have an onLogout method that dispatches our logout action in the store. We then add a @click to the button which calls the to the onLogout method as we can see below:

<template>
  <header id="header">
    <div class="logo">
      <router-link to="/">Vue Authenticate</router-link>
    </div>
    <nav>
      <ul>
        <li v-if='auth'>
          <router-link to="/dashboard">Dashboard</router-link>
        </li>
        <li  v-if='!auth'>
          <router-link to="/signup">Register</router-link>
        </li>
        <li  v-if='!auth'>
          <router-link to="/signin">Log In</router-link>
        </li>
         <li  v-if='auth'>
          <ul @click="onLogout">Log Out</ul>
        </li>
      </ul>
    </nav>
  </header>
</template>
<script>
  export default {
    computed: {
      auth () {
        return this.$store.getters.ifAuthenticated
      }
    },
    methods: {
      onLogout() {
        this.$store.dispatch('logout')
      }
    }
  }
</script>

Auto login? Sure!

We’re almost done with our app. We can sign up, log in, and log out with all the UI changes we just made. But, when we refresh our app, we lose the data and are signed out, having to start all over again because we stored our token and Id in Vuex, which is JavaScript. This means everything in the app gets reloaded in the browser when refreshed. 

What we’ll do is to retrieve the token within our local storage. By doing that, we can have the user’s token in the browser regardless of when we refresh the window, and even auto-login the user as long as the token is still valid.

Create a new actions method called AutoLogin, where we’ll get the token and userId from the local storage, only if the user has one. Then we commit our data to the authUser method in the mutations.

actions : {
  AutoLogin ({commit}) {
    const token = localStorage.getItem('token')
    if (!token) {
      return
    }
    const userId = localStorage.getItem('userId')
    const token = localStorage.getItem('token')
    commit('authUser', {
      idToken: token,
      userId: userId
    })
  }
}

We then go to our App.vue and make a created method where we’ll dispatch the autoLogin from our store when the app is loaded.

created () {
  this.$store.dispatch('AutoLogin')
}

Yay! With that, we’ve successfully implemented authentication within our app and can now deploy using npm run build. Check out the live demo to see it in action.

The example site is purely for demonstration purposes. Please do not share real data, like your real email and password, while testing the demo app.

The post Tackling Authentication With Vue Using RESTful APIs appeared first on CSS-Tricks.

Inspirational Websites Roundup #15

With our roundups we want to share the most interesting design trends around the web with you. Every collection is our personal selection of what we consider to be the most inspirational and trend-setting designs.

This collection is no different: we think these are the finest and most intriguing web experiences that were released in the past weeks. They are not the only ones though, of that I’m sure! So if you stumble upon some great designs, please share them with us @codrops.

We hope you enjoy this special set of really nice designs!

Madies

Rino & Pelle

Stone & Style

LM Chabot

Dash Dash

Henrik & Sofia

Muteza

Voeux Adveris 2020

Powerhouse Company

CUSP

Mixlegno

Kontrapunkt Type

Waka Waka

Houses Of

Corentin Bernadou

LEGO Ventures

Polygon

Edoardo Smerilli

Kati Forner

DEGENESIS

Kelly Milligan

Henge

Cassiom

thePenTool

Rogier de Boevé

Tiffanie Mazellier

100 DAYS OF POETRY

Olivier Gillaizeau

Guillaume Gouessan

GOODFISH

Ruud Luijten

Alan Menken

Rodolfo Sarno

Stephanie Jeong

Inspirational Websites Roundup #15 was written by Mary Lou and published on Codrops.