8 Open Source Projects You Need to See!

The year 2020 has already started and with it, the huge amount of languages/frameworks/tools that we developers have to know, learn or just 'take a look at' only increases. In this short article, I try to demonstrate the 8 OpenSource projects that appear to be promising for the year. Many of these projects are already in use today (some even on a large scale), others are coming into focus just this year, either through community adoption or relevance in the current context of software development.

Frontend

React — Gatsby

Gatsby is an SSG (Static Site Generator) OpenSource based on React that aims to make development easier and more efficient. Gatsby is a framework that brings together the main features of React and several other modern tools in the same package, facilitating the creation of fast and powerful websites and web applications. 

7 Vue.js Backends Compared

Which backend are you planning to use for your next Vue.js project?

Often developers choose what they're familiar with. If you're primarily a Laravel developer, for example, I'll bet Laravel will be first to your mind when planning a new project.

REST to GraphQL in Minutes

With all the madness currently going in the API world with GraphQL, you might be wondering how to migrate your existing REST APIs to GraphQL without breaking anything. This guide will help you accomplish your REST to GraphQL mission without changing your codebase so that you can REST with GraphQL (pun intended)!

REST to GraphQL

Well, GraphQL advocates have done a great job in marketing GraphQL already. Respecting their efforts, I won’t be going into details, but provide a summary:

A Simple HTTP Server in Java

Do you want to implement an HTTP server, but do you not want to take any risk of writing a full-fledged HTTP server? Developing an HTTP server with full capability is not a trivial task. But Java has got a solution to this kind of problem. Java supports an in-built HTTP server. By just writing 100 lines of code, we can develop a somewhat-decent HTTP server that can handle HTTP GET and POST requests. We can also leverage it to handle other HTTP commands as well.

HTTPServer class

Java SDK provides an in-built server called HttpServer. This class belongs to com.sun.net   package. 

A Technologist’s Perspective: Blockchain Beyond the Hype

There’s a lot of speculative investment around blockchain space but not a lot of real use. This will change when reality kicks in and new players get involved.

As a developer in this space, you don't sell hype. You sell your craftmanship. I had the privilege to get to interview @jillesvangurp, a senior backend developer with hands-on experience in building blockchains. Interesting stuff on the future of money and finance. And how to navigate in such a hyped and speculative industry as a developer.

The Best of Node and Express [Articles and Tutorials]

All aboard!

Built on top of Google Chrome's V8 Engine, Node.js (and its companion framework, Express.js) have come to dominate much of backend development, especially when JavaScript is your language of choice on the server-side. In this edition of "Best of DZone," we're going to take a look into the two frameworks to better understand key pieces of functionality and how they work in tandem to create applications.  

Before we begin, we'd like need to thank those who were a part of this article. DZone has and continues to be a community powered by contributors like you who are eager and passionate to share what they know with the rest of the world. 

Tips for Beginning Backend Web Developers to Advance Quickly

U + Django = <3

It’s easy to learn to build scalable interactive web sites if you choose a simple learning path. I recommend you start with Python and Django instead of JavaScript and Mongo, Express, Angular (or React, Vue) and Node (MEAN) stack.

I've observed the success and failure to approaches that thousands of developers took to access a REST-like API in the RICOH THETA developer community. I saw problems students encountered in workshops and one-on-one training. Novice backend developers finish more projects when they use Python. To get people started quickly, I developed a free video course on YouTube, The Beginner Django Tutorial.

Create your own bulk actions

2016-10-21_13-46-04
Including version 4.6 it was quite difficult to add custom bulk actions to the WordPress admin pages. In version 4.7 a hook is added that simplifies the task a lot:

add_action('bulk_actions-{screen_id}', 'my_bulk_action');

Defining the hook

As an example we’ll use the post page, the variables are named accordingly.

add_filter( 'bulk_actions-edit-post', 'register_my_bulk_actions' );

Definig the hook

function register_my_bulk_actions($bulk_actions) {
  $bulk_actions['my_bulk_action'] = __( 'My Bulk Action', 'domain');
  $bulk_actions['my_other_bulk_action'] = __( 'My Other Bulk Action', 'domain');
  return $bulk_actions;
}

You can define more than one bulk action in this function because it merely adds an additional element to the array $bulk_actions. You simply have to take care that you use different names for the element keys and, logically, for the display texts.

The screen ids

The screen id of an admin page can be displayed this code snippet:

$screen = get_current_screen();
var_dump($screen);

This table shows the ids for some admin pages:

Page $screen_id File
Media Library upload upload.php
Comments edit-comments edit-comments.php
Tags edit-post_tag edit-tags.php
Plugins plugins plugins.php
Links link-manager link-manager.php
Users users users.php
Posts edit-post edit.php
Pages edit-page edit.php
Edit Site: Themes site-themes-network network/site-themes.php
Themes themes-network network/themes
Users users-network network/users
Edit Site: Users site-users-network network/site-users
Sites sites-network network/sites

Defining the callback function

Here’s an overview of the whole function:

add_filter( 'handle_bulk_actions-edit-post', 'my_bulk_action_handler', 10, 3 );

function my_bulk_action_handler( $redirect_to, $action_name, $post_ids ) { 
  if ( 'my_bulk_action' === $action_name ) { 
    foreach ( $post_ids as $post_id ) { 
      $post = get_post($post_id); 
      // process $post wp_update_post($post); 
    } 
    $redirect_to = add_query_arg( 'bulk_posts_processed', count( $post_ids ), $redirect_to ); 
    return $redirect_to; 
  } 

  elseif ( 'my_other_bulk_action' === $action_name ) { 
    foreach ( $post_ids as $post_id ) { 
      $post_meta = get_post_meta( $post_id ); 
      // process $post_meta update_post_meta( $post_meta ); 
    } 
    $redirect_to = add_query_arg( 'other_bulk_posts_precessed', count( $post_ids ), $redirect_to );
    return $redirect_to; 
  } 
  
  else 
    return $redirect_to; } 

As mentioned above you can define more than one custom bulk action but only a single callback function. So you first have to test which bulk action has been selected (lines 4 and 13).

Next the posts are processed in a foreach loop (lines 5 and 14). In this loop you can load the post with get_post or the post meta with get_post_meta() and process the data. Next the changed data is written back to the database with wp_update_post() or update_post_meta().

The variable $redirect_to (lines 9 and 18) is used to define the URL the browser will change to after the bulk actions have been completed, in our case it is set to .../wp-admin/edit.php?paged=1. We do not want to change the location but to use the variable to pass a value to the page the browser is redirected to.
With the function add_query_arg() we add an argument to the URL that specifies the number of processed posts: /wp-admin/edit.php?paged=1&bulk_posts_processed=1.

Display a success notification

After completing processing all posts you can display an admin notice using the action admin_notices(). The second parameter of the function call needs to contain the text string we have defined in our filter bulk_actions-{screen-id}:

function my_bulk_action_admin_notice() { 
  if ( ! empty( $_REQUEST['bulk_posts_processed'] ) ) { 
    $posts_count = intval( $_REQUEST['bulk_posts_processed'] ); printf( '
' . _n( 'Processed %s post.', 'Processed %s posts.', $posts_count, 'domain' ) . ' ', $posts_count ); 
  } 
} 

Trivia

A little fun fact at the end: The corresponding ticket (#16031) was opened six years ago, 2010, in that times we used WordPress v3.0.