3591 stories
·
2 followers

I Will Fucking Piledrive You If You Mention AI Again

1 Share
Read the whole story
emrox
2 hours ago
reply
Hamburg, Germany
Share this story
Delete

htmx ~ htmx 2.0.0 has been released!

1 Share

htmx 2.0.0 Release

I’m very happy to announce the release of htmx 2.0. This release ends support for Internet Explorer and tightens up some defaults, but does not change most of the core functionality or the core API of the library.

Note that we are not marking 2.0 as latest in NPM because we do not want to force-upgrade users who are relying on non-versioned CDN URLs for htmx. Instead, 1.x will remain latest and the 2.0 line will remain next until Jan 1, 2025. The website, however, will reference 2.0.

Major Changes

  • All extensions have been moved out of the core repository to their own repo and website: https://extensions.htmx.org. They are now all versioned individually and can be developed outside of the normal (slow) htmx release cadence.
    • Most 1.x extensions will work with 2.x, however the SSE extension did have a break and must be upgraded.
    • The older extensions remain in the /dist/ext directory so as to not break the URLs of CDNs like unpkg, but please move to the new extension URLs going forward
  • We removed the deprecated hx-sse and hx-ws attributes in favor of the extensions, which were available and recommended in 1.x.
  • HTTP DELETE requests now use parameters, rather than form encoded bodies, for their payload (This is in accordance w/ the spec.)
  • We now provide specific files in /dist for the various JavaScript module styles:
    • ESM Modules: /dist/htmx.esm.js
    • UMD Modules: /dist/htmx.umd.js
    • AMD Modules: /dist/htmx.amd.js
    • The /dist/htmx.js file continues to be browser-loadable
  • The hx-on attribute, with its special syntax, has been removed in favor of the less-hacky hx-on: syntax.

Minor Changes

  • We made some default changes:
    • htmx.config.scrollBehavior was changed to 'instant' from 'smooth'
    • As mentioned previously, DELETE requests now use query parameters, rather than a form-encoded body. This can be reverted by setting htmx.methodsThatUseUrlParams to the value ['get'],
    • htmx.config.selfRequestsOnly now defaults to true rather than false

Features

Not much, really:

  • The selectAndSwap() internal API method was replaced with the public (and much better) swap() method
  • Web Component support has been improved dramatically
  • And the biggest feature of this release: the website now supports dark mode! (Thanks @pokonski!)

A complete upgrade guide can be found here:

htmx 1.x -> 2.x Migration Guide

If you require IE compatibility, the 1.x will continue to be supported for the foreseeable future.

Installing

htmx 2.0 can be installed via a package manager referencing version 2.0.0, or can be linked via a CDN:

<script src="https://unpkg.com/htmx.org@2.0.0/dist/htmx.min.js"></script>

or Downloaded

Read the whole story
emrox
1 day ago
reply
Hamburg, Germany
Share this story
Delete

Learn Grid Now, Container Queries Can Wait

1 Share

Chris Coyier wrote about this recently over at Frontend Masters. As he (and several comments) mention, grid and flexbox make layout more responsive without the need for queries. That’s true! But looking at the numbers, I think we’re asking the wrong question.

Learn CSS layout in-depth:

CSS has a number of useful layout models with different strengths. Join us for a Cascade Layouts Workshop, June 24-26! We’ll cover everything from normal flow to flexbox, grid, and container queries – with clear advice on when to use the different tools. Register now!

Container (size) queries shipped in Firefox on February 14, 2023 – the last major browser to ship the feature. Chrome/Edge and Safari shipped a few months earlier, in the fall of 2022. CanIUse lists size queries support in 93.49% of all tracked browsers, with a Baseline status of Newly Available.

In contrast, Safari shipped CSS grid on March 27, 2017 – and Edge un-prefixed the feature on October 17 that same year. CanIUse lists grid support in 99.39% of all tracked browsers, with a Baseline status of Widely Available.

These are the two ‘stages’ of Baseline support, as described on Google’s web.dev:

  • Newly available: The feature becomes supported by all of the core browsers, and is therefore interoperable.
  • Widely available: 30 months has passed since the newly interoperable date. The feature can be used by most sites without worrying about support.

Even in single-digits, 6% of the web is still a big difference in support.

Firefox was the first to support flexbox behind a prefix, and the last to un-prefix the feature on March 18, 2014. CanIUse shows flexbox support in 99.9% of all tracked browsers. Solidly in the wide support category for Baseline, but only a fraction more than grid support.

Chris links the Chrome usage counters for container queries. I’m warned these numbers are extremely unreliable – easily triggered by feature checks (e.g. Modernizr), unused code in third-party libraries, or popular outliers skewing the data – so take this with truckloads of salt. Here’s what I see:

The State of CSS survey attempts to measure how many web authors are using a feature. This is also suspect, but 26.7% of 2023 respondents ‘have used’ container queries). They didn’t have questions about grid and flexbox.

With popular tools like Bootstrap shipping flexbox-based grid systems, it’s not surprising to see it highly represented in the Chrome use counter. Maybe this data is meaningless. But anecdotally, it does seem like most developers are using flexbox, a few are also using grid, and everyone still has container queries on their to-do list once it has better support.

Container queries are basically brand new. But what’s going on with grids?

The CanIUse defaults are broken:

By default, CanIUse will show you % of all users, which is a very misleading number. Since nearly 3% of browsers are untracked, those support numbers will never go over 97% for new features. I recommend opening the CanIUse default display settings, and selecting All tracked users. You might also want to apply the ‘filtered’ view, to see only browsers with more than 0.5% usage by default.

As close observers of CSS we often overestimate how long these features have been around. Especially with newer features shipping every few months. Our scale is off!

You’re still talking about container queries?! That was before color mixing and selector nesting, last year! Try to keep up! If you’re not learning view transitions with anchor positions now, you’ll be left behind!

I get it. I’m in the CSS Working Group, regularly discussing features that won’t even become newly available for another year or three. At OddBird, we often work on internal tools for clients – building from scratch, with little need for legacy support.

I’ve been thinking about (and playing with) container queries for much longer than the baseline wide support 30 months. I wrote the specification, and started building demos in January 2021 (this demo is broken, since the syntax changed several times). But actual browser support is barely over half-way there – reaching 16 months next week.

This is still a very new feature, despite our hype cycles moving on.

Large sites (and core features) are slow to change

Copy permalink to “Large sites (and core features) are slow to change”

Many developers are working in a context with much more conservative legacy support policies – often waiting for ‘full’ support of a new feature before they even consider using it in production.

In conversations, I especially hear concerns about browsers like iOS Safari that update more slowly, sometimes requiring a much heavier OS update. Safari on Mac may update in monthly-ish cycles, but users with an old phone are more often out-of-date.

Big sites are container ships that will get stuck in the Suez Canal during high winds, or decimate the Francis Scott Key bridge when there’s a power issue. These ships are not easy to maneuver. Sometimes they are maintaining essential resources for a long tail of users on older devices – sometimes they are weighed down by the sheer scale of their organization. Either way, it takes some time to change course.

But it’s not just the sites that are difficult to move. Developers can start sprinkling text-wrap: balance on headings with a 5-minute pull request, no matter how large the project. But Layout Systems are core features, and often rely on third-party tooling. It’s one thing to install new light fixtures, it’s another thing to replace the entire hull of a ship. Even with a smaller team, a smaller project, and a lighter browser-support matrix – it doesn’t make sense to re-write your code base or design system every time a new feature comes out.

We started phasing out Susy (our light-weight grid system) on OddBird projects in 2015. By 2017, we were recommending others do the same, and we officially deprecated the project on Jul 14, 2020. Four years later, OddBird.net/susy still has the highest traffic of anything on our site, and the susy package gets nearly 19k weekly downloads on npm.

There’s no rush to rip out all your media queries, and replace them with containers. You’ll be fine waiting for widely available support and your next scheduled re-factor.

But if you’re still avoiding grid – whatever your reasons – you are, in fact, missing out. CSS grid is one of the best features in CSS, and one of the biggest time-savers on every site we build.

I can imagine it’s hard to re-write a system built on flexbox. Flexbox is a great feature, and part of the web platform. What more do you need?

But flexbox is designed for content-out distribution, not system-wide page layouts. Using flexbox alone is like only using inline text, without paragraphs, divs, and other block elements. You’re using half the system, and it’s the more complicated half to manage.

At some point people looked at grid and thought “that looks complicated” – then spent nearly a decade over-complicating flexbox to compensate. People still rely on third-party grid systems like Bootstrap, because flexbox needs to be coerced into doing this job.

No! Stop. It’s time to learn grid. Right now. You might not think you need it, but you do. Set down container queries, and go learn grid.

If you want to learn more, check out our workshop below.

Read the whole story
emrox
2 days ago
reply
Hamburg, Germany
Share this story
Delete

If English was written like Chinese

1 Share

If English was written like Chinese


Also see the Belorussian translation provided by Fatcow.

The English spelling system is such a pain, we'd might as well switch to hanzi-- Chinese characters. How should we go about it?

Japanese style

One way would be to use hanzi directly, asthe Japanese do. For instance, we'd write "work" as , and "ruler" as . Chinese and Japanese borrowings could be written using the original hanzi, e.g. "gung-ho" would be , and "tycoon" as .

You can already see that this is going to be tricky. We've just given two readings, for instance-- /wrk/ and /gûng/-- and two as well-- /rulr/ and /kun/.

Proper names will be a problem as well. Again, Chinese, Japanese, and Korean names already have hanzi forms-- e.g. for the name of the bodaciously cute singer Faye Wong-- but for English names we'd have no better recourse than to spell things out using the nearest Chinese syllables. For instance, Winston Churchill would be represented by hanzi that would be transliterated Wensuteng Chuerqilu.

Chinese style

Maybe there's a better approach. Instead of using hanzi directly, let's invent a new system-- we'll call it yingzi, "English characters"-- that would work for English exactly as hanzi works for Chinese.

The basic principle will be, one yingzi for a syllable with a particular meaning. So two, to, and too will each have their own yingzi. (If we were creating a syllabary, by contrast, we'd write all three with the same symbol, the one for /tu/.)

Does that mean we need a completely separate symbol for each of the thousands of possible English syllables? Not at all. We can simplify the task enormously with one more principle: syllables that rhyme can have yingzi that are variations on a theme.

Little pictures

You've been reading for half a page and are probably wondering why I haven't yet talked about pictograms. When do we get to draw little pictures?

Well, now's the time. Let's draw pictures. For instance:


horse

mount

king

man

child

bug

sun

moon

tree
When the pictures are abstract we can call them "ideograms", but they still represent particular English morphemes: Some of our pictures will be kind of clever. For instance, woods repeats the yingzi for tree, while east is a little picture of the sun rising through the trees. guilt is a picture of a man inside an enclosure.

Let's not go crazy, however. We only need a thousand or so, and we'll restrict ourselves to fairly simple, one-syllable words. We'll derive the vast majority of our yingzi from this basic stock of pictures.

Phonetic classes

Basically each simple yingzi will be the basis for an open-ended set of yingzi, used for a set of rhyming syllables. For instance, the king character will generate the family king, thing, sing, sling, sting, shing(le).

It would be awfully confusing to use for all of these. Instead we'll use it only for king, which will be the phonetic for this set, and add little signs called radicals to distinguish the rest. Examples:

When we add a radical, we scrunch up the yingzi so the whole thing still fits into a square. All characters, however complex, fit into the same size box.

"Rhyming" isn't quite accurate. We don't want each family of words to get too large; so we'll restrict a single family to either voiced or unvoiced initial consonants.

So, bring, ring, Bing, wing, zing will form a separate family of yingzi, based on the character wing.

Overlaps and secondary derivations

The yingzi formed from a single phonetic will all rhyme; but not all syllables that rhyme will necessarily have the same yingzi. This is largely because we started with a set of pictograms chosen for their pictorial rather than phonetic qualities; but it also adds visual distinctions to the script, and thus aids the reader. (It rather burdens the writer; but heck, everyone does a lot more reading than writing.)

For instance, the phonetic un- will be used for fun, ton, pun, thun(der), Hun, etc. But sun will have its own yingzi, , and this will be used for son, shun, stun, spun. For instance, sun plus the man radical makes son, and sun with the fight radical is used for shun.

Moreover, a compound yingzi may itself be used as a phonetic with its own set of yingzi. The shun character , for instance, will be used with the work radical to form -tion, used to spell this common suffix, as in section.

Radicals

Where do the radicals come from? For the most part they are either simple characters (e.g king, work), or abbreviations of characters; for instance the character net is abbreviated to when used as a radical.

The set of radicals is not unlimited; there is in fact a fixed set of 214 of them. The total number of yingzi that belong to one phonetic set is thus absolutely limited to 214. No set will actually have this number of yingzi, though some will have a few dozen.

(However, the potential number of yingzi is still unlimited, because we can always choose a compound yingzi as a new phonetic, and generate a new set of rhyming yingzi from it.)

Because the set of radicals is limited, a really good radical will not always be available to distinguish the yingzi in a rhyming set. We'll just choose the best one we can. In addition, when choosing radicals we will rely on the etymological meaning of a word, which may not always match its current meaning. For instance, the word villain originally meant peasant, and so the sign for vill- uses the field radical (added to the phonetic bill).

The yingzi that use a particular radical will form a class of their own-- a sort of meaning class. We can consider the entire English language to be divided into 214 meaning categories. For instance, every yingzi that uses the bug radical will have something to do (at least etymologically) with insects or reptiles. However, since the number of radicals is so limited, and because the choice of radical is sometimes quirky, the resulting sets will be rather vague and eccentric.

Guessing at an unknown character

There will be tens of thousands of yingzi; but we must not let this frighten us. There are tens of thousands of conventional spellings, too, but despite what the wiseacres say, it would be absurd to say that there's no logic to English orthography at all. Likewise, the yingzi themselves are not the basic graphical units or graphemes of the writing system; the phonetics and radicals are.

Readers can make use of this fact to guess the pronunciation of an unknown character. For instance, is a straightforward combination of the speech radical with the phonetic purse. A type of speaking that rhymes with purse-- curse, of course.

Or, , a combination of the plant radical with the guilt phonetic . Something about plants that rhymes with guilt? This one is a bit harder-- wilt.

-- a plant (radical plant) that rhymes with speech-- is easy: peach. But note that speech, which we used as a radical above, is used as a phonetic here.

Since there are many more phonetics than radicals, the information content of the radical is much less than that of the phonetic. If you knew only the radical for an unknown character, you can only narrow down the meaning to 1/214 of the lexicon; if you knew only the phonetic, you could narrow it down much further, since there are more than a thousand phonetics.

Polysyllabic words

Where possible we will divide a word into morphemes. For instance outsider breaks into out + side + -er; reshipment is re- + ship + -ment.

How do we handle morphemes of more than one syllable? We simply create a yingzi for each syllable. For instance, person would be expressed as . The first character is based on per, with the addition of the man radical; the second is sun with the addition of the same radical.

A polysyllabic morpheme, in fact, can generally be recognized because all the syllables have the same radical. For instance, insect consists of in and sect, each with the addition of the bug radical. (Note that sect is itself a compound character, formed from the rite radical with the specked phonetic.)

Inflections

How about inflections that don't form a full syllable, such as plural -s? It would be pretty tiresome, even with the add-a-radical trick, to create thousands of yingzi for syllables that just happen to have a final -s.

Note, however, that the plural morpheme sometimes takes up its own syllable, as in grasses, rashes. So why not use the yingzi for is, which is ? Of course, is and -s are both pretty common, so we should add a little dot to the character to represent final -s: So peach is , peaches is ; sun is , suns is . We can use a similar strategy for other inflections.

Foreign words

Very old borrowings (e.g. the mass of words borrowed in medieval and Renaissance times from French and Latin) will be treated like native words. We've already seen examples like

Words borrowed more recently, however, won't get their own radical+phonetic compounds. Instead we'll represent them, syllable by syllable, using the nearest existing characters. For instance, Peking will be represented as . The first character is the first syllable of pecan (that is, pe-; phonetic see, radical gourd), and the second is the word king. The name Fellini will be written , composed of the yinzi fell, lean, knee. (You may amuse yourself working out what the phonetics and radicals are for these three characters.)

Dictionaries

English dictionaries would no longer be arranged alphabetically, of course, since we're no longer using an alphabet. They'll be organized by radical.

The 214 radicals are ordered according to the number of strokes needed to draw them. Radicals of one stroke (e.g. one or per ) come first, followed by radicals of two strokes (e.g. un-), and so on, up to monstrosities like toad, which has 20 strokes.

The section for each radical is also organized by stroke number. Under the plant radical, for instance, the first entry is plant itself, followed by characters with one extra stroke (like dron, the last character in rhododendron), then characters with two strokes, and so on (up to , the first character in toadstool).

Note that there are no main entries for what we're used to calling words at all. There wouldn't be a main entry at all for a word like person, for instance. There would be an entry for the man radical; under it a sub-entry for the

Thinking in yingzi

The nature of the writing system would encourage lexicographers (and English speakers) to think of everything in the language as built out of yingzi. There wouldn't seem to be a great difference between "words" like storehouse, storage, restore and "expressions" like shoe store, store up, store detective, store manager; or between blackboard and black eye, or between alphabet and alpha male.

Many morphemes that now live out a shadowy existence, forever bound to other morphemes, would take on an independent existence; for instance the volve in revolve, evolve, involve, devolve, which would have its own yingzi, and would seem as much a "word" or component of the language as the match in rematch, mismatch, unmatch. There would be a tendency to describe the meanings, vague or miscellaneous as they might be, for such characters.

This might seem sensible and even wise for a morpheme like volve, which after all derives from a real Latin root meaning roll; but there would be other, more dubious applications. For instance, the son in person was represented by , which happens to be the yingzi for son. It will be almost impossible not to assume that person derives from son; but historically it's just a coincidence; person derives from Latin and has nothing to do with son.

Worse yet, the -cuit of biscuit and circuit might be written with the same character (a derivative of kit), and a meaning sought for it-- perhaps 'round', since biscuits are round and circuits involve going round. Again, etymologically this is nonsense.

Words, perceived as compounds, might lend themselves to abbreviation. After all, why write two yingzi when one will do, especially if it unmistakably implies its partner? For instance, language would be a two-character word , each character defined only as part of this compound and used nowhere else in the language. If you've written

The complexities of the writing system, the inherent interest of the pictorial elements, the cleverness inherent in graphic compounds like

If someone asks where a word comes from, we (now) think of its original phonetic form; we say for instance that language comes from French langage, itself derived from Latin lingua 'tongue', which in turn comes from Proto-Indo-European dnghu. With the yingzi system, people would be tempted instead to give what we might call the graphic etymology. They'd say that lang derives from the speech radical and the gang phonetic, and that the latter is actually a picture of a gang-- a reduplication of the man character. That is indeed where comes from, but not lang, which did not derive from it! (But it wouldn't even be easy to make this point in yingzi-- how do you distinguish lang from if you can't even write "lang" without writing the character?)

A word is a word is a word

Does all this mean that words are cultural constructs or that the concept of a word would no longer apply to English written in yingzi? Not at all. A word is still a useful linguistic concept-- or rather a series of overlapping concepts. By word linguists may mean one or all of the following:

  • a phonological unit-- e.g. something with one stress accent or one pitch contour; or a unit within which intervocalic stops get voiced.
  • the abstraction underlying a set of morphological forms (e.g. write underlying write, writes, writing, written, wrote).
  • an element which can stand alone (e.g. in response to a suitably chosen question), as suffixes or bound morphemes cannot.
  • a morphological unit you can't insert other morphemes into (e.g. black dog is not a word since you can change it to black, tired dog; but you can't turn blackbird into blacktiredbird)
  • an expression with a conventional meaning-- something that has to be defined in the mental lexicon (this sense is also called a lexeme).

A moment's thought should show that these definitions may or may not coincide even in English; and that even where they do they may not coincide with the typographical or lexicographical notion of a word. The latter idea-- roughly 'something with spaces around it'-- is of little interest to linguists since it depends on the writing system. That makes it useless for describing most of the languages of the world; and even for written languages it's pretty arbitrary, as this page should show. (Everything you know about writing English would change if we adopted yingzi instead.)

It's safe to say, however, that such definitions would seem fairly abstract in a yingzi system. Word might become a technical term, like morpheme or lexeme. Or it might be identified with a yingzi (a written character); or be abstracted into a more vaguely defined linguistic element, applicable to anything from a character to a compound to a whole phrase.


Hey, did I just learn something about Chinese?

I've attempted in this sketch to lay out, by analogy, the nature and structure of the Chinese writing system. All of the concepts apply:

  • the limited role of pictograms
  • the clever compound pictures (indeed all three examples are from Chinese)
  • the phonetic-and-radical system (97% of Chinese characters work this way)
  • the inclusion of radicals as part of the character (rather than as separate symbols, as in cuneiform or hieroglyphic writing)
  • the relative information content of radicals and phonetics
  • compounds used as secondary phonetics
  • the handling of multisyllabic and foreign words
  • the handling of subsyllabic morphemes (the model here is Mandarin -r, represented by ér)
  • the organization of dictionaries (in fact, the graphic at the top of the page shows part of the radical index for a Chinese dictionary, organized by stroke count)
  • the psychological effects.

The radicals named are all also Chinese radicals. The phonetics are not, of course, since the phonetics in hanzi refer to the sounds of Chinese words, not English ones. But I tried to pick phonetics which would also be phonetics in Chinese (e.g. sun, king, wing, tree, one, east, field, bill).

There are differences, too. For instance, I haven't made any attempt to make my yingzi look like hanzi.

The phonetic sets of Chinese are not exactly based on rhymes. Karlgren explains that the hanzi belonging to one set had homorganic initial consonants (e.g. k, g), the same main vowel, and the same final consonant.

I've also underreported the complexity (and arguably the inefficiency) of the Chinese script in several important ways:

  • The phonetic sets in Chinese, though still useful, are two thousand years out of date. It's as if my yingzi phonetics had to rhyme in Proto-Germanic, not in modern English.
  • The scribes who devised hanzi often went wild adding radicals, creating multiple characters for what are etymologically the same root.
  • Four milennia have reduced the pictorial content of the hanzi primitives almost to nil. What the "pictograms" are pictures of is often evident only to the scholar.
  • Clear and precise handwriting is by no means a virtue in Chinese; the most admired style, câoshu, is highly simplified, suggesting rather than delineating the characters intended.
  • The People's Republic has simplified many of the traditional hanzi; and this reform has been accepted in Singapore but not in Taiwan or Hong Kong. It's as if the US had its own versions of a large fraction of English yingzi.

I also haven't gotten into the many additional complications engendered when hanzi were adopted by Japanese, Korean, or Vietnamese; for more on that see John DeFrancis's The Chinese Language: Fact and Fantasy.

In some respects, however, yingzi are harder than hanzi. For instance, English has many more multisyllabic morphemes than Chinese. Only about 10% of Chinese morphemes are more than one syllable long. Also, English has borrowed so much that it often has five or six morphemes where Chinese would have just one-- compare wáng vs. king, regal, royal, regicide, Rex, or vs. word, verb, logograph, bon mot.

--Mark Rosenfelder


[ Home ]
Fellini: fell has the radical vertical and the phonetic sell; lean has the radical stand and the phonetic bean; and knee has the radical body and phonetic tree.
Read the whole story
emrox
15 days ago
reply
Hamburg, Germany
Share this story
Delete

Wann würde das letzte Licht ausgehen, wenn alle Menschen sterben würden?

1 Share

Im Rahmen ihrer fortlaufenden „Was wäre wenn?“-Serie erklären uns xkcd, wann die letzte künstliche Lichtquelle erlöschen würde, wenn die Menschheit von der Erde verschwinden würde. Die ersten, die verschwinden, sind die offensichtlichsten. Wie immer die Antworten auf die wichtigen Fragen.


(Direktlink)

Read the whole story
emrox
20 days ago
reply
Hamburg, Germany
Share this story
Delete

Meaningful Nonsense: How I generate sentences

1 Share
Read the whole story
emrox
20 days ago
reply
Hamburg, Germany
Share this story
Delete
Next Page of Stories