Thursday, January 26, 2017

The First Rule Of Good Software Design? First, Do No Harm!

Doctor and patient.

Who amongst us hasn’t at some time been cursed by the autocorrect gremlin?

You tap out a ‘letter-perfect’ message, dart your thumb to ‘SEND’, only to watch in slow-motion horror as the autocorrect gremlin decides you couldn’t have meant THAT, right? A moment later it has overridden your words with something ludicrous before sending it on its way before you can object.

It’s like having a little Mr. Bean in your pocket.

SMS message fails

I particularly love the following example — mainly because it didn’t happen to me.

Autocorrect fail.This is one of those cases of product designers trying to help us, but accidentally doing the opposite. A misspelled message of ‘I am leaving noo’ would have come off as forgivably sloppy, but not as heart-attack inducing as ‘I’m leaving you’. Less funny too.

Still, as funny as autocorrect fails can be, I suspect the total impact of autocorrect is a win. The benefit of the fixes outweighs the fails.

Sometimes these attempts to help can be more damaging.

So, is this a date?

Date formatting

One of the newer ‘UI helpers’ we’ve seen in the last decade is the ability for applications to recognize dates in plain text. 
Although, as humans, we skip between date formats with relative ease, it’s only been recently that software has been sophisticated enough to understand that the following all refer to the same point in time:

  • Wed 25th Jan
  • 25–1–2017
  • Wednesday, 1/25/2017
  • 1/25

In fact, applications like Gmail, MS Word and Slack are even clever enough to understand concepts like ‘tomorrow’ or ‘next Friday’ as dates that you can click on to turn into events or appointments.

This can be really helpful — until it’s not…

Please Stop Helping

Although Microsoft isn’t quite the global juggernaut it once was, their ability to offer their software very affordably to schools, universities, and academia has kept them dominant in the education and research sector. The vast majority of the world’s university studies and papers are produced using some combination of MS-Word, Excel or Access. A feather for MS caps.

Unfortunately, last year it was reported that Microsoft’s Office suite was responsible for breaking or invalidating about 20% of genetics studies since 2004.

How did this happen?

As with most sciences, Genetics has its own language and vocabulary of terms that most of us will never encounter. For instance, you probably didn’t know that…

[caption id="attachment_147709" align="alignright" width="510"]SEPTIN 2 SEPTIN2 looks like a party mask.[/caption]

Septin 2 (or SEPT2)

  • is a protein which seems to be used in the tracking and analysis of tumors and cancers (yes, I’m out of my depth here). It’s commonly referred to as ‘SEPT2’ in studies. It looks like a little masquerade mask.

Membrane-Associated Ring Finger (C3HC4) 8 (or MARCH8)

  • is a gene found in creatures from mice to trout to humans. It may have anti-viral properties and it often — with good reason — shortened to ‘MARCH8’.

Many of these studies are dozens, if not hundreds, of pages long and individual Excel tables may list ‘SEPT2’, ‘MARCH5’ or ‘MARCH8’ many thousands of times.
How does Excel handle these gene names?

As you probably guessed — Excel and MS Word try to convert each and every one of those genes into a helpful date. In fact, altogether there are at least 25 different known gene names that get automatically renamed when imported into Excel.

“That’s not a gene, sir — it’s a calendar event!!”

The real kicker? When Excel auto-converts the gene into a date, it permanently forgets the original state. You can convert it to 25 different formats of September 2nd, but ‘UNDO’ simply deletes the text rather than returning it to original ‘SEPT2’.

Of course, if you know to turn off the defaults before importing your data, you’ll have no problem. Many researchers know to do this. Still, this problem has been detected in 720 of 3,600 genetics papers since 2004, so this is no ‘freak occurrence’.

We’ll never know precisely what impact this has had on genetics and medical research. But corrupted data simply HAS to weaken the quality of the results. Scientists build on other scientist’s data, and we know that data is flawed.

Might we be closer to a cure for cancer or antibiotic-resistant superbugs if all this corrupt data was clean?
Probably — though we’ll never know exactly how much closer.

“First, do no harm”

This idea is one of the central principles of medicine. In other words:

[author_more]

[/author_more]

“You’re better to do nothing, than do something that might make things worse.”

We don’t have a set of universal tenets that we adhere to in designing software, but gee,… that’s a good first design principle, isn’t it?

“When designing new features, first, do no harm.”

Continue reading %The First Rule Of Good Software Design? First, Do No Harm!%


by Alex Walker via SitePoint

A Step by Step Guide to the Auto-Placement Algorithm in CSS Grid

Auto-placement algorithm in CSS Grid Layout module

In this tutorial, I'll be going over all the steps the auto-placement algorithm of the CSS Grid Layout module follows when positioning elements. These steps are controlled by the grid-auto-flow property.

In Introducing the CSS Grid Layout and Seven Ways You Can Place Elements Using CSS Grid Layout, I gave an overview of the CSS Grid spec and explained all the different ways Grid lets you arrange elements on the web. However, in my previous articles I explicitly specified the position of just one element in the grid. As for the rest of the items, they got placed properly based on an algorithm.

Here, I am going to show you how this algorithm works. This way, the next time an element ends up in an unexpected location, you are not left scratching your head wondering what just happened.

Basic Concepts for a Better Grasp of the Auto-placement Algorithm

Let's go over some fundamental concepts before diving into the workings of the algorithm.

  • Anonymous grid items - If you place some text directly inside a grid container without wrapping it in any tag, it will form its own anonymous grid item. You can't style an anonymous grid item because there is no element for you to style, but it still inherits style rules from its parent container. On the other hand, note that white space inside the grid container will not create its own anonymous grid item
  • Value of grid spans - Unlike grid positions, the algorithm has no special rules to resolve the value of grid spans. If not explicitly specified, their value is set to 1 (the item only occupies its own cell)
  • Implicit grid - The grid built on the basis of the value of properties like grid-template-rows, grid-template-columns and grid-template-areas is called explicit grid. Now, if you specify the position of a grid item in such a way that it lies outside the bounds of the explicit grid, the browser will generate additional grid lines to accommodate the item. These lines, along with the explicit grid, form the implicit grid. You can read more about it in Where Things Are at in the CSS Grid Layout Working Draft. The auto-placement algorithm can also result in the creation of additional rows or columns in the implicit grid.

Finally, I'd like to make the following preliminary point. The default value of the grid-auto-flow property, which is the property controlling the algorithm, is row. This is also the value I am going to assume in the following explanation of the auto-placement algorithm. On the other hand, if you explicitly set the above property to column, remember to replace instances of the term row with the term column in my explanation of the algorithm. For example, the step "Placement of Elements With a Set Row Position but No Set Column Position" will become "Placement of Elements With a Set Column Position but No Set Row Position".

Now, let's go over the details of all the steps the algorithm follows to build the layout.

Step #1: Generation of Anonymous Grid Items

The first thing that happens when the algorithm is trying to place all the items inside a grid is the creation of anonymous grid items. As I mentioned earlier, you cannot style these elements because there is no item to apply the style to.

The markup below generates an anonymous grid item from the inter-element text:

[code language="html"]
<div class="container">
<span class="nonan">1</span>
Anonymous Item
<div class="nonan floating">2</div>
<div class="nonan">3</div>
<div class="nonan floating">4</div>
<div class="nonan">5</div>
</div>
[/code]

Besides the generation of an anonymous item, one more thing to notice in the demo below is that the grid placement algorithm ignores the CSS floats applied to div 2 and div 4 .

See the Pen Anonymous Grid Items by SitePoint (@SitePoint) on CodePen.

Step #2: Placement of Elements with an Explicitly Specified Position

For this and the next few steps, I will be using a grid of nine different items to show how they are going to be placed.

Here's the relevant markup:

[code language="html"]
<div class="container">
<div class="item a">A</div>
<div class="item b">B</div>
<div class="item c">C</div>
<div class="item d">D</div>
<div class="item e">E</div>
<div class="item f">F</div>
<div class="item f">G</div>
<div class="item f">H</div>
<div class="item f">I</div>
</div>
[/code]

The first items to be placed in the grid are those with an explicitly set position, which in the example below are items A and B. Just ignore all other items in the grid for now. Here is the CSS that explicitly sets the position of A and B:

[code language="css"]
.a {
grid-area: 1 / 2 / 2 / 3;
}

.b {
grid-area: 2 / 1 / 4 / 3;
}
[/code]

Explicitly set position of A and B

The algorithm positions items A and B according to the values of their respective grid-area property. In particular, the algorithm:

  • Sets the position of the top left corner of both A and B using the first and second value of the grid-area property
  • Sets the position of the bottom right corner of both A and B using the third and fourth value of thegrid-area property.

The demo below illustrates the final placement of A and B after this step:

See the Pen Placing Elements with Explicit Positions by SitePoint (@SitePoint) on CodePen.

Step #3: Placement of Elements With a Set Row Position but No Set Column Position

Next, the algorithm places the elements whose row position has been set explicitly by using the grid-row-start and grid-row-end properties.

For this example, I will be setting only the grid-row values of item C and item D to give them a definite row position. Here is the CSS for placing both of them:

[code language="css"]
.c {
grid-row-start: 1;
grid-row-end: 3;
}

.d {
grid-row-start: 1;
grid-row-end: 2;
}
[/code]

To determine the column position, which is not explicitly set, the algorithm behaves in one of two ways, according to the packing mode:

  • sparse packing (default)
  • dense packing

Sparse Packing in Step #3

This is the default behavior. The column-start line of our item will be set to the smallest possible line index which ensures that there won't be any overlap between the item's own grid area and the cells already occupied by other items. The column-start line also needs to be past any other item already placed in this row by this step. Please note that I wrote by this step and not until this step.

Placement of items C and D

To clarify this point further, item D in the demo below did not move to the left of item A, even though it could fit in there without any overlap. This is due to the fact that the algorithm does not allow any item with an explicitly set row position but not set column position to be placed before any other similarly positioned item in that specific row (item C in this case). In fact, if you remove the grid-row rules applied to item C, then item D will move to the left of item A.

In short, item D, which has a definite row position but no explicitly set column position, can end up being placed before item A, but only if C does not interfere (interference takes place in this case because C, like D, has a definite row position but no set column position and is in the same row as D).

See the Pen Placing Elements with Definite Grid Positions by SitePoint (@SitePoint) on CodePen.

Dense Packing in Step #3

If you want to fill that empty space before item A with item D, you will have to set the value of the grid-auto-flow property to row dense.

[code language="css"]
.container {
grid-auto-flow: row dense;
}
[/code]

Placement of D before A using the dense value of the grid-auto-flow property

In this case too, the column-start line is placed at the smallest index which does not cause any overlap with other grid items. The only difference is that this time, if there is some empty space in a row where our element can fit without any overlap, it will be placed in that position, without considering the previous item in the same row with the same position rules (in this case item C).

See the Pen Elements with Definite Grid Positions - Dense by SitePoint (@SitePoint) on CodePen.

Continue reading %A Step by Step Guide to the Auto-Placement Algorithm in CSS Grid%


by Nitish Kumar via SitePoint

More HTML5 Semantics: Content Types & New Elements

The following is an extract from our book, HTML5 & CSS3 for the Real World, 2nd Edition, written by Alexis Goldstein, Louis Lazaris, and Estelle Weyl. Copies are sold in stores worldwide, or you can buy it in ebook form here. Our sample site is coming along nicely. We’ve given it some basic structure, along […]

Continue reading %More HTML5 Semantics: Content Types & New Elements%


by Louis Lazaris via SitePoint

Using Illuminate Database With Eloquent in Your PHP App Without Laravel

How to Improve Your Blog Posts With YouTube Videos

Do your blog posts need a little pizzazz? Have you considered using video to enhance your articles? Combining YouTube videos with your written content can help you stand out from your competitors. In this article, you’ll discover how to enhance your blog posts with YouTube videos. Embed YouTube Video in Your Blog Posts Embedding videos [...]

This post How to Improve Your Blog Posts With YouTube Videos first appeared on .
- Your Guide to the Social Media Jungle


by Ana Gotter via

One Page Love ‘Award Ribbons’ in Retina

Below is a little tutorial on how to add a subtle award ribbon to your website. Feel free to hot link the image file. The ribbon is hosted on AmazonS3 and optimized so load time should be swift:)

ps. head here if you are after Printable Award Certificates

Ribbon Previews:

One Page Love Award Banner

One Page Love Award Ribbon


Direct Ribbon image links:

Left aligned Retina ribbon:

http://ift.tt/2k3MFZ9

Right aligned Retina ribbon:

http://ift.tt/2kmR7Qy

Left aligned non-Retina ribbon:

http://ift.tt/2k3MFs7

Right aligned non-Retina ribbon:

http://ift.tt/2kmOiic


Code

Simply add this HTML code in your page just after your first <body> tag, then the CSS to your stylesheet. Make sure you replace the link in the HTML code to the link of your feature.

HTML:

<div class="opl"><a href="http://ift.tt/2k3LFnO" target="_blank">Your Site Name featured on One Page Love</a></div>

CSS for fixed position:

The code below is for the ribbon to stay visible while the rest of the page content moves when scrolling

.opl {
position:fixed;
top:100px;
left:0px;
z-index:99999;
}
.opl a {
width:73px;
height:56px;
text-indent:-9999px;
display:block;
background:url('http://ift.tt/2k3MFZ9') no-repeat;
background-size: 100%;
}

CSS for non-fixed position:

The code below is for the ribbon to move with the rest of content when scrolling

.opl {
position:relative;
top:100px;
left:0px;
z-index:99999;
}
.opl a {
width:73px;
height:56px;
text-indent:-9999px;
display:block;
background:url('http://ift.tt/2k3MFZ9') no-repeat;
background-size: 100%;
}


Feel free to modify or add your own!

Help? rob@onepagelove.com


by Rob Hope via One Page Love

Merci-Michel

Merci-Michel is a digital production house based in Paris. We specialize in creating cutting edge interactive solutions, ground breaking user interfaces and immersive campaigns.
by via Awwwards - Sites of the day