Feed aggregator
Recent Droughts Are 'Slow-Moving Global Catastrophe' - UN Report
Read more of this story at Slashdot.
Lorde's New CD is So Transparent That Stereos Can't Even Read It
Read more of this story at Slashdot.
Air Pollution Linked To Lung Cancer-Driving DNA Mutations, Study Finds
Read more of this story at Slashdot.
Google Undercounts Its Carbon Emissions, Report Finds
Read more of this story at Slashdot.
Earth's Atmosphere Hasn't Had This Much CO2 in Millions of Years
Read more of this story at Slashdot.
UK Eyes New Law as 1885 Telegraph Act Proves Inadequate for Cable Sabotage
Read more of this story at Slashdot.
Microsoft To Lay Off As Many As 9,000 Employees in Latest Round
Read more of this story at Slashdot.
Young Americans Are Spending a Whole Lot Less On Video Games This Year
Read more of this story at Slashdot.
China Successfully Tests Hypersonic Aircraft, Maybe At Mach 12
Read more of this story at Slashdot.
Bezos-Backed Methane Tracking Satellite Is Lost In Space
Read more of this story at Slashdot.
CodeSOD: And Config
It's not unusual to store format templates in your application configuration files. I'd argue it's probably a good and wise thing to do. But Phillip inherited a C# application from a developer woh "abandoned" it, and there were some choices in there.
<appSettings> <add key="xxxurl" value="[http://{1}:7777/pls/xxx/p_pristjek?i_type=MK3000{0}i_ean={3}{0}i_style=http://{2}/Content/{0}i_red=http://{2}/start.aspx/]http://{1}:7777/pls/xxx/p_pristjek?i_type=MK3000{0}i_ean={3}{0}i_style=http://{2}/Content/{0}i_red=http://{2}/start.aspx"/> </appSettings>Okay, I understand that this field contains URLs, but I don't understand much else about what's going on here. It's unreadable, but also, it has some URLs grouped inside of a [] pair, but others which aren't, and why oh why does the {0} sigil keep showing up so much?
Maybe it'll make more sense after we fill in the template?
var url = string.Format(xxxUrl, "&", xxxIp, srvUrl, productCode);Oh. It's an "&". Because we're constructing a URL query string, which also seems to contain URLs, which I suspect is going to have some escaping issues, but it's for a query string.
At first, I was wondering why they did this, but then I realized: they were avoiding escape characters. By making the ampersand a formatting parameter, they could avoid the need to write & everywhere. Which… I guess this is a solution?
Not a good solution, but… a solution.
I still don't know why the same URL is stored twice in the string, once surrounded by square brackets and once not, and I don't think I want to know. Only bad things can result from knowing that.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!
Google's Data Center Energy Use Doubled In 4 Years
Read more of this story at Slashdot.
Laptop Mag Is Shutting Down
Read more of this story at Slashdot.
Apple Accuses Former Engineer of Taking Vision Pro Secrets To Snap
Read more of this story at Slashdot.
Tinder To Require Facial Recognition Check For New Users In California
Read more of this story at Slashdot.
Figma Files For IPO
Read more of this story at Slashdot.
Xerox Buys Lexmark For $1.5 Billion As Print Industry Clings To Relevance
Read more of this story at Slashdot.
AMC Warns Moviegoers To Expect '25-30 Minutes' of Ads and Trailers
Read more of this story at Slashdot.
Amazon Deploys Its One Millionth Robot, Releases Generative AI Model
Read more of this story at Slashdot.
Landmark EU Tech Rules Holding Back Innovation, Google Says
Read more of this story at Slashdot.