Easy Offsite Security Tips for WordPress

Easy Offsite Security Tips for WordPressIn the age of digital branding, WordPress is reveling in the increased demand for its user-friendly platform that supports a variety of websites from e-commerce to personal branding ventures. WordPress boasts a diverse client-base from the individual web development nomad looking to utilize the digital space to market their unique skills to companies that run […]

The post Easy Offsite Security Tips for WordPress appeared first on WPExplorer.

Machine and Operations Learning (MLOps)

Machine and Operations Learning (MLOps), similar to DevOps, is a combination of practices and tools that use Data Science and Operations teams to improve model deployment through Machine Learning (ML), AI, monitoring, validation, collaboration, and communication.

Figure: Microsoft Azure - MLOps

This is because according to Gartner, many companies develop Machine Learning models, but only 47% of them are published in production. And still, 88% of AI initiatives have difficulty passing the test stage.

0xcert Announces API to Improve Blockchain Adoption

0xcert, provider of the 0xcert Framework for building decentralized applications, has announced the release of an API that is designed specifically to accelerate the adoption of blockchain technologies. The new API will help users issue and manage non-fungible tokens on the Ethereum blockchain. 

API Security Weekly: Issue #68

This week, we take a look at where API security is at on Gartner Hype Cycle, what the threatscape for 2020 looks like according to McAfee, and a SANS Institute whitepaper on DevSecOps.

Analysts: API Security in Gartner Hype Cycle

Gartner published their Hype Cycle for Application Security, 2019 a few months ago. The Hype Cycle provides a graph on where we are in application security in terms of the maturity of technologies and their adoption; what is up and coming and what is already established.

Intro to MongoDB

The word “database” instantly creates a picture of a table having rows and columns. Typically, any system architecture has a relational database management system (RDBMS) to store data. Data in an RDBMS is stored in tables containing rows and columns, and tables are connected to each other via relational models.

Examples of traditional RDBMSs include Oracle, MySQL, Microsoft SQL Server, DB2, etc. These databases have been in the market for a substantial amount of time, as they are highly efficient and deliver great performance.

Two Rookie Mistakes to Avoid When Training a Predictive Model

Mistakes to avoid when training a predictive modelWhen creating predictive models, it's important to measure accuracy to be able to clearly articulate how good the model is. This article talks about two mistakes that are commonly made when measuring these accuracy values.

1. Measuring Accuracy on the Same Data Used for Training

One common mistake that gets made is measuring the accuracy of the same data that was trained. For example, say you have data from 2017 and 2018 for customer churn. Say you feed all that data to train the model and subsequently use the same data to predict and compare the predictions with the actual results. That is like you are given a question paper before the exam to study at home and the exact same question paper was given to you the next day in the exam. Obviously, that person is going to do great in the exam.

A Practical Way to Think About Prediction Accuracy

One of the common questions that gets asked by management when trying to deploy is, "What is the accuracy?" That is the trap companies tend to get into for wanting the best accuracy to go live.

When talking about accuracy, it's important to compare the accuracy that your model provides in comparison to what you do now without the model.

Image title

How Do You Measure If Your Customer Churn Predictive Model Is Good?

Accuracy is a key measure that management looks at it before giving a green light to take the model to production. This article talks about the practical aspect of what to measure and how to measure. Please refer to this article to learn about the common mistakes made in measuring accuracy.

Two Important Points to Consider When Measuring Accuracy

  1. The data to use when measuring the accuracy should not have been used in the training. You can split your data into 80% and 20%. Use 80% to train and use the rest — 20% — to predict and compare the predicted value with the actual outcome to define the accuracy
  2. One outcome eclipsing the other outcome. Say 95% of your transactions are not fraud. If the algorithm marks every transaction is not fraud, its right 95% of the time. So the accuracy is 95% but the 5% its wrong can break the bank. In those scenarios, we need to deal with other metrics such as Sensitivity & Specificity etc. which we will cover in this article in a practical way.

Problem Definition

The goal for this predictive problem is to identify which customers would churn. The dataset has 1000 rows. Use 80% sample (800 rows) for training and the 20% of the Data to measure accuracy. (200 rows). Say we have trained the model with 800 rows and predicting on the 200 rows.

Google Completing Accelerated Budget Delivery Sunset

Google has announced the complete sunset of accelerated budget delivery. Last October, Google sunsetted its use with search campaigns, shopping campaigns, and shared budgets. Now, Google is beginning to sunset its use with other campaign types (this includes both shared and non-shared budgets). Such apps include Display, App, video campaigns and more.

Native Lazy Loading Support Coming to WordPress

It seems to be the week for dropping news of WordPress feature plugins. Felix Arntz, WordPress core committer and developer programs engineer at Google, announced a plan to push a lazy loading feature to the platform. If testing goes well, this feature could land in WordPress 5.4 in March.

The concept of lazy loading allows a webpage to render without loading certain resources until they are needed. This leads to faster page loads and saves data on the visitor’s end. Lazy loading is particularly useful when rendering images on the web.

The opposite of lazy loading is called eager loading, which loads everything in bulk. By default, this is how all images are loaded on the web. This often leads to poor performance on image-heavy webpages where many of the images are not in the site visitor’s viewport when first viewing the page.

For many years, various JavaScript libraries have handled this feature but not always to success. A native solution is slowly making its way into browsers. Native lazy loading works by adding a loading attribute to an <img> or <iframe> element. Browsers can then decide how to load a resource based on the value of the attribute. Currently, Chrome, Edge, and Opera all handle the loading attribute. Once the attribute officially makes it into the HTML specification, the feature should be a standard that all browsers support.

Adopting the new loading attribute is a great chance for WordPress to lead the way for a faster web overall.

Felix Arntz

The new Lazy Loading feature plugin is now available in the WordPress plugin directory. The plugin relies only on native browser support and does not add extra JavaScript. The implementation adds a loading attribute to images in post content, excerpts, comments, text widgets, avatars, and instances of using core WordPress image functions. By default, the plugin sets all images to load lazily rather than eagerly.

It is refreshing to see the continued work by core contributors on more robust image solutions. Along with WordPress 5.3’s large image size handling, both features will lead to a generally faster web. With more users loading high-quality images via mobile phones over the past few years, it has only exacerbated the problem of a slow web. That is why it imperative that WordPress continually push for image optimization.

“With WordPress enabling native lazy-loading by default, it would significantly impact performance and user experience for millions of sites, without requiring any technical knowledge or even awareness of lazy-loading as a concept,” wrote Arntz in the announcement post. “Adopting the new loading attribute is a great chance for WordPress to lead the way for a faster web overall.”

Arntz and a team of engineers originally released a native lazy loading plugin in September 2019. This was shortly after Google brought the “loading” attribute feature to version 76 of its Chrome browser. The Native Lazyload plugin currently has over 7,000 installations.

How This Affects Existing Plugins

Because not all web browsers support the loading attribute, users may not want to automatically drop their current plugins when the feature lands in WordPress. Users may choose to support browsers without native lazy loading for a while

The proposed code within the Lazy Loading plugin attempts to detect whether the loading attribute exists on an image before applying it. This means the code should play nicely with existing plugins and avoid conflicts in most cases.

Developers of plugins that handle lazy loading need to start testing their plugins and updating them for WordPress 5.4. Follow the Lazy Loading API ticket on core Trac to stay updated on when the feature lands and the GitHub repository for contributing to its development.

Sticky Table of Contents with Scrolling Active States

Say you have a two-column layout: a main column with content. Say it has a lot of content, with sections that requires scrolling. And let's toss in a sidebar column that is largely empty, such that you can safely put a position: sticky; table of contents over there for all that content in the main column. A fairly common pattern for documentation.

Bramus Van Damme has a nice tutorial on all this, starting from semantic markup, implementing most of the functionality with HTML and CSS, and then doing the last bit of active nav enhancement with JavaScript.

For example, if you don't click yourself down to a section (where you might be able to get away with :target styling for active navigation), JavaScript is necessary to tell where you are scrolled to an highlight the active navigation. That active bit is handled nicely with IntersectionObserver, which is, like, the perfect API for this.

Here's that result:

It reminds me of a very similar demo from Hakim El Hattab he called Progress Nav. The design pattern is exactly the same, but Hakim's version has this ultra fancy SVG path that draws itself along the way, indenting for sub nav. I'll embed a video here:

That one doesn't use IntersectionObserver, so if you want to hack on this, combine 'em!

The post Sticky Table of Contents with Scrolling Active States appeared first on CSS-Tricks.

“resize: none;” on textareas is bad UX

Catalin Rosu:

Sometimes you need to type a long reply that consists of many paragraphs and wrapping that text within a tiny textarea box makes it hard to understand and to follow as you type. There were many times when I had to write that text within Notepad++ for example and then just paste the whole reply in that small textarea. I admit I also opened the DevTools to override the resize: none declaration but that’s not really a productive way to do things.

Removing the default resizeability of a <textarea> is generally user-hurting vanity. Even if the resized textarea "breaks" the site layout, too bad, the user is trying to do something very important on this site right now and you should not let anything get in the way of that. I know the web is a big place though, so feel free to prove me wrong in the comments.

This must have been cathartic for Catalin, who has been steadily gaining a reputation on Stack Overflow for an answer on how to prevent a textarea from resizing from almost a decade ago.

Direct Link to ArticlePermalink

The post “resize: none;” on textareas is bad UX appeared first on CSS-Tricks.

In-App Tips

You might see modals like this from time to time when you log in and visit the homepage.

It's a little in-app feature education, if you will. It's marketing too, in a sense, as sometimes we're using it to tell you about PRO features. We podcasted about that just recently:

That one above is about the Dashboard. We chose that one recently as we've had some feedback from people telling us it's too hard to find their own work, and it turns out they had never tried the Dashboard, and once they had were very happy with that.

The first time we ever did this style of in-app notification was when we released the Private by Default feature. That was met with much enthusiasm. We worried that these types of notifications might cause pushback (get out of my way! I'm trying to do something else!), but we've heard almost none of that and plenty of thanks for letting us know feedback.

You might see modals like this once in a while going forward letting you know about features of CodePen you might not be aware of.

The post In-App Tips appeared first on CodePen Blog.

Understanding Immutability in JavaScript

If you haven’t worked with immutability in JavaScript before, you might find it easy to confuse it with assigning a variable to a new value, or reassignment. While it’s possible to reassign variables and values declared using let or var, you'll begin to run into issues when you try that with const.

Say we assign the value Kingsley to a variable called firstName:

let firstName = "Kingsley";

We can reassign a new value to the same variable,

firstName = "John";

This is possible because we used let. If we happen to use const instead like this:

const lastName = "Silas";

…we will get an error when we try to assign it to a new value;

lastName = "Doe"
// TypeError: Assignment to constant variable.

That is not immutability.

An important concept you’ll hear working with a framework, like React, is that mutating states is a bad idea. The same applies to props. Yet, it is important to know that immutability is not a React concept. React happens to make use of the idea of immutability when working with things like state and props.

What the heck does that mean? That’s where we're going to pick things up.

Mutability is about sticking to the facts

Immutable data cannot change its structure or the data in it. It’s setting a value on a variable that cannot change, making that value a fact, or sort of like a source of truth — the same way a princess kisses a frog hoping it will turn into a handsome prince. Immutability says that frog will always be a frog.

Objects and arrays, on the other hand, allow mutation, meaning the data structure can be changed. Kissing either of those frogs may indeed result in the transformation of a prince if we tell it to.

Say we have a user object like this:

let user = { name: "James Doe", location: "Lagos" }

Next, let’s attempt to create a newUser object using those properties:

let newUser = user

Now let’s imagine the first user changes location. It will directly mutate the user object and affect the newUser as well:

user.location = "Abia"
console.log(newUser.location) // "Abia"

This might not be what we want. You can see how this sort of reassignment could cause unintended consequences.

Working with immutable objects

We want to make sure that our object isn’t mutated. If we’re going to make use of a method, it has to return a new object. In essence, we need something called a pure function.

A pure function has two properties that make it unique:

  1. The value it returns is dependent on the input passed. The returned value will not change as long as the inputs do not change.
  2. It does not change things outside of its scope.

By using Object.assign(), we can create a function that does not mutate the object passed to it. This will generate a new object instead by copying the second and third parameters into the empty object passed as the first parameter. Then the new object is returned.

const updateLocation = (data, newLocation) => {
    return {
      Object.assign({}, data, {
        location: newLocation
    })
  }
}

updateLocation() is a pure function. If we pass in the first user object, it returns a new user object with a new value for the location.

Another way to go is using the Spread operator:

const updateLocation = (data, newLocation) => {
  return {
    ...data,
    location: newLocation
  }
}

OK, so how does this all of this fit into React? Let’s get into that next.

Immutability in React

In a typical React application, the state is an object. (Redux makes use of an immutable object as the basis of an application’s store.) React’s reconciliation process determines if a component should re-render or if it needs a way to keep track of the changes.

In other words, if React can’t figure out that the state of a component has changed, then it will not not know to update the Virtual DOM.

Immutability, when enforced, makes it possible to keep track of those changes. This allows React to compare the old state if an object with it’s new state and re-render the component based on that difference.

This is why directly updating state in React is often discouraged:

this.state.username = "jamesdoe";

React will not be sure that the state has changed and is unable to re-render the component.

Immutable.js

Redux adheres to the principles of immutability. Its reducers are meant to be pure functions and, as such, they should not mutate the current state but return a new object based on the current state and action. We’d typically make use of the spread operator like we did earlier, yet it is possible to achieve the same using a library called Immutable.js.

While plain JavaScript can handle immutability, it’s possible to run into a handful of pitfalls along the way. Using Immutable.js guarantees immutability while providing a rich API that is big on performance. We won’t be going into all of the fine details of Immutability.js in this piece, but we will look at a quick example that demonstrates using it in a to-do application powered by React and Redux.

First, lets’ start by importing the modules we need and set up the Todo component while we’re at it.


const { List, Map } = Immutable;
const { Provider, connect } = ReactRedux;
const { createStore } = Redux;

If you are following along on your local machine. you’ll need to have these packages installed:

npm install redux react-redux immutable 

The import statements will look like this.

import { List, Map } from "immutable";
import { Provider, connect } from "react-redux";
import { createStore } from "redux";

We can then go on to set up our Todo component with some markup:

const Todo = ({ todos, handleNewTodo }) => {
  const handleSubmit = event => {
    const text = event.target.value;
    if (event.keyCode === 13 && text.length > 0) {
      handleNewTodo(text);
      event.target.value = "";
    }
  };

  return (
    <section className="section">
      <div className="box field">
        <label className="label">Todo</label>
        <div className="control">
          <input
            type="text"
            className="input"
            placeholder="Add todo"
            onKeyDown={handleSubmit}
          />
        </div>
      </div>
      <ul>
        {todos.map(item => (
          <div key={item.get("id")} className="box">
            {item.get("text")}
          </div>
        ))}
      </ul>
    </section>
  );
};

We’re using the handleSubmit() method to create new to-do items. For the purpose of this example, the user will only be create new to-do items and we only need one action for that:

const actions = {
  handleNewTodo(text) {
    return {
      type: "ADD_TODO",
      payload: {
        id: uuid.v4(),
        text
      }
    };
  }
};

The payload we’re creating contains the ID and the text of the to-do item. We can then go on to set up our reducer function and pass the action we created above to the reducer function:

const reducer = function(state = List(), action) {
  switch (action.type) {
    case "ADD_TODO":
      return state.push(Map(action.payload));
    default:
      return state;
  }
};

We’re going to make use of connect to create a container component so that we can plug into the store. Then we’ll need to pass in mapStateToProps() and mapDispatchToProps() functions to connect.

const mapStateToProps = state => {
  return {
    todos: state
  };
};

const mapDispatchToProps = dispatch => {
  return {
    handleNewTodo: text => dispatch(actions.handleNewTodo(text))
  };
};

const store = createStore(reducer);

const App = connect(
  mapStateToProps,
  mapDispatchToProps
)(Todo);

const rootElement = document.getElementById("root");

ReactDOM.render(
  <Provider store={store}>
    <App />
  </Provider>,
  rootElement
);

We’re making use of mapStateToProps() to supply the component with the store’s data. Then we’re using mapDispatchToProps() to make the action creators available as props to the component by binding the action to it.

In the reducer function, we make use of List from Immutable.js to create the initial state of the app.

const reducer = function(state = List(), action) {
  switch (action.type) {
    case "ADD_TODO":
      return state.push(Map(action.payload));
    default:
      return state;
  }
};

Think of List as a JavaScript array, which is why we can make use of the .push() method on state. The value used to update state is an object that goes on to say that Map can be recognized as an object. This way, there’s no need to use Object.assign() or the spread operator, as this guarantees that the current state cannot change. This looks a lot cleaner, especially if it turns out that the state is deeply nested — we do not need to have spread operators sprinkled all over


Immutable states make it possible for code to quickly determine if a change has occurred. We do not need to do a recursive comparison on the data to determine if a change happened. That said, it’s important to mention that you might run into performance issues when working with large data structures — there’s a price that comes with copying large data objects.

But data needs to change because there’s otherwise no need for dynamic sites or applications. The important thing is how the data is changed. Immutability provides the right way to change the data (or state) of an application. This makes it possible to trace the state’s changes and determine what the parts of the application should re-render as a result of that change.

Learning about immutability the first time will be confusing. But you’ll become better as you bump into errors that pop up when the state is mutated. That’s often the clearest way to understand the need and benefits of immutability.

Further reading

The post Understanding Immutability in JavaScript appeared first on CSS-Tricks.

Uses This

A little interview with me over on Uses This. I'll skip the intro since you know who I am, but I'll republish the rest here.

What hardware do you use?

I'm a fairly cliché Mac guy. After my first Commodore 64 (and then 128), the only computers I've ever had have been from Apple. I'm a longtime loyalist in that way and I don't regret a second of it. I use the 2018 MacBook Pro tricked out as much as they would sell it to me. It's the main tool for my job, so I've always made sure I had the best equipment I can. A heaping helping of luck and privilege have baked themselves into moderate success for me such that I can afford that.

At the office, I plug it into two of those LG UltraFine 4k monitors, a Microsoft Ergonomic Keyboard, and a Logitech MX Master mouse. I plug in some Audioengine A2s for speakers. Between all those extras, the desk is more cluttered in wires than I would like and I look forward to an actually wireless future.

I'm only at the office say 60% of the time and aside from that just use the MacBook Pro as it is. I'm probably a more efficient coder at the office, but my work is a lot of email and editing and social media and planning and such that is equally efficient away from the fancy office setup.

And what software?

  • Notion for tons of stuff. Project planning. Meeting notes. Documentation. Public documents.
  • Things for personal TODO lists.
  • BusyCal for calendaring.
  • 1Password for password, credit cards, and other secure documents and notes.
  • Slack for team and community chat.
  • WhatsApp for family chat.
  • Zoom for business face-to-face chat and group podcasting.
  • Audio Hijack for locally recording podcasts.
  • FaceTime for family face to face chat.
  • ScreenFlow for big long-form screen recordings.
  • Kap for small short-form screen recordings.
  • CleanMyMac for tidying up.
  • Local for local WordPress development.
  • VS Code for writing code.
  • TablePlus for dealing with databases.
  • Tower for Git.
  • iTerm for command line work.
  • Figma for design.
  • Mailplane to have a tabbed in-dock closable Gmail app.
  • Bear for notes and Markdown writing.

What would be your dream setup?

I'd happily upgrade to a tricked out 16" MacBook Pro. If I'm just throwing money at things I'd also happily take Apple's Pro Display XDR, but the price on those is a little frightening. I already have it pretty good, so I don't do a ton of dreaming about what could be better.

The post Uses This appeared first on CSS-Tricks.

Free Website Builder + Free CRM + Free Live Chat = Bitrix24

(This is a sponsored post.)

You may know Bitrix24 as the world’s most popular free CRM and sales management system, used by over 6 million businesses. But the free website builder available inside Bitrix24 is worthy of your attention, too.

Why do I need another free website/landing page builder?

There are many ways to create free websites — Wix, Squarepage, WordPress, etc. And if you need a blog — Medium, Tumblr and others are at your disposal. Bitrix24 is geared toward businesses that need websites to generate leads, sell online, issue invoices or accept payments. And there’s a world of difference between regular website builders and the ones that are designed with specific business needs in mind.

What does a good business website builder do? First, it creates websites that engage visitors so that they start interacting. This is done with the help of tools like website live chat, contact form or a call back request widget. Second, it comes with a landing page designer, because business websites are all about conversion rates, and increasing conversion rates requires endless tweaking and repeated testing. Third, integration between a website and a CRM system is crucial. It’s difficult to attract traffic to websites and advertising expensive. So, it makes sense that every prospect from the website as logged into CRM automatically and that you sell your goods and services to clients not only once but on a regular basis. This is why Bitrix24 comes with email and SMS marketing and advertising ROI calculator.

Another critical requirement for many business websites is ability to accept payments online and function as an ecommerce store, with order processing and inventory management. Bitrix24 does that too. Importantly, unlike other ecommerce platforms, Bitrix24 doesn’t charge any transaction fees or come with sales volume limits.

What else does Bitrix24 offer free of charge?

The only practical limit of the free plan is 12 users inside the account. You can use your own domain free of charge, the bandwidth is free and unlimited and there’s only a technical limit on the number of free pages allowed (around 100) in order to prevent misusing Bitrix24 for SEO-spam pages. In addition to offering free cloud service, Bitrix24 has on-premise editions with open source code access that can be purchased. This means that you can migrate your cloud Bitrix24 account to your own server at any moment, if necessary.

To register your free Bitrix24 account, simply click here. And if you have a public Facebook or Twitter profile and share this post, you’ll be automatically entered into a contest, in which the winner gets a 24-month subscription for the Bitrix24 Professional plan ($3,336 value).

Direct Link to ArticlePermalink

The post Free Website Builder + Free CRM + Free Live Chat = Bitrix24 appeared first on CSS-Tricks.

Collective #585






Collective Item Image

YourStack

YourStack is a place to share and discover your favorite products. Now in public beta.

Check it out






Collective Item Image

The Year of Greta

An interactive timeline of how Greta Thunberg rose from a solo campaigner to the leader of a global movement in 2019.

Check it out



Collective Item Image

Lingua Franca

Lingua Franca is a design language for human-centered AI – a set of guidelines that apply to any AI-driven product, tool, service, or experience, to bring coherence and fluidity to otherwise complex and messy technologies.

Check it out


Collective Item Image

PPL MVR

An animated recreation of a PPL MVR band poster. By Kristopher Van Sant.

Check it out




Collective Item Image

HanaGL

Such an awesome WebGL demo! Put the finger in the nose and see what happens 🙂

Check it out






Collective #585 was written by Pedro Botelho and published on Codrops.