Feed aggregator

CodeSOD: A Date with Gregory

The Daily WTF - Tue, 2025-09-30 08:30

Calendars today may be controlled by a standards body, but that's hardly an inherent fact of timekeeping. Dates and times are arbitrary and we structure them to our convenience.

If we rewind to ancient Rome, you had the role of Pontifex Maximus. This was the religious leader of Rome, and since honoring the correct feasts and festivals at the right time was part of the job, it was also the standards body which kept the calendar. It was, ostensibly, not a political position, but there was also no rule that an aspiring politician couldn't hold both that post and a political post, like consul. This was a loophole Julius Caesar ruthlessly exploited; if his political opposition wanted to have an important meeting on a given day, whoops! The signs and portents tell us that we need to have a festival and no work should be done!

There's no evidence to prove it, but Julius Caesar is exactly the kind of petty that he probably skipped Pompey's birthday every year.

Julius messed around with the calendar a fair bit for political advantage, but the final version of it was the Julian calendar and that was our core calendar for the next 1500 years or so (and in some places, still is the preferred calendar). At that point Pope Gregory came in, did a little refactoring and fixed the leap year calculations, and recalibrated the calendar to the seasons. The down side of that: he had to skip 13 days to get things back in sync.

The point of this historical digression is that there really is no point in history when dates made sense. That still doesn't excuse today's Java code, sent to us by Bernard.

GregorianCalendar gregorianCalendar = getGregorianCalendar(); XMLGregorianCalendar xmlVersion = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); return gregorianCalendar.equals(xmlVersion .toGregorianCalendar());

Indenting as per the original.

The GregorianCalendar is more or less what it sounds like, a calendar type in the Gregorian system, though it's worth noting that it's technically a "combined" calendar that also supports Julian dates prior to 15-OCT-1582 (with a discontinuity- it's preceeded by 04-OCT-1582). To confuse things even farther, this is a bit of fun in the Javadocs:

Prior to the institution of the Gregorian calendar, New Year's Day was March 25. To avoid confusion, this calendar always uses January 1. A manual adjustment may be made if desired for dates that are prior to the Gregorian changeover and which fall between January 1 and March 24.

"To avoid confusion." As if confusion is avoidable when crossing between two date systems.

None of that has anything to do with our code sample, it's just interesting. Let's dig into the code.

We start by fetching a GregorianCalendar object. We then construct an XMLGregorianCalendar object off of the original GregorianCalendar. Then we convert the XMLGregorianCalendar back into a GregorianCalendar and compare them. You might think that this then is a function which always returns true, but Java's got a surprise for you: converting to XMLGregorianCalendar is lossy so this function always returns false.

Bernard didn't have an explanation for why this code exists. I don't have an explanation either, besides human frailty. No matter if the original developer expected this to be true or false at any given time, why are we even doing this check? What do we hope to learn from it?

[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.
Categories: Computer

Climate Change Spurs Rare Hybrid Between Blue Jay and Green Jay

Slashdot - Tue, 2025-09-30 05:30
Researchers in Texas confirmed the first documented wild hybrid between a blue jay and a green jay -- a rare pairing that is likely a result of climate change and habitat shifts. Slashdot reader fjo3 shares a report from CNN: "We think it's the first observed vertebrate that's hybridized as a result of two species both expanding their ranges due, at least in part, to climate change," said Brian Stokes, a doctoral student of biology at the University of Texas at Austin and first author of the study published September 10 in the journal Ecology and Evolution. The vividly colored green jay is found in parts of South and Central America, Mexico and a limited portion of southern Texas. But since 2000, the tropical bird's territory has expanded north by hundreds of kilometers -- more than 100 miles and about 2 degrees of latitude -- along the Rio Grande and up toward San Antonio, said study coauthor Timothy Keitt. Avid birders across Central Texas have taken note, sharing sightings of the emerald birds on social media and apps like eBird. Keitt, a professor of integrative biology at UT Austin, has been keeping tabs on their rapid northward creep since 2018. "They're pretty unmistakable in the field," he told CNN. "You see a green jay and you absolutely know that it's a green jay." Stokes joined Keitt's project a few years later, trapping birds to take blood samples for genetic analysis and releasing them back into the wild. While monitoring social media for green jay sightings in May 2023, Stokes came across an intriguing post on a Facebook group called Texbirds. A woman in a suburb of San Antonio shared a photo of an unusual bird that didn't look like any jay Stokes or Keitt had ever seen. "He happened to notice that this person posted a picture of this odd jay, and immediately told me, and we got in the car and drove down to find it right away," Keitt said. He and Stokes described their finding as one of the "increasingly unexpected outcomes" that arise when global warming and land development converge to drive animal populations to new habitat ranges. This, they wrote, can lead to unpredictable animal interactions -- in this case, between a tropical species and a temperate one -- and create never-before-seen ecological communities.

Read more of this story at Slashdot.

Categories: Computer, News

Reddit Mods Sued By YouTuber Ethan Klein Fight Efforts To Unmask Them

Slashdot - Tue, 2025-09-30 04:20
alternative_right shares a report from 404 Media: Critics of YouTuber Ethan Klein are pushing back on subpoenas that would reveal their identities as part of an ongoing legal fight between Klein and his detractors. Klein is a popular content creator whose YouTube channel has more than 2 million subscribers. He's also involved in a labyrinthine personal and legal beef with three other content creators and the moderators of a subreddit that criticizes his work. Klein filed a legal motion to compel Discord and Reddit to reveal the identities of those moderators, a move their lawyers say would put them in harm's way and stifle free speech on the internet forever. [...] On July 31, a judge allowed Klein's lawyers to file a subpoena with Reddit and Discord that would reveal the identities of the people running r/h3snark and an associated Discord server. On September 22, lawyers for the defendants filed a motion to quash the subpoenas. "On its face, the Action is about copyright infringement," the latest filing said. "At its heart, however, the Action is about stifling criticism and seeking retribution by unmasking individuals for perceived reputational harms TEI [Klein's production company] attributes to [John Doe moderators] unrelated to TEI's intellectual property rights." [...] The anonymity of places like Reddit and Discord grant a layer of protection to people seeking to critique power. This case could set a dangerous precedent, the lawyers believe. "If the court allows TEI's Subpoenas, it would enable TEI to impose a considerable price on Does' use of the vehicle of anonymous speech -- including public exposure, real risks of retaliation and actual harm, and the financial and other burdens of defending the Action," the filing said. The filing added: "Very few would-be commentators are prepared to bear costs of this magnitude. So, when word gets out that the price tag of criticizing Ethan is this high -- that speech will disappear. But that is precisely what Ethan Klein wants."

Read more of this story at Slashdot.

Categories: Computer, News

Streameast Reclaims Domain Name Previously Seized By US Government

Slashdot - Tue, 2025-09-30 03:40
Pirate sports streaming site Streameast has quietly reclaimed the Streameast.xyz domain after U.S. authorities allowed it to expire, despite having seized it under a federal warrant in 2024. TorrentFreak reports: While researching both old and newly-seized Streameast domains recently, we noticed that Streameast.xyz expired earlier this year. Apparently, it was not renewed by those who controlled it, as the seizure banner was gone. Instead, the domain appeared to have been reclaimed by the original Streameast team. While it is not listed as an official mirror site, Streameast.xyz points to content from the original site once again. And indeed, the original Streameast team confirms that the domain is theirs. It is not clear why the U.S. authorities lost control of the domain or whether it was intentional. Other domain names covered by the same seizure warrant were renewed recently, including Streameast.io. The Streameast team might view this as a significant symbolic victory. After all, they effectively reclaimed a federally seized domain name without having to mount a legal challenge. In the grander scheme, one domain name is not going to make a massive difference. However, the U.S. government went through the trouble to obtain a federal warrant, so it's ironic to see it controlled by pirates once again.

Read more of this story at Slashdot.

Categories: Computer, News

ChatGPT Adds 'Instant Checkout' To Shop Directly In Chat

Slashdot - Tue, 2025-09-30 03:00
OpenAI unveiled Instant Checkout, a new ChatGPT feature that lets users buy stuff directly through its chatbot. Currently, the feature supports single-item purchases directly from Etsy sellers, but support for more than one million Shopify merchants is coming soon. It's also only available to U.S. ChatGPT Plus, Pro and Free users at this time. CNBC reports: OpenAI will take a fee from transactions that are completed through ChatGPT, which means Instant Checkout could become an important new revenue stream for the startup. OpenAI is not yet profitable, and is burning through cash as it works to scale up its computing infrastructure. The company declined to share specific details about how large the fees are since they are determined through confidential contracts with Etsy and Shopify. Instant Checkout is free to users and will not affect their prices, OpenAI said. "Our vision for ChatGPT -- and a lot of the technology we create, but especially ChatGPT -- is that it's not just providing you information, it is also helping you get things done in the real world," Michelle Fradin, OpenAI's product lead for ChatGPT commerce, told CNBC in an interview. The company plans to introduce multi-item carts and expand the regional availability of Instant Checkout moving forward. [...] Instant Checkout is powered by OpenAI's Agentic Commerce Protocol, which is the underlying technology that allows users to complete a transaction directly with a merchant through ChatGPT. OpenAI built the framework in partnership with the fintech company Stripe, which powers ChatGPT subscriptions. OpenAI initially decided to use Agentic Commerce Protocol for e-commerce, but Fradin said the company thinks it could be used to facilitate other types of purchases or payments as well. OpenAI is open-sourcing the framework to help merchants build integrations more quickly, and so that developers can explore different use cases, she said.

Read more of this story at Slashdot.

Categories: Computer, News

Buyers of RadioShack Accused of Running $112 Million Ponzi Scheme

Slashdot - Tue, 2025-09-30 02:20
An anonymous reader quotes a report from CBS News: A pair of e-commerce entrepreneurs who bought a number of well-known retail brands -- including RadioShack, Modell's Sporting Goods and Pier 1 Imports -- out of bankruptcy are accused of running a Ponzi scheme. The Securities and Exchange Commission on Monday accused Alex Mehr and Tai Lopez, founders of the Miami-based Retail Ecommerce Ventures (REV), of defrauding investors out of approximately $112 million. Through their holding company, Mehr and Lopez acquired distressed brick-and-mortar companies in order to turn them into successful, online-only brands. Dress Barn and Linens 'n Things were also among their acquisitions. [...] The SEC's suit alleges that between 2020 and 2022, Mehr and Lopez, "made material misrepresentations" to hundreds of investors about the bankrupt retailers they had acquired. For example, to entice individuals to invest in their acquisitions, they said their portfolio companies were "on fire" and that "cash flow is strong." They also told prospective backers that money raised for a company would only be invested in that specific firm. That proved not to be the case, according to the SEC's lawsuit, which was filed Monday in the U.S. District Court for the Southern District of Florida. "Contrary to these representations, while some of the REV Retailer Brands generated revenue, none generated any profits," the suit states. "Consequently, in order to pay interest, dividends and maturing note payments, Defendants resorted to using a combination of loans from outside lenders, merchant cash advances, money raised from new and existing investors, and transfers from other portfolio companies to cover obligations." The SEC alleges that at least $5.9 million of returns paid to investors were actually Ponzi-like payments funded by other investors, as opposed to companies' profits. Additionally, the federal regulatory agency claims that Mehr and Lopez allocated $16 million worth of investments for their own use, according to the filing.

Read more of this story at Slashdot.

Categories: Computer, News

Pages