Bidirectional Horizontal Rules in CSS

Say you have a <blockquote> and the design calls for a thick border along the left side. Well, you might not necessarily mean left side, but actually mean on the side of the start of the text.

That's exactly what CSS logical properties are meant to address, and Hussein Al Hammad has a nice article laying out some use cases, including the blockquote thing I mentioned above.

By using logical properties, you don't have to mess around with manually writing selectors including [dir="rtl"] or needing to be aware of writing modes and such. The box model stuff (borders, padding, margin...) will adjust where it needs to be.

Hussein's blockquote is a good baby step example for understanding of all this:

blockquote {
  /* Rather than... */
  border-left: 4px solid #aaa;
  padding-left: 1.75rem;

  /* You'd do... */
  border-inline-start: 4px solid #aaa;
  padding-inline-start: 1.75rem;
}

See the Pen
Logical properties demo: blockquote
by Hussein Al Hammad (@hus_hmd)
on CodePen.

Support is pretty good.

This browser support data is from Caniuse, which has more detail. A number indicates that browser supports the feature at that version and up.

Desktop

ChromeOperaFirefoxIEEdgeSafari
6962*41No7612.1

Mobile / Tablet

iOS SafariOpera MobileOpera MiniAndroidAndroid ChromeAndroid Firefox
12.2-12.446*No767668

One thing that threw me off in the article is the term "Horizontal Rules." First I imagined the <hr> element. Then I imagined wanting to reverse the direction of the design with logical properties. Usually an <hr> is just a line so horizontal direction doesn't matter, but let's say it's like a shorter line along the edge where new lines start after wrapping.

We could draw the shorter line with backgrounds that cover different parts of the box model, then use logical properties where the padding applies. This is a pretty unique edge case, but it's fun to fiddle with:

See the Pen
<hr>s that are direction aware kinda
by Chris Coyier (@chriscoyier)
on CodePen.

It would be even easier if we had logical gradients.

Direct Link to ArticlePermalink

The post Bidirectional Horizontal Rules in CSS appeared first on CSS-Tricks.

Automatic Image Alt Tags and More with Image SEO

Screenshot of using the Image SEO plugin in the WordPress block editor.

I had the opportunity to test the Image SEO plugin over the past week. Image SEO is a plugin that connects to an accompanying online service that processes images uploaded to a WordPress installation. The plugin can automatically rename file names, create alt tags for screen readers, and optimize images for Pinterest.

The plugin is one half of a Software as a Service (SaaS) product. To use the image processing features, you must sign up for an account on the Image SEO website. Currently, users are provided credits for processing 10 images for free to test out the service. After that, image processing requires a monthly or annual fee based on a set number of images. Pricing starts at 4.99€ per month for the lowest tier and ranges up to 59.99€ for the enterprise option. The service also offers one-time purchases for a given number of images.

The Image SEO team went public with their plugin and service in April and have been refining the product since. Aurelio Volle, co-founder and chief marketing officer, said a big part of the process was removing unnecessary features in favor of developing the core product and creating new features.

“[Thomas Deneulin] asked me in December 2018 to come and work with him on a project,” said Volle. “They had developed an Image SEO auditing tool but they were not able to sell it. I went through the product, cut so many features, created a new narrative, asked for reviews, etc.” Volle’s work primarily centered around identifying user needs and figuring out what they would be willing to pay for the service.

Volle said they use all the major facial recognition APIs available on the market, but they are not willing to share their secret recipe at this time. “We process the results with an algorithm we created to provide our users with the most relevant data possible for alts and names,” said Volle. “We are still working on the algorithm. The results should be more and more accurate in the future.”

When I come across a new WordPress plugin or theme with the term “SEO” in the name, I cringe. It is used so often as a marketing term that it has lost meaning for me. I’d like to ignore it like a bad commercial on TV, but it’s there in the name. I know it is probably smart to use it for marketing purposes. Despite my misgivings about the name, I gave Image SEO a serious look and found that I liked its potential.

Would I use the plugin? Probably not on a personal blog where I control all of the content. I am a stickler for controlling every aspect of my own content. I am not within the target audience for the plugin.

However, I would use the plugin for a large site with multiple writers. It would work well as part of a quality control system.

My primary interest was in how well Image SEO auto-created image alt tags. I have little interest in what search engine benefits the plugin might provide. I was more interested in how it could help describe images for users who use a screen reader. A plugin that can accurately add alt tags for users on assistive technologies could be useful in an environment with multiple writers. I have worked with clients in the past where such a plugin would have been a welcome addition to the site.

This is not to say the plugin isn’t useful for single-person sites or those with a small group of writers. It depends on whether the individual site could use it. If needed, I would recommend the Image SEO plugin to anyone.

The free service is currently only available in English. If you need alt tags in another language, you will need to go with a premium plan. This would be better opened up to all languages. It is hard to vouch for the accuracy of non-English alt tags when they are not available in the free plan.

How Well Does the Plugin Work?

The plugin gives you the option of automatically renaming image file names and setting alt tags. I would recommend using both of these options. File names like IMG_2019_345.jpg do not tell search engines or users anything about an image, and the automatic alt tags are the most useful feature of the plugin.

The plugin doesn’t make you work to get results. I tested out 60 images (10 free plus an extra 50 provided by the Image SEO team). On the whole, the results were fairly accurate.

However, not every image passed the accuracy test. Take note of the following screenshot with an image of two people standing at the end of some hallway or structure. I’m not exactly sure what they are in, and neither was the service. The resulting alt tag was “Archives – A very dark water – Art.”

Screenshot of the Image SEO plugin in the block editor with an inaccurate image alt tag.
A rare inaccurate alt tag added by the plugin.

I had to throw a few curveballs at the software to see how it stood up. Technologically, humans are not at the pinnacle of artificial intelligence and recognition software, but we are constantly improving. The service will undoubtedly improve over time with anything thrown at it.

My biggest gripe with the plugin is that it automatically prepended the post/page title to the front of every image’s alt tag when uploading via the post editor. There is no reason to do this. The post title often has nothing to do with describing the image for screen readers. I could see this being useful for product images on an eCommerce site. This feature should be opt-in. It would quickly become irritating to manually remove the post title from each image.

The plugin also allows you to add a description, ID, and other elements for use with Pinterest. I also could not figure out how to get the attributes to show for my images on anything but attachment pages. It was unclear how this feature worked on the front end of the site. Admittedly, it did not bother me because I had no interest in this aspect of the plugin.

Bulk Optimizing Images

A screenshot of cat images when using the Image SEO bulk optimization tool.
Bulk optimizing cat pictures, the most useful type of images for internet usage.

The Image SEO plugin allows users to bulk optimize images across the entire site. The bulk optimization tool also allows you to preview the results before deciding on whether you want to make the changes. This can be an extremely powerful tool if you are running a site with a lot of old images with missing alt tags.

The biggest thing to watch out for is that running this tool can eat up a ton of image credits.

A fair word of warning: even the optimization preview uses image credits. I hope this limitation is addressed in some way because it is not clear up front. Using the feature can catch you off guard and drain money if you simply want to preview the optimization prior to deciding whether you want to go through with the changes.

The textual description on the bulk optimization page may even lull you into a false sense of security. It reads, “No worries, you can get a preview of the results before going further.” Fortunately, I was running this on a free account and did not lose real dollars over it.

It will take a bit of time to run, depending on the number of images, but the bulk optimization tool works flawlessly.

How Does the Code Stack Up?

I see little reason for concern with the code. The developers have a clear architecture and hierarchy. It is forward-thinking and uses modern PHP practices.

The one caveat is that the plugin does not use the core WordPress HTTP API for handling remote requests to their service. Users without cURL enabled on their site would be unable to use the plugin, which is likely not an issue for most people. The team said they went with a custom implementation so they could easily deploy their project on other PHP projects and not be limited by tying the code to WordPress. They have reported no problems with customers thus far.

The Final Verdict

There is a lot to like about the plugin. If you are in it for the SEO benefits, having a system in place to automatically rename ugly image file names and create fairly accurate alt tags, you may find this plugin useful.

The plugin is not 100% accurate by any means, but you won’t find that level of accuracy anywhere. With the 60 images I threw at it, it performed well. The pricing model also looks fair for what the service offers.

Kafka Consumer Delivery Semantics

This article is a continuation of part 1 Kafka technical overview, part 2 Kafka producer overview, part 3 Kafka producer delivery semantics and part 4 Kafka consumer overview. Let's understand different consumer configurations and consumer delivery semantics.

Subscribe

To read records from Kafka topic, create an instance of Kafka consumer and subscribe to one or more of Kafka topics. You can subscribe to a list of topics using regular expressions, for example,  myTopic.*.

Five Reasons Why a Seedbox Is a Practical Alternative to VPN

It seems like you are confused between Seedbox and VPN — which one to choose? Which one would be more effective in terms of security? Which one would be better for downloading and uploading files?

Congratulations! You are reading the right article. In this blog, we will discuss how VPN has been replaced by Seedboxand and how you can benefit with its features.

Mobile Security and QA Strategy [Mobile Security – Part 1]

As we all know, Internet security is among the top risks faced by individuals and businesses today. With the evolution and robust growth of internet-enabled mobile devices across the globe, they have become the number one target for cyber attacks.

Mobile security involves protecting portable devices such as laptops, tablets, smart watches, and phones against cyber threats. Today, the need for protection is more critical because we store a lot of sensitive data like bank details, patients information on these devices.

Thinking in React Hooks: Building an App With Embedded Analytics

Get hooked on React Hooks

You may have noticed that React Hooks, introduced in the React’s 16.8.0 release, have been received by the web dev community very diversely. Some warmly embraced this new way to reuse stateful logic between components, while some strongly criticized it. One thing can be said for sure — React Hooks are an incredibly hot topic now. This is confirmed by the number of articles, tutorials, video courses, and project samples on the subject.

My goal is to briefly introduce to you this powerful concept (if you are not familiar with it yet) and show how it can be applied to building a simple analytical app. Note that we’ll focus more on getting a hands-on experience rather than on debating on the pros and cons of using Hooks.

Android App Architecture: Modularization, Clean Architecture, MVVM

Clean architecture is key

Based on my experience on previous projects, I decided to write an article on how to properly set up the base architecture of an android app which can be easily extended and applied to different kinds of applications.

The key concept that I’ll analyze in this series of articles involves the combination of Clean Architectureapp modularization and MVVM design pattern in creating modular, scalable and testable android application. For that purpose, I created a demo application called WeatherApp that will demonstrate this approach.

Use Angular to Build Your First PWA

Progressive Web Application (PWA) has been quite the buzz word for the last few years, but what exactly is it? 

PWAs utilize a number of modern browser technologies to improve overall user experience. The core component of a PWA is a service worker, which is a piece of JavaScript code that runs in the background of a website intercepting and fetching all browser requests.

Show message if length of array is 0 in Angular 5

I have a search script that a user may search persons etc. I want to display a message if what he or types doesn't exist in the array. By default, I display some results and it displays the desired person when one writes on searchbar. but I want to show a message if what the user writes on searchbar doesn't much the array. the ngfor works perfectly I just can't show the message.

I did a ngIf but doesn't show the #noThings when I type for example djlsklkssk.

Note that userSet always has length > 0 because I call the API anyway.

<ion-searchbar style="height: 30px" showCancelButton="focus" cancelButtonText="Custom Cancel" animated placeholder="Search Rovespier" [(ngModel)]="terms"></ion-searchbar>

<ion-card *ngFor="let item of userSet | search : terms">
    <div *ngIf="item; else noThings">
        {{item.name}}
    </div>
</ion-card>
<ng-template #noThings>
    <div>
        No Result
    </div>
</ng-template>

TS

I have a search script that a user may search persons etc. I want to display a message if what he or types doesn't exist in the array. By default, I display some results and it displays the desired person when one writes on searchbar. but I want to show a message if what the user writes on searchbar doesn't much the array. the ngfor works perfectly I just can't show the message.

I did a ngIf but doesn't show the #noThings when I type for example djlsklkssk.

Note that userSet always has length > 0 because I call the API anyway.

<ion-searchbar style="height: 30px" showCancelButton="focus" cancelButtonText="Custom Cancel" animated placeholder="Search Rovespier" [(ngModel)]="terms"></ion-searchbar>

<ion-card *ngFor="let item of userSet | search : terms">
    <div *ngIf="item; else noThings">
        {{}item.name}}
    </div>
</ion-card>
<ng-template #noThings>
    <div>
        No Result
    </div>
</ng-template>

.ts

userSet: any = [];

constructor() {
    this.searchSet();
}

searchSet() {
    this.userData.searchUser()
        .map(res => res.json())
        .subscribe(data => {

            if (data.success) {
                this.userSet = data.searchDetails; // then it is uid_fk
            }
        });
}

Why You Should Avoid Using Exceptions as the Control Flow in Java

Learn more about using exceptions as control flow in Java.

Java is a general-purpose programming language with many alternatives to solving a certain problem. However, there are best practices that need to be followed, and there are some bad practices out there as well that are still commonly used.

One of these common bad practices is using exceptions as the control flow. This should be avoided for two reasons: It reduces the performance of your code as a response per unit time, and it makes your code less readable.

GPU-Accelerated IoT Workloads at the Edge

Bring IoT to the Edge!

Introduction

In this article, we will look at how to create GPU accelerated IoT Edge workloads targeting the NVIDIA Jetson line of IoT devices. Portions of this content are planned to be delivered during an interactive workshop session as part of Microsoft Ignite 2019.

If you are unable to attend the conference in person, we will give you all of the details that you need to know to run this content on your own, or in a public workshop environment. Let's get started.

Building an ABAC Policy Using APIs and Java SDK From Machina Tools


Determining what data a user, application, or device can access can be one of the most important decisions an organization faces. You don’t have to be a healthcare or financial institution to be responsible for customer data. But to maintain customer trust, your organization may want to treat all customer data as such.

The data access problem is complex. Elements of policy may be driven by IT, human resources, legal, or even by finance. Policies might be enforced at different points depending on where data travels and how it is consumed. Policies might be enforced at the network layer through remote-access systems, at the database layer, within cloud infrastructure, or at endpoints like email and files. Most of these platforms inherently implement a permissive security policy.

The Landscape of Cross-Platform App Development

I don't track this stuff very well, but I get it. If you want a native app for Android and iOS, it sure would be nice to only have to write it once rather than two very different languages. Roughly double your reach without doubling the work. More and more of these things are reaching into desktop as well, meaning three targets for one.

Stuff like PhoneGap comes to mind. They say, "Reuse existing web development skills to quickly make hybrid applications built with HTML, CSS and JavaScript." That's obviously compelling for web developers who would have to learn minimal new things. My brain leans more toward, "Well if I'm going to write this thing in HTML, CSS, and JavaScript, why don't I leave it at that?" Progressive Web Apps are doing great things. Still, I'm curious what the flagship PhoneGap apps are. Do I use any great ones and not even know it?

If you're going to layer on a framework, but still stay in JavaScript-land, I'd think the biggest player is React Native. I hear it's almost always used with Expo these days, which apparently has a thing to help React Native work on the web. Plus, there is literally React Native for Web.

In React-land, there is another new player: Ionic React. It targets all three platforms (iOS, Android, and Desktop) right out of the gate. Ionic isn't new though — it's long been a framework that does this in JavaScript (alternatively in Angular) and is apparently coming soon to Vue. Compelling. Nader Dabit has a first-look blog post that is pretty well done.

This all starts to get confusing to me as apparently Ionic ultimately uses Cordova under the hood... just like PhoneGap does? Or something? But now Ionic is moving to their own thing? I guess it makes sense that there are some low-level interpreter things that translate web primitives to native primitives and that people build developer tooling on top of that.

Google's got a stake in this game with Flutter. Flutter is about hitting all three targets and helping you build the UI. Material design, animation and performance are all first-class citizens. It's all in Dart though. Dart can compile to JavaScript (so it can be used for web stuff) but it also compiles to machine code. I imagine Flutter apps are compiled that way when they become native apps for bonus performance. I don't have a good sense of how popular Dart is, but I'd assume web developers really won't care what they're writing in if great performance on all three targets is the outcome.

Ever further outside my wheelhouse is Xamarin, which is Microsoft's take on unifying development on multiple platforms. The languages involved here are .NET and C#. It has all the same promises as everything else: build with this and it works everywhere! This is for developer convenience! It's fast and you will make amazing things with it!

I'm always of two minds with all this stuff. Some part of me is envious of really nice native apps. Most of my favorite apps on my phone feel very native, although I'm not sure I could spot which framework created them, if any. For example, I have a Dribbble app on my phone and I quite like it. It's simple and nice. I open it up and I'm logged in, which is usually not the case when I open a web app. It feels fast and has all the in-page animation stuff you expect from a native app. I totally wish we had an app like that for CodePen. Maybe if we were starting over today we'd write it in some cross-platform framework that targets all three platforms and maybe gives us some cool competitive advantage. Another part of me is like, meh, I'm a web guy on purpose. I think the native open web is the place to be and has the most longevity. A codebase that serves that well will be the least regrettable over time.

The post The Landscape of Cross-Platform App Development appeared first on CSS-Tricks.