Chromium lands Flexbox gap

I mentioned this the other day via Michelle Barker’s coverage, but here I’ll link to the official announcement. The main thing is that we’ll be getting gap with flexbox, which means:

.flex-parent {
  display: flex;
  gap: 1rem;
}
.flex-child {
  flex: 1;
}

That’s excellent, as putting space in between flex items has been tough in the past. We have justify-content: space-between, which is nice sometimes, but that doesn’t allow you to explicitly tell the flex container how much space you want. For that, we’d typically use margin, but that means avoiding setting the margin on the first or last element depending on the direction of the margin — which is annoying gets complicated.

We have gap in CSS Grid and it’s way better. It’s great to have it in flexbox.

But it’s going to get weird for a minute. Safari doesn’t support it yet (nor stable Chrome) so we can’t just plop it out there and expect it to work with flexbox. But shouldn’t we be able to do an @supports query these days?

/* Nope, sorry. This "works" but it doesn't 
   actually tell you if it works in *flexbox* or not.
   This works in grid in most browsers now, so it will pass. */
@supports (gap: 1rem) {
  .flex-parent {
     gap: 1rem;
  }
}

That got weird because grid-gap was dropped in favor of just gap. I’m sure grid-gap will be supported forever because that’s generally how these things go, but we’re encouraged to use gap instead. So, you might say gap is a little overloaded, but that should shake out over time (a year?). It’s complicated a smidge more by the fact that column-gap is now going to gap as well. gap has a whole bunch of jobs.

I’d say I’m still in favor of the change, despite the overloading. Simpler mental modals are important for the long-term, and there isn’t exactly anything coming up to challenge CSS for styling in the browser. I’d bet my 2-year old daughter writes some CSS in her lifetime.

Direct Link to ArticlePermalink

The post Chromium lands Flexbox gap appeared first on CSS-Tricks.

prerender.js

This is another player in the game of rendering the page of the link that you’re about to click on before you click it. It’s like getting a decent performance boost for extremely little effort.

Instant.page is another one, and I’ve been sufficiently convinced by its methodology to the extent that I run it here on this site right now. I don’t really know the difference between the two. And they aren’t the only players either. Google has quicklink and there’s guess-js for really exotic preloading.

It’s a bit of a pity that Safari and Firefox don’t support <link rel="prerender">, as it really seems to me the absolute easiest way to pull this off would be to drop that on the page where, on mouseover of a link, it points to the href of that link.

Direct Link to ArticlePermalink

The post prerender.js appeared first on CSS-Tricks.

Open Food Facts Launches Laravel API Library

Open Food Facts, a global provider of nutrition information, has launched an API library for Laravel. The Open Food Facts database includes information on over 1.3 million food items and the organization has added the API wrapper for Laravel to simplify integration with the database for Laravel applications. 

WordCamp Spain 2020 Q&A: Matt Mullenweg Discusses Virtual Events, Decoupled WordPress, and the Future of Page Builders

Matt Mullenweg joined Matías Ventura at WordCamp Spain yesterday for a lively Q&A session. The virtual event drew 5,000 registered users, and attendees came prepared with some thought-provoking questions about the future of WordPress. Here are a few highlights on some recent topics of interest.

WordCamps around the globe have been going virtual, embracing the challenge of keeping communities connected through the screen. Mullenweg shared thoughts on how WordCamps have changed during the pandemic and what might be worthwhile to maintain after things go back to normal:

WordCamps were always exclusionary. If you couldn’t make it to be in a physical point at a physical time, you couldn’t be there. Tickets were cheap but travel and other costs could be expensive. To our mission of democratizing publishing, if we could radically open up some of the value of WordCamps, not just the talks because the talks you could always watch later online, but some of that person-to-person connection and relationship-building that would happen at WordCamps – if we can recreate that online I feel like that could be something that would be amazing for the WordPress community. I feel like we used our in-person events as a crutch, actually. Because they were so good, and I love them, we overweighted towards them. This time allows us to reflect and also try new things that we might not have been pushed to otherwise. I hope that we don’t stop any of these new things. I hope there are more WordCamp events in every language.

Large regional events like WordCamp Europe and WordCamp US will be going virtual in the coming months and it will be interesting to see how they work to reproduce the intimate, in-person connections that are often forged at these events.

One of the first questions was regarding Automattic’s recent investment in Frontity. Does Automattic’s interest mean that React might be implemented in the public part of WordPress? Mullenweg highlighted a few of the positive and negative aspects of decoupled WordPress setups but also confirmed that a React frontend is not on the roadmap for core:

I’m excited to be able to support Frontity. Automattic tries to support as many of the WordPress ecosystem companies as possible. If there is a company doing something interesting in WordPress, we would love to invest and support it. In terms of a React theme in default WordPress, I think that to me that stays in plugin and theme territory for the foreseeable future. The downside of that approach is that you lose all the capabilities of the decades of WordPress plugins and themes and integrations and everything when you move to that more decoupled React frontend. I don’t know if what you gain is that much better for a normal content website. In fact, so many single page applications in React when they get to version 2 or 3 usually work on server side rendering. We have server side rendering by default, and it’s really fast and really good, especially when you layer in AMP or some other things that can speed it up. It can actually be probably the best possible thing for content driven sites, the best practice, versus application driven sites where something like React might be better. If you take a really optimized PHP-served AMP page, performance-wise versus the same thing going through React, it’s hard for me to imagine the React page being faster. In fact, I think it would be much slower. That’s how I think about the defaults. But for people who are building more advanced applications or have some sort of constraint on their website where they need the React frontend, I think the decoupled use case of WordPress is stronger than ever. I don’t know why anyone would use a proprietary backend, like Contentful or something like that, when you have all the open source security, scalability, and robustness of WordPress available in a decoupled infrastructure as well.

Ventura noted that just because WordPress uses these technologies in the backend, doesn’t mean it has to be used on the frontend as well. Based on these comments, it doesn’t seem likely that WordPress will be adopting a React-based default theme anytime in the near future.

The fate of page builders in the Gutenberg era is always a popular topic during Q&A sessions and WordCamp Spain was no exception. The general concern is whether Gutenberg’s full site editing capabilities will make these plugins obsolete, but Mullenweg seemed optimistic about WordPress leaving page builders a piece of the market:

I’m really excited for the future of page builders. Before every single page builder would have to do a fair amount of work to recreate their version of blocks. There was a lot of wasted effort with many talented and great developers all over the world essentially rebuilding the wheel or recreating the block over and over. Now that we have these rails in the core of this block infrastructure, it’s been widely adopted and implemented with thousands of blocks being created and many more to come, they don’t have to create that core fundamental infrastructure and can instead innovate on top of it, because there are so many cool things you can do in page builders that are out of scope of where we want to take Gutenberg.

Mullenweg also said he anticipates that page builders that are not built with Gutenberg in mind will likely be used less and less over time. However, it should be reassuring that there will still be a place in the WordPress ecosystem for products that build on top of the core standard.

The Q&A session included many more questions on topics of interest, including when multi-language is coming to core, the future of themes, the present and future of the WP REST API, and what new business options may be coming to the WordPress ecosystem. Check out the recorded session embedded below to find out what Matt and Matías would improve in WordPress if they had a magic wand.

Modular Mining Launches API for Bi-Directional Data Sharing

Modular Mining, a global provider of real-time computer-based mine optimization solutions, announced today the launch of its Modular Mining Public Application Programming Interface (API). The new API is designed for superior integration and increased openness among third-party technologies and Modular Mining’s IntelliMine® portfolio, including the DISPATCH® Fleet Management and ProVision® Machine Guidance systems.

Drag and Drop Nav Menu Items in WordPress

Earlier this week, Sajjad Hossain Sagor released the first version of his Drag & Drop Menu Items plugin in the WordPress plugin repository. The plugin is a one-off, single-use plugin that does exactly what its name describes — it allows end-users to drag menu items from the meta boxes on the nav menu screen to the menu they are currently editing.

Sagor is a freelance web developer from Bangladesh. Drag & Drop Menu Items is the latest of his 18 contributions to the free plugin directory.

The plugin is simple in nature and does its one job well. To use it, users merely need to open the Appearance > Menus screen in the WordPress admin. Menu items from the meta boxes under the “Add menu items” section can then be dragged into the menu under the “Menu structure” section.

Screenshot of the Drag & Drop Menu Items WordPress plugin.
Dragging an item into a custom menu.

When dragging a menu item over, a drop-box appears between each of the existing items in the menu. It is worth noting that you cannot drag items into a sub-menu slot directly from the meta boxes. This is on par with the default functionality and could be a limitation of WordPress. However, sub-menu organization works as usual.

The Drag & Drop Menu Items plugin is limited to the Menus screen in the WordPress admin. It does not work in the customizer, which sports a different interface and method of adding menu items.

The plugin code is minimal and does not appear to have any issues. The additional JavaScript, at less than 4 kb, should not add much weight to the page either.

By default, WordPress requires two mouse clicks to add an item to a menu: one click to tick the checkbox and a button click to add the item. However, the default method also allows users to append multiple items at once.

On the whole, the plugin is a good option for users who prefer the drag-and-drop method of adding items or those who prefer to have both methods at their disposal. It adds a nice touch that would make sense as an existing part of WordPress.

An Uncertain Future

Screenshot of the experimental Navigation screen in the Gutenberg plugin.
Experimental Navigation screen from the Gutenberg plugin.

Eventually, Drag & Drop Menu Items may no longer function. The Gutenberg plugin team has already built an early experimental version of a new Navigation screen in the admin. The plan is to incorporate this new screen into core WordPress in the future.

The new screen will work within the block system and likely use the work that has gone into the existing Navigation block. This will provide consistency in how menus are added across the site.

For now, if you would like the ability to drag and drop menu items, this plugin is a solid solution.

Alpha Roc Opens Crypto Arbitrage Algorithms through API

Alpha Roc, a crypto trading firm specializing in arbitrage, has announced that it is opening up its keystone trading algorithm (ALPHA) through an open API. Access to Alpha Roc's suite of trading algorithms has been traditionally limited to hedge funds and partner offices. Now, the company is opening up this powerful technology to retail investors.

Fake News’ Foe: Machine Learning and Twilio

Fake news has become a huge issue in our digitally-connected world and it is no longer limited to little squabbles — fake news spreads like wildfire and is impacting millions of people every day.

How do you deal with such a sensitive issue? Countless articles are being churned out every day on the internet — how do you tell real from fake? It's not as easy as turning to a simple fact-checker which is typically built on a story-by-story basis. As developers, can we turn to machine learning?

Generating Classes at Runtime and Invoking Their Methods With and Without the Use of Reflection in Java 8 and Later

The generation of classes at runtime is an advanced topic that requires a lot of knowledge that can be reduced if you use particular libraries that perform the most complex functions to accomplish this task.
So, for this purpose, we can use the ClassFactory component and the sources generating components of the Burningwave Core library. Once the sources have been set in UnitSourceGenerator objects, they must be passed to loadOrBuildAndDefine method of ClassFactory with the ClassLoader where you want to define newly generated classes.

This method performs the following operations: tries to load all the classes present in the UnitSourceGenerator through the class loader, if at least one of these is not found it proceeds to compile all the UnitSourceGenerators and uploading their classes on class loader: in this case, keep in mind that if a class with the same name was previously loaded by the class loader, the compiled class will not be uploaded.

How to Back Up and Restore a 10-TB Cluster at 1+ GB/s

Backing up or restoring large-scale distributed databases is time-consuming. When it takes a lot of time to backup or restore a database, Garbage Collection might break the snapshot used in the backup or restore process. Thus, some changes might be missing. This threatens data safety.

As an open-source, distributed SQL database, TiDB fulfills the requirement for backing up and restoring large-scale clusters. TiDB 4.0 release candidate (RC) introduced Backup & Restore (BR), a distributed backup and restore tool, that offers high backup and restore speeds—1 GB/s or more for 10 TB of data.

SSL Offloading: A Solution For a Slow Website

SSL offloading is a great solution for enterprises that wish to improve website performance without compromising security — here’s how it works.

As a website user, you might have noticed that certain websites get slower when there’s a large number of people accessing them at the same time. For example, entertainment websites (when a new episode of a popular series goes on air), news channel websites (at the time of elections), sports websites (during major events and competitions), etc.

Convolutional Neural Network – How to Code Some of the Critical Steps

While I was writing my custom program, I realized that some of the functions could be a little tricky to handle. I tried to make this article not just another article on how CNN works or the mathematics behind it, but more about some of the techniques on how data is structured/formatted while it moves from the convolution layers to maxpool, to the fully connected layer, and back again.

I will take an example to explain how the convolve, max pool, FC, and backpropagation datasets will look with details on some of the key functions

Error in required structured data element

Google search console flagged a couple of my AMP pages with the error: Error in required structured data element

When I use the URL inspection tool, it says:

Linked AMP version is valid with warnings
Error in required structured data element

But in the HTML section of the crawled page, it says Sorry--no code highlighting available for this issue. I made sure to do a Live Test and not use code from Google's index.

However, when I run the same URL thrugh Google's Structured Data Testing Tool, it says there are 0 errors and 0 warnings. Additionally, when I add #development=1 to the end of the URL and use the Chrome DevTools console, it says AMP validation successful.

How can I find what the error is?

I want to add that all of the URLs with this issue are using the same template, and no valid URLs are using this template, so it's obvious this is not random.

Storing and Aggregating Time Series Data With Elastic Search

When talking about time series data, the data will be very huge. The number of records increases based on the granularity level. If the granularity is minute, we will get 60 records for one minute for one instance.

For example, we want to store CPU percentage of a device for each minute. So let's assume we are getting data for the last 30 days.

How to Do DevOps Effectively?

In today’s digitized world, each and every organization dealing with software development processes seek ways for optimizing this whole process as it has become a costly affair to deliver more robust products than the opponents. This is where DevOps practices come into the picture as they can help in this regard. Although the Waterfall development model existed, development and operations were actually separated from the lifecycle of software development. And today, with these agile methodologies having amplified iterations and deployments rounds, this new DevOps approach has somewhat become quite essential.

Statistics Speak

As per a recent study of over 25 thousand technical professionals, most high-performing firms tend to deploy two hundred times more effectively as well as frequently while using DevOps, with around 2555 times quicker leads’ times. Though DevOps as well as change management are not always that easy, but with the correct set-up of this particular process, it is possible to augment IT performances, while at the same time, reducing organizational IT costs, which in turn lead to amazing business results. Thus, the need for DevOps services has increased considerably.

Can API-Driven Technology Help Save the Media?

The digital age has not been kind to media outlets. While the importance of a message, its medium, and knowing how and where to spread it is becoming ever more critical, it doesn’t help that in most cases the media is being held back by old online digital architecture.