Feed aggregator
Google Will Begin Labeling AI-Generated Images In Search
Read more of this story at Slashdot.
Snap's New Spectacles Inch Closer To Compelling AR
Read more of this story at Slashdot.
Apple Pulls iPadOS 18 For M4 iPad Pro After Bricking Complaints
Read more of this story at Slashdot.
Final Fantasy 16 Producer Asks Fans Not To Make 'Offensive Or Inappropriate' Mods
Read more of this story at Slashdot.
Instagram Makes All Teen Accounts Private
Read more of this story at Slashdot.
Mozilla Exits the Fediverse, Will Shutter Its Mastodon Server In December
Read more of this story at Slashdot.
TCL Accused of Selling Quantum Dot TVs Without Actual Quantum Dots
Read more of this story at Slashdot.
Salesforce's New AI Strategy Acknowledges That AI Will Take Jobs
Read more of this story at Slashdot.
Desktop Hypervisors Are Like Buses: None for Ages, Then Four at Once
Read more of this story at Slashdot.
IBM Acquires Kubernetes Cost Optimization Startup Kubecost
Read more of this story at Slashdot.
Exploding Pagers Injure Thousands Across Lebanon
Read more of this story at Slashdot.
FDIC Unveils Rule Forcing Banks To Keep Fintech Customer Data in Aftermath of Synapse Debacle
Read more of this story at Slashdot.
Demand For High-End Cameras is Soaring
Read more of this story at Slashdot.
UK Business Secretary Says Right To Work From Home Boosts Productivity
Read more of this story at Slashdot.
China Wants Red Flags on All AI-generated Content Posted Online
Read more of this story at Slashdot.
In US v. Google, YouTube's CEO Defends the Google Way
Read more of this story at Slashdot.
The Trumps Have Gone Full Crypto With World Liberty Financial
Read more of this story at Slashdot.
Chrome Switching To NIST-Approved ML-KEM Quantum Encryption
Read more of this story at Slashdot.
Google Backs Privately Funded Satellite Constellation For Wildfire Detection
Read more of this story at Slashdot.
CodeSOD: String Du Jour
It's not brought up frequently, but a "CodeSOD" is a "Code Sample of the Day". Martin brings us this function, entitled StringOfToday. It's in VB.Net, which, as we all know, has date formatting functions built in.
Public Function StringOfToday() As String Dim d As New DateTime d = Now Dim DayString As String If d.Day < 10 Then DayString = "0" & d.Day.ToString Else DayString = d.Day.ToString End If Dim MonthString As String If d.Month < 10 Then MonthString = "0" & d.Month.ToString Else MonthString = d.Month.ToString End If Dim YearString As String = d.Year.ToString Return YearString & MonthString & DayString End FunctionThere's not much new here, when it comes to formatting dates as strings. Grab the date, and pad it if it's less than 10. Grab the month, and pad it if it's less than 10. Grab the year, which will be 4 digits anytime within the last 2,000 years or so, so we don't need to pad it. Concatenate it all together, and voila: a date string.
Mostly, I just enjoy this because of the name. StringOfToday. It's like I'm in a restaurant. "Excuse me, waiter, what's the string of the day?" "Ah, a piquant 8 digit numeric string, hand concatenated using the finest ampersands, using a bounds checked string type." "Oh, excellent, I'm allergic to null terminators. I'll have that."
[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.