Parenting expert reveals how you can end your toddler's tantrum in just TWO minutes - all thanks to a simple game
Miriam Margolyes, Charles Dance, Mike Leigh and Harry and Meghan's 'dear friend' blast the BBC for reporting on Israel in dramatic open letter
Cheryl 'is in talks for TV return' five years after her last on-screen gig as she 'kickstarts career comeback' after ex Liam Payne's death
Men accused of shooting prison officer dead in 'revenge' for exposing affair with guard are pictured at Glastonbury
REVEALED: Tupac's friends and family smoked his ashes after rapper's death at 25
Bryan Kohberger's family makes galling request as they break silence after shock Idaho murders plea deal
Clint Eastwood compared quitting 'addictive' affairs to giving up smoking after years of serial cheating ... according to new memoir
'Tenniscore' becomes the trend of the summer with royals and celebs serving up Wimbledon-inspired looks - here are the best buys
Al Pacino, 85, gets VERY cozy with another woman decades younger than him as legendary star films in Rome
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 who "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!
Amazon's latest Graviton 4 EC2 instances pack dual 300Gbps NICs
Amazon Web Services has cooked up a new Graviton 4-powered instance tuned for network-intensive applications like cloud firewalls and load balancers.…