"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com
Thursday, November 3, 2016
Hannah Purmort
by via Awwwards - Sites of the day
Wednesday, November 2, 2016
10 Must-Haves For Brands Trying To Grow On YouTube
AtoZ CSS Quick Tip: How to Vertically Center Text and Icons
V is for vertically centering text and icons
In the original screencast video for the vertical-align
property, we looked at a couple of methods for centering elements vertically. In this article we’ll outline three different methods for vertical centering - something that always used to be quite tricky but is now a breeze to accomplish.
Use line-height
for simple vertical centering
To vertically center a single line of text or an icon within its container, we can use the line-height
property. This property controls the height
of a line in a run of text and adds an equal amount of space above and below the line-box of inline elements. If the height
of the container is known, then setting a line-height
of the same value will vertically center the child elements.
[code language="css"]
.container {
width: 200px;
height: 200px;
line-height: 200px;
}
[/code]
Use position
and transform
for flexible vertical centering
The line-height
method above is quick and dirty but relies on fixed heights. I tend to avoid setting height
explicitly as it can often restrict the flow of content in a responsive project. This technique is not flexible enough if you’re working with elements of variable or fluid height
.
Instead, we can combine position
and translations to vertically center variable height
elements. For example, to vertically center an element within the whole height
of the viewport, we could use the following snippet:
[code language="css"]
.container {
position: relative;
min-height: 100vh;
}
.vertical-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
[/code]
We first create a positioning context by setting position:relative
on a container element. This will then allow us to position the .vertical-center
element within its boundaries.
Continue reading %AtoZ CSS Quick Tip: How to Vertically Center Text and Icons%
by Guy Routledge via SitePoint
Inside Java 9 – Part I
Two months back I took you for a dive into Java 9, looking at new language features and APIs. But there are lots of things I had to left out, so here comes a two-parter to fix that. In this first part we'll be looking at new version strings and command line syntax, multi-release JARs, improved logging, and much more.
JShell
In the first part we skipped Jigsaw because everybody's talking about it already. In this part we'll do the same with JShell, the brand-new REPL for Java. (I.e. a thing where you can type Java code and it immediately evaluates it.) If don't know (much) about it yet but would like to, watch this great introduction Robert Field gave last year at Devoxx Belgium (I think).
New Version Strings
To ease into this, let's start with something simple: version strings.
Or so I thought until I tried to understand Java's version naming schema. It started with JDKs 1.0 and 1.1 - so far so easy but things go downhill from there. Apparently, versions 1.2 to 1.5 were at some point rebranded as Java 2. (Remember J2SE? That's the 2 in there.) With JDK 1.5 it became clear that this didn't really work out so Sun started calling it Java 5. Sometime around Java 6 the whole idea of Java 2 was silently buried and ever since things cleared up a little - we simply say "Java X". (Did you know that all Java version up to and including Java 7 had cool project names like Tiger and Mustang?)
The version strings reported by the JVM were untouched though - they always reported 1.x...
. Now, with JEP 223, version strings and the naming schema align. If you check the relevant system properties (see the demo), this is the output you will get:
java.version: 9-ea
java.runtime.version: 9-ea+138-jigsaw-nightly-h5561-20161003
java.vm.version: 9-ea+138-jigsaw-nightly-h5561-20161003
java.specification.version: 9
java.vm.specification.version: 9
This is not overly informative because it's run on an early access build. In the future java.version
will report strings like 9.1.2
, which follow the schema $MAJOR.$MINOR.$SECURITY
:
$MAJOR
marks the major version Oracle is planning to release every two to three years.$MINOR
marks the smaller releases for bug fixes and other details that follow regularly in between - it resets to zero when a new major version is released.$SECURITY
is really interesting - it gets bumped with every release that "contains critical fixes including those necessary to improve security" and is not reset when$MINOR
increases.
To make parsing that string unnecessary we get Version
, a nice little class that does it for us.
Version version = Runtime.version();
System.out.println("Reported by runtime: " + version);
switch (version.major()) {
case 9:
System.out.println("Modularity!");
break;
case 10:
System.out.println("Value Types!");
break;
}
GNU-style Command Line Options
Java's tools have a lot of idiosyncrasies when it comes to the syntax of their command line options:
- some use a single dash for long versions (
-classpath
), others use two (--gzip
) - some separate words with dashes (
--no-gzip
), others don't (again-classpath
) - some have single letter forms (
-d
), others two (-cp
, seriously what's wrong with that option?!) - some assign values with the equals sign (
-D<name>=<value>
), others require a space (I won't even...)
On Linux and other GNU-based systems, by contrast, pretty much all tools use the same syntax for their options:
- two dashes for long versions
- words are separated by dashes
- abbreviations consist of a single letter
In a recklessly courageous move Java 9 changes all command line options to match these rules, thus breaking all scripts! Nah, just kidding... ๐ But JEP 293 established a guideline mirroring and adapting those rules and new options are expected to follow it. Old options might at some point be migrated towards the cleaner syntax but that's not part of Java 9. The JEP contains a lot of details and examples - give it a read.
A Mixed Bag Of Extensions And Updates
Java 9 ships with a lot of JEPs that extend or update existing functionality. Here they are, somewhat ordered by topic, some summarized, some in more detail.
Unicode
While Java itself can be written in UTF-16 (yes, your code can sport emojis), property files used to be limited to ISO-8859-1. Let's say you have a config.properties
file like this one:
money = € / \u20AC
Then accessing this file with Java 8 yields:
money = รข▯¬ / €
With JEP 226 those times are finally over and no more Unicode escapes are required. Running the same access code on Java 9 shows what we expected:
money = € / €
(The full example even has a ๐ but our code highlighter doesn't play well with that.)
Note that there are several ways to access property files and only the one via PropertyResourceBundle
got updated. How exactly the encoding is determined and how that can be configured is documented in the API note of the JavaDoc. The defaults are sensible, though, and make the API "just work" for common cases:
try (InputStream propertyFile = new FileInputStream("config.properties")) {
PropertyResourceBundle properties = new PropertyResourceBundle(propertyFile);
properties.getKeys().asIterator().forEachRemaining(key -> {
String value = properties.getString(key);
System.out.println(key + " = " + value);
});
} catch (IOException e) {
e.printStackTrace();
}
You will find this code and a comparison to the Properties
API in the demo. If you try to run it on Java 8 for comparison, you will find a nifty little API change Java 9 made for those poor developers who are still using the ancient Enumeration
.
In other Unicode-related news, Java 9 supports Unicode 8.0. Yay! (JEP 227, JEP 267)
Graphics
TIFF images are now supported by the Image I/O Framework (in javax.imageio
). The Java Advanced Imaging (JAI) project implemented readers and writers for the format, which are now standardized and moved into javax.imageio.plugins.tiff
. (JEP 262)
Retina-style HiDPI screens pose unique challenges for desktop UIs. Java already dealt with them on Mac and now follows suit on Linux and Windows. With this "windows and GUI components should have an appropriate size based on the platform recommendations, text should remain crisp despite any default scaling indicated by the HiDPI settings, and icons and images should be smooth and preferably have details appropriate for the pixel density of the display." (JEP 263)
On Linux the Java desktop triumvirate (AWT, Swing, and JavaFX) can now use GTK 3. For the time being, the JVM will default to GTK 2 and only use GTK3 if indicated by the new system property jdk.gtk.version
or "GTK 3 is required for interoperability, and this requirement can be detected sufficiently early". (JEP 283)
JavaFX used an outdated GStreamer version, which is updated to 1.4.4. This should improve stability and performance of replaying media with JavaFX. (JEP 257)
HarfBuzz is the new OpenType layout engine and displaces ICU, which is discontinued. (JEP 258)
Security
The SHA-3 hash algorithms SHA3-224, SHA3-256, SHA3-384, and SHA3-512 were implemented. They can be used via the MessageDigest
API. (JEP 287)
When using SecureRandom
(on any Java version) you either get a native implementation based on your operating system or a pure Java version. The latter "uses an older SHA1-based RNG implementation, which is not as strong as the algorithms used by approved DRBG [Deterministic Random Bit Generator] mechanisms." Since older but especially embedded systems rely on the Java variant, its security was boosted by implementing the DRBG mechanisms described in NIST 800-90Ar1. Alongside that SecureRandom
's API was improved to allow passing parameters to DRGB and future algorithms (JEP 273):
Instantiation instantiation = DrbgParameters.instantiation(128, RESEED_ONLY, null);
SecureRandom random = SecureRandom.getInstance("DRBG", instantiation);
byte[] bytes = new byte[20];
random.nextBytes(bytes);
[caption id="attachment_142693" align="aligncenter" width="1024"] Published by Ali Bindawood under CC-BY-ND 2.0[/caption]
New Java Virtual Machine Features
The machince doing all the work for us - I wonder, will rise up one day? It got some love in this release in the form of a couple of new features, so maybe we calmed it. If not, I, for one, welcome our new ~~insect~~ machine overlords.
Continue reading %Inside Java 9 – Part I%
by Nicolai Parlog via SitePoint
How eCommerce Professionals Can Reduce Checkout Abandonment Rates
If you own or work for an eCommerce website (small or large), chances are that a significant percentage of your prospective customers are getting to your checkout page and then leaving in droves. Let’s take a look at the art of reducing checkout abandonment and how you can fix it — starting today.
Statistics on the percentage of abandoned shopping carts are staggering — from over 75% according to SalesCycle, to a low of around 60% according to MarketingSherpa. Whatever the exact figure is, it’s bad.
Understand Why Customers Are Leaving
Research shows that the number one reason consumers leave eCommerce websites during the check-out process is because of "extra costs too high" (i.e. shipping, tax, fees). These are followed by the website asking you to register an account (the lack of a ‘guest checkout’ option), long and complicated checkout processes, not being ready to purchase, high product prices, the need for a Save/Wishlist feature and more.
One such research study was conducted by the Baymard Institute in 2016 with 1,044 response participants throughout the US.
Source: Baymard Institute, Reasons for abandonments during checkout research study
Similar research findings were uncovered by Forrester Research, BI Intelligence, VWO and many other firms.
When VWO surveyed participants in 2016, they found the most commonly cited reasons for website visitors not completing their purchases online were:
A thorough usability study conducted by the Baymard Institute found a whopping 520+ usability-related issues concerning the checkout process — and these were on big-name shopping sites like 1-800-Flowers, Levi’s, and Apple. You’d think they’d know better, right? It just goes to show that a poor customer checkout experience isn’t limited to SMBs.
The good news is that all of these issues can be fixed, leading to a smoother, more seamless checkout process. Of course, it’s one thing to tell you why customers are leaving, but it’s another thing entirely to guide you through how to fix the issues that cause them to give up.
Let's go through some of the biggest problems and how to fix them.
Extra Taxes, Slow Shipping and High Shipping Costs
With the rise of Amazon Prime offering free two-day shipping on everything from electronics to pet food, it’s easy to see how customers have adapted to expecting things to be here sooner rather than later. But you’re not Amazon, so does that mean you have to simply deal with disappointing customers with slow or high shipping costs? Not necessarily.
The Solution
Depending on where your business is based, you may be able to work with local couriers to help streamline your shipping process. Traditionally, this would require a heavy investment in customized, in-house software to pack and track items, which is the route that Amazon took. Thankfully for the rest of us, there are plenty of specialized shipping software solutions that integrate the most popular couriers in your local geography while enabling you to manage tracking, shipping, inventory and in some cases, even accounting and fleet management.
And while there’s not much you can do about high taxes (short of setting up shop elsewhere), you can help soften the blow through the strategic use of coupons and geo-fencing, which involves defining a perimeter area that notifies customers in that area of special deals and discounts.
One of Australia’s leading eCommerce retail brands not only offers free shipping over a certain amount, but tells you how much to add to your card in order to qualify for it. By offering multiple payment options (including AliPay), they open themselves up to flexibility of payment methods.
But perhaps the biggest and most impactful change you can make (if at all financially feasible) is to offer free shipping, which is the biggest contributor by far to higher conversion rate numbers. Just how far are customers willing to go for free shipping?
You may be surprised.
According to a ComScore study, 90% of customers surveyed would take significant actions to qualify for free shipping, including 58% who said they would add more items to their cart in order to qualify, and half who said they would choose the slowest shipping option.
Website Issues: Slow Loading Time, Crashes, Complex Checkout
On the other side of the spectrum are website-specific issues often related to the shopping cart platform or the technology that powers the site itself. There are two issues here — the speed of the website and the speed of the checkout process. Both can affect customers interchangeably.
For loading issues, it’s worth checking out what could be causing the slow page loading speeds. You can do that with tools such as GTMetrix and Google PageSpeed Insights. Both tools will give you useful tips on how to make your pages load faster. For comparison, look at how they checked Amazon.com:
While there's some skill in knowing which of these may be 'false positives', GTMetrix provides a wealth of information on where to start in terms of improving performance and load speed (which can be a complicated subject). Best-practices like using CSS sprites are useful opportunities for load speed optimization (although not so commonly applied).
The Solution
Since this is SitePoint, I won't go into detail with what's necessary to fix each of these problems — but if you run into any difficulties, grab your nearby server administrator and fellow front-end devs and start working through each. Failing that, doing a Google search for "fixing [issue]" and the relevant reading can be used to solve almost any load speed issue.
Even if your page is blazingly fast, what about the checkout process itself? Unusually complex checkouts, a lack of guest registration and even requesting too much information on the checkout form are small but nevertheless significant areas of concern for customers.
According to the Baymard Institute’s Usability Report, customers also have issues with checkout in terms of inputting their shipping and billing information. Things that should be common sense rarely are, and instead add enough minor irritation to sour the customer experience altogether. We’re talking about missed improvements like:
- Making shipping address the same as billing address by just clicking a checkbox
- Preserving information entered in forms even when there’s one or more errors
- Auto-detecting city and state/province after postal code is entered
- Clearly labeling which fields are required and which are optional
- Only asking for the same information one time (such as name, email address, address, username/password)
Here's one example of a well-thought out check-out process:
Kogan.com, Australia's largest online department store, has a streamlined and simplified check-out process. They've gone for a multi-step check-out process (allowing for cart recovery e-mails if a visitor drops out after 'Step 1'). The elegant usage of HTML5 placeholders for each form field, clear reminders of what's in the cart, total order value and total delivery cost instill trust in the customer. The usage of the word "Secure" prior to Checkout also instils trust. You can get through the checkout faster by using a social login such as Facebook or PayPal. They've also used the word "Continue" rather than "Submit" for the primary call-to-action button.
Getting to the "Thank-You" Page
Getting to the Thank You page is a customer’s end goal, but many sites throw up every conceivable hurdle to try and prevent them from doing that. One common complaint from users is that the checkout process requires too much information. While most shopping carts have a fairly standard and unassuming billing/shipping detail window, there is certainly room for improvement.
Continue reading %How eCommerce Professionals Can Reduce Checkout Abandonment Rates%
by James Spittal via SitePoint
Quick Tip: Mock REST APIs Using json-server
Sometimes you need to prototype the front-end of your application without a back-end in place. Creating even a basic mock API to develop against can be time-consuming. The json-server library solves this problem for you by providing a fast and easy way to create complex RESTful APIs for development and testing.
This quick tip will teach you how to create mock REST APIs using json-server, allowing you to get a fully-featured API up and running in as little as 30 seconds.
Prerequisites
You should have basic knowledge of RESTful principles and how to consume APIs.
You'll need the following tools:
Windows users: There are curl binaries available in 32-bit and 64-bit varieties from the curl downloads page that will allow you to follow along with the examples in this article.
This tutorial assumes you’ll be using a bash-like terminal.
Installation
To install json-server, open your terminal and enter:
$ npm install -g json-server
This will install json-server globally on your system so that you can start the server from any directory you like.
Resources
In a RESTful API, a resource is an object with a type, associated data, relationships to other resources, and a set of methods that operate on it. For example, if you are creating an API for movies, a movie would be a resource. You can apply CRUD operations on this resource using your API.
Let's create an API with a /movies
resource.
Creating a Resource
Create a file called db.json
and add the following content to it:
{
"movies": [
{"id": 1, "name": "The Godfather", "director":"Francis Ford Coppola", "rating": 9.1},
{"id": 2, "name": "Casablanca", "director": "Michael Curtiz", "rating": 8.8}
]
}
After saving the file, start your server with the following command:
$ json-server --watch db.json
That's it! Now you have a movies API; you can fetch movies from this server, add new movies, delete movies, and a bunch of other stuff.
To test our mock API, we can use curl to make an HTTP request:
$ curl -X GET "http://localhost:3000/movies"
This will return a list of all the movies you have on this server. In the above case, you'll get two movies. Now to get the movie with the id of 1, just specify the id at the end of the URI: http://localhost:3000/movies/1.
To add movies to the server, you can send a POST request to the API with the movie details. For example:
Continue reading %Quick Tip: Mock REST APIs Using json-server%
by Ayush Gupta via SitePoint
This Week's HTML5, CSS and Browser Tech News #264
|
by via FrontEnd Focus