Shared posts

23 May 23:16

Households that lost income

by Nathan Yau

This straightforward grid map by Danielle Alberti for Axios shows the percentage of adults in a household where someone lost employment income. In all likelihood, you know someone affected in one way or another.

The data comes from the Census Household Pulse Survey, which is an effort to gauge the impact of Covid-19.

Tags: Axios, coronavirus, Danielle Alberti, unemployment

23 May 23:16

Reopening states and how they currently measure up

by Nathan Yau

States are reopening. Some seem ready, and some less so. Lena V. Groeger and Ash Ngu for ProPublica made a reference so that you can quickly see how your state is doing in five important metrics:

To give people context on state reopenings, and what happens afterward, we are tracking metrics derived from a set of guidelines published by the White House for states to achieve before loosening restrictions. Even if these criteria are met, without a vaccine, reopening may cause an increase in cases. What’s more, some states may meet all of the criteria and still have a high infection rate.

There’s a national overview, as shown above, and then it quickly goes to the individual states.

Check out Groeger’s thread for some process.

Tags: arrows, coronavirus, ProPublica, reopening

23 May 23:14

This Japanese Zoo is Using Stuffed Capybaras to Visualize Social Distancing

by Grace Ebert

All images by @chacha0rca

Take a seat for lunch at Izu Shabonten Zoo in Shizuoka, Japan, and meet your plush dining partners. To help restaurant patrons visualize social distancing guidelines, the zoo has occupied chairs with stuffed capybaras. The soft toys encourage diners to space out among the tables and maintain an appropriate distance.

With only a few other cuddly creatures in the mix, the institution’s main choice is a nod to its decades-long fascination with the giant rodent. Izu Zoo boasts a plethora of capybara-themed programming and souvenirs and also is credited with creating open-air hot baths in 1982 that offer the animals, which are native to South America, a place to bathe, relax, and warm up during cold winters.

Although many of us won’t be visiting the wild creatures in the near future, you can get a glimpse at their steamy retreats below. For similarly visual social distancing, check out Singapore’s tape demarcations. (via Spoon & Tamago)

 

02 May 03:09

Grassy Inclines Embedded in the Ground by Tanya Preminger Throw the Earth Off Balance

by Grace Ebert

“Round Balance” (2008), soil, grass 900 x 900 x 260 centimeters, Saint-Flour, France. All images © Tanya Preminger, shared with permission

Take a seat on one of Tanya Preminger’s grass-covered artworks, and you won’t be able to right the balance. The Isreal-based artist created immovable slants and indentations embedded in the land that seem like they should tip depending upon the amount of weight settled on either side. For each sloping piece, Preminger employed an excavator to dig a hole and pour the soil into a nearby pile. She then used a shovel, rake, and lengthy ruler to sculpt the slanted earth, covering it with sod at the end.

After seeing a footprint left in a bit of sand, Preminger wanted to express the relationship between give and take that’s inherent in nature. “In physics, an action is equal to its reaction,” she tells Colossal. “The project expresses in material form the philosophical law of balance between opposing sides of one essence.”

The artist produced the first oval impression in 1989 in the fields of the kibbutz Givat Brenner. When organizers of the Chemin d’Art asked her to recreate her original work for their 2008 festival in France, she designed “Round Balance,” altering her oval to a circle “to give a more universal meaning.” (via Design You Trust)

 

Do stories and artists like this matter to you? Become a Colossal Member and support independent arts publishing. Join a community of like-minded readers who are passionate about contemporary art, apply for our annual grant, and get exclusive access to interviews, partner discounts, and event tickets.

18 Apr 03:20

“My Wife Hates it When I Work From Home” — Banksy Shares Rats Run Amok in his Bathroom from Quarantine

by Christopher Jobson

Presumably quarantined like the rest of humanity, Banksy just posted a few images of an artwork executed in his supposed home bathroom. The installation depicts a mischievous pack of his signature rats destroying everything in sight: swinging from towel racks, running on toilet paper, marking the days of quarantine on the wall, and making a disgusting mess of the toilet. The caption accompanying the work on Instagram reads simply, “My wife hates it when I work from home.”

 

Do stories and artists like this matter to you? Become a Colossal Member and support independent arts publishing. Join a community of like-minded readers who are passionate about contemporary art, apply for our annual grant, and get exclusive access to interviews, partner discounts, and event tickets.

04 Feb 11:20

Eevee’s whirlwind history of CSS and web design

by Andy Baio
a delightful, practical look back at how CSS evolved
01 Feb 16:09

In secret deal with drugmaker, health records tool pushed opioids to doctors

by Andy Baio
dark software patterns fueling the opioid crisis
28 Oct 02:52

Leave no database behind with Cloud SQL for SQL Server

by Ori Kashi
Hsiufan

I worked on this :)

At Google Cloud, we develop our database services to meet the needs of enterprise teams wherever they are in their cloud journey. We’re excited today to announce the beta launch of Cloud SQL for SQL Server and make it available to all of our customers. This addition to our database lineup means you can migrate your enterprise SQL Server workloads to Google Cloud easily, and take advantage of fully managed services.  

Earlier this year, we announced the addition of Microsoft SQL Server to the Cloud SQL portfolio of available database engines. At Next, we showed how easily an existing Windows environment could be migrated to Google Cloud, then integrated alongside our many other managed services. Cloud SQL for SQL Server is a key component when onboarding your existing applications and infrastructure to get the benefits of a fully managed and compatible database that will reduce your operational costs and overhead.  

Highlights of Cloud SQL for SQL Server
Cloud SQL for SQL Server brings some key benefits that can help you run workloads easily. 

  • Compatibility: Cloud SQL for SQL Server offers multiple editions of the current version of SQL Server and works with popular clients such as SQL Server Management Studio.

  • Flexible backups: Schedule automatic daily backups or run them on-demand.

  • Scalability: Enable the automatic storage increase configuration and Cloud SQL will add storage capacity whenever you approach your limit. Easily scale up your customized machines’ memory and processor cores as necessary.

  • Built-in high availability: Cloud SQL for SQL Server has built-in high availability enabled for all editions that synchronously replicates data to each zone’s regional persistent disk.

As part of the Cloud SQL platform, Cloud SQL for SQL Server will launch in all currently available regions and will integrate with our existing Cloud SQL functionality, such as connectivity via the Cloud SQL Proxy.   Here’s a look at creating a new instance.

sql.png

Early adopters of Cloud SQL for SQL Server have been using the service for the last few months, and we’ve heard that they see the potential value for onboarding more workloads.

"Cloud SQL for SQL Server was very easy and fast to get up and going.” says Andrew P. Toi, database engineer lead at advertising management software company WideOrbit Inc. “With built-in high availability that can be used across editions, I can reduce the cost and overhead of managing databases dramatically, especially for smaller workloads" 

And desktop virtualization infrastructure company Itopia had this to say. "Cloud SQL Server dramatically reduces the complexity and cost involved in deploying cloud desktop infrastructure for our customers,” says Ubaldo Don, CTO of Itopia. “It turns a bulky pillar of infrastructure into a one-click service, reducing IT service management overhead." 

More features coming soon
We’re continuing to improve Cloud SQL for SQL Server during beta and beyond to meet all of your cloud database needs. Watch for the following:

  • Active Directory integration

  • Read replicas

  • Expanded machine types

  • Online migration tools

See what Google Cloud can do for you
Sign up for a $300 credit to try Cloud SQL and the rest of GCP. You can start with inexpensive micro instances for testing and development. When you’re ready, you can easily scale them up to serve performance-intensive applications. As a bonus, everyone gets 100%sustained use discount during beta, regardless of usage. Enjoy your exploration of Google Cloud and Cloud SQL for SQL Server.

28 Oct 01:38

How to Avoid Being Fleeced When Using a Credit Card Overseas

by Vindu Goel
Merchants frequently try to confuse and bulldoze foreign travelers into paying a stiff markup on credit card charges. But you can fight back.
12 Oct 19:28

Fixing the ‘impeach this’ map with a transition to a cartogram

by Nathan Yau

As discussed previously, the “impeach this” map has some issues. Mainly, it equates land area to votes, which makes for a lot of visual attention to counties that are big even though not many people live in them. So, Karim Douïeb used a clever transition to change the bivariate map to a cartogram. Now you can have a dual view.

Tags: election, impeachment

12 Oct 19:27

GitHub contribution graph to show burnout

by Nathan Yau

A quick annotation by Jonnie Hallman on Twitter: “GitHub is really good at visualizing burnout.”

Tags: annotation, burnout, GitHub

25 Jul 07:30

User Inyerface

by Andy Baio
frustrating and funny interactive dark patterns
07 May 20:56

Sacred Spaces: The Grand Interiors of Modern Churches Across Europe and Japan by Thibaud Poirier

by Kate Sierzputowski
Kirche am Hohenzollernplatz, Berlin, Germany - Johann Freidrich Höger, 1933, all images via Thibaud Poirier

Kirche am Hohenzollernplatz, Berlin, Germany – Johann Freidrich Höger, 1933, all images via Thibaud Poirier

Thibaud Poirier (previously) travels the world photographing the architectural spaces that surround us as we live, sleep, study, and pray. In his most recent series, the French photographer captured the interiors of 29 modern churches across Germany, The Netherlands, France, Denmark, and Japan to see how each city has designed structures of worship within the last century. In Sacred Spaces, Poirier uses the same focal point in each image. The stylistic choice makes it easier to compare the similarities of basic structures such as seating and pulpit placement, while contrasting the differences in interior design choices such as lighting and color palettes. You can see more modern churches from the series on his website, Instagram, and Behance.

Saint Moritz, Augsburg, Germany - John Pawson, 2013

Saint Moritz, Augsburg, Germany – John Pawson, 2013

Resurrection of Christ, Köln, Germany - Gottfried Böhm, 1957

Resurrection of Christ, Köln, Germany – Gottfried Böhm, 1957

Grundtvigs Kirke, Copenhagen, Denmark - Peder Vilhelm Jensen-Klint, 1927

Grundtvigs Kirke, Copenhagen, Denmark – Peder Vilhelm Jensen-Klint, 1927

Opstandingskerk, Amsterdam - Marius Duintjer, 1956

Opstandingskerk, Amsterdam – Marius Duintjer, 1956

Kapelle, Berlin, Germany - Axel Schultes and Charlotte Frank, 1999

Kapelle, Berlin, Germany – Axel Schultes and Charlotte Frank, 1999

Saint Joseph, Le Havre, France - Auguste Perret, 1956

Saint Joseph, Le Havre, France – Auguste Perret, 1956

Saint Anselm's Meguro, Tokyo, Japan - Antonin Raymond, 1954

Saint Anselm’s Meguro, Tokyo, Japan – Antonin Raymond, 1954

Notre dame du Chêne, Viroflay, France - Louis, Luc and Thierry Sainsaulieu, 1966

Notre dame du Chêne, Viroflay, France – Louis, Luc and Thierry Sainsaulieu, 1966

Saint Mary's Cathedral, Tokyo, Japan - Kenzo Tange, 1964

Saint Mary’s Cathedral, Tokyo, Japan – Kenzo Tange, 1964

05 Apr 01:18

I Don’t Want to Sink

by waiter

A while back I realized I needed to sort some things out and started seeing a therapist about once a month. Last week I was early for my appointment so I sat in my car and enjoyed a blueberry scone with a cup of coffee. As I was listening to the radio a loud scraping sound suddenly overwhelmed the news announcer and my jar rocked with a sickening jolt. My scone flew out of my hand and hot coffee spilled on my pants

“GODDAMMIT!” I yelled.

Leaping out of my car, I saw a beat up old Honda driving away at about six miles per hour. “Sonavabitch!” I muttered. My vehicular assailant wasn’t even going to stop.

It must have been funny to watch, but I jogged after the car and caught up with it at the traffic circle. Peering through the scratched  and dirty windows I saw an elderly couple sitting inside. About what I figured. I rapped on the passenger side window and it rolled down.

“You hit my car back there, sir,” I said to the driver.

“Oh?” the man said.

“Did you know you hit me?”

“I knew I hit something,” he replied weakly.

“Sir,” I said, feeling the anger inside me ebbing, “You’re supposed to stop when you hit someone’s car.”

“We’re sorry!” the man’s wife yelped. “We’re sorry!”

Judging from the car, I knew this couple didn’t have any money. I figured this car was their only lifeline to the outside world – doctors’ appointments, food shopping – that sort of thing. I have elderly parents and I understand how important it is that my father can still drive.

“We’re sorry,” the woman said again. Then couple looked at me plaintively. They wanted me to forget about it.. They knew the jig was up. They wanted me to let them go.

Nope.

“Do you have insurance sir?” I asked.

“Yes.”

“Then let’s go back to my car and let the police sort this out.”

The man seemed very confused and started to drive away. Figuring he was going to rabbit, I took a picture of his license plate with my phone. Then I called the police. After a few minutes the old man pulled up in his heap. “There’s no damage,” he said. “It’s not bad.” Sure, there was a nasty scrape on my bumper and a small crack, but not enough to get mad about. No one was hurt. But that wasn’t what I was worried about.

A cop came and I told them him what happened as I handed him my paperwork.  “He hit you while you were parked there?” the officer said, shaking his head.

“I don’t care about the car,” I said. “The guy didn’t realize he hit me until I ran after him.”

While the cop was doing his thing I called my therapist. “Look out your window,” I said.

I watched the curtains pull back and the therapist’s face appear in the window. “What happened?” he said.

“Some old guy hit me while I was parked. I’ll be late.”

“Take your time. Don’t worry about it.” Considering what my therapist charges, I wondered if he’d prorate my session.

Whenever there’s flashing lights and sirens people gather. I noticed one bystander glaring at me. Maybe he saw me chase the car and thought I acted like an asshole. Who knows? Maybe he had an old father too.  Then the old man got out of his car. He could barely stand. I felt like a shit.

“I hate doing this,” the cop said, handing me back my paperwork, “But that guy can’t drive anymore.”

“What’ll happen?” I asked.

“I’ll send in a report and the state will make him take the driver’s test again. If he fails they’ll take his license away.”

Accident report number in hand, I walked up to my therapist’s office and sat down in my customary chair. Grey haired and slim with a healthy Florida vacation tan, the shrink was around my father’s age. I picked him partly because of that. Talking about my problems with someone younger than me would feel weird. When I went to the podiatrist for a tendonitis flare up last week I was chagrined that the doctor looked like she had just got out of high school. Reverse ageism I guess.

“Steve” the shrink said. “I saw that guy from up here. He was a mess. He shouldn’t be driving.”

“I know,’ I said. “I just hate to be the reason he loses his license.”

“Next time it could be a person. A kid.”

“He wanted me to let him skate,” I said. “But I couldn’t for just that reason.”

Staring out the office window, I knew that old man’s life was going to be diminished. But if he ended up seriously hurting or killing someone then a whole lot of peoples’ lives would be diminished too. It was really a no brainer – but that didn’t make me feel any better.

Sitting in my chair, I began to talk about what’s bothering me. People say age brings wisdom but that’s often a load of horseshit.  Some people, smug in their grey hairs, use old age as an excuse to not change. They’re in for a rude shock. Growing old means you’re going to encounter things you’ve never experienced before. If you’re not able to roll with those changes then growing old is going to be a shipwreck. I’m far from old but I’ve caught a glimpse the rocky shoals ahead. I don’t want to sink.

I don’t want to run over someone and not even notice.

The post I Don’t Want to Sink appeared first on Waiter Rant.

23 Dec 23:18

Ages in Congress, from the 1st to the 115th

by Nathan Yau

As I watched Google’s CEO Sundar Pichai field questions from the House Judiciary Committee it was hard not to feel like there was a big gap in how the internet works and how members of Congress think it works. Many suggested the gap was related to age, so I couldn’t help but wonder how the age distribution has changed over the years.

You can see the median age shifting older, but I’m not totally sure what to make of it. After all, the population as a whole is getting older too. On the other hand, the internet changed a lot of things in our lives, and the hope is that those forming the policies understand the ins and outs.

Tags: age, Congress

20 Oct 22:48

Optimized bubble tea consumption

by Nathan Yau

When you drink bubble tea, ideally you’d like to finish with the same proportions of boba and tea that you started at. Krist Wongsuphasawat took care of the math and provides a simulator for this ever important challenge:

This article simulates an optimized sip based on amount of boba and tea in the straw before sipping (method adopted from this post). The simulation assumes that all bobas sit in the bottom of the cup and stack on top of each other nicely. If you put a straw straight down when there are n layers of bobas, you will get n bobas in the straw. The rest of the straw up to the drink’s height is tea. The drinker sips until all n bobas are in his/her mouth then stop. After each sip these n bobas and tea inside the straw are gradually reduced from the cup.

The final recommendations: use a slim cup, minimize ice, and drink strongly. Mess around with variables here.

Tags: boba, simulation

10 Oct 04:25

Measuring the varied sentiments of good and bad words

by Nathan Yau

There was a survey a while back that asked people to provide a 0 to 100 percent value to probabilistic words like “usually” and “likely”. YouGov did something similar for words describing good and bad sentiments.

Tags: sentiment, words

19 Aug 04:46

A visual analysis of jean pockets and their lack of practicality

by Nathan Yau

Frustrated with the size of pockets on women’s pants, Jan Diehm and Amber Thomas for The Pudding, measured pocket sizes in 20 popular jean brands. They compared men’s and women’s pockets and calculated what actually fits in the mix of sizes.

[W]e programmatically determined whether various everyday items could fit in an otherwise empty pocket in jeans that aren’t being worn. (If an object won’t fit in the pocket of a pair of jeans on the hanger, it certainly won’t fit when you’re wearing them.) Only 40 percent of women’s front pockets can completely fit one of the three leading smartphone brands. Less than half of women’s front pockets can fit a wallet specifically designed to fit in front pockets. And you can’t even cram an average woman’s hand beyond the knuckles into the majority of women’s front pockets.

Impressive and informative work.

It reminds me of the Amanda Cox graphic that compared women’s dress sizes for different brands in 2011. There’s also the broken waistline measurement.

Let’s just all wear sweats from now on.

Tags: pants, pockets, The Pudding

15 Jul 02:03

Street network orientation in major cities

by Nathan Yau

Using OpenStreetMap data, Geoff Boeing charted the orientation distributions of major cities:

Each of the cities above is represented by a polar histogram (aka rose diagram) depicting how its streets orient. Each bar’s direction represents the compass bearings of the streets (in that histogram bin) and its length represents the relative frequency of streets with those bearings.

So you can easily spot the gridded street networks, and then there’s Boston and Charlotte that are a bit nutty. Check out Boeing’s other chart for orientation of major non-US cities.

See also Stephen Von Worley’s color-coded maps and Seth Kadish’s charts from 2014 that showed the same thing but used Census data instead of OpenStreetMap.

Tags: directions, streets

06 Jul 04:22

Google Reader Time Capsule

by Andy Baio

Mihai Parparita’s snapshot of Google Reader before it shuttered five years ago; more on the project

24 Apr 00:25

Mimi Choi’s makeup artistry

by Andy Baio

intensely disturbing makeup illusions

06 Mar 18:20

Long Exposure Photos Capture the Light Paths of Drones Above Mountainous Landscapes

by Kate Sierzputowski

Photographer Reuben Wu creates images that reveal an alien splendor in natural and manmade landscapes across the globe. Previously he has explored the brilliant blue rivers of molten sulfur in Indonesian volcanoes, and photographed the thousands of glistening mirrors that compose Nevada’s SolarReserve. For his ongoing series Lux Noctis, the Chicago-based photographer utilizes modified drones as aerial light sources, illuminating obscure landscapes in a way that makes each appear new and unexplored.

Recently Wu has evolved his process of working with the drones to form light paths above topographical peaks in the mountainous terrain. “I see it as a kind of ‘zero trace’ version of land art where the environment remains untouched by the artist, and at the same time is presented in a sublime way which speaks to 19th century Romantic painting and science and fictional imagery,” said Wu to Colossal.

The light from his GPS-enabled drones create a halo effect around some of the presented cliffs and crests when photographed using a long exposure. An elegant circle of light traces the flight of the drone, leaving a mark only perceptible in the resulting photograph. You can see more of Wu’s landscape photography on his Instagram and Facebook. (via Faith is Torment)

08 Feb 21:58

Winamp2-js now supports all three windows

by Andy Baio

the list of features it supports is pretty impressive

30 Jan 20:42

Photographer Jonathan Higbee Discovers a World of Coincidence on the Streets of New York

by Christopher Jobson

All images © Jonathan Higbee.

For over a decade, photographer Jonathan Higbee has walked the streets of New York with a camera in-hand, spotting extraordinary juxtapositions and unusual moments when the world aligns for a split second in front of his lens. At times he manages to completely erase the boundaries between manufactured imagery found in billboards or signage that pollute the city streets and captures anonymous passersby who seem to live in an alternate reality.

This uncanny talent for observation has made the Missouri-born photographer a rising name in street photography where he won the World Street Photography grand prize in 2015 and a LensCulture 2016 Street Photography Award. Higbee’s work has been exhibited in group shows around the world and his photos were recently included in World Street Photography 4. You can follow more of his photography on Instagram. (via LensCulture)

22 Oct 03:16

A study of the geographic forms in cartography

by Nathan Yau

Cartographer Geraldine Sarmiento from Mapzen explores the drawing forms in cartography, such as lines, bridges, and buildings.

What is the visual language of cartography? Let’s explore this question through the medium of drawing. After all, it is this abstract representation of place onto a surface of fewer dimensions that the act of cartography entails.

Be sure to check out the Morphology tool to poke at the forms yourself.

04 Oct 05:25

safe-area-inset values on iOS11

by ppk

With the iPhone X’s notch came viewport-fit=cover and safe-area-inset, as explained here. It turns out that safe-area-inset is 0 on iOS11 devices that are not the iPhone X. This may sound logical, but I wonder if it is. Also, the value remains static, even when you zoom in.

Note: testing for this article was done exclusively on Apple’s simulator.

To recap briefly:

  • viewport-fit=cover, when added to the meta viewport, ensures the site takes over the entire screen, even the space below the notch, if applicable.
  • safe-area-inset-dir (where dir is left, right, top, or bottom) gives the safe areas you should apply if you want enough margin or padding to prevent your site from being obscured by the notch.

viewport-fit

Let’s treat viewport-fit=cover first. When applied on the iPhone X, your sites now stretches into the space below the notch, as advertised. When applied on any other device with iOS11, nothing happens. That’s logical: the viewport is already stretched to its maximum and there is no notch to avoid or stretch under.

In other words, viewport-fit=cover can be added to any site and will fire only when applicable. Keep that in mind.

The safe area

safe-area-inset should be added as a padding (or, I suppose, a margin) to elements or the entire page. Its value on the iPhone X, in case you’re wondering, is 44px. This value could conceivably be different on future models where the notch is larger or smaller, so using a constant that may change from model to model is a good idea.

But what is its value on iOS11 devices that are not the iPhone X and have no notch? It turns out it’s 0px. This may sound logical as well, since there is no notch and thus no safe area, but is it?

My problem is the following. Suppose I have this:

element {
	padding-left: 10px;
	padding-left: constant(safe-area-inset-left);
}

What I want to do here is give the element a padding-left of 10px, except when a notch is present, then I want to give it a pading-left equal to the safe area (44px). This works absolutely fine on the iPhone X and in non-iOS browsers. In the former the initial 10px values is overwritten by the safe area, while the latter don’t understand the safe area and ignore the second rule.

Problem is: on iOS11 devices other than the iPhone X this misfires and gives the element a padding-left of 0. Thus, safe-area-inset fires even when it’s not applicable. I do not find this logical at all. As far as I can see, safe-area-inset should simply be absent when there is no safe area to describe. And 0 is not the same as absent.

As far as I’m concerned Apple should remove safe-area-inset entirely from devices that do not need it. Thus we web developers do not need to worry about the notch. We write a tiny bit of CSS for the notch, and can rest assured that the CSS will not fire when it’s absent.

The official post notes that you should use the following instead, but also notes that max() is not supported by the current Safari/iOS version, which makes the advice a bit pointless:

element {
	padding-left: max(10px,constant(safe-area-inset-left));
}

So they kind-of admit there might be a problem, but offer an as-yet-unavailable solution. Also, as far as I’m concerned this tip-toes around the fundamental problem of having a safe area of 0 where none is needed.

Zoom

There’s another problem as well: safe-area-inset is not adjusted when the user zooms, even though, at high zoom levels, the safe area becomes comically large. Even when I’m zoomed in to the maximum level on an iPhone X, the safe area is still 44px, though that now means about one-third of the screen.

How safe-area-inset misfires on high zoom levels: it gives way too much padding-left

I can understand why Apple did this. If safe-area-inset would become zoom-dependent, the browser would have to run re-layouts every time the user zooms, changing the calculated padding-left on every applicable element. This is likely to be a costly operation.

Still, the conclusion must be that safe-area-inset also misfires whenever the user zooms in.

Notch detection

So we have to write a notch detection script. Fortunately it’s quite simple: create a test element, apply the safe-area-inset and see if its value is larger than 0. If so, a notch is present.

function hasNotch() {
	if (CSS.supports('padding-left: constant(safe-area-inset-left)')) {
		var div = document.createElement('div');
		div.style.paddingLeft = 'constant(safe-area-inset-left)';
		document.body.appendChild(div);
		var calculatedPadding =  parseInt(window.getComputedStyle(div).paddingLeft);
		document.body.removeChild(div);
		if (calculatedPadding > 0) {
			return true;
		} 
	}
	return false;
}

Still, I would argue that the very need for such a script means safe-area-inset has not been implemented quite properly.

22 Sep 22:51

Designing Websites for iPhone X

by TImothy Horton
The section below about safe area insets was updated on Oct 31, 2017 to reflect changes in the iOS 11.2 beta.

Out of the box, Safari displays your existing websites beautifully on the edge-to-edge display of the new iPhone X. Content is automatically inset within the display’s safe area so it is not obscured by the rounded corners, or the device’s sensor housing.

The inset area is filled with the page’s background-color (as specified on the <body> or <html> elements) to blend in with the rest of the page. For many websites, this is enough. If your page has only text and images above a solid background color, the default insets will look great.

Other pages — especially those designed with full-width horizontal navigation bars, like the page below — can optionally go a little further to take full advantage of the features of the new display. The iPhone X Human Interface Guidelines detail a few of the general design principles to keep in mind, and the UIKit documentation discusses specific mechanisms native apps can adopt to ensure that they look good. Your website can make use of a few similar new pieces of WebKit API introduced in iOS 11 to take full advantage of the edge-to-edge nature of the display.

While reading this post you can tap on any of the images to visit a corresponding live demo page and take a peek at the source code.

Safari's default insetting behavior
Safari’s default insetting behavior.

Using the Whole Screen

The first new feature is an extension to the existing viewport meta tag called viewport-fit, which provides control over the insetting behavior. viewport-fit is available in iOS 11.

The default value of viewport-fit is auto, which results in the automatic insetting behavior seen above. In order to disable that behavior and cause the page to lay out to the full size of the screen, you can set viewport-fit to cover. After doing so, our viewport meta tag now looks like this:

<meta name='viewport' content='initial-scale=1, viewport-fit=cover’>

After reloading, the navigation bar looks much better, running from edge to edge. However, it is immediately clear why it is important to respect the system’s safe area insets: some of the page’s content is obscured by the device’s sensor housing, and the bottom navigation bar is very hard to use.

viewport-fit=cover
Use `viewport-fit=cover` to fill the whole screen.

Respecting the Safe Areas

The next step towards making our page usable again after adopting viewport-fit=cover is to selectively apply padding to elements that contain important content, in order to ensure that they are not obscured by the shape of the screen. This will result in a page that takes full advantage of the increased screen real estate on iPhone X while adjusting dynamically to avoid the corners, sensor housing, and indicator for accessing the Home screen.

Safe and Unsafe Areas
The safe and unsafe areas on iPhone X in the landscape orientation, with insets indicated.

To achieve this, WebKit in iOS 11 includes a new CSS function, env(), and a set of four pre-defined environment variables, safe-area-inset-left, safe-area-inset-right, safe-area-inset-top, and safe-area-inset-bottom. When combined, these allow style declarations to reference the current size of the safe area insets on each side.

The env() function shipped in iOS 11 with the name constant(). Beginning with Safari Technology Preview 41 and the iOS 11.2 beta, constant() has been removed and replaced with env(). You can use the CSS fallback mechanism to support both versions, if necessary, but should prefer env() going forward.

env() works anywhere var() does — for example, inside the padding properties:

.post {
    padding: 12px;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

For browsers that do not support env(), the style rule that includes it will be ignored; for this reason, it is important to continue to separately specify fallback rules for any declarations using env().

Safe area constants
Respect safe area insets so that important content is visible.

Bringing It All Together, With min() and max()

This section covers features that are available starting in Safari Technology Preview 41 and the iOS 11.2 beta.

If you adopt safe area insets in your website design, you might notice that it is somewhat difficult to specify that you want a minimum padding in addition to the safe area inset. In the page above, where we replaced our 12px left padding with env(safe-area-inset-left), when we rotate back to portrait, the left safe area inset becomes 0px, and the text sits immediately adjacent to the screen edge.

No margins
Safe area insets are not a replacement for margins.

To solve this, we want to specify that our padding should be the default padding or the safe area inset, whichever is greater. This can be achieved with the brand-new CSS functions min() and max() which will be available in a future Safari Technology Preview release. Both functions take an arbitrary number of arguments and return the minimum or maximum. They can be used inside of calc(), or nested inside each other, and both functions allow calc()-like math inside of them.

For this case, we want to use max():

@supports(padding: max(0px)) {
    .post {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
}
It is important to use @supports to feature-detect min and max, because they are not supported everywhere, and due to CSS’s treatment of invalid variables, to not specify a variable inside your @supports query.

In our example page, in portrait orientation, env(safe-area-inset-left) resolves to 0px, so the max() function resolves to 12px. In landscape, when env(safe-area-inset-left) is larger due to the sensor housing, the max() function will resolve to that size instead, ensuring that the important content within is always visible.

max() with safe area insets
Use max() to combine safe area insets with traditional margins.

Experienced web developers might have previously encountered the “CSS locks” mechanism, commonly used to clamp CSS properties to a particular range of values. Using min() and max() together makes this much easier, and will be very helpful in implementing effective responsive designs in the future.

Feedback and Questions

You can start adopting viewport-fit and safe area insets today, by using Safari in the iPhone X Simulator included with Xcode 9. We’d love to hear how your adoption of all of these features goes, so please feel free to send feedback and questions to web-evangelist@apple.com or @webkit on Twitter, and to file any bugs that you run into on WebKit’s bug tracker.

17 Sep 22:50

Facebook – “Need a break” feature when the user switches...



Facebook – “Need a break” feature when the user switches relationship status. 

08 Aug 02:48

You Snooze, You Lose (and Someone Buys Your Street)

by Phil Yu
Bay Area couple buys private San Francisco street at a city auction -- unbeknownst to residents.


Photo Credit: San Francisco Chronicle
Thanks to a little-noticed auction sale -- and a comedically overlooked unpaid tax bill -- a Bay Area couple are now the proud owners of one of the most exclusive streets in San Francisco. And now the street's super-rich residents might actually have to pay to park on their own private street.

Tina Lam and Michael Cheng won Presidio Terrace for just over $90,000 at a city-run auction. The block-long oval private street, home to 35 multi-million-dollar mansions, was up for sale after the Presidio Homeowners Association failed to pay a $14-a-year property tax for thirty years. The homeowners apparently had no idea, and failed to pay because the tax bills had been going to an accountant's outdated address.

Read more »
20 Jul 19:19

Boost economy with immigration

by Nathan Yau

Want to increase the GDP? Easy. Let more immigrants in. Lena Groeger for ProPublica:

In an analysis for ProPublica, Adam Ozimek and Mark Zandi at Moody’s Analytics, an independent economics firm, estimated that for every 1 percent increase in U.S. population made of immigrants, GDP rises 1.15 percent. So a simple way to get to Trump’s 4 percent GDP bump? Take in about 8 million net immigrants per year. To show you what that really looks like, we’ve charted the effect below. You can see for yourself what might happen to the economy if we increased immigration to the highest rates in history or dropped it to zero – and everything in between.

The interactive in the article lets you pose the what-if with various immigration rates. Give it a try.

Tags: economy, immigration