Wikipedia:Reference desk/Archives/Computing/2020 September 3

From Wikipedia, the free encyclopedia
Computing desk
< September 2 << Aug | September | Oct >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


September 3[edit]

C# and JavaScript question[edit]

At work, I've come across a C# method that is writing a string to be directly inserted into a JavaScript function. The JavaScript function is supposed to handle the inserted content as a simple string. The JavaScript function is something like this:

exampleFunction('@ExampleClass.ExampleFunction()') which is Razor syntax that executes ExampleClass.ExampleFunction() first and then inserts the result directly into exampleFunction().

Now, to avoid JavaScript syntax errors, ExampleClass.ExampleFunction() escapes ' into \', \r into \\r and \n into \\n.

My question is first, is this enough? And second, is there an easier way to do this, preferably some ready-existing way to escape strings? JIP | Talk 00:53, 3 September 2020 (UTC)[reply]

@JIP, if possible, and you're using ECMAScript 6 (i.e. the JavaScript engine you're using is from the past 5 or so years) you might prefer to use backticks (`) to pass in your string parameter. These support a whole manner of characters, including newlines,
e.g. instead of using exampleFunction('@ExampleClass.ExampleFunction()') you'd use exampleFunction(`@ExampleClass.ExampleFunction()`). If backticks don't work for you, escaping JavaScript strings is easy, and you have two options: you can use a JSON parsing library (many, many of these about, depending on your flavour of C#, for .NET I'd use system.text.json) and use their string parsing function (keep in mind you're adding a whole JSON library, which you might not use past this), or the probably more economical option of using just a subroutine that does this for you. This Stackoverflow thread contains many examples that you may find useful. Hope this helps :) Ed talk! 20:25, 3 September 2020 (UTC)[reply]

What are The "FBI Triple I Teletype" and "Wisconsin Circuit Court Automated Program"?[edit]

In the charging document by ADA Carli McNeill of Kyle Rittenhouse, these terms are used in the last sentence. Google shows they’re not novel, but only turns up 60 hits (Only 60 documents with both of those terms, A few of which are said charging document.) After I couldn’t find the first term on Wikipedia, I felt at a dead end and thought I’d ask here betting that other people are wondering the same thing. --50.201.195.170 (talk) 18:47, 3 September 2020 (UTC)[reply]

Interstate Identification Index -- Finlay McWalter··–·Talk 22:31, 3 September 2020 (UTC)[reply]
Thanks x 2! (Edited accordingly.) --50.201.195.170 (talk) 16:01, 11 September 2020 (UTC)[reply]
Wisconsin CCAP -- Finlay McWalter··–·Talk 22:32, 3 September 2020 (UTC)[reply]