|
|
Tomaž Štih wrote: I think this is the guy you're looking for.
Tools don't create bad code, it's the person wielding the tool!
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
That's what I always say about guns. 
|
|
|
|
|
Maybe it started as 20 separate tables each with a single column?
DBA came along and joined the tables together, so the devs did the obvious refactor?
|
|
|
|
|
When you refactor, make sure to return the collection as a DataRow so that annoying strong-typing gets eliminated.
|
|
|
|
|
This is were the Warhammer 40K universe gets it right, I think.
They lobotomize and reeducate people like that. Clean, cost effective, ecological.
I've pitched a similar idea, but marketing disagrees every time I propose to stab people.
The numbers check out though; the reduction in technical debt and project costs is significant, even if you reallocate resource to pay for the funerals.
|
|
|
|
|
Only the two options? To kill or not to kill?
Nah! I want a bit of torture first! You know, just to get my mental stability back before they die!
|
|
|
|
|
I don't get it ! ! !
Why must you 'not kill'?
It seems justified.
|
|
|
|
|
You probably know about C# String interpolation and the new(er) (C# 6, via .NET 4.6) string operator $.
Here's the explanation and sample from ($ - string interpolation (C# Reference) | Microsoft Docs[^])
string name = "Mark";
var date = DateTime.Now;
Console.WriteLine("Hello, {0}! Today is {1}, it's {2:HH:mm} now.", name, date.DayOfWeek, date);
Console.WriteLine($"Hello, {name}! Today is {date.DayOfWeek}, it's {date:HH:mm} now.");
The new formatting is very nice, much more straight forward and obvious about which values are included in the string.
JavaScript Analog
But, did you know about the JavaScript equivalent that entered in JavaScript 2015?
I just saw this for the first time -- only three years late.
JavaScript calls them template literals.
The very odd thing is that you have to use back-ticks to get them to work.
var who = "world";
console.log(`hello, ${who}`);
That produces an output of :
hello, world
If you use double or single quotes instead of back-ticks it doesn't work.
The back-ticks kind of make me shudder.
It is a bit nicer than concatenating strings and vars with all those + signs though.
Previously you had to do something like:
var who = "world";
console.log("hello, " + who);
You can read more about template literals here[^].
It's interesting to see a concept emerge and then how different language developers implement it.
C# Bonus Weirdness
You can use the verbatim string operator with the interpolated string operator like the following:
string finalAnswer = $@"this is the answer to the question: {40+2}";
Console.WriteLine(finalAnswer);
But if you place the verbatim string operator before the interpolated string operator you will get a syntax error.
string finalAnswer = @$"this is the answer to the question: {40+2}";
Console.WriteLine(finalAnswer);
|
|
|
|
|
Quote: if you place the verbatim string operator before the interpolated string operator you will get a syntax error. That's because the verbatim operator is tightly couple to the string and suppresses interpolation of the string - therefore the interpolation operator needs to come after the resulting string from the "non-interpolation" operator.
...erm, or maybe the other way around? Whatevs!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Yeah, the way I saw it explained was :
$ then @ because you are saying, "interpolate this verbatim string..."
Instead of
@ then $ "Give me verbatim of this interpolated string..."
Kind of makes sense, I guess.
|
|
|
|
|
raddevus wrote: Kind of makes sense, I guess.
I promise to quote you verbatim without interpolation.
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Marc Clifton wrote: I promise to quote you verbatim without interpolation.

|
|
|
|
|
|
Richard Deeming wrote: Looks like that should be "fixed" in C# 8:
Thanks for the update and links.
|
|
|
|
|
(Yes, I meant to put this here, no real reason.)
I discovered this this week. Unsure anyone else has noticed it or has any idea of how to avoid it.
I'm working on a command-line program which will require XML in a parameter.
I stored an example XML parameter in VS (2010 and 2015) for debugging.
It seemed OK the first day, but things went awry when I ran it the following day.
This evening I whipped up a little demonstration.
I set the debug parameter such:
"<ArgTest><Parameter>Value</Parameter></ArgTest>"
In ArgTest.csproj.user, it looks good:
<StartArguments>"<ArgTest><Parameter>Value</Parameter></ArgTest>"</StartArguments>
And on first run, the output is good:
<ArgTest><Parameter>Value</Parameter></ArgTest>
Value
"c:\Project\ArgTest\bin\Debug\ArgTest.exe" "<ArgTest><Parameter>Value</Parameter></ArgTest>"
Value
But, save, close, and re-open the solution, and the parameter somehow gains a default namespace which then gets mangled by the system:
"<ArgTest xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><Parameter>Value</Parameter></ArgTest>"
<ArgTest xmlns=http://schemas.microsoft.com/developer/msbuild/2003><Parameter>Value</Parameter></ArgTest>
'http' is an unexpected token. The expected token is '"' or '''. Line 1, position 16.
"c:\Project\ArgTest\bin\Debug\ArgTest.exe" "<ArgTest xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><Parameter>Value</Parameter></ArgTest>"
Not found
Some of you will be surprised by the "Not found", but I'm not, I expected it once I saw the problem.
Obviously, Visual Studio saves the .user file inappropriately, but that doesn't explain the addition of the namespace.
Very weird.
namespace CP
{
public static partial class ArgTest
{
static int
Main
(
string[] args
)
{
int result = 0 ;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument() ;
try
{
System.Console.WriteLine ( args [ 0 ] ) ;
doc.LoadXml ( args [ 0 ] ) ;
System.Xml.XmlNode val = doc.DocumentElement.SelectSingleNode ( "Parameter" ) ;
if ( val == null )
{
System.Console.WriteLine ( "Not found" ) ;
}
else
{
System.Console.WriteLine ( val.InnerText ) ;
}
}
catch ( System.Exception err )
{
System.Console.WriteLine ( err.Message ) ;
}
try
{
System.Console.WriteLine ( System.Environment.CommandLine ) ;
int s = System.Environment.CommandLine.IndexOf ( "\"<" ) + 1 ;
int e = System.Environment.CommandLine.IndexOf ( ">\"" ) + 1;
doc.LoadXml ( System.Environment.CommandLine.Substring ( s , e - s ) ) ;
System.Xml.XmlNode val = doc.DocumentElement.SelectSingleNode ( "Parameter" ) ;
if ( val == null )
{
System.Console.WriteLine ( "Not found" ) ;
}
else
{
System.Console.WriteLine ( val.InnerText ) ;
}
}
catch ( System.Exception err )
{
System.Console.WriteLine ( err.Message ) ;
}
return ( result ) ;
}
}
}
|
|
|
|
|
Seems like you need to manually edit the .csproj.user file to wrap the arguments in a CDATA section:
Visual Studio changes debug xml Command line arguments - Stack Overflow[^]
Unfortunately, you'll have to repeat that every time you change a project setting.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
This program doesn't warrant that amount of effort.
I'll have to ensure that my command line parser can remove the namespace when present, but this program doesn't use that anyway.
|
|
|
|
|
|
Nice idea - shame it's so limited. Once you get to the rock - "I need a tool to get past this" - that seems to be the end, since there isn't a tool anywhere.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: since there isn't a tool anywhere.
You can get the pick. I found it. I can give you the first hint and then more if you need them.
I' thinking you got stuck on the part I got stuck on....
The elevators do go down but you click below the down arrow.
This is your HINT : You have to go down the elevator to find the pick and bring it back up.
|
|
|
|
|
raddevus wrote: The elevators do go down but you click below the down arrow.
Sounds like a bug to me.
I've now been through every bit it will let me get to, and clicked on everything it will let me click, and there doesn't seem to be any way to progress. Time to give up and get some sleep.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Aaaargh! Finally worked out what the notes meant.
It didn't help that the spinners for the combination didn't seem to be working in FF62.
Shenanigans indeed.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Glad you got it.
It is a fairly nice extended example of what can be done with CSS3.
|
|
|
|
|
Richard Deeming wrote: shame it's so limited. If only there were a way to make changes to it.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|