GitHub Introduces Darkmode, Discussions for Public Repositories, and Dependency Review

GitHub Universe, the company’s annual marquee product and community event, took place this week, bringing users a flurry of new features. Dark mode is now in public beta and can be activated under the Settings menu or set to follow system preferences.

Discussions is a new feature that GitHub unveiled at its Satellite event in May to facilitate questions and open-ended conversations. The company has been testing it with open source communities like Gatsby and Laravel to iron out bugs ahead of the public launch. Discussions currently allows users to customize categories, transfer and pin discussions, and convert issues into discussion threads. Mobile support is coming soon.

Participants on Discussions can search or sort conversations by newest, top, answered, and unanswered. Threads can be upvoted for better exposure and a sidebar widget displays the “most helpful” users. Discussions are essentially a modernized forum, with a little bit of gamification sprinkled in. for good measure.

Project maintainers for WordPress plugins, themes, and tools hosted on GitHub may want to explore Discussions to see if it could benefit their communities. The format is more approachable for less technical participants who may not be familiar with GitHub issues.

Building on the existing dependency graph and security alerts features, GitHub is introducing dependency review as a way to help developers catch vulnerable code before it gets added to their projects. Dependency review displays the following information for each pull request:

  • which dependencies were added, removed, or updated
  • release dates
  • how many projects use these components
  • vulnerability information for each dependency

The beta for the dependency review feature is now open to all public repositories and will be gradually rolled out across GitHub in the next few weeks.

Other notable announcements include the ability to auto-merge pull requests when using protected branches, improvements to continuous delivery support, and GitHub Sponsors for companies, which allows organizations to use their existing billing to donate to open source developers and projects. Check out the full details in the announcement summary from the event.

Polyglot COVID-19 Dashboard

As a developer, you will be seeing numerous articles on Big Data, containers, complex algorithms, caching, etc. But the reality is that a lot of us still have to solve simple problems, especially if one is a freelance programmer or working with small companies.

A simple use case is that of data, coming in spreadsheets or CSV files, have to be visualized in a simple dashboard. You and the customer agree to build it as a web application. There are plentiful ways, from PHP to the Java-based Metabase, of implementing the solution. Since I have experience with Ruby on Rails (RoR or just Rails) and it has extensive easy-to-use libraries, it's my first go-to choice to build a web application real quick.

Unit Testing Void Methods with Mockito and JUnit

Writing functionality is the main focus whenever we are writing a software program, but it is equally important that we make sure our code works the way we intended it to. And how do we do that? By writing unit test cases. They are used to test the smallest functionality of code. Unit test cases are an essential part of software development. In this blog, we are going to cover one of the testing scenarios and unit test cases for void methods.

How to Test Void Methods 

As we already know that our aim is to test void methods in a class. But it is also really important to understand why we test void methods. 

Google Announces Updates to the Search Console API

As a result of increased demand, Google has been steadily improving the infrastructure behind the Google Search Console API to ensure that users are able to fully leverage all of the powerful features available in the Search Console. This week, the company announced that it will be further updating the API to include fresh data and news filters, domain property support for the Sitemaps API, and more. 

Heroku and Salesforce: From Idea to App (Part 1)

As someone who became a Salesforce developer by accident 10 years ago and parlayed that into a career and business, I’m fully aware of the dividends that investing in continuous learning and brushing up on the latest in my industry can yield.  Even after years of working in the Salesforce ecosystem, earning 11 certifications, and going through several hundred different projects, I’ve found it’s difficult to make the time to keep up with all the new tools and features of modern development (and usually I have the TrailheaDX and Dreamforce conferences each year to get caught up!).  

Due to the COVID-19 travel restrictions, in-person conferences are canceled. However, a new video series piqued my interest. In particular, two Salesforce Developer Advocates, Mohith Shrivastava and Julián Duque, are doing a series on Modern App Development on Heroku/Salesforce.

Identity and Access Management

Given the rise in identity-focused breaches and the continuously growing number of identities, identity and access management (IAM) has emerged as a cornerstone for safeguarding enterprise systems. By orchestrating secure authorization and authentication, IAM serves as the digital gatekeeper, granting controlled access to diverse resources — from on-premises databases to cloud-based applications. In this Refcard, we delve deep into IAM's crucial role in modern cybersecurity. We outline the primary functions and principles that underpin IAM, highlight its significance, address common challenges faced by engineering teams, and focus on the core practices.

Why Is Flutter Sdk Ruling the App Development Trends?

Why does every app development company love Flutter? The simplest answer is that Flutter SDK has offered everything required to develop an app like a breeze. 

Features of Flutter left developers wheedled, and it soon became the first choice of app developers. Flutter has a strong foothold in the market today. With a total number of 106K stars and 14.8K forks, Flutter overrules every other cross-platform SDK. Numerous small and big enterprises have embraced flutter app development; some popular names include Alibaba Group, Groupon, BMW, eBay, EMAAR, Dream11, SONOS, Square, and more. 

Optimize Performance and Render Websites Superfast in ReactJS

To optimize the performance of your React code, you have to make sure that it’s not re-rendering unnecessarily. This is the main reason behind performance bottleneck. Use these tips to improve your codebase and make your website super-fast:

  1. Avoid unnecessary code re-rendering.
  2. Keep your code files short and break them into components.
  3. Use minified production build.
  4. Remove console logs from production code.
  5. For big tables, render a few rows and columns at a time (like FlatList in React Native).
  6. Do not mutate state object.

Let’s discuss all these points, one at a time. Buckle up.

Unconventional Stock Image Sources

This year, I learned that there is a wide world of free stock imagery available beyond Unsplash and Pexels. You see, I’ve been working on designing WordPress themes this year, and all images need to be compatible with the GPL. Unsplash and Pexels both have free and open licenses, but unfortunately, aren’t compatible. Many other free stock photos sites don’t have the highest quality photos, so I’ve had to get creative about where I get the imagery I use in my mockups.

I discovered the solution to my stock imagery problem, ironically, on Unsplash. I started noticing photos from sources like the British Library, Birmingham Museums Trust, and Library of Congress. Who often has archives of public domain imagery? Libraries, museums, and governments. The sites are never a site like Unsplash, but they work well if you have the time and patience to dive through their archives. Plus? You can find some pretty cool photography, art, and illustrations that have a very different vibe than most stock photo resources.

Libraries

There are tons of libraries with license-compatible digital archives, such as the New York Public Library, Library of Congress, The State Library of New South Wales, National Library of Ireland, and many more. Try seeing if a major city with your state has a digital archive. Libraries are great for old photos, advertisements, and illustrations that I’ll use in portfolio site designs.

Museums

Many museums have started digitizing their collections in the past few years, such as the Smithsonian’s National Museum of Asian Art, the Met, and the Art Institute of Chicago. As the museums are often digitizing the work themselves, they have the luxury of releasing the images into the public domain. Museums are a fantastic resource for art, and for photos of objects like ceramics and jewelry that work well in e-commerce mockups.

Governments

US Government agencies like NASA tend to release a ton of their own media for public use, and I’ve discovered that space images look great in blog post mockups. Need some COVID photos? The CDC’s got you covered. Need some black & white nature photos? Check out the National Park Service’s “Open Parks Network.” 


Finding high-quality, totally free stock imagery can be a huge hassle. But I’ve found, with some creativity and some patience, there are far more options than I knew!


The post Unconventional Stock Image Sources appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Simplifying ARM Template Deployments With Ansible

I discussed how you could use Ansible with Terraform to simplify configuration management in my previous post. If, instead of Terraform, you prefer using Azure Resource Manager (ARM) templates to define the infrastructure and configuration for your project, you can use Ansible for managing parameters that customize each environment by dynamically generating a Resource Manager parameters file.

A great thing about using Ansible for your ARM configuration needs is that it includes a suite of modules for interacting with Azure Resource Manager. You can install the modules using Ansible Galaxy, a repository of Ansible Roles that you can drop directly in your Playbooks.

It’s all relative.

I remember sitting in the back seat of our family’s Subaru station wagon. I was six and this was long before child carseats were a thing. My dad was at the wheel and my mom played 20 Questions with me while we drove to some vacation spot I can’t even remember.

It was my mom’s turn as she and I played 20 Questions. She had an object in mind and I was asking the questions.

“Is it big?” I asked.

“Relative to what?” my mom replied.

This was the pattern throughout the entire game. I asked a question and my mom answered with a question about relativity.

“You can ask questions when it’s my turn to think of an object,” I’d say.

“If you’re asking if the thing is as big as a mountain, the answer is no. But next to ant, yes, it is big.”

This year has been a long stretch of re-learning what it means to think relatively. How long of a stretch? It’s relative, I suppose. But as 2020 comes to a close, I can almost hear my mom asking me the same question, whether it’s at work or in my personal life.

“Relative to what?” she asks.


My mind jumps to relative units in CSS when I hear the word “relative.” I’m sure many of you are the same. I reach for things like em, rem and % all the time in my work. I only started using them to be cool when I first learned about them (whenever that was). I didn’t even know there was a real difference between em and rem. I thought they had something to do with retina screens.

Of course, that was a long time ago. (How long? It’s relative.) I now know that relative units are relative to the thing they reference. 2rem is going to evaluate one way on a site with a root font size of 16px and another for a site at 24px. Same deal with percentages. 50% inside a 400px container means something different than 50% inside a 1200px container.

So, now, when I find myself assigning size values to elements, I first having a little dialogue with my mom.

“This element is 5.25em.”

“Relative to what?” she asks.


I’ve also learned that thinking relatively requires a little perspective. And, no, this has nothing to do with CSS perspective (although I could probably try to make that connection). Thinking in relative terms means momentarily stepping out of your own shoes and seeing things from something else’s vantage point.

I say “something” because I think about this most when writing code. Whenever I’m working on the pieces of a component, I have to be mindful of the context—or perspective—of where they sit. Why? Because the pieces mean different things in different contexts and those contexts are relative to the component that contains them.

When is an <h2> just an <h2>? Hardly ever. It might be the post name. Or perhaps the heading for a widget. Maybe it’s the heading for a card component. As front-enders, we name those things according to the perspective of the component. From the perspective of a post, an <h2> means (and probably looks) something different from the perspective of, say, a card.

.post {}
.post__title {}

.widget {}
.widget__title {}

.card {}
.card__title {}

Naming things is hard. I often find myself thinking, “Ack! What the heck should I call this thing?”

“Relative to what?” my mom interjects.


I could go on and on. The truth is that thinking in terms of relativity is just as important to the code we write as it is to a game of 20 Questions, or even our personal lives. And in a year where we’ve been upended by so many competing forces, thinking along these lines can offer solace and wisdom in the midst of what has been stressful and frustrating for many of us—relatively, of course.

  • “This is stressing me out.” Relative to what?
  • “I have so much to do.” Relative to when?
  • “I suck as JavaScript.” Relative to whom?
  • “I hate the place I work.” Relative to where?

It’s easy to get caught up in absolutes. Relativity forces us to see things differently.


The post It’s all relative. appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

An Introduction to Cloud-Native DevOps

DevOps, the method of automating processes between development and operations, is one of the essential factors of successfully implementing a cloud-native approach. Since cloud-native has a purpose to reduce go-to-market time and bring more efficiency to companies, DevOps is what streamlines individuals, tools, and systems, contributing to the overall success of the enterprise. This is what makes cloud-native DevOps a logical step towards improved productivity. 

Both cloud-native and DevOps movements are on the rise. Reports and Data predict that the global DevOps market will grow from $4.49 billion in 2019 to $17.27 billion in 2027

Optimize Images According to Network and Device Constraints in React

Connectivity has evolved beyond recognition since the beginning of the internet. We are lightyears past dial up, these days, and can watch a video in high resolution on our smartphone while being connected to a mobile network. But not all mobile connections are created equal – older generation networks (3G, 2G, etc.) are still quite dominant, accounting for almost half of all connections worldwide in 2020.

Unfortunately, the phasing out process is very slow, and many people around the globe are experiencing really dragged out page loads, comparable to the very early days of home internet adoption.

Modern websites became resource-hungry, featuring lots of images and animations. For a visitor on an underpowered device and a fragile network connection, an average webpage might take a good minute to load completely. This is largely due to the fact that developers often make binary decisions when it comes to user’s hardware and network conditions: devices fall either in the desktop or smartphone category, while connectivity is a question of being on- or offline. In reality, user’s circumstances tend to be much more nuanced.

We Can Do Better?

What can be done to bridge the gap for users on modest devices and spotty connections? First, we need to do a quick evaluation of what exactly their conditions are by looking at the following two properties:

Based on that, we can decide, for instance, to adjust the quality of the images we intend to serve. There is a catch, however, with Jamstack websites and apps rendered on the server – `navigator`object, as any other browser API, isn’t available during the rendering stage. A common workaround for this issue is to add a bunch of responsive image markup, but it comes with a significant pain point – inefficient scaling. An image CDN like ImageEngine helps to avoid this and other pitfalls associated with responsive images as it handles all the heavy-lifting behind the scenes by applying automated, smart tweaks to requested resources on-the-fly.

When it comes to adapting to a user’s network constraints, one could detect connection type and instruct an image CDN to vary compression according to connection quality. Here’s how one might go about it in React:

import React, { useState, useEffect } from 'react'

const useConnectionType = (defaultConnectionType) => {

  const isSupported = navigator?.connection?.effectiveType
    ? true
    : false

  const [connectionType, setNetworkStatus] = useState(
    isSupported
      ? navigator.connection.effectiveType
      : defaultConnectionType
  )

  useEffect(() => {
    if (isSupported) {
      const { connection } = navigator
      const updateConnectionType = () => {
        setNetworkStatus(connection.effectiveType)
      }

      connection.addEventListener('change', updateConnectionType)

      return () => {
        connection.removeEventListener('change', updateConnectionType)
      }
    }
  }, [])

  return [ connectionType, setNetworkStatus ]
}

const imageCDNHost = 'images.foo.com

function ConnectionAwareComponent () {

  const [ connectionType ] = useConnectionType()

  let compressionLevel = 0

  switch (connectionType) {
    case 'slow-2g':
      compressionLevel = 65
      break
    case '2g':
      compressionLevel = 50
      break
    case '3g':
      compressionLevel = 30
      break
    case '4g':
      compressionLevel = 0
      break
  }

  return (
    <div>
      {/* Apply variable compression via dedicated directive */}
      <img src={`${imageCDNHost}/?imgeng?=cmpr_${compressionLevel}`} />
    </div>
  )
}

One can take this idea even further to accommodate those on really sluggish and wonky networks by rendering blurred images and offering an option to download a higher resolution version on demand. Or devise a performance score system and adjust what is sent based on that. 

On the other hand, the fact that the user is on a “speedy” 4G connection doesn’t necessarily mean they aren’t interested in saving data as they might be accessing a website in roaming. Enabling Client Hints on one’s website will let site owners detect the presence of a data saver flag and take necessary steps to adjust to the user’s preferences.

Reasons for Faster Images

Mediocre CPU, modest amounts of memory and a low-grade connection aren’t imaginary constraints. They pose real user experience challenges potentially affecting hundreds of millions of users worldwide. Some companies began to bake inclusive experiences into their products: streaming services like Netflix and Spotify adjust the streaming quality based on your network conditions, while many others are doing automatic image optimizations behind the scenes for users.

Developing regions, where fast networks aren’t yet accessible to everyone and everywhere, might not be one’s target market. Meanwhile, someone browsing from a rural area in a developed country will likely have a jarring experience if they are served a fully-fledged version of a website. We can be more considerate and intentional by adjusting what we send / display to our users with only a couple of small tweaks.

Using an image CDN like ImageEngine simplifies the image optimization process and automatically responds to the Client Hints for network constraints. The result is a better experience for a network-constrained visitor and an elegant workflow for developers.


The post Optimize Images According to Network and Device Constraints in React appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

How to Create a Barcode Image in Java

Barcodes are used universally in commerce and retail to aid in tracking, purchasing, and inventory. This allows organizations to keep accurate records of their supplies, products, and other items that are pivotal to their operations. For international and national use, there are different barcodes that are utilized for specific contexts. For example, UPC and EAN barcodes look similar in their formatting and can be used in similar ways, but UPC is a largely North American coding system; however, both UPC and EAN are used globally. QR Codes are also used globally but are usually employed for sharing complex sets of information like item details or website links 

The following five APIs will allow you to create barcode images in the three previously mentioned formats. This will allow you to print or create packaging with your personal barcodes attached, without needing to retrieve it from an outside source. This can be especially useful for small businesses as it provides increased independence as a company and improved visual, professional appeal for your products. 

RPA, Low-Code, SaaS/COTS, Custom – Which Is Right for You?

The year was 1994. I worked full-time as a software engineer and went to graduate school part-time to get my master’s degree. One of my professors told us that we would not be writing software with code within the next five years. Fourth Generation Languages (4GL) will make it so anyone can build software, and visual drag-and-drop tools will let us build anything. Fast forward 26 years, and we are still writing code. Even in 2020, recent articles predict the end of custom software development. Coming soon, robots will be writing code for us using GPT-3.

The current state of software options to solve your business problems is quite complex, and it can often become overwhelming. You read articles about robotic process automation (RPA) saving the world, or low-code/no-code solutions saving 80% of your costs, or software as a service (SaaS) solutions like Salesforce, ServiceNow, and others being the answer to all your problems. What if none of these work for you? When is it time to build your own software?

Functional Programming Patterns With Java 8

It’s been four years since functional programming became feasible in Java. The means we have had four years to play with Java 8.

And we've played... and played. After developing several large enterprise projects that made heavy use of Lambdas and Streams, consulted many other projects in doing so, and taught these concepts to hundreds of developers as an independent trainer, I think it’s time to summarize patterns, best practices, and anti-patterns.