Uber System Design

Featured Imgs 23

The popular implementations of the ride-hailing service are the following:

  • Uber
  • Lyft
  • Curb
  • Grab

Requirements

  • The rider can see all the available nearby drivers
  • The driver can accept a trip requested by the rider
  • The current location of the rider and driver should be continuously published on the trip confirmation

Data Storage

Database Schema

Chris’ Corner: Resizing, Conditionals, and Initials

Category Image 052

Ahmad Shadeed recently wrote:

I like to think of CSS as a conditional design language.

It totally is! We tend to think of stuff like @media queries as the conditional part:

@media (max-width: 550px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

That’s true, and new stuff like container and style queries are giving us more “conditional” stuff to work with. But it might be better to think of literally everything in CSS as conditional. Every selector you can write is conditional in some way. Just a sector like aside is conditional — it says, only style elements that match that selector. To grok CSS, you are grokking a massive set of conditions. As Ahmad indicated:

.alert p:empty {
  display: none;
}

This is a big logical if statement. IF the element is a paragraph. IF that paragraph is empty. IF it is a child of another element with a class of alert. All those IFs have to be true for the styles to apply.


You could take conditional CSS another step up though, meaning conditions by which to load the entire .css file at all.

Vadim Makeev wrote up some interesting experiments around all this. Say you do:

<link rel="stylesheet" href="style.css" media="print">

The browser is smart enough not to load that CSS file at all (unless you’re printing, natch).

You can also do this:

<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="mobile.css"
  media="(max-width: 767px)"
>

Butttttt, the browser will actually load both of those files regardless if the media matches or not. So no obvious immediate benefit, but that’s where Vadim’s research comes in. While all the files with non-matching media (queries) still load, the browser is smart enough to make the non-matching stylesheets load with a lower priority. At least in Chrome and Firefox — Safari has some bug that makes the priority levels not provide the perf benefits.

Pretty cool I think. Doing this kind of work by hand feels onerous though, I’d love to see build processes deal with it automatically.


Ya know I was scared for Mozilla & Firefox for a while. Those big layoffs in 2020 included many browser engine engineers and it seemed like it would be hard to continue to be a viable browser engine alternative without a strong team there. But I was essentially wrong. Since then they’ve shipped plenty of important web platform features at a decent pace, including the ever-important Container Queries and new color formats. Putting MDN on GitHub happened after the layoffs too and that seems like a massive thing to get shipped.

Last year WIRED asked Is Firefox OK? There wasn’t really an answer there, but some good information. We know Google provides the bulk of their income, but they showed really strong growth with their own products and services, saying 14% of all revenue was that back in 2021. They’ve clearly been trying new stuff to increase that, so things look on the right track to me.

I like to see little stories like this: Mozilla fixed an 18-year old CSS bug in the Firefox browser. So they aren’t just playing catch up, they are getting details right along the way too. Better late than never. This one was a weird bug with ::first-letter, the real ticket for doing drop caps:

They said it was kind of a bandaid for now but still cool. Speaking of drop caps though… ::first-letter was always fraught for this purpose. Much better would be to support initial-letter. C’mon Firefox, you can do it!


Michelle Barker on Resizing with CSS:

One drawback is the resize control is only positioned in the bottom right corner of the element, and it’s not possible to style it. It would be nice to have this customiseable ability, and increase the area of the resize control.

Yes!

That’s literally my opening thing in Things CSS Could Still Use Heading Into 2023. Just imagine the CodePen editors. So many things resize, and the ability to do that in HTML and CSS alone would be super sweet. But probably with JavaScript callbacks so we can do stuff like save/persist what has changed in the UI.

And ya know, that makes me think about how we only just got a scrollend event in JavaScript, maybe we should get a resizeend event too.

Hierarchy in MDM: What and Why

Featured Imgs 23

What Is Hierarchy?

In master data management, hierarchy management is an essential component. It allows a comprehensive view of different domains within an organization. It links the relationship among customers, suppliers, products, locations, and other entities within the business. 

Hierarchy Used in Different Master Data Domains

Hierarchy in MDM is used in several domains, such as party master data, location master data, and product master data. Party master data includes the company, business contacts (customers, suppliers, and related business partners), and individuals (employees, customers, and contractors).  It deals with customers, providers, and other business entities. The accounts are settled in the department, legal representatives, and parent organization sequence at the national level; and then at the global level. 

Location master data occupies the external hierarchies around the globe ranging from continents to the down level to streets and buildings. In contrast, internal hierarchies include geographies such as sales districts and different regions in the organization. Product master data is related to external and internal products. External products may be UNSPSC, HS, ETIM, etc. Contrarily internal products are linked to reporting, purchasing, and sales of products, etc.

Weebly Tutorial: How to Use Weebly to Set Up a Website

Category Image 041
Weebly TutorialWeebly is a popular website builder and is highly rated amongst entrepreneurs and small business owners that want to create their own website or online store. The tool is generally considered very easy to use. However, if you’re new to it, you might be wondering what the best way to get started is. In this Weebly tutorial, we will walk through all the steps required to set up a new Weebly website and show you a few things you should consider before launching it.

How To Use CSS To Maintain Aspect Ratio For Responsive Design

Category Image 052

Maintaining the Aspect ratio of a div is a common requirement when creating responsive web designs. In this article, we’ll explore how to use CSS to maintain the Aspect ratio of a div as the window’s width changes.

To achieve this, we’ll use the padding hack. The padding hack is a technique that uses a percentage value for padding-top or padding-bottom to maintain the Aspect ratio of an element. The percentage value is calculated based on the width of the parent element. As the width of the parent element changes, the padding value will adjust to maintain the Aspect ratio of the child element.

Your Web Designer Toolbox
Unlimited Downloads: 500,000+ Web Templates, Icon Sets, Themes & Design Assets


 

Let’s start by creating a div element with a background color.

<div class="aspect-ratio"></div>

<style>
  .aspect-ratio {
    background-color: #ccc;
  }
</style>

To maintain the Aspect ratio of this div, we’ll set its padding-top to a percentage value. The percentage value will be calculated based on the desired Aspect ratio of the div. For example, if we want the Aspect ratio to be 16:9, we’ll set the padding-top to 56.25% (9/16 * 100).

.aspect-ratio {
  background-color: #ccc;
  padding-top: 56.25%;
}

Now, as the width of the parent element changes, the padding value will adjust as desired.

Here’s an example that shows how to use the padding hack on a div with a background image.

<div class="aspect-ratio" style="background-image: url('image.jpg')"></div>

<style>
  .aspect-ratio {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
  }
  
  .aspect-ratio:before {
    content: "";
    display: block;
    padding-top: 56.25%;
  }
  
  .aspect-ratio > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
</style>

In this example, we are again using the padding hack, and we’re also using a pseudo-element (:before) to create the padding. We’re setting the position of the parent element to relative and the position of the child element to absolute to position the child element inside the parent element. We’re also setting the width and height of the child element to 100% to fill the parent element.

In conclusion, the padding hack is a simple and effective technique for maintaining the Aspect ratio of a div as the window’s width changes. By using a percentage value for padding-top or padding-bottom, we can calculate the padding value based on the desired Aspect ratio of the div. This technique is widely used in responsive web design and can be used to create a variety of layouts and designs. Be sure to check out our library of CSS articles and tutorials while you’re here!