Interested in getting started with your own IoT project at home? Or are you embarking on a new IoT project at work? Either way, we've got some great tutorials on getting started, opinions pieces that examine different platforms you can use, and the benefits IoT devices and tech can bring to your development projects.
I recently found a solution to dynamically update the color of any product image. So with just one <img> of a product, we can colorize it in different ways to show different color options. We don’t even need any fancy SVG or CSS to get it done!
We’ll be using an image editor (e.g. Photoshop or Sketch) and the image transformation service imgix. (This isn’t a sponsored post and there is no affiliation here — it’s just a technique I want to share.)
I work with a travel software company called CarTrawler on the engineering team, and I recently undertook a project a revamp our car images library that we use to display car rental search results. I wanted to take this opportunity to introduce dynamically colored cars.
We may sometimes load up to 200 different cars at the same time, so speed and performance are key requirements. We also have five different products throughout unique code bases, so avoiding over-engineering is vital to success.
I wanted to be able to dynamically change the color of each of these cars without needing additional front-end changes to the code.
Step 1: The Base Layer
I'm using car photos here, but this technique could be applied to any product. First we need a base layer. This is the default layer we would display without any color and it should look good on its own.
Step 2: The Paint Layer
Next we create a paint layer that is the same dimensions as the base layer, but only contains the areas where the colors should change dynamically.
A light color is key for the paint layer. Using white or a light shade of gray gives us a great advantage because we are ultimately “blending” this image with color. Anything darker or in a different hue would make it hard to mix this base color with other colors.
Step 3: Using the imgix API
This is where things get interesting. I'm going to leverage multiple parameters from the imgixAPI. Let's apply a black to our paint layer.
We changed the color by applying a standard black hex value of #000000.
If you noticed the URL of the image above, you might be wondering: What the heck are all those parameters? The imgix API docs have a lot of great information, so no need to go into greater detail here. But I will explain the parameters I used.
w. The width I want the image to be
bri. Adjusts the brightness level
con. Adjusts the amount of contrast
monochrome. The dynamic hex color
Because we are going to stack our layers via imgix we will need to encode our paint layer. That means replacing some of the characters in the URL with encoded values — like we’d do if we were using inline SVG as a background image in CSS.
Now that we have one URL, we can basically swap out the black hex value with any other colors we want. Let’s try blue!
Or green!
Why not red?
That's it! There are certainly other ways to accomplish the same thing, but this seems so straightforward that it’s worth sharing. There was no need code a bunch of additional functionality. No complex libraries to manage or wrangle. All we need is a couple of images that an online tool will stack and blend for us. Seems like a pretty reasonable solution!
I say "was" because it's deprecated. It may still "work" (like everybody's favorite <marquee> in some browsers), but it could stop working anytime, they say. The whole purpose of it was to display text in a monospace font, like the way Teletype machines used to.
Dave used it jokingly the other day.
Per recent events: As you can see by this official transcript, Dave Rupert LLC has done nothing wrong...
<tt> Client: This is the greatest call I've ever been on. Dave Rupert LLC: Definitely and we didn't even do anything illegal or quid pro quo'y. </tt>
Right here on CSS-Tricks. See, in my early days, I learned about that element and how its job is to set text as monospace. I thought, oh! like code! and then for years that's how I marked up code on this site. I had never heard of the <code> element! When I did, I switched over to that. But I still haven't updated every single article from <tt> to <code>. It lingers in articles like this:
I bring this up just because it's a funny little example of not knowing what you don't know. It's worth having a little sympathy for people early in their journey and just doing things that get the job done because that's all they know. We've all been there... and are always still there to some degree.
I was looking to analyze the blood donation data from Brazilian blood centers. To my surprise, this data is not standardized, nor is there an API to show this information.
So the way I found it was to create a web-scraping to read this information. For this study, I used the Pró-Sangue Foundation of the state of Sao Paulo, Brazil.
With increasing efficiency and sophistication, the IT environment is becoming extremely complex too. The recent shift to microservices and containers has further added to the already large number of components that go into a single application, which means the challenge is equally big when it comes to orchestrating all of them.
The ability of IT Ops teams to handle such complexities is fairly limited and hiring more resources to configure, deploy, and manage them is not very cost-effective.
The microservice paradigm has been a topic of heavy discussion and interest in recent years. To make the matter even more involved developers and architects have different understandings of the core principles of microservices and the need to adopt a microservice-based architecture.
“Pets versus cattle” has become something of a standard vernacular for describing the shift in how we build systems. It alludes to the elastic and dynamic nature of these (typically, but not necessarily) container-based systems with on-demand scaling and more transparent fault-tolerance.
Here's a presentation from the recent DevOpsDays 2019.
Today was the launch of this new workshop, focused on creating real DevOps heroes by sharing a brand new (for most) tool for their toolboxes at DevOps Days Raleigh.
Whether you're a developer or and operations-minded person, it's always nice to have a powerful selection of tooling to choose from when tackling the various problems in your daily work.
These DevOps tools make every DevOps implementation easier.
Puppet
Puppet is one of the most widely-used DevOps tools. It makes delivering and releasing technology changes quicker and more frequent with features that support versioning, automated testing, and continuous delivery. It can manage multiple servers and enforce system configuration. Puppet is one of the most popular configuration management tools in the IT world these days for a number of reasons.
A lot of companies are considering the agile approach, and it is no secret that the “waves of agile adoption” are everywhere in the business environment.
The medium of your Code journal is an important decision. Just as the content will be individual to you so will your preference for analogue or digital, and the exact choice of a medium within those categories.
If you want, you can directly jump on the Service Oriented Architecture course on Coursera it's a good one but if you need more choices, here are some of the other useful SOA courses for programmers.
Wine testing...browser testing...what's the difference?
In the earlier days of web development, executing cross-browser testing used to be very easy. There used to be only a few limited browsers, each browser had limited versions in usage, and most importantly, there were not so many different mobile screen sizes to worry about. But time has turned upside-down, now there are multiple devices to check on, there are many different browsers available on the market that are used by a considerable number of internet goers, and there are thousands of different screen sizes to test on.
The Payara team is extremely proud to be among the first to achieve Jakarta EE 8 Full Platform Compatibility, starting with Payara Platform 5.193.1. This is a significant milestone for Payara, and the team has done a huge amount of work to get this done. I think this is a great adoption story for Jakarta EE, in general, as Payara Server is not a Java EE 8 implementation. Furthermore, this shows that Jakarta EE is an open standard and can bring in new organizations and implementations.
Check out the article below to become a master of Java Streams!
Declarative code (e.g. functional composition with Streams) provides superior code metrics in many cases. Code your way through this hands-on-lab article series and mature into a better Java programmer by becoming a Master of Java Streams.
The whole idea with Streams is to represent a pipeline through which data will flow and the pipeline's functions operate on the data. This way, functional-style operations on Streams of elements can be expressed. This article is the first out of five where you will learn firsthand how to become a Master of Streams. We start with basic stream examples and progress with more complex tasks until you know how to connect standard Java Streams to databases in the Cloud.
One of the requests I received from many of my readers was to create a Java developer roadmap. Since Java is my area of expertise, it wasn't a problem to create a roadmap, but it took slightly longer for me to create one because of my limited free time. Anyway, I am finally ready to share my Java developer roadmap with you all.
This roadmap contains an unobstructed path on how to become a Java expert, answering burning questions like: Which technologies should a Java developer learn? What tools make you a better Java developer? And lastly, which frameworks must a Java developer absolutely learn?