Webinar Wednesday, May 9, 2018: MySQL Troubleshooting and Performance Optimization with Percona Monitoring and Management (PMM)

Webinar Wednesday, May 9, 2018: MySQL Troubleshooting and Performance Optimization with Percona Monitoring and Management (PMM)

 | May 7, 2018 | 
Posted In: Insight for DBAs, Percona Monitoring and Management, Technical Webinars

MySQL TroubleshootingPlease join Percona’s CEO, Peter Zaitsev as he presents MySQL Troubleshooting and Performance Optimization with PMM on Wednesday, May 9, 2018, at 11:00 AM PDT (UTC-7) / 2:00 PM EDT (UTC-4).

Optimizing MySQL performance and troubleshooting MySQL problems are two of the most critical and challenging tasks for MySQL DBAs. The databases powering your applications must handle heavy traffic loads while remaining responsive and stable so that you can deliver an excellent user experience. Further, DBAs’ bosses expect solutions that are cost-efficient.

In this webinar, Peter discusses how you can optimize and troubleshoot MySQL performance and demonstrate how Percona Monitoring and Management (PMM) enables you to solve these challenges using free and open source software. We will look at specific, common MySQL problems and review the essential components in PMM that allow you to diagnose and resolve them.

Register for the webinar now.

Peter ZaitsevPeter Zaitsev, CEO

Peter Zaitsev co-founded Percona and assumed the role of CEO in 2006. As one of the foremost experts on MySQL strategy and optimization, Peter leveraged both his technical vision and entrepreneurial skills to grow Percona from a two-person shop to one of the most respected open source companies in the business. With over 140 professionals in 30 plus countries, Peter’s venture now serves over 3000 customers – including the “who’s who” of internet giants, large enterprises and many exciting startups. The Inc. 5000 recognized Percona in 2013, 2014, 2015 and 2016. Peter was an early employee at MySQL AB, eventually leading the company’s High-Performance Group. A serial entrepreneur, Peter co-founded his first startup while attending Moscow State University where he majored in Computer Science. Peter is a co-author of High-Performance MySQL: Optimization, Backups, and Replication, one of the most popular books on MySQL performance. Peter frequently speaks as an expert lecturer at MySQL and related conferences, and regularly posts on the Percona Database Performance Blog. He was also tapped as a contributor to Fortune and DZone, and his recent ebook Practical MySQL Performance Optimization is one of percona.com’s most popular downloads.

Peter Zaitsev

Peter managed the High Performance Group within MySQL until 2006, when he founded Percona. Peter has a Master’s Degree in Computer Science and is an expert in database kernels, computer hardware, and application scaling.

via MySQL Performance Blog
Webinar Wednesday, May 9, 2018: MySQL Troubleshooting and Performance Optimization with Percona Monitoring and Management (PMM)

Tell Us Your Disney World Travel Tips

“Everything the light touches is our kingdom.”

This week on Hack Your City, we’re covering a single theme park. Four theme parks in one, for you Trinitarians. We’re talking about Walt Disney World, the Floridian compound encompassing Epcot, Hollywood Studios, Magic Kingdom, and Disney’s Animal Kingdom, and further assorted attractions.

Each Monday on Hack Your City, we ask readers for your best tips on a city: driving tips, restaurant recs, things to do, and any other advice for visitors and locals. Then on Thursday, we present the best comments. We’re working our way around the U.S. and around the globe.

Advertisement

We’ve covered the Disney parks a little, but now we need your hacks for maximizing happiness in the Happiest Place on Earth, so you don’t end up like that couple who accidentally booked shitty motel tickets in The Florida Project. What’s your favorite trick for getting the most out of Disney World?

How do you save money at the park? What are the cheapest ways to fulfill your child’s dreams? What parts of the park experience can you get nearby? Or what do you get if you splurge?

How do you deal with the crowds, beyond just buying your way to the front of the line? What’s the best part of the off-season? What are the underrated parts of the park?

Advertisement

How do you have the most fun as an adult? (Are those secret dance clubs really so secret?) How do you have that adult fun even when you’ve brought your kids?

What secrets can you find if you ask the right person, or walk down the right path? What freebies and upgrades can you earn? What special deals or access can you get for being a teacher, a veteran, or something else?

Some secrets, like the hidden Mickeys, are so famous that they have their own website. What are the best guides and resources to those famous secrets?

Advertisement

Tell us your best tips in the comments (please stop emailing them to us), and we’ll post highlights in a new post on Thursday.


via Lifehacker
Tell Us Your Disney World Travel Tips

’Luke Cage’ season two introduces a powerful new enemy


David Lee/Netflix

Today, Netflix released a trailer for the second season of Marvel’s Luke Cage, the story of a bulletproof man (Mike Colter) who is fighting to save Harlem from forces that want to do the local population harm. The second season premieres on Netflix on June 22nd.

In the trailer, viewers can see that Luke Cage is no longer operating in the shadows; he’s become a hero to the people of Harlem. He attracts the notice of a new villain, who seems to be just as indestructible as Luke. According to the press release, Luke will need to “confront the fine line that separates a hero from a villain.” It seems as though this season will force Luke to test the boundaries of his own principles in order to defeat this new enemy.

The trailer also gives the viewer glimpses of Claire Temple (Rosario Dawson), who seems to be a sort of conscience for Luke in this season. Misty Knight (Simone Missick) is sporting the prosthetic arm that she is famous for in the comics, while Mariah (Alfre Woodard) is clearly up to no good once again. The premiere episode of the second season is directed by Lucy Liu.

via Engadget
’Luke Cage’ season two introduces a powerful new enemy

10 things I’ve learned in 10 years of entrepreneurship with 10-yr-old twins

Peter Chee hiking with his 10-year-old twin sons on a past trip to Zion National Park, Utah. He marked 10 years of entrepreneurship on May 1. (Photo Courtesy Peter Chee)

[Editor’s Note: Peter Chee is founder and CEO of Seattle-based Thinkspace.]

I’ve been reflecting on my journey over the last 10 years of being an entrepreneur with my boys, Max, Sam and Josh, of which Sam and Josh are 10 years old. I’ve been having them reflect back on their 10-year life journey too. Through this journey, I’ve experienced some amazing highs and crazy lows. I’ve made some good choices and had some fantastic experiences that I lean on which remind myself that I can accomplish things I never thought I could. I also see a string of mistakes that I’ve made which still sting with pain like a cut on my foot while getting hit by a wave of salt water at the beach. It’s uncomfortable, but, in a healthy way. 

Put your name on your list

Back in the first year of running the company, I hired Sonya Stoklosa, an executive coach who was a former Olympic Trials athlete. I resonate with someone who has an athlete mindset and applies that to business. One of the most critical questions she asked me was to make a list of the 10 most important people who I care about. After looking at that list, she said to me, why isn’t my name on it? My response was I have to take care of other people; I don’t have time for myself. Her response was if you don’t take care of yourself, how could you take care of others? It was this one question that spawned off a lot of shifts and changes in my life and business. 

Don’t be afraid to fail

I intentionally make sure my kids see me falling down. They have even said to me, “get back up and try again.” Life of being an entrepreneur isn’t a highlight reel of success. I’ve learned that while it’s important to have a lot of grit and push really hard, it’s much more about resilience from failure. It’s about getting up quickly after falling. The most important part of failure is to keep running at it, not away from it. Eventually, if you spend enough time running towards something, it will get a lot less scary and difficult.

Define and defend

Keep intact the things you cherish the most. For me, my non-negotiables are:

  1. I’m showing up for my three boys Max, Sam, and Josh no matter what. When I asked them, “does Dad show up?” their response isn’t going to allow me to win Dad of the Year Awards, but “yes most of the time” is a pretty solid response.
  2. My health. Wake up at 5 a.m. no matter what bad choices I’ve made the night before and start my day with exercise.
  3. Push as hard as I possibly can and recharge with the same level of intensity. The hardest part is once you define it, you have to also defend it ferociously. Do this and it will help make decisions simpler. 

Measure your feelings

While measuring feelings sounds subjective or maybe even impossible it can be done. Start by doing this on the first day of each month and come up with one-word summaries for these things and ask yourself how you were feeling over the last 30 days:

  1. Mentally
  2. Emotionally
  3. Relationally
  4. Physically
  5. Spiritually

Then for each of these things assign a number between minus five (-5) worst it has ever been and plus five (+5) best that it has ever been and where zero is your personal normal. Once you begin to track these things you’ll see trends and from there you can make conscious choices to give energy towards the category that you want to see change. It wasn’t until I had amassed a year of data that I threw this information into a spreadsheet and saw these trends. I also started to reflect back at those past months and ask myself what did I do to make some months so much better than others? 

Why can’t everything be fun?

In this framework, everything has to be fun. There are three categories: Type 1 Fun, which is quick. Type 2 Fun, which is moderate. Type 3 Fun, which is big impact. Here are some examples of my Type 1 Fun: checking email, talking with a new customer, having a glass of wine with a friend and having a good conversation. Type 2 Fun: talking with a mentor that is 10x where you’re at, strategic planning, coming up with a go-to-market strategy, going for a 5-mile run, learning to swim. Type 3 Fun: launching a new location, forming a new partnership with a big company, running a marathon, swimming across Lake Washington, hiking Mailbox Peak.

So for me, it’s simple, I need to spend more time doing Type 2 and 3 Fun. Just remember to define your own list, some of the things on my list could be total torture to another person. Once you start to schedule in these kinds of things into your day and week, protect your schedule and see the impact on how you feel.

Your personal core values

My personal core values became clear to me over this last 10 years. They are:

  1. Adventure
  2. Challenge
  3. Relationships.

In the darkest times of running your company when everything comes into question as to whether or not you’re doing the right thing, take a look at what you’re working on and ask yourself where you’re spending your time. If you’re spending all of your time on things you don’t enjoy, you don’t have to quit your company, you can hire someone who really enjoys doing those things and focus your time on the things that are in alignment with your personal core values. Be the best version of yourself and let that drive the business. Don’t let the circumstances of the business drive you. 

Your identity is not your company

Yes, you’re spending so much time focused on your company and chances are after 10 years, people will associate you with the brand of your company. Through the successes and failures of your company, those things do not define you and if you get to the point where you successfully exit your company, you’re not exiting yourself. If you’re a parent, you’re not defined by your children either and some could say that you care about your company and your children similarly. Yes, you love them with all your heart, but, they do not define you. Do other things that provide you personal accomplishment. For me, I’m a marathoner and an Ironman in-training. These other activities give me confidence, reduce my stress, provide me focus, and allow me to invest in myself.

Pay Yourself

Yes, there are sacrifices that you have to make. Sometimes cash flow is so tight that you fear you might miss payroll. This is always the most stressful and scariest thing that can happen. If you’re bootstrapping, the first thing that happens when cash flow is really tight is you pay your employees and don’t pay yourself. If you’ve raised money and cash flow is tight or you are not hitting your goals, your board or investors may ask you to lay off employees. Either way, you’re in a situation where you’re going to have to make hard decisions. The key thing is to pay yourself. You’re putting everything at risk and setting aside 10 percent profit for that level of risk needs to be ferociously defended. Once you set that aside, you won’t have any regrets, and, the company will learn to adjust itself on the expense side. Leaders in charge of profit and cost centers will innovate in order to survive and eventually thrive.

Hire a coach

The number one reason is accountability. Hire someone who is going to be asking you hard questions, helping you set goals, and holding you accountable. They can provide you an unbiased perspective on what you’re dealing with. If you can’t afford to hire a coach, bring on advisors to your company. These advisors should be people who are 10x where you are at. Set a regular time to meet and ask them to hold you accountable to your goals. These people don’t judge you, they support you, and just want you to succeed. This is a game-changer.

Don’t worry about what other people think

After reflecting and talking with my boys, the things that they said they learned were to not worry about what others think of them and it is not going to be as bad as you think. The thing that they are most proud of is hiking up Angels Landing in Zion National Park, Utah.

via GeekWire
10 things I’ve learned in 10 years of entrepreneurship with 10-yr-old twins

President Trump & Vice President Pence Address the NRA Membership ~ VIDEO

Donald Trump speaks to NRA
Donald Trump speaks to NRA

Dallas Texas – -(Ammoland.com)- President Trump and Vice President Pence each delivered rousing remarks to the National Rifle Association (NRA) Leadership Forum. See them below.

National Rifle Association Institute For Legislative Action (NRA-ILA)

About:
Established in 1975, the Institute for Legislative Action (ILA) is the “lobbying” arm of the National Rifle Association of America. ILA is responsible for preserving the right of all law-abiding individuals in the legislative, political, and legal arenas, to purchase, possess and use firearms for legitimate purposes as guaranteed by the Second Amendment to the U.S. Constitution. Visit: www.nra.org

The post President Trump & Vice President Pence Address the NRA Membership ~ VIDEO appeared first on AmmoLand.com.

via AmmoLand.com
President Trump & Vice President Pence Address the NRA Membership ~ VIDEO

Deadpool 2 Just Released a Music Video From Canadian Queen Celine Dion

Oh my stars, it’s Deadpool and Celine.
Image: Celine Dion VEVO (YouTube)

Holy shit, Deadpool. Every time I think I’m done, you pull me back in. With goddamn Celine Dion this time? The legendary artist has released her first English single in two years… and yes, it’s about Deadpool 2.

The music video for “Ashes” debuted this morning on Good Morning America, complete with a sexy dancing Deadpool and Dion’s signature “up to 11″ pipes. I’ve been spending most of the morning making GIFs of this video, because my joy has reached “I’m not working on anything else”-level proportions.

What is happening and why can’t I stop smiling
Image: Celine Dion VEVO (YouTube)

Honestly, there’s not much else to say. Just watch the damn thing. Actually, I’ve got one more detail—the song is surprisingly good! It’ll be in my head for most of the day, I guarantee it.

Deadpool 2 comes out May 18.

via Gizmodo
Deadpool 2 Just Released a Music Video From Canadian Queen Celine Dion

Quarantining Bayh-Dole

Quarantining Bayh-Dole

by Dennis Crouch

National Institute of Standards and Technology (NIST) (a branch of the Department of Commerce) has announced a new initiative to “improve federal technology transfer” along with a Request for Information (RFI) published in the Federal Register.  The government is looking to “gather information about the current state of Federal technology transfer and the public’s ability to engage with Federal laboratories and access federally funded R&D through collaborations, licensing, and other mechanisms.”

The agency is broadly seeking for comments on topics including:

  1. Best practices in federal technology transfer (what are we doing right . . . and wrong);
  2. Improving efficiency and reducing regulatory burdens in order to attract private sector investment in later-stage R&D, commercialization, and advanced manufacturing;
  3. Ideas for new partnership models with the private sector, academia, other Federal agencies.
  4. Metrics and methods for evaluating the ROI outcomes and impacts arising from Federal R&D investment; and
  5. Mechanisms for significantly increasing technology transfer outcomes from the Federal sector, universities, and research organizations.

Looming large in the background of current Federal Policy is the the Bayh-Dole Act that allows universities and companies to privately patent the results of federally funded research.  In two-years, Bayh-Dole will have its 40th Anniversary — thus the “quarantine” title.

Notes:

 

via Patent Law Blog (Patently-O)
Quarantining Bayh-Dole

A Guide To The State Of Print Stylesheets In 2018

A Guide To The State Of Print Stylesheets In 2018

Rachel Andrew



Today, I’d like to return to a subject that has already been covered in Smashing Magazine in the past — the topic of the print stylesheet. In this case, I am talking about printing pages directly from the browser. It’s an experience that can lead to frustration with enormous images (and even advertising) being printed out. Just sometimes, however, it adds a little bit of delight when a nicely optimized page comes out of the printer using a minimum of ink and paper and ensuring that everything is easy to read.

This article will explore how we can best create that second experience. We will take a look at how we should include print styles in our web pages, and look at the specifications that really come into their own once printing. We’ll find out about the state of browser support, and how to best test our print styles. I’ll then give you some pointers as to what to do when a print stylesheet isn’t enough for your printing needs.

Key Places For Print Support

If you still have not implemented any print styles on your site, there are a few key places where a solid print experience will be helpful to your users. For example, many users will want to print a transaction confirmation page after making a purchase or booking even if you will send details via email.

Any information that your visitor might want to use when away from their computer is also a good candidate for a print stylesheet. The most common thing that I print are recipes. I could load them up on my iPad but it is often more convenient to simply print the recipe to pop onto the fridge door while I cook. Other such examples might be directions or travel information. When traveling abroad and not always having access to data these printouts can be invaluable.

Reference materials of any sort are also often printed. For many people, being able to make notes on paper copies is the way they best learn. Again, it means the information is accessible in an offline format. It is easy for us to wonder why people want to print web pages, however, our job is often to make content accessible — in the best format for our visitors. If that best format is printed to paper, then who are we to argue?

Why Would This Page Be Printed?

A good question to ask when deciding on the content to include or hide in the print stylesheet is, “Why is the user printing this page?” Well, maybe there’s a recipe they’d like to follow while cooking in the kitchen or take along with them when shopping to buy ingredients. Or they’d like to print out a confirmation page after purchasing a ticket as proof of booking. Or perhaps they’d like a receipt or invoice to be printed (or printed to PDF) in order to store it in the accounts either as paper or electronically.

Considering the use of the printed document can help you to produce a print version of your content that is most useful in the context in which the user is in when referring to that print-out.

Workflow

Once we have decided to include print styles in our CSS, we need to add them to our workflow to ensure that when we make changes to the layout we also include those changes in the print version.

Adding Print Styles To A Page

To enable a “print stylesheet” what we are doing is telling the browser what these CSS rules are for when the document is printed. One method of doing this is to link an additional stylesheet by using the <link> element.

<link media="print" href="print.css">

This method does keep your print styles separate from everything else which you might consider to be tidier, however, that has downsides.

The linked stylesheet creates an additional request to the server. In addition, that nice, neat separation of print styles from other styles can have a downside. While you may take care to update the separate styles before going live, the stylesheet may find itself suffering due to being out of sight and therefore out of mind — ultimately becoming useless as features are added to the site but not reflected in the print styles.

The alternate method for including print styles is to use @media in the same way that you includes CSS for certain breakpoints in your responsive design. This method keeps all of the CSS together for a feature. Styles for narrow to wide breakpoints, and styles for print. Alongside Feature Queries with @supports, this encourages a way of development that ensures that all of the CSS for a design feature is kept and maintained together.

@media print {
    
}

Overwriting Screen CSS Or Creating Separate Rules

Much of the time you are likely to find that the CSS you use for the screen display works for print with a few small adjustments. Therefore you only need to write CSS for print, for changes to that basic CSS. You might overwrite a font size, or family, yet leave other elements in the CSS alone.

If you really want to have completely separate styles for print and start with a blank slate then you will need to wrap the rest of your site styles in a Media Query with the screen keyword.

@media screen {
    
}

On that note, if you are using Media Queries for your Responsive Design, then you may have written them for screen.

@media screen and (min-width: 500px) {
    
}

If you want these styles to be used when printing, then you should remove the screen keyword. In practice, however, I often find that if I work “mobile first” the single column mobile layout is a really good starting point for my print layout. By having the media queries that bring in the more complex layouts for screen only, I have far less overwriting of styles to do for print.

Add Your Print Styles To Your Pattern Libraries And Style Guides

To help ensure that your print styles are seen as an integral part of the site design, add them to your style guide or pattern library for the site if you have one. That way there is always a reminder that the print styles exist, and that any new pattern created will need to have an equivalent print version. In this way, you are giving the print styles visibility as a first-class citizen of your design system.

Basics Of CSS For Print

When it comes to creating the CSS for print, there are three things you are likely to find yourself doing. You will want to hide, and not display content which is irrelevant when printed. You may also want to add content to make a print version more useful. You might also want to adjust fonts or other elements of your page to optimize them for print. Let’s take a look at these techniques.

Hiding Content

In CSS the method to hide content and also prevent generation of boxes is to use the display property with a value of none.

.box {
  display: none;
}

Using display: none will collapse the element and all of its child elements. Therefore, if you have an image gallery marked up as a list, all you would need to do to hide this when printed is to set display: none on the ul.

Things that you might want to hide are images which would be unnecessary when printed, navigation, advertising panels and areas of the page which display links to related content and so on. Referring back to why a user might print the page can help you to decide what to remove.

Inserting Content

There might be some content that makes sense to display when the page is printed. You could have some content set to display: none in a screen stylesheet and show it in your print stylesheet. Additionally, however, you can use CSS to expose content not normally output to the screen. A good example of this would be the URL of a link in the document. In your screen document, a link would normally show the link text which can then be clicked to visit that new page or external website. When printed links cannot be followed, however, it might be useful if the reader could see the URL in case they wished to visit the link at a later time.

We achieve this by using CSS Generated Content. Generated Content gives you a way to insert content into your document via CSS. When printing, this becomes very useful.

You can insert a simple text string into your document. The next example targets the element with a class of wrapper and inserts before it the string, “Please see www.mysite.com for the latest version of this information.”

.wrapper::after {
  content: "Please see www.mysite.com for the latest version of this information.";
}

You can insert things that already exist in the document however, an example would be the content of the link href. We add Generated Content after each instance of a with an attribute of href and the content we insert is the value of the href attribute – which will be the link.

a[href]:after {
  content: " (" attr(href) ")";
}

You could use the newer CSS :not selector to exclude internal links if you wished.

a[href^="http"]:not([href*="example.com"]):after {
  content: " (" attr(href) ")";
}

There are some other useful tips like this in the article, “I Totally Forgot About Print Stylesheets”, written by Manuel Matuzovic.

Advanced Print Styling

If your printed version fits neatly onto one page then you should be able to create a print stylesheet relatively simply by using the techniques of the last section. However, once you have something which prints onto multiple pages (and particularly if it contains elements such as tables or figures), you may find that items break onto new pages in a suboptimal manner. You may also want to control things about the page itself, e.g. changing the margin size.

CSS does have a way to do these things, however, as we will see, browser support is patchy.

Paged Media

The CSS Paged Media Specification opens with the following description of its role.

“This CSS module specifies how pages are generated and laid out to hold fragmented content in a paged presentation. It adds functionality for controlling page margins, page size and orientation, and headers and footers, and extends generated content to enable page numbering and running headers/footers.”

The screen is continuous media; if there is more content, we scroll to see it. There is no concept of it being broken up into individual pages. As soon as we are printing we output to a fixed size page, described in the specification as paged media. The Paged Media specification doesn’t deal with how content is fragmented between pages, we will get to that later. Instead, it looks at the features of the pages themselves.

We need a way to target an individual page, and we do this by using the @page rule. This is used much like a regular selector, in that we target @page and then write CSS to be used by the page. A simple example would be to change the margin on all of the pages created when you print your document.

@page {
  margin: 20px;
}

You can target specific pages with :left and :right spread pseudo-class selectors. The first page can be targeted with the :first pseudo-class selector and blank pages caused by page breaks can be selected with :blank. For example, to set a top margin only on the first page:

@page :first {
  margin-top: 250pt;
}

To set a larger margin on the right side of a left-hand page and the left side of a right-hand page:

@page :left {
  margin-right: 200pt;
}
    
@page :right {
  margin-left: 200pt;
}

The specification defines being able to insert content into the margins created, however, no browser appears to support this feature. I describe this in my article about creating stylesheets for use with print-specific user agents, Designing For Print With CSS.

CSS Fragmentation

Where the Paged Media module deals with the page boxes themselves, the CSS Fragmentation Module details how content breaks between fragmentainers. A fragmentainer (or fragment container) is a container which contains a portion of a fragmented flow. This is a flow which, when it gets to a point where it would overflow, breaks into a new container.

The contexts in which you will encounter fragmentation currently are in paged media, therefore when printing, and also when using Multiple-column layout and your content breaks between column boxes. The Fragmentation specification defines various rules for breaking, CSS properties that give you some control over how content breaks into new fragments, in these contexts. It also defines how content breaks in the CSS Regions specification, although this isn’t something usable cross-browser right now.

And, speaking of browsers, fragmentation is a bit of a mess in terms of support at the moment. The browser compatibility tables for each property on MDN seem to be accurate as to support, however testing use of these properties carefully will be required.

Older Properties From CSS2

In addition to the break-* properties from CSS Fragmentation Level 3, we have page-break-* properties which came from CSS2. In spec terms, these have been superseded by the newer break-* properties, as these are more generic and can be used in the different contexts breaking happens. There isn’t much difference between a page and a multicol break. However, in terms of browser support, there is better browser support for the older properties. This means you may well need to use those at the current time to control breaking. Browsers that implement the newer properties are to alias the older ones rather than drop them.

In the examples that follow, I shall show both the new property and the old one where it exists.

break-before & break-after

These properties deal with breaks between boxes, and accept the following values, with the initial value being auto. The final four values do not apply to paged media, instead being for multicol and regions.

  • auto
  • avoid
  • avoid-page
  • page
  • left
  • right
  • recto
  • verso
  • avoid-column
  • column
  • avoid-region
  • region

The older properties of page-break-before and page-break-after accept a smaller range of values.

  • auto
  • always
  • avoid
  • left
  • right
  • inherit

To always cause a page break before an h2 element, you would use the following:

h2 {
  break-before: page;
}

To avoid a paragraph being detached from the heading immediately preceding it:

h2, h3 {
  break-after: avoid-page;
}

The older page-break-* property to always cause a page break before an h2:

h2 {
  page-break-before: always;
}

To avoid a paragraph being detached from the heading immediately preceding it:

h2, h3{
  page-break-after: avoid;
}

On MDN find information and usage examples for the properties:

break-inside

This property controls breaks inside boxes and accepts the values:

  • auto
  • avoid
  • avoid-page
  • avoid-column
  • avoid-region

As with the previous two properties, there is an aliased page-break-inside from CSS2, which accepts the values:

  • auto
  • avoid
  • inherit

For example, perhaps you have a figure or a table and you don’t want a half of it to end up on one page and the other half on another page.

figure {
  break-inside: avoid;
}

And when using the older property:

figure {
  page-break-inside: avoid;
}

On MDN:

Orphans And Widows

The Fragmentation specification also defines the properties orphans and widows. The orphans property defines how many lines can be left at the bottom of the first page when content such as a paragraph is broken between two pages. The widows property defines how many lines may be left at the top of the second page.

Therefore, in order to prevent ending up with a single line at the end of a page and a single line at the top the next page, you can use the following:

p {
  orphans: 2;
  widows: 2;
}

The widows and orphans properties are well supported (the missing browser implementation being Firefox).

On MDN:

box-decoration-break

The final property defined in the Fragmentation module is box-decoration-break. This property deals with whether borders, margins, and padding break or wrap the content. The values it accepts are:

  • slice
  • clone

For example, if my content area has a 10-pixel grey border and I print the content, then the default way that this will print is that the border will continue onto each page, however, it will only wrap at the end of the content. So we get a break before going to the next page and continuing.


The border does not wrap each page and so breaks between pages
The border does not wrap each page and so breaks between pages

If I use box-decoration-break: clone, the border and any padding and margin will complete on each page, thus giving each page a grey border.


The border wraps each individual page
The border wraps each individual page

Currently, this only works for Paged Media in Firefox, and you can find out more about box-decoration-break on MDN.

Browser Support

As already mentioned, browser support is patchy for Paged Media and Fragmentation. Where Fragmentation is concerned, an additional issue is that breaking has to be specified and implemented for each layout method. If you were hoping to use Flexbox or CSS Grid in print stylesheets, you will probably be disappointed. You can check out the Chrome bugs for Flexbox and for Grid.

The best suggestion I can give right now is to keep your print stylesheets reasonably simple. Add fragmentation properties — including both the old page-break-* properties as well as the new properties. However, accept that these may well not work in all browsers. And, if you find lack of browser support frustrating, raise these issues with browsers or vote for already raised issues. Fragmentation, in particular, should be treated as a suggestion rather than a command, even where it is supported. It would be possible to be so specific about where and when you want things to break that it is almost impossible to lay out the pages. You should assume that sometimes you may get suboptimal breaking.

Testing Print Stylesheets

Testing print stylesheets can be something of a bore, typically requiring using print preview or printing to a PDF repeatedly. However, browser DevTools have made this a little easier for us. Both Chrome and Firefox have a way to view the print styles only.

Firefox

Open the Developer Toolbar then type media emulate print at the prompt.


Typing media emulate print
Emulating print styles in Firefox

Chrome

Open DevTools, click on the three dots icon and then select “More Tools” and “Rendering”. You can then select print under Emulate CSS Media.


Chrome DevTools emulate print media
Emulating print styles in Chrome

This will only be helpful in testing changes to the CSS layout, hidden or generated content. It can’t help you with fragmentation — you will need to print or print to PDF for that. However, it will save you a few round trips to the printer and can help you check as you develop new parts of the site that you are still hiding and showing the correct things.

What To Do When A Print Stylesheet Isn’t Enough

In an ideal world, browsers would have implemented more of the Paged Media specification when printing direct from the browser, and fragmentation would be more thoroughly implemented in a consistent way. It is certainly worth raising the bugs that you find when printing from the browser with the browsers concerned. If we don’t request these things are fixed, they will remain low priority to be fixed.

If you do need to have a high level of print support and want to use CSS, then currently you would need to use a print-specific User Agent, such as Prince. I detail how you can use CSS to format books when outputting to Prince in my article “Designing For Print With CSS.”

Prince is also available to install on your server in order to generate nicely printed documents using CSS on the web, however, it comes at a high price. An alternative is a server like DocRaptor who offer an API on top of the Prince rendering engine.

There are open-source HTML- and CSS-to-PDF generators such as wkhtmltopdf, but most use browser rendering engines to create the print output and therefore have the same limitations as browsers when it comes to implementing the Paged Media and Fragmentation specifications. An exception is WeasyPrint which seems to have its own implementation and supports slightly different features, although is not in any way as full-featured as something like Prince.

You will find more information about user agents for print on the print-css.rocks site.

Other Resources

Due to the fact that printing from CSS has really moved on very little in the past few years, many older resources on Smashing Magazine and elsewhere are still valid. Some additional tips and tricks can be found in the following resources. If you have discovered a useful print workflow or technical tip, then add it to the comments below.

Smashing Editorial
(il)

via Smashing Magazine
A Guide To The State Of Print Stylesheets In 2018

Google launches Cloud Composer, a new workflow automation tool for developers

Google Cloud is launching the first public beta of Cloud Composer today, a new workflow automation tool for developers that’s based on the Apache Airflow project.

Typically, IT teams build their own automated workflow as needed, but the result of that is often a mess of different tools and Bash scripts that don’t always work together. Airflow and Cloud Composer allow teams to standardize on a single way of building and orchestrating workflows.

Google notes that its new tool, which uses Python as its default language, will allow teams to build workflows across on-premises tools and across multiple clouds and that the open source nature of the project will ensure that developers can take their workflows and use them across platforms. While the service is deeply integrated with the Google Cloud Platform, the team stressed that there is no lock-in.

“In building Cloud Composer, we wanted to combine the strengths of Google Cloud Platform with Airflow,” the Cloud Composer team writes in today’s announcement. “We set out to build a service that offers the best of Airflow without the overhead of installing and managing Airflow yourself. As a result, you spend less time on low-value work, such as getting Airflow installed, and more time on what matters: your workflows.”

In Airflow — and by extension in Cloud Composer, too — the different tasks and their expected outcomes (as well as what to do when things go wrong), are defined in a so-called Directed Acyclic Graph. These are standard Python files that define the workflow down to its details. You can find the full documentation here.

Google notes that it is actively participating in the Airflow community, too, and that it has contributed a number of pull requests already.


via TechCrunch
Google launches Cloud Composer, a new workflow automation tool for developers