Feeds
Russ Allbery: Review: Number Go Up
Review: Number Go Up, by Zeke Faux
Publisher: Crown Currency Copyright: 2023 Printing: 2024 ISBN: 0-593-44382-9 Format: Kindle Pages: 373Number Go Up is a cross between a history and a first-person account of investigative journalism around the cryptocurrency bubble and subsequent collapse in 2022. The edition I read has an afterward from June 2024 that brings the story up to date with Sam Bankman-Fried's trial and a few other events. Zeke Faux is a reporter for Bloomberg News and a fellow of New America.
Last year, I read Michael Lewis's Going Infinite, a somewhat-sympathetic book-length profile of Sam Bankman-Fried that made a lot of people angry. One of the common refrains at the time was that people should read Number Go Up instead, and since I'm happy to read more about the absurdities of the cryptocurrency world, I finally got around to reading the other big crypto book of 2023.
This is a good book, with some caveats that I am about to explain at absurd length. If you want a skeptical history of the cryptocurrency bubble, you should read it. People who think that it's somehow in competition with Michael Lewis's book or who think the two books disagree (including Faux himself) have profoundly missed the point of Going Infinite. I agree with Matt Levine: Both of these books are worth your time if this is the sort of thing you like reading about. But (much) more on Faux's disagreements with Lewis later.
The frame of Number Go Up is Faux's quixotic quest to prove that Tether is a fraud. To review this book, I therefore need to briefly explain what Tether is. This is only the first of many extended digressions.
One natural way to buy cryptocurrency would be to follow the same pattern as a stock brokerage account. You would deposit some amount of money into the account (or connect the brokerage account to your bank account), and then exchange money for cryptocurrency or vice versa, using bank transfers to put money in or take it out. However, there are several problems with this. One is that swapping cryptocurrency for money is awkward and sometimes expensive. Another is that holding people's investment money for them is usually highly regulated, partly for customer safety but also to prevent money laundering. These are often called KYC laws (Know Your Customer), and the regulation-hostile world of cryptocurrency didn't want to comply with them.
Tether is a stablecoin, which means that the company behind Tether attempts to guarantee that one Tether is always worth exactly one US dollar. It is not a speculative investment like Bitcoin; it's a cryptocurrency substitute for dollars. People exchange dollars for Tether to get their money into the system and then settle all of their subsequent trades in Tether, only converting the Tether back to dollars when they want to take their money out of cryptocurrency entirely. In essence, Tether functions like the cash reserve in a brokerage account: Your Tether holdings are supposedly guaranteed to be equivalent to US dollars, you can withdraw them at any time, and because you can do so, you don't bother, instead leaving your money in the reserve account while you contemplate what new coin you want to buy.
As with a bank, this system rests on the assurance that one can always exchange one Tether for one US dollar. The instant people stop believing this is true, people will scramble to get their money out of Tether, creating the equivalent of a bank run. Since Tether is not a regulated bank or broker and has no deposit insurance or strong legal protections, the primary defense against a run on Tether is Tether's promise that they hold enough liquid assets to be able to hand out dollars to everyone who wants to redeem Tether. (A secondary defense that I wish Faux had mentioned is that Tether limits redemptions to registered accounts redeeming more than $100,000, which is a tiny fraction of the people who hold Tether, but for most purposes this doesn't matter because that promise is sufficient to maintain the peg with the dollar.)
Faux's firmly-held belief throughout this book is that Tether is lying. He believes they do not have enough money to redeem all existing Tether coins, and that rather than backing every coin with very safe liquid assets, they are using the dollars deposited in the system to make illiquid and risky investments.
Faux never finds the evidence that he's looking for, which makes this narrative choice feel strange. His theory was tested when there was a run on Tether following the collapse of the Terra stablecoin. Tether passed without apparent difficulty, redeeming $16B or about 20% of the outstanding Tether coins. This doesn't mean Faux is wrong; being able to redeem 20% of the outstanding tokens is very different from being able to redeem 100%, and Tether has been fined for lying about its reserves. But Tether is clearly more stable than Faux thought it was, which makes the main narrative of the book weirdly unsatisfying. If he admitted he might be wrong, I would give him credit for showing his work even if it didn't lead where he expected, but instead he pivots to focusing on Tether's role in money laundering without acknowledging that his original theory took a serious blow.
In Faux's pursuit of Tether, he wanders through most of the other elements of the cryptocurrency bubble, and that's the strength of this book. Rather than write Number Go Up as a traditional history, Faux chooses to closely follow his own thought processes and curiosity. This has the advantage of giving Faux an easy and natural narrative, something that non-fiction books of this type can struggle with, and it lets Faux show how confusing and off-putting the cryptocurrency world is to an outsider.
The best parts of this book were the parts unrelated to Tether. Faux provides an excellent summary of the Axie Infinity speculative bubble and even traveled to the Philippines to interview people who were directly affected. He then wandered through the bizarre world of NFTs, and his first-hand account of purchasing one (specifically a Mutant Ape) to get entrance to a party (which sounded like a miserable experience I would pay money to get out of) really drives home how sketchy and weird cryptocurrency-related software and markets can be. He also went to El Salvador to talk to people directly about the country's supposed embrace of Bitcoin, and there's no substitute for that type of reporting to show how exaggerated and dishonest the claims of cryptocurrency adoption are.
The disadvantage of this personal focus on Faux himself is that it sometimes feels tedious or sensationalized. I was much less interested in his unsuccessful attempts to interview the founder of Tether than Faux was, and while the digression into forced labor compounds in Cambodia devoted to pig butchering scams was informative (and horrific), I think Faux leaned too heavily on an indirect link to Tether. His argument is that cryptocurrency enables a type of money laundering that is particularly well-suited to supporting scams, but both scams and this type of economic slavery existed before cryptocurrency and will exist afterwards. He did not make a very strong case that Tether was uniquely valuable as a money laundering service, as opposed to a currently useful tool that would be replaced with some other tool should it go away.
This part of the book is essentially an argument that money laundering is bad because it enables crime, and sure, to an extent I agree. But if you're going to put this much emphasis on the evils of money laundering, I think you need to at least acknowledge that many people outside the United States do not want to give US government, which is often openly hostile to them, veto power over their financial transactions. Faux does not.
The other big complaint I have with this book, and with a lot of other reporting on cryptocurrency, is that Faux is sloppy with the term "Ponzi scheme." This is going to sound like nit-picking, but I think this sloppiness matters because it may obscure an ongoing a shift in cryptocurrency markets.
A Ponzi scheme is not any speculative bubble. It is a very specific type of fraud in which investors are promised improbably high returns at very low risk and with safe principal. These returns are paid out, not via investment in some underlying enterprise, but by taking the money from new investments and paying it to earlier investors. Ponzi schemes are doomed because satisfying their promises requires a constantly increasing flow of new investors. Since the population of the world is finite, all Ponzi schemes are mathematically guaranteed to eventually fail, often in a sudden death spiral of ever-increasing promises to lure new investors when the investment stream starts to dry up.
There are some Ponzi schemes in cryptocurrency, but most practices that are called Ponzi schemes are not. For example, Faux calls Axie Infinity a Ponzi scheme, but it was missing the critical elements of promised safe returns and fraudulently paying returns from the investments of later investors. It was simply a speculative bubble that people bought into on the assumption that its price would increase, and like any speculative bubble those who sold before the peak made money at the expense of those who bought at the peak.
The reason why this matters is that Ponzi schemes are a self-correcting problem. One can decry the damage caused when they collapse, but one can also feel the reassuring certainty that they will inevitably collapse and prove the skeptics correct. The same is not true of speculative assets in general. You may think that the lack of an underlying economic justification for prices means that a speculative bubble is guaranteed to collapse eventually, but in the famous words of Gary Schilling, "markets can remain irrational a lot longer than you and I can remain solvent."
One of the people Faux interviews explains this distinction to him directly:
Rong explained that in a true Ponzi scheme, the organizer would have to handle the "fraud money." Instead, he gave the sneakers away and then only took a small cut of each trade. "The users are trading between each other. They are not going through me, right?" Rong said. Essentially, he was arguing that by downloading the Stepn app and walking to earn tokens, crypto bros were Ponzi'ing themselves.
Faux is openly contemptuous of this response, but it is technically correct. Stepn is not a Ponzi scheme; it's a speculative bubble. There are no guaranteed returns being paid out of later investments and no promise that your principal is safe. People are buying in at price that you may consider irrational, but Stepn never promised you would get your money back, let alone make a profit, and therefore it doesn't have the exponential progression of a Ponzi scheme. One can argue that this is a distinction without a moral difference, and personally I would agree, but it matters immensely if one is trying to analyze the future of cryptocurrencies.
Schemes as transparently unstable as Stepn (which gives you coins for exercise and then tries to claim those coins have value through some vigorous hand-waving) are nearly as certain as Ponzi schemes to eventually collapse. But it's also possible to create a stable business around allowing large numbers of people to regularly lose money to small numbers of sophisticated players who are collecting all of the winnings. It's called a poker room at a casino, and no one thinks poker rooms are Ponzi schemes or are doomed to collapse, even though nearly everyone who plays poker will lose money.
This is the part of the story that I think Faux largely missed, and which Michael Lewis highlights in Going Infinite. FTX was a legitimate business that made money (a lot of money) off of trading fees, in much the same way that a casino makes money off of poker rooms. Lots of people want to bet on cryptocurrencies, similar to how lots of people want to play poker. Some of those people will win; most of those people will lose. The casino doesn't care. Its profit comes from taking a little bit of each pot, regardless of who wins. Bankman-Fried also speculated with customer funds, and therefore FTX collapsed, but there is no inherent reason why the core exchange business cannot be stable if people continue to want to speculate in cryptocurrencies. Perhaps people will get tired of this method of gambling, but poker has been going strong for 200 years.
It's also important to note that although trading fees are the most obvious way to be a profitable cryptocurrency casino, they're not the only way. Wall Street firms specialize in finding creative ways to take a cut of every financial transaction, and many of those methods are more sophisticated than fees. They are so good at this that buying and selling stock through trading apps like Robinhood is free. The money to run the brokerage platform comes from companies that are delighted to pay for the opportunity to handle stock trades by day traders with a phone app. This is not, as some conspiracy theories would have you believe, due to some sort of fraudulent price manipulation. It is because the average person with a Robinhood phone app is sufficiently unsophisticated that companies that have invested in complex financial modeling will make a steady profit taking the other side of their trades, mostly because of the spread (the difference between offered buy and sell prices).
Faux is so caught up in looking for Ponzi schemes and fraud that I think he misses this aspect of cryptocurrency's transformation. Wall Street trading firms aren't piling into cryptocurrency because they want to do securities fraud. They're entering this market because there seems to be persistent demand for this form of gambling, cryptocurrency markets reward complex financial engineering, and running a legal casino is a profitable business model.
Michael Lewis appears as a character in this book, and Faux portrays him quite negatively. The root of this animosity appears to stem from a cryptocurrency conference in the Bahamas that Faux attended. Lewis interviewed Bankman-Fried on stage, and, from Faux's account, his questions were fawning and he praised cryptocurrencies in ways that Faux is certain he knew were untrue. From that point on, Faux treats Lewis as an apologist for the cryptocurrency industry and for Sam Bankman-Fried specifically.
I think this is a legitimate criticism of Lewis's methods of getting close to the people he wants to write about, but I think Faux also makes the common mistake of assuming Lewis is a muckraking reporter like himself. This has never been what Lewis is interested in. He writes about people he finds interesting and that he thinks a reader will also find interesting. One can legitimately accuse him of being credulous, but that's partly because he's not even trying to do the same thing Faux is doing. He's not trying to judge; he's trying to understand.
This shows when it comes to the parts of this book about Sam Bankman-Fried. Faux's default assumption is that everyone involved in cryptocurrency is knowingly doing fraud, and a lot of his research is looking for evidence to support the conclusion he had already reached. I don't think there's anything inherently wrong with that approach: Faux is largely, although not entirely, correct, and this type of hostile journalism is incredibly valuable for society at large. Upton Sinclair didn't start writing The Jungle with an open mind about the meat-packing industry. But where Faux and Lewis disagree on Bankman-Fried's motivations and intentions, I think Lewis has the much stronger argument.
Faux's position is that Bankman-Fried always intended to steal people's money through fraud, perhaps to fund his effective altruism donations, and his protestations that he made mistakes and misplaced funds are obvious lies. This is an appealing narrative if one is looking for a simple villain, but Faux's evidence in support of this is weak. He mostly argues through stereotype: Bankman-Fried was a physics major and a Jane Street trader and therefore could not possibly be the type of person to misplace large amounts of money or miscalculate risk.
If he wants to understand how that could be possible, he could read Going Infinite? I find it completely credible that someone with what appears to be uncontrolled, severe ADHD could be adept at trading and calculating probabilities and yet also misplace millions of dollars of assets because he wasn't thinking about them and therefore they stopped existing.
Lewis made a lot of people angry by being somewhat sympathetic to someone few people wanted to be sympathetic towards, but Faux (and many others) are also misrepresenting his position. Lewis agrees that Bankman-Fried intentionally intermingled customer funds with his hedge fund and agrees that he lied about doing this. His only contention is that Bankman-Fried didn't do this to steal the money; instead, he invested customer money in risky bets that he thought would pay off. In support of this, Lewis made a prediction that was widely scoffed at, namely that much less of FTX's money was missing than was claimed, and that likely most or all of it would be found.
And, well, Lewis was basically correct? The FTX bankruptcy is now expected to recover considerably more than the amount of money owed to creditors. Faux argues that this is only because the bankruptcy clawed back assets and cryptocurrencies have gone up considerably since the FTX bankruptcy, and therefore that the lost money was just replaced by unexpected windfall profits on other investments, but I don't think this point is as strong as he thinks it is. Bankman-Fried lost money on some of what he did with customer funds, made money on other things, and if he'd been able to freeze withdrawals for the year that the bankruptcy froze them, it does appear most of the money would have been recoverable. This does not make what he did legal or morally right, but no one is arguing that, only that he didn't intentionally steal money for his own personal gain or for effective altruism donations. And on that point, I don't think Faux is giving Lewis's argument enough credit.
I have a lot of complaints about this book because I know way too much about this topic than anyone should probably know. I think Faux missed the plot in a couple of places, and I wish someone would write a book about where cryptocurrency markets are currently going. (Matt Levine's Money Stuff newsletter is quite good, but it's about all sorts of things other than cryptocurrency and isn't designed to tell a coherent story.) But if you know less about cryptocurrency and just want to hear the details of the run-up to the 2022 bubble, this is a great book for that. Faux is writing for people who are already skeptical and is not going to convince people who are cryptocurrency true believers, but that's fine. The details are largely correct (and extensively footnoted) and will satisfy most people's curiosity.
Lewis's Going Infinite is a better book, though. It's not the same type of book at all, and it will not give you the broader overview of the cryptocurrency world. But if you're curious about what was going through the head of someone at the center of all of this chaos, I think Lewis's analysis is much stronger than Faux's. I'm happy I read both books.
Rating: 8 out of 10
parallel @ Savannah: GNU Parallel 20241222 ('Bashar') released [stable]
GNU Parallel 20241222 ('Bashar') has been released. It is available for download at: lbry://@GnuParallel:4
Quote of the month:
"Do this with gnu parallel" is the Copilot hack of the day
-- Chase Clark @chasingmicrobes.bsky.social
New in this release:
- No new features. This is a candidate for a stable release.
- Bug fixes and man page updates.
GNU Parallel - For people who live life in the parallel lane.
If you like GNU Parallel record a video testimonial: Say who you are, what you use GNU Parallel for, how it helps you, and what you like most about it. Include a command that uses GNU Parallel if you feel like it.
GNU Parallel is a shell tool for executing jobs in parallel using one or more computers. A job can be a single command or a small script that has to be run for each of the lines in the input. The typical input is a list of files, a list of hosts, a list of users, a list of URLs, or a list of tables. A job can also be a command that reads from a pipe. GNU Parallel can then split the input and pipe it into commands in parallel.
If you use xargs and tee today you will find GNU Parallel very easy to use as GNU Parallel is written to have the same options as xargs. If you write loops in shell, you will find GNU Parallel may be able to replace most of the loops and make them run faster by running several jobs in parallel. GNU Parallel can even replace nested loops.
GNU Parallel makes sure output from the commands is the same output as you would get had you run the commands sequentially. This makes it possible to use output from GNU Parallel as input for other programs.
For example you can run this to convert all jpeg files into png and gif files and have a progress bar:
parallel --bar convert {1} {1.}.{2} ::: *.jpg ::: png gif
Or you can generate big, medium, and small thumbnails of all jpeg files in sub dirs:
find . -name '*.jpg' |
parallel convert -geometry {2} {1} {1//}/thumb{2}_{1/} :::: - ::: 50 100 200
You can find more about GNU Parallel at: http://www.gnu.org/s/parallel/
You can install GNU Parallel in just 10 seconds with:
$ (wget -O - pi.dk/3 || lynx -source pi.dk/3 || curl pi.dk/3/ || \
fetch -o - http://pi.dk/3 ) > install.sh
$ sha1sum install.sh | grep 883c667e01eed62f975ad28b6d50e22a
12345678 883c667e 01eed62f 975ad28b 6d50e22a
$ md5sum install.sh | grep cc21b4c943fd03e93ae1ae49e28573c0
cc21b4c9 43fd03e9 3ae1ae49 e28573c0
$ sha512sum install.sh | grep ec113b49a54e705f86d51e784ebced224fdff3f52
79945d9d 250b42a4 2067bb00 99da012e c113b49a 54e705f8 6d51e784 ebced224
fdff3f52 ca588d64 e75f6033 61bd543f d631f592 2f87ceb2 ab034149 6df84a35
$ bash install.sh
Watch the intro video on http://www.youtube.com/playlist?list=PL284C9FF2488BC6D1
Walk through the tutorial (man parallel_tutorial). Your command line will love you for it.
When using programs that use GNU Parallel to process data for publication please cite:
O. Tange (2018): GNU Parallel 2018, March 2018, https://doi.org/10.5281/zenodo.1146014.
If you like GNU Parallel:
- Give a demo at your local user group/team/colleagues
- Post the intro videos on Reddit/Diaspora*/forums/blogs/ Identi.ca/Google+/Twitter/Facebook/Linkedin/mailing lists
- Get the merchandise https://gnuparallel.threadless.com/designs/gnu-parallel
- Request or write a review for your favourite blog or magazine
- Request or build a package for your favourite distribution (if it is not already there)
- Invite me for your next conference
If you use programs that use GNU Parallel for research:
- Please cite GNU Parallel in you publications (use --citation)
If GNU Parallel saves you money:
- (Have your company) donate to FSF https://my.fsf.org/donate/
GNU sql aims to give a simple, unified interface for accessing databases through all the different databases' command line clients. So far the focus has been on giving a common way to specify login information (protocol, username, password, hostname, and port number), size (database and table size), and running queries.
The database is addressed using a DBURL. If commands are left out you will get that database's interactive shell.
When using GNU SQL for a publication please cite:
O. Tange (2011): GNU SQL - A Command Line Tool for Accessing Different Databases Using DBURLs, ;login: The USENIX Magazine, April 2011:29-32.
GNU niceload slows down a program when the computer load average (or other system activity) is above a certain limit. When the limit is reached the program will be suspended for some time. If the limit is a soft limit the program will be allowed to run for short amounts of time before being suspended again. If the limit is a hard limit the program will only be allowed to run when the system is below the limit.
gtypist @ Savannah: GNU Typist 2.10 released
This is a major release
Changes in 2.10:
- new welcome screen
- new P lesson series for programmers
- fixes for various lessons
- new Romanian lessons
- expand the S lesson series with a new quotation and a few more passages from Shakespeare
- jump over whitespace characters at the beginning of lines in lessons
- fix the terminal resize bug
- fix a few compilation warnings
- add the Romanian translation
- updates to a few translations
- few updates to the documentation
- update the project license to GPL3+
- remove or update the lessons incompatible with the new license
- update the KTouch lesson import script
- fix warnings from help2man generated manual pages
- fix a few comments
Sources for this release can be downloaded here:
https://ftp.gnu.org/gnu/gtypist/gtypist-2.10.tar.gz
Top Open Source licenses in 2024
The Open Source Initiative (OSI) serves as the premier resource for millions of visitors seeking essential information about OSI-Approved licenses. The enriched license pages go beyond basic descriptions, incorporating relevant metadata to provide deeper insights and better support for Open Source users, developers, and organizations.
The most popular licenses include the MIT license, BSD licenses (3-clause and 2-clause), Apache 2.0 license, and GNU General Public license (2.0 and 3.0). These licenses continue to lead the way as the go-to choices for countless Open Source projects worldwide, reflecting their widespread adoption and versatility.
Here’s the top 20 OSI-Approved licenses most frequently sought out by our community in 2024 based on number of pageviews.
LicensePageviewsVisitorsmit1.7M1Mbsd-3-clause247.9K207Kapache-2-0244.6K184Kbsd-2-clause115.8K98.2Kgpl-2-083.8K71.7Kgpl-3-072.4K61.5Kisc-license-txt48.7K34.9Klgpl-2-121.6K19Klgpl-3-017.8K15.4KOFL-1.116.9K14.1Kmpl-2-014.8K12.8Kpostgresql14.6K12Kms-pl-html13.8K9.9Kagpl-v313.3K11.1K0bsd13.1K11.1Kbsd-1-clause10.3K8.7Kafl-3-0-php10.1K8.6Kcpl1-0-txt8.1K5.9Kosl-3-0-php7.2K6.3Kmit-06.7K5.8KIn 2025, we plan to further enhance these license pages with even more features, insights, and user-focused improvements. Whether you’re a seasoned developer, a project maintainer, or just beginning your Open Source journey, these resources will continue to evolve to meet your needs. If you are interested in supporting our work, please consider donating to or sponsoring the OSI.
Russ Allbery: Dropping the git protocol
Ever since I started converting my free software repositories to Git and hosting them on git.eyrie.org, I've made them available via the Git network protocol (the one that uses git:// URLs). This protocol doesn't support TLS or any other form of integrity checking on the wire and has been gently deprecated for some time. Recent changes to git daemon broke the way I was managing permissions for my personal repositories, which meant that the git://git.eyrie.org/ URLs have been broken for several months. Since no one has complained or apparently noticed, this seems like a good excuse to drop support entirely and run one fewer service.
All of my personal repositories will continue to be accessible via Git over HTTPS, which is now the standard for anonymous Git checkouts. If the prior URL was git://git.eyrie.org/area/package.git, the new URL is https://git.eyrie.org/git/area/package.git. I've updated my web pages accordingly. This protocol provides integrity protection on the wire and a moderate amount of authentication of my server via a Let's Encrypt certificate.
Daniel Roy Greenfeld: TIL: SequentialTaskSet for Locust
SequentialTaskSet makes it so Locust tasks happen in a particular order, which ensures your simulated users are clicking around in a more human manner at a more human pace. Attribution goes to Audrey Roy Greenfeld.
You can see it in action in the now updated previous entry on the topic of Locust for load testing.
Daniel Roy Greenfeld: TIL: Making pytest use Ipython's PDB
Usage:
pdb tests/test_things::test_broken_thingDaniel Roy Greenfeld: TIL: Fractional Indexing
In the past when I've done this for web pages and various other interfaces it has been a mess. I've built ungainly sort order in numeric or alphanumeric batches. Inevitably there is a conflict, often sooner rather than later. So sorting a list of things often means updating all the elements to preserve the order in the datastore. I've learned to mark each element with a big value, but it's ugly and ungainly
Fortunately for me, going forward, I now know about Fractional Indexing.
References:
- https://www.figma.com/blog/realtime-editing-of-ordered-sequences/
- https://observablehq.com/@dgreensp/implementing-fractional-indexing
- https://github.com/httpie/fractional-indexing-python
Daniel Roy Greenfeld: TIL: Python Dictonary Merge Operator
Until today I did this:
# Make first dict num_map = { 'one': '1', 'two': '2', 'three': '3', 'four': '4', 'five': '5', 'six': '6', 'seven': '7', 'eight': '8', 'nine': '9' } # Add second dict num_map.update({str(x):str(x) for x in range(1,10)}) print(num_map) The operator wayNow thanks to Audrey Roy Greenfeld now I know I can do this:
# Make first dict while adding second dict num_map = { 'one': '1', 'two': '2', 'three': '3', 'four': '4', 'five': '5', 'six': '6', 'seven': '7', 'eight': '8', 'nine': '9' } | {str(x):str(x) for x in range(1,10)} print(num_map)Daniel Roy Greenfeld: TIL: Python's defaultdict takes a factory function
I've never really paid attention to this object but maybe I should have. It takes a single argument of a callable function. If you put in Python types it sets the default value to those types. For example, if I use an int at the instantiating argument then it gives us a zero.
>>> from collections import defaultdict >>> >>> mydict = defaultdict(int) >>> print(mydict['anykey']) 0Note that defaultdict also act like regular dictionaries, in that you can set keys. So mydict['me'] = 'danny' will work as you expect it to with a standard dictionary.
It gets more interesting if we pass in a more dynamic function. In the exmaple below we use random.randint and a lambda to make the default value be a random number between 1 and 100.
>>> from random import randint >>> >>> random_values = defaultdict(lambda: randint(1,100))Let's try it out!
>>> for i in range(5): >>> print(random_values[i]) >>> print(random_values) 29 90 56 42 70 defaultdict(<function <lambda> at 0x72d292bb6de0>, {0: 29, 1: 90, 2: 56, 3: 42, 4: 70})Attribution goes to Laksman Prasad, who pointing this out and encouraging me to closer look at defaultdict.
Daniel Roy Greenfeld: TIL: How to reset Jupyter notebook passwords
Attribution for this goes to Johno Whitaker.
Daniel Roy Greenfeld: TIL: Arity
I'm excited to have learned there's a word for the count of arguments to a function/method/class: arity. Throughout my career I would have called this any of the following:
- number_of_args
- param_count
- numargs
- intArgumentCount
Thanks to Simon Willison for using it in a library or two and making me look up the word.
Daniel Roy Greenfeld: TIL: Using hx-swap-oob with FastHTML
Until now I didn't use this HTMX technique, but today Audrey Roy Greenfeld and I dove in together to figure it out. Note that we use language that may not match HTMX's description, sometimes it's better to put things into our own words so we understand it better.
from fasthtml.common import * app,rt = fast_app() def mk_row(name, email): return Tbody( # Only the Tr element and its children is being # injected, the Tbody isn't being injected Tr(Td(name), Td(email)), # This tells HTMX to inject this row at the end of # the #contacts-tbody DOM element hx_swap_oob="beforeend:#contacts-tbody", ), @rt def index(): return Div( H2("Contacts"), Table( Thead(Tr(Th("Name"), Th("Email"))), Tbody( Tr(Td("Audrey"), Td("mommy@example.com")), Tr(Td("Uma"), Td("kid@example.com")), Tr(Td("Daniel"), Td("daddy@example.com")), # Identifies the contacts-tbody DOM element id="contacts-tbody", ), ), H2("Add a Contact"), Form( Label("Name", Input(name="name", type="text")), Label("Email", Input(name="email", type="email")), Button("Save"), hx_post="/contacts", # Don't swap out the contact form hx_swap='none', # Reset the form and put focus onto the name field hx_on__after_request="this.reset();this.name.focus();" ) ) @rt def contacts(name:str,email:str): print(f"Adding {name} and {email} to table") return mk_row(name,email) serve()To verify the behavior, view the rendered elements in your browser of choice before, after, and during submitting the form.
Daniel Roy Greenfeld: TIL: Using Python to removing prefixes and suffixes
Starting in Python 3.9, s.removeprefix() and s.removesuffix() were added as str built-ins. Which easily covers all the versions of Python I currently support.
Usage for removeprefix(): >>> 'Spam, Spam'.removeprefix('Spam') ', Spam' >>> 'Spam, Spam'.removeprefix('This is not in the prefix') 'Spam, Spam' Usage for removesuffix(): >>> 'Spam, Spam'.removesuffix('Spam') 'Spam, ' >>> 'Spam, Spam'.removesuffix('This is not in the suffix') 'Spam, Spam'Daniel Roy Greenfeld: Using locust for load testing
Locust is a Python library that makes it relatively straightforward to write Python tests. This heavily commented code example explains each section of code. To use locust:
- Install locust: pip install locust
- Copy the file below into the directory where you want to run locust
- In that directory, at the command-line, type: locust
- Open http://localhost:8089/
For reference, this is the test site used to create the above locustfile. I'll admit that the above test is incomplete, a lot more tasks could be added to hit web routes. To use it:
- Install FastHTML: pip install python-fasthtml
- Copy the file into the directory you want to run it
- In that directory, at the command-line, type: python cats.py
- Open http://localhost:5001/
- 2024-11-08 Use SequentialTaskSet as recommended by Audrey Roy Greenfeld
- 2024-11-08 Fixed a few bugs in cats.py
Daniel Roy Greenfeld: TIL: Autoreload for Jupyter notebooks
Add these commands to the top of a notebook within a Python cell. Thanks to Jeremy Howard for the tip.
%load_ext autoreload %autoreload 2Daniel Roy Greenfeld: TIL: run vs source
A run launches a child process in a new bash within bash, so variables last only the lifetime of the command. This is why launching Python environments doesn't use run.
./list-things.sh SourceA source is the current bash, so variables last beyond the running of a script. This is why launching Python environments use source.
source ~/.venv/bin/activateTalking Drupal: Talking Drupal #481 - Drupal Marketing & Drupal CMS
Today we are talking about Drupal Marketing, how it applies to Drupal CMS, and what a Drupal and Drupal CMS Marketing Future look like with guest Suzanne Dergacheva. We’ll also cover Drupal 11.1 as our module of the week.
For show notes visit: https://www.talkingDrupal.com/481
Topics- Drupal marketing moves
- New brand
- Marketing people at the DA
- Goal of marketing
- How does this impact Drupal CMS
- Drupal CMS marketing
- How will you educate people about the differences between core and CMS
- Any challenges
- How do you like the new homepage
- Next steps to move the brand forward
- Case studies
- Why did you volunteer
- If someone wants to get involved how can they
- Brand Portal
- Drupal.org homepage
- Case study guidelines
- Webinar with Suzanne and Rosie Gladden about Key Strategies for Expanding Drupal’s Reach
- Advent Calendar - Freelock.com - 24 days of Drupal automations
Nic Laflin - nLighteneddevelopment.com nicxvan John Picozzi - epam.com johnpicozzi Suzanne Dergacheva - evolvingweb.com pixelite
MOTW CorrespondentMartin Anderson-Clutz - mandclu.com mandclu
- Brief description:
- Have you been wanting a version of Drupal with improvements to the recipes system, the ability to write hooks as classes, and an icon management API? The new Drupal 11.1 release has all of that and more.
- Module name/project name:
- Brief history
- How old: created on Dec 16 by catch of Tag1 and Third & Grove
- Module features and usage
- We’ve talked a number times on this show about the recipes system, particularly because it’s at the heart of Drupal CMS. In Drupal 11.1 recipes can define whether or not to use strict comparison for provided configuration, and there are a ton of new config actions. These allow your recipe to place blocks, take user input, enable layout builder for content types, clone configuration entities and more. It’s a huge leap forward, and I think you’ll quickly see a number of recipes that require Drupal 11.1 or newer.
- Hooks have long been a powerful Drupalism that allow for deep customization of how your website functions. These hooks can now be written as classes, thanks to the new Hook attribute on methods. This will bring many of the object-oriented benefits of modern Drupal to the hooks system, and should also make it easier for developers new to Drupal to understand the code to create these customizations.
- A new Icon Management API allows themes and modules to define icon packs, with unique identifiers for each included icon.
- Drupal 11.1 also includes PHP 8.4 support. I haven’t been able to find any data on speed improvements compared to PHP 8.3, but there are interesting new features like property hooks, asymmetric visibility, new functions for finding array items, and more
- There are plans to use Workspaces for content moderation, so the UI for Workspaces is now in a separate module. For new site builds if you want your editors to be able to use Workspaces, you’ll need to remember to enable this new UI module as well
- New installs of Drupal 11.1 will also see improvements to the initial experience. These include defaulting to admin-created user accounts only, not adding the body field by default when creating new content types, and more.
- Drupal 11.1 also includes a new views entity reference filter, opt-in render caching for forms, and improved browser and CDN caching for Javascript and CSS, among a host of other improvements.
- A number of these improvements will also find their way into the upcoming 10.4 release, ensuring, for example, that recipes built to use the new config actions can be used with Long-Term Support (LTS) versions of Drupal, that will be supported until the stable release of Drupal 12 in mid- to late-2026
texinfo @ Savannah: Texinfo 7.2 released
We have released version 7.2 of Texinfo, the GNU documentation format.
It's available via a mirror (xz is much smaller than gz, but gz is available too just in case):
http://ftpmirror.gnu.org/texinfo/texinfo-7.2.tar.xz
http://ftpmirror.gnu.org/texinfo/texinfo-7.2.tar.gz
Please send any comments to bug-texinfo@gnu.org.
Full announcement:
https://lists.gnu.org/archive/html/bug-texinfo/2024-12/msg00043.html
DXPR: A Christmas Message: Empowering Communities with AI for a Brighter Digital Future
This Christmas, I want to share a vision for the year ahead—one rooted in the principles of openness, collaboration, and empowerment. Just as the spirit of giving inspires acts of kindness, the open-source community, including Drupal, shows us how collective effort can create tools that serve everyone. At this pivotal moment in the evolution of artificial intelligence, I believe it’s our responsibility to ensure that AI becomes a force for good.
AI and the changing dynamics of influenceArtificial intelligence is rapidly transforming how communication happens. Governments and corporations use AI to dominate narratives, leveraging its power for hybrid warfare, infodomwarfare, and highly targeted campaigns. These tools amplify their voices and shape public opinion at an unprecedented scale.
But while some benefit from this technological leap, countless others are left behind. Grassroots movements, small organizations, and individuals working for positive change often lack access to the same advanced tools. This disparity risks creating a digital landscape where only the most powerful can influence and persuade.
AI has the potential to level the playing field—but only if we act now to make it accessible to everyone, not just those with vast resources. The Drupal community has long championed the idea that technology should empower rather than exclude, and this belief continues to inspire our work.
AI as a tool for empowermentAI offers powerful capabilities for creating, translating, and distributing content. But to truly empower communities, we must focus on making these tools both affordable and usable for all.
Here’s where AI can make the greatest impact:
- Empowering human rights advocates: AI tools can protect their causes, amplify their messages, and counter deceitful propaganda campaigns effectively.
- Breaking language barriers: Advanced localization features allow for accurate and culturally resonant translations, opening up global audiences.
- Countering misinformation: By identifying and responding to false narratives quickly, AI can help protect the credibility of those working for truth.
- Streamlining communication: Automation of repetitive tasks, such as content generation or scheduling, frees up time for more impactful work.
These applications make AI a practical and transformative tool, not just for large organizations, but for anyone looking to make a difference.
AI’s role: a realistic perspectiveLet’s be clear: AI will continue to play a significant role in shaping narratives, both for good and ill. It will be used for propaganda, hybrid warfare, and to amplify echo chambers. We cannot completely control this reality.
However, we can ensure that AI is also a force for good—a tool that enables collaboration, fosters mutual understanding, and empowers those working for positive change. By giving more people access to these tools, we can shift the balance away from dominance and toward dialogue.
This isn’t about revolutionizing AI’s role overnight; it’s about giving more people the resources they need to participate in the conversation.
Looking ahead with optimismAI is here to stay, and its impact will only grow. While challenges remain, the potential for AI to empower individuals and communities is enormous. By democratizing these tools, we can help bridge divides, amplify diverse voices, and foster a digital world that values collaboration over competition.
In this rapidly evolving landscape, the key to a fairer future is accessibility. With the right tools, anyone—whether a grassroots organizer, a small business, or a passionate advocate—can create, influence, and inspire. The Drupal community and the spirit of open-source collaboration remind us that technology can serve everyone, not just a privileged few.
As we celebrate this Christmas season, let’s also look forward to a new year filled with opportunity—where AI tools bring us closer together and empower us all to shape a brighter future. The work we are doing right now is shaping the world of tomorrow that is changing so rapidly.
Category Drupal Community Jurriaan Roelofs