Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
SplitDuck.com Use A/B testing to increase revenue
90

Recently

from macwright.com [alt+shift+b] in programming

Listening My friend Dave Infante has been busy – he launched his own beer-centric podcast, Taplines, and guest-starred on the enormous Chapo Trap House podcast. Reading It’s been a slow few weeks for books, but since I skipped Recently in May, I can still talk about Achieving Our Country, which was a pivotal read. It’s a political-philosophy book on the left about the shifts in American leftism in the 1900s. It really clicked with me: someone who wants there to be a thriving left and is fully on board with the theories in Piketty’s Capital and many of Henry George’s ideas, but is constantly surprised and disappointed by the mainstream brand of socialism that I find in DSA chapters in major cities and online. I keep wondering why the American left is so enthusiastic about homeownership, skeptical of reform and political participation, accepting of libertarian-tinged ideas, and attached to a class politics and “class analysis” that seems skin-deep and more interested in identity than anything else. Why do they waffle about their support of Ukraine and give space to so-called tankies? Achieving our Country gives a compelling theory for why: that the 1960s marked a shift from a reformist leftism to one dominated by radical and Marxist thought. Writing radical Marxist here might set off some “Fox news” alarm bells, but it’s meant literally: that people shifted from wanting to reform a system to radically replace it. And that the explicit influence of the Marxist strain of Socialism – his historical materialism, emphasis on labor, ideas about the proletariat - are the underpinnings of a lot of what you hear at the average DSA meeting or in your issue of Jacobin. Of course, it’s a thoroughly opinionated book that is trying to summarize a lot of different movements and influences, and it’s impossible to write any statement about what Marx proposed without getting blowback about another place where he proposed something different. But anyway, I was born long after the...
1st Jun 2023

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from macwright.com

Recently

I watched a large part of All Watched Over By Machines of Loving Grace this month. This also counts as a “listening” item, because the theme song, “Baby Love Child” by Pizzicato Five, is also spectacular. Guitar Moves is a good series of interviews by Matt Sweeney, who I mostly know via his involvement in Bonnie Prince Billy. It’s a really cool format. I like how he interviews guitarists with recognizable sounds, and you get to see how little they need to play to sound just like themselves. The episode with St. Vincent is excellent too: she’s one of my guitar heroes: check out the guitar solo in Just The Same But Brand New, or her version of Dig a Pony. I also watched No Other Land. Everyone should watch No Other Land. AI thoughts roundup I don’t have a conclusion. Really, that’s my current state: ambivalence. I acknowledge that these tools are incredibly powerful, I’ve even started incorporating them into my work in certain limited ways (low-stakes code like POCs and unit tests seem like an ideal use case), but I absolutely hate them. I hate the way they’ve taken over the software industry, I hate how they make me feel while I’m using them, and I hate the human-intelligence-insulting postulation that a glorified Excel spreadsheet can do what I can but better. Nolan Lawson: AI ambivalence As I always say, the purpose of the system is what it does. Or, in this case, how I think about AI stuff is mostly affected by how people use AI stuff, and how people use AI stuff is a real mixed bag. There’s the tidal wave of spam, the aesthetic of fascism, the low-effort marketing materials with nonsense images, the non-consensual AI porn. I see all of the bad stuff every day both online and in the odd subway ad. The good stuff seems pretty theoretical, though: the press releases about AI-driven medical advances never seem to break into the real world. The stories about engineers 10x’ing their ability seem pretty mixed: we’re already at the hangover-and-regret phase with programmers bemoaning how they’ve generated so much slop and lost so much knowledge. Anyway, I’m mildly optimistic about the potential! But it’s a lot like crypto in that you could theoretically use the technology for something good but most people loudly used it for bad stuff, and people including me judged it based on what it did. AI has to start doing some good stuff soon. Potential isn’t enough. I think one thing chatGPT’s invention has revealed is how many people - including some very important people in society - find just basic reading and writing to be laborious and cumbersome to perform, and how oddly closely that type of strained literacy correlates with having other shitty opinions. From mtsw on Bluesky, about this story about Andrew Cuomo using ChatGPT to half-assedly write a policy platform. Right off the bat I should say that judging people for their level of literacy reeks of classism and so on. My own ability to read & write has a lot to do with my place in society: I went to good schools, had a stable home life, and smart parents. However, “the way that society was set up” kind of evened this out. Extremely social people with cultural capital and chiseled jawlines and biceps would get their rewards, and people like… myself, we would get rewarded for literacy and critical thinking. When one group needed the other, it was usually some kind of payment or partnership: Cuomo pays his scriptwriter, the TV show creator pays the actors. And some people can do both sides of the equation. But LLMs definitely indicate that people do not like this deal. Whew, they don’t like writing, but they also don’t like paying the writers or reading what they write. Maybe they could rejigger the system so that they could do it all. They have ideas for music and art but no interest in learning about music, practicing instruments, going to art school, or concentrating on a task for a long time, so why not generate it all? Why not, well - there are reasons, those reasons being that the generated output usually passes their own vibe check but once someone who looks closely at things or reads all the words encounters it, everyone points at the slop and it’s embarrassing. (Cuomo will never be embarrassed) Plus, you’re always going to get average results by asking a device that is incapable of creativity or thought. Also, you’ll miss out on the human experience of creating. And you’ll be indirectly feeding output data into training data for future LLMs, consequentially making their output worse. (Cuomo does not care about consequences) Colophon update I’ve moved the images for this website to Bunny (that’s an affiliate link, here’s a non-affiliate link if that’s what you prefer). When I initially moved my photos to this website, I set them up with Amazon S3 for storage and CloudFront to serve them with a CDN. Using AWS is painful for me, so I moved them to Cloudflare R2, which is Cloudflare’s equivalent to S3, and Cloudflare as a CDN. Thanks to owning my own domains, swapping out image hosts is pretty quick: switching to Bunny took all of five minutes. So what’s the deal with Bunny? Partly I’ve become a little more negative on Cloudflare and R2: I think Cloudflare’s technology is neat, but R2 has iffy reliability and Cloudflare has iffy politics. I’m also intrigued by diversifying my dependencies geographically. Bunny is a Slovenian company, and my email is from an Australian company. This probably won’t have any practical effect, but it feels kind of good for obvious reasons to even minutely hedge my bets here. So far Bunny has been great. They don’t support the S3 protocol but they do support SFTP, which works just as well for my purposes and works great with the beautiful Transmit app. Before, with R2, I was using the significantly less beautiful Cyberduck application because Cloudflare R2 doesn’t support all of the S3 protocol. It seems to be just as fast as Cloudflare was, too. And I’m somewhat reassured by the prospect of paying Bunny. I don’t like the feeling of getting “free” services like I can from Cloudflare. I want that customer relationship. Reading Then again, pop culture is powerful, and even the dumbest marketing both affects and reflects it. Busch Light’s can holder shaped like a cup that holds beer is dumb, which is fine, because most beer promos are. But the fact that the brand frames it as a functional, masculine alternative to Stanley’s H2.0 Flowstate affirms a similarly retrograde outlook on gender roles to the one that young American men are seeking out on the political right. From my friend Dave’s article about Busch Light’s weird attempt to riff on the Stanley Tumbler trend. I was once a loyal listener of the Chapo Trap House podcast, but fell off of it in 2020 when their support of Bernie Sanders led them to be jerks about Elizabeth Warren. But reading this Vanity Fair article about the cohosts of the podcast endeared them to me a bit. “Like to thank” is linguistic phlegm. “I’d like to thank the Academy.” They’d “like to thank” me. Well I’d like to be 6’3” and drive a G Wagon, thanks. I’d like you to accept my novella. I’d like to quit paying three dollars to Submittable every time I want to send a story out. The world is full of actions I would like to do. The most direct way to say thank you is just to say it: “thank you, name, for doing X.” “I’d like to thank” is a performative thanks, a thanks with a smirk and a blink, eyeing for extra credit. Just because people say it in their award show acceptance speeches doesn’t mean you should say it, too. In fact, that’s the reason you shouldn’t say it. Loved this article “Close reading my rejections” from friend of the blog Barrett Hathcock.

1st May 2025 • 36 votes
Personal tools

I used to make little applications just for myself. Sixteen years ago (oof) I wrote a habit tracking application, and a keylogger that let me keep track of when I was using a computer, and generate some pretty charts. I’ve taken a long break from those kinds of things. I love my hobbies, but they’ve drifted toward the non-technical, and the idea of keeping a server online for a fun project is unappealing (which is something that I hope Val Town, where I work, fixes). Some folks maintain whole ‘homelab’ setups and run Kubernetes in their basement. Not me, at least for now. But I have been tiptoeing back into some little custom tools that only I use, with a focus on just my own computing experience. Here’s a quick tour. Hammerspoon Hammerspoon is an extremely powerful scripting tool for macOS that lets you write custom keyboard shortcuts, UIs, and more with the very friendly little language Lua. Right now my Hammerspoon configuration is very simple, but I think I’ll use it for a lot more as time progresses. Here it is: hs.hotkey.bind({"cmd", "shift"}, "return", function() local frontmost = hs.application.frontmostApplication() if frontmost:name() == "Ghostty" then frontmost:hide() else hs.application.launchOrFocus("Ghostty") end end) Not much! But I recently switched to Ghostty as my terminal, and I heavily relied on iTerm2’s global show/hide shortcut. Ghostty doesn’t have an equivalent, and Mikael Henriksson suggested a script like this in GitHub discussions, so I ran with it. Hammerspoon can do practically anything, so it’ll probably be useful for other stuff too. SwiftBar I review a lot of PRs these days. I wanted an easy way to see how many were in my review queue and go to them quickly. So, this script runs with SwiftBar, which is a flexible way to put any script’s output into your menu bar. It uses the GitHub CLI to list the issues, and jq to massage that output into a friendly list of issues, which I can click on to go directly to the issue on GitHub. #!/bin/bash # <xbar.title>GitHub PR Reviews</xbar.title> # <xbar.version>v0.0</xbar.version> # <xbar.author>Tom MacWright</xbar.author> # <xbar.author.github>tmcw</xbar.author.github> # <xbar.desc>Displays PRs that you need to review</xbar.desc> # <xbar.image></xbar.image> # <xbar.dependencies>Bash GNU AWK</xbar.dependencies> # <xbar.abouturl></xbar.abouturl> DATA=$(gh search prs --state=open -R val-town/val.town --review-requested=@me --json url,title,number,author) echo "$(echo "$DATA" | jq 'length') PR" echo '---' echo "$DATA" | jq -c '.[]' | while IFS= read -r pr; do TITLE=$(echo "$pr" | jq -r '.title') AUTHOR=$(echo "$pr" | jq -r '.author.login') URL=$(echo "$pr" | jq -r '.url') echo "$TITLE ($AUTHOR) | href=$URL" done Tampermonkey Tampermonkey is essentially a twist on Greasemonkey: both let you run your own JavaScript on anybody’s webpage. Sidenote: Greasemonkey was created by Aaron Boodman, who went on to write Replicache, which I used in Placemark, and is now working on Zero, the successor to Replicache. Anyway, I have a few fancy credit cards which have ‘offers’ which only work if you ‘activate’ them. This is an annoying dark pattern! And there’s a solution to it - CardPointers - but I neither spend enough nor care enough about points hacking to justify the cost. Plus, I’d like to know what code is running on my bank website. So, Tampermonkey to the rescue! I wrote userscripts for Chase, American Express, and Citi. You can check them out on this Gist but I strongly recommend to read through all the code because of the afore-mentioned risks around running untrusted code on your bank account’s website! Obsidian Freeform This is a plugin for Obsidian, the notetaking tool that I use every day. Freeform is pretty cool, if I can say so myself (I wrote it), but could be much better. The development experience is lackluster because you can’t preview output at the same time as writing code: you have to toggle between the two states. I’ll fix that eventually, or perhaps Obsidian will add new API that makes it all work. I use Freeform for a lot of private health & financial data, almost always with an Observable Plot visualization as an eventual output. For example, when I was switching banks and one of the considerations was mortgage discounts in case I ever buy a house (ha 😢), it was fun to chart out the % discounts versus the required AUM. It’s been really nice to have this kind of visualization as ‘just another document’ in my notetaking app. Doesn’t need another server, and Obsidian is pretty secure and private.

3rd Apr 2025 • 71 votes
Recently

I have a non-recently post ready to write, any day now… Reading This was a strong month for reading: I finished The Hidden Wealth of Nations, Useful Not True, and Cyberlibertarianism. I had a book club that read Cyberlibertarianism so we discussed it last week. I have a lot of qualms with the book, and gave it two stars for that reason. But I will admit that it’s taking up space in my mind. The ‘cyberlibertarian’ ideology was familiar to me before reading it. The book’s critique of it didn’t shift my thinking that much. But I have been thinking a lot about what it argued for, which is a world in which the government has very extensive powers – to limit what is said online, to regulate which companies can even create forums or social media platforms. He also believed that a government should be able to decrypt and read conversations between private citizens. It’s a very different idea of government power than what I’m used to, and well outside my comfort zone. I think it’s interesting to consider these things: the government probably should have some control of some kinds of speech, and in some cases it’s useful to have the FBI tapping the phones of drug smugglers or terrorists. How do we really define what’s acceptable and what isn’t? I don’t know, I want to do more thinking about the uncomfortable things that nevertheless may be necessary for functioning of society. Besides that, there is so much to read. This month I added a lot of news subscriptions to my pile, which I think is now Hell Gate, Wired, NYTimes, Bloomberg, 404 Media, The Verge, and a bunch of newsletters. This interview with Stephanie Kelton, who is at the forefront of the Modern Monetary Theory movement in America, and wrote the very good book The Deficit Myth. This 404 Media story on an AI-generated ‘true crime’ YouTube channel is great because the team at 404 Media does both deep research and they interrogate their sources. Nathan Tankus has always been good but in this era he’s essential reading. His piece on Fort Knox is quick and snappy. His others are more involved but always worth reading. Listening We’ve been rewatching The Bear and admiring the dad-rock soundtrack. This Nine Inch Nails track shows up at the end of a season: And this Eno track: Besides that, this track from Smino played at a local cocktail bar. The bars at 0:45 sound like they’re tumbling downhill in a delightful way. Watching So I bought a sewing machine in February, a beautiful old Kenmore 158-series, produced in the 1970s in Japan. It’s awesome. How sewing machines work is amazing, as this video lays out. There’s so much coordinated motion happening for every stitch, and the machines are so well-designed that they last for decades easily. Besides that, I just watched The Apprentice, which I really did not like. Elsewhere I was on a podcast with Jeremy Jung, taking about Placemark! My post in the /micro/ section, All Hat No Cowboy, probably could have or should have been a blog post, but I was feeling skittish about being too anti-AI on the main.

1st Mar 2025 • 47 votes
Recently

I am not going to repeat the news. But man, things are really, really bad and getting worse in America. It’s all so unendingly stupid and evil. The tech industry is being horrible, too. Wishing strength to the people who are much more exposed to the chaos than I am. Reading A Confederacy of Dunces was such a perfect novel. It was pure escapism, over-the-top comedy, and such an unusual artifact, that was sadly only appreciated posthumously. Very earnestly I believe that despite greater access to power and resources, the box labeled “socially acceptable ways to be a man” is much smaller than the box labeled “socially acceptable ways to be a woman.” This article on the distinction between patriarchy and men was an interesting read. With the whole… politics out there, it’s easy to go off the rails with any discussion about men and women and whether either have it easy or hard. The same author wrote this good article about declining male enrollment in college. I think both are worth a read. Whenever I read this kind of article, I’m reminded of how limited and mostly fortunate my own experience is. There’s a big difference, I think, in how vigorously you have to perform your gender in some red state where everyone owns a pickup truck, versus a major city where the roles are a little more fluid. Plus, I’ve been extremely fortunate to have a lot of friends and genuine open conversations about feelings with other men. I wish that was the norm! On Having a Maximum Wealth was right up my alley. I’m reading another one of the new-French-economist books right now, and am still fascinated by the prospect of wealth taxes. My friend David has started a local newsletter for Richmond, Virginia, and written a good piece about public surveillance. Construction Physics is consistently great, and their investigation of why skyscrapers are all glass boxes is no exception. Watching David Lynch was so great. We watched his film Lost Highway a few days after he passed, and it was even better than I had remembered it. Norm Macdonald’s extremely long jokes on late-night talk shows have been getting me through the days. Listening This song by the The Hard Quartet – a supergroup of Emmett Kelly, Stephen Malkmus (Pavement), Matt Sweeney and Jim White. It’s such a loving, tender bit of nonsense, very golden-age Pavement. They also have this nice chill song: I came across this SML album via Hearing Things, which has been highlighting a lot of good music. Small Medium Large by SML It’s a pretty good time for these independent high-quality art websites. Colossal has done the same for the art world and highlights good new art: I really want to make it out to see the Nick Cave (not the musician) art show while it’s in New York.

4th Feb 2025 • 67 votes
2025 Predictions

I was just enjoying Simon Willison’s predictions and, heck, why not. 1: The web becomes adversarial to AI The history of search engines is sort of an arms race between websites and search engines. Back in the early 2000s, juicing your ranking on search engines was pretty easy - you could put a bunch of junk in your meta description tags or put some text with lots of keywords on each page and make that text really tiny and transparent so users didn’t notice it but Google did. I doubt that Perplexity’s userbase is that big but Perplexity users are probably a lot wealthier on average than Google’s, and there’s some edge to be achieved by getting Perplexity to rank your content highly or recommend your website. I’ve already noticed some search results including links to content farms. There are handful of startups that do this already, but the prediction is: the average marketing exec at a consumer brand will put some of their budget to work on fooling AI. That means serving different content to AI scrapers, maybe using some twist on Glaze and other forms of adversarial image processing to make their marketing images more tantalizing to the bots. Websites will be increasingly aware that they’re being consumed by AI, and they will have a vested interest in messing with the way AI ‘perceives’ them. As Simon notes in his predictions, AIs are gullible: and that’s before there are widespread efforts to fool them. There’s probably some way to detect an AI scraper, give it a special payload, and trick it into recommending your brand of razors whenever anyone asks, and once someone figures it out this will be the marketing trend of the decade. 2: Copyright nihilism breeds a return to physical-only media The latest lawsuit about Meta’s use of pirated books, allegedly with Mark Zuckerberg’s explicit permission, if true, will be another reason to lose faith in the American legal system’s intellectual property system entirely. We’ve only seen it used to punish individuals and protect corporations, regardless of the facts and damages, and there’s no reason to believe it will do anything different (POSIWID). The result, besides an uptick in nihilism, could be a rejuvenation of physical-only releases. New albums only released on vinyl. Books only available in paperback format. More private screenings of hip movies. When all digital records are part of the ‘training dataset,’ a niche, hipster subset will be drawn to things that aren’t as easily captured and reproduced. This is parallel, to the state of closed-source models from Anthropic or OpenAI. They’re never distributed or run locally. They exist as bytes on some hard drive and in some massive GPU’s memory in some datacenter, and there aren’t Bittorrents pirating them because they’re kept away from people, not because of the power of copyright law. What can be accessed can be copied, so secrecy and inaccessibility is valuable. 3: American tech companies will pull out of Europe because they want to do acquisitions The incoming political administration will probably bring an end to Lina Khan’s era of the FTC, and era in which the FTC did stuff. We will go back to a ‘hands off’ policy in which big companies will acquire each other pretty often without much government interference. But, even in Khan’s era, the real nail in the coffin for one of the biggest acquisitions - Adobe’s attempt to buy Figma – was regulators from the EU and UK. Those regulators will probably keep doing stuff, so I think it’s likely that the next time some company wants to acquire a close competitor, they just close up shop in the EU, maybe with a long-term plan to return. 4: The tech industry’s ‘DEI backlash’ will run up against reality The reality is that the gap between women and men in terms of college degrees is really big: “Today, 47% of U.S. women ages 25 to 34 have a bachelor’s degree, compared with 37% of men.” And that a great deal of the tech industry’s workforce is made of up highly-skilled people who are on H-1B visas. The synthesis will be that tech workers will be more diverse, in some respects, but by stripping away the bare-bones protections around their presence, companies will keep them in a more vulnerable and exploitable position. But hard right-wingers will have plenty to complain about because these companies will continue to look less white and male, because the labor pool is not that. 5: Local-first will have a breakthrough moment I think that Zero Sync has a good chance at cracking this really hard problem. So does electric and maybe jazz, too. The gap between the dream of local-first apps and the reality has been wide, but I think projects are starting to come to grips with a few hard truths: Full decentralization is not worth it. You need to design for syncing a subset of the data, not the entire dataset. You need an approach to schema evolution and permission checking These systems are getting there. We could see a big, Figma-level application built on Zero this year that will set the standard for future web application architecture. 6: Local, small AI models will be a big deal Embedding models are cool as heck. New text-to-speech and speech-to-text models are dramatically better than what came before. Image segmentation is getting a lot better. There’s a lot of stuff that is coming out of this boom that will be able to scale down to a small model that runs on a phone, browser, or at least on our own web servers without having to call out to OpenAI or Anthropic APIs. It’ll make sense for costs, performance, and security. Candle is a really interesting effort in this area. Mini predictions Substack will re-bundle news. People are tired of subscribing to individual newsletters. Substack will introduce some ~$20/month plan that gives you access to all of the newsletters that participate in this new pricing model. TypeScript gets a zeitwork equivalent and lots of people use it. Same as how prettier brought full code formatting from TypeScript, autoloading is the kind of thing that once you have it, it’s magic. What if you could just write <SomeComponent /> in your React app and didn’t have to import it? I think this would be extremely addictive and catch on fast. Node.js will fend off its competitors. Even though Val Town is built around Deno’s magic, I’ve been very impressed that Node.js is keeping up. They’ve introduced permissions, just like Deno, and native TypeScript support, just like the upstarts. Bun and Deno will keep gaining adherents, but Node.js has a long future ahead of it. Another US city starts seriously considering congestion pricing. For all the chatter and terrible discourse around the plan, it is obviously a good idea and it will work, as it has in every other case, and inspire other cities to do the same. Stripe will IPO. They’re still killing it, but they’re killing it in an established, repeatable way that public markets will like, and will let up the pressure on the many, many people who own their stock.

11th Jan 2025 • 78 votes

More in programming

counting large numbers of events in small floating point registers

In 1978, the ACM published an algorithm by Robert Morris for counting large numbers of events in small registers. It uses one byte to keep track of the approximate logarithm of the count, and randomly increments the logarithm with a probability that scales with the value of the count. You can tune the range and precision of the counter by adjusting the base of the logarithm. Morris suggests pre-calculating a table of probabilities so that no difficult calculations are needed at runtime. Recently I learned from emsenn about a 2009 paper by Miklós Csűrös titled approximate counting with a floating-point counter. It changes Morris’s algorithm to use a binary log-linear counter instead of a pure logarithm. It reminded me of my hg64 log-linear histograms, so I thought it would be fun to implement, especially since the algorithm can be made shorter and faster. representing a counter We need to choose the number of bits to use for the exponent and mantissa of each approximate floating point counter. Typically the exponent will be 5 or 6 bits, corresponding to an unpacked exact counter of 32 or 64 bits. The mantissa will typically be the rest of an 8 or 16 bit integer (though languages such as Zig and C23 allow more adventurous integer sizes). I’ll call the approximate counter type usmol and the unpacked counter type ubig. #define EXPBITS 5 #define SIGBITS 3 typedef unsigned _BitInt(EXPBITS+SIGBITS) usmol; typedef uint32_t ubig; static_assert(sizeof(ubig) * 8 == 1 << EXPBITS, "ubig must match EXPBITS"); It’s straightforward to extract the exponent and mantissa from a usmol counter. Unpacking a usmol into a ubig is slightly tricky. Like hg64 and IEEE754, normal numbers (with a nonzero exponent) have an implicit leading bit, and denormal numbers (exponent is zero) do not. The effect is that small counts are represented exactly in a usmol (up to 2*MANTISSA, covering denormal numbers and exponent == 1), and larger counts are shifted by the exponent. (I don’t need the inverse conversion here, but it is used by hg64 to map a sample to a histogram bucket, truncating the value by shifting right.) #define MANTISSA (1 << SIGBITS) static inline ubig exponent(usmol approx) { return(ubig)(approx / MANTISSA); } static inline ubig mantissa(usmol approx) { return(ubig)(approx % MANTISSA); } static inline ubig unpack(usmol approx) { ubig e = exponent(approx) - 1; ubig m = mantissa(approx) | MANTISSA; return(approx < MANTISSA ? approx : m << e); } bumping a counter Because binary floating point uses logarithms in base 2, we need the probability of incrementing the counter to scale with 2^-e. Specifically, we want the probability of increasing the counter to be 100% when its exponent is 0 or 1, 50% when the exponent is 2, 25% when it is 3, etc. Csűrös does this by getting a random bit e times in a loop and incrementing the counter if they are all zero. A more efficient way to do this on a computer is to get a ubig word full of random bits and count the leading or trailing zeroes. There are a variety of bit scan functions that differ in how they number bits and what they do when the word is entirely zero. The POSIX ffs() family has the advantage of no undefined behaviour, but it weirdly counts from one. However this oddity turns out to match the way denormal numbers give our exponent an off-by-one bias. So for instance, when our exponent is 2 and we want a 50% probability, we want ffs() to return 2 or more. OK, that determines when to increment the mantissa given a particular exponent. But how does the exponent get incremented? Like Csűrös, we put the exponent immediately to the left of the mantissa; when the mantissa overflows, it rolls over to zero and the exponent ticks up. No special cases are needed. The resulting code is short: usmol bump(rng_t *rng, usmol approx) { ubig r = ubig_random(rng); ubig z = (ubig)ffsll((long long)r); ubig e = exponent(approx); return(approx + (z >= e)); } considerations Morris allows you to smoothly tune the allowable range and precision of a counter by adjusting the base of the logarithm. By contrast, Csűrös has very lumpy 2^2^n choice of ranges; that isn’t necessarily bad because it’s normal for programmers to have to choose between uint32_t and uint64_t. Morris uses a lookup table to determine the probability of incrementing, which is tolerable for an 8 bit counter, but it can get large for wider counters. Csűrös just uses a few instructions and bigger counters don’t need much more. So I don’t think either algorithm is clearly better than the other, except that Csűrös has the winning fun factor of bithacking a bespoke floating point format.

an hour ago • 1 votes
How to tokenmaxx correctly

Parallelize discovery and execution, but serialize judgement.

17 hours ago • 1 votes
You really shouldn't vibe code a newsletter app

Sending email is easy. Making sure good emails land where they should is not.

17 hours ago • 2 votes
User preferences, exclusion, and understanding what you’re deciding

This is an article about user preferences. It is also about the larger framework of decisions designers sit inside of when employing them, and the outcomes that they can create. I wrote this article because the power dynamics and downstream effects surrounding user preferences is something multiple accessibility practitioners I know are aware of. My, and their thinking about these dynamics and end results is worth being aware of. Discussing the concerns that surround how user preferences are introduced can also be, ahem, counterproductive to healthy working relationships when brought up in the moment. So, I am writing it out here instead for people to read and digest at their own pace. What are user preferences? For the uninitiated, user preferences are different modes you can set in your operating system to help you use a digital device. Examples include, but are not limited to: Dark mode, Reduced motion, Reduced transparency, Increased contrast, Forced colors, etc. All of these user preferences enable, improve, and enhance someone’s ability to operate digital experiences. Consequently, they can be considered assistive technology. However, someone enabling user preferences isn’t a given. This is worth emphasizing because the existence of user preferences can also serve as an excuse during the product or feature design process. Just because a user preference exists does not mean someone who could benefit from it is using it There are a whole host of reasons as to why this is. Here’s a few: Low digital literacy means someone does not know how to navigate to their operating system preferences, or that said preferences even exist in the first place. Someone might not know they have a disability, and consequently will not seek out a related user preference. Related, internalized ableism means someone does not think the accessibility section of operating system preferences applies to them. A device might be locked down by someone’s employer, with large swaths of functionality set to be restricted. A device may be shared due to economic circumstance, where individuals in disadvantaged communities share a device or access one from locations like a public library or shelter. A device’s operating system may not be updated to a version where support for the user preference was added. etc. An example of where the existence of user preferences gets abused A common example I’ve had to contend with is color contrast. A common response to contrast issues being brought up is to propose setting a high contrast theme that kicks in if someone has the increased contrast user preference enabled. This is done in an attempt to avoid the minimum contrast ratio demanded by the Web Content Accessibility Guidelines (WCAG) requires. More abstractly, this response enables a designer avoiding deeper inquiry into their sense of aesthetics. This in turn avoids questioning how personal opinions around taste impact the audiences they ultimately serve. The reason why a low-contrast-experience-as-default is a non-starter is obvious if you understand what the spirit of WCAG is getting at. It is also why a website offering an increased contrast theme switcher using color values in the UI that are too low contrast is also not a viable approach. That reason is content in its default state may be unable to be perceived. And if it cannot be seen, it cannot be read or used. It’s as simple as that. These examples, and other related ones compels a change of mindset. Accessible by default, opt-out by choice Disability intersecting with digital experiences creates a range of outcomes from mild annoyance, to hard barriers, and even direct harm. This intersection compels an approach that means proactively accommodating the widest swath of unknown people with unknown preferences, capabilities, devices, and circumstances as the default. Another example: I know someone who had a seizure because of a full-screen animation a website played. The animation implementation itself honored a reduced motion user query. However, the person did not know that the reduced motion user preference existed and consequently did not enable it. Are we to blame them? People who work in the digital accessibility space are already aware of this accessible-by-default approach. It is why the WCAG is phrased the way it is. As a positive example of this, this is why GitHub underlines its links by default now, but also enables you to switch link underlines off. However, this accessible by default, opt-out by choice mindset isn’t always present for designers. This brings about three tough, yet vital questions that need to be asked, and this article’s format is a safer way to provide the larger surrounding context of why they need to be asked. Who do you want to exclude? Asking this question in a structured way, in good faith at the beginning of a project is a great way to help build awareness and consensus. This question is what an in-house accessibility practitioner is likely thinking when they hear a proposal to present an accessible alternative hidden away under a user query. I will also note that asking it directly at later stages of the design process isn’t feasible in most professional environments. What are you deciding? Here’s another question your peer really can’t ask in the moment. Accessibility practitioners tend to think of their work as an output coming from an ethical or harm prevention way of thinking. Unfortunately, this kind of thinking isn’t always the most compelling or effective strategy in contemporary business culture. Because of this, there are three more pragmatic lenses we can view design choices through: Usability Constraining the methods of operation of a digital experience to work in only the ways you personally use something is a decision. And that decision limits how usable the experience is to others. In opposition to this artificially-applied constraint, conferring the ability for someone to efficiently navigate and take action on a digital experience is one of the main jobs you have as a designer. This applies to both the public and private sectors. Profitability Another main job of designers working in the private sector is to enable the creation and continuation of profit, and profitability is impacted by usability. To that point, poor usability leads to less profitability if your product is actively competing in the market. Consequently, choosing to limit usability also chooses to limit profitability. Here, in the context of lucrative SaaS contracts I would like to call out both the tyranny of the majority and also the correlations between age, disability, and decision-making power. Law At the end of the day it is a court—and not you—that decides whether or not a barrier is present for a disabled person using a service. Here, know two things: There is also plenty of precedent in the private sector in the United States to draw from, and also WCAG helps inform how to avoid many forms of barriers in digital experiences. I am not going to say that you are choosing to break the law when you lead with an inaccessible default. However, I will say that a jury might. Where do you want to place the burden? Learning about and enabling user preferences takes effort. Forcing disabled people to fiddle with obscure operating system preferences places the burden on them to get basic accessibility accommodation. Also know It is a fallacy to assume the presence of an active user query means someone is accommodating their disability. For example, I use a reduced motion media query on my laptop and phone because I am impatient and want OS transition effects to get out of the way and take as little time as possible. As alluded to earlier with my comments on age and decision-making power, it is also a fallacy to assume the presence of disability or use of a user query means a lack of ability, competency, or value. This mindset is largely due to how pervasive ableism—and how it shapes ideas about disability—is in our culture. Try sitting with this To quote my friend Soren: User preference settings or accessibility settings cannot replace our responsibility to design and build accessible apps and websites. The ideas and viewpoints shared in this post article are something you may not be exposed to due to both a historic lack of disability theory in design education, and also a lack of organizational prioritization of accessibility in design practice. Your ideas and values may be challenged by this, as well as your aesthetic sensibilities. Spend some time reflecting on why you feel this friction and unease, as well as the power and responsibility you wield as someone who creates digital experiences.

17 hours ago • 1 votes
NSRS georeferencing

The US is updating its primary spatial reference system, replacing NAD 83 with NATRF 2022 and other systems.

yesterday • 1 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in