|
How you can improve your workflow using the JavaScript console is an excellent summary of the methods afforded by the Console class. Although the context of the article is the Web browser console, the information is equally applicable to the Node console. The examples made clear some methods that weren't entirely obvious without an example and its output to study.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
|
Thank you!
This is very much appreciated!
|
|
|
|
|
You are most welcome!
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Thanks
One very useful command not covered in the article is the debugger command.
Create a line with debugger; and every time that line is hit the dev tool of the browser will open at that line with the run paused.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Thanks for calling my attention to the debugger command. Though I vaguely remember a reference to it, I've never seen it in action. I'll do my best to remember to do so the next time I'm working on some JScript that runs in a Web browser.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
So we have this SSRS report that is supported via several SQL jobs that do exactly the same thing for a specific set of facilities, each with their own ID. Each job is comprised of about a dozen steps representing a mic of SSIS packages and plain old sql. As you might guess, each job has its own facility id hard-wired into each of its steps. On Friday, I was tasked with adding support for an additional facility ID (and adding support for a new column in the source data).
Today, I generalized all of it by creating stored procs that accept the facility ID as a parameter (to replace the sql steps), and a single ssis import package that accepts the facility id on the command line.
The result is a single job that performs work for all desired facility id's (five steps per facility ID), and it only takes about five minutes to add support for additional facility IDs instead of the better part of two hours to create and test a whole new set of packages and associated SQL agent. The real silver lining is significantly eliminating the possibility of copy/paste errors when creating the steps.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Just don't tell anyone, you'll have a 2 hour break every time a new facility is added.
|
|
|
|
|
Quote: In every job that must be done
There is an element of fun
You find the fun and snap!
The job's a game
And every task you undertake
Becomes a piece of cake
A lark! A spree! It's very clear to see that
A spoonful of sugar helps the medicine go down
The medicine go down, the medicine go down
Just a spoonful of sugar helps the medicine go down
In a most delightful way
|
|
|
|
|
|
The best laid plans of mice and men sometimes work out fine.
|
|
|
|
|
That's really amusing. I got an email from some code regarding a very similar issue and how to fix it.
I didn't quite buy the fix, it seemed odd. Refactoring a Reporting Services Report with Some SQL Magic
And congrats for the win. I often experience management kicking and screaming when I suggest similar optimizations.
|
|
|
|
|
I empathize with you about management kicking and screaming when you suggest optimizations. Why do you suppose that happens?
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
The biggest food distributor in xxxx (with some 90 "divisions"; 100,000+ service workers, and billions in sales), duplicates all the job streams and "data schemas" (VSAM files!) every time they create a new division ... which happens every few months.
The only change is the division "identifiers".
90+ duplicate job streams running every day.
The "head" responsible for this is a 30+ year "company" man.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
John Simmons / outlaw programmer wrote: The real silver lining is significantly eliminating the possibility of copy/paste errors when creating the steps.
So what are the government beauro crats supposed to do all day?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
When I saw mention of compiler support for ReadOnlyReferences in the C# 7.2 language, for passing variables by reference but without exposing data to modifications in a list of new features in version 4.7.2 of the Microsoft .NET Framework in What’s new in Microsoft .Net Framework 4.8, I realized that this is a big deal.
Here's why.
- Without this option, the only way to pass a read-only reference to an object is to create an adapter, so that you can pass through the properties through getter methods, omitting setters entirely.
- Writing such an adapter is time consuming and error-prone.
- Using the adapter adds a layer to every request to read a property on the underlying object, because the request must pass through the getter on the adapter, which passes it along to the getter on the adapted object.
- If your project has many of these, your source code tree has lots of branches that add little value, and the extra objects make the assembly bigger.
See C# Futures: Read-Only References and Structs for additional details not mentioned in the InfoWorld article, not the least of which is that this parameter modifier applies to structs, too. Presumably, that includes the system-defined structs, such as DateTime, char, and others.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
If you're passing struct s around as readonly references, you'll want to make sure the struct itself is readonly as well. The same applies if you're storing them in a readonly field. Otherwise, every time you access a property or method on the struct , the compiler will make a defensive copy to enforce the readonly-ness of the value.
The ‘in’-modifier and the readonly structs in C# – Dissecting the code[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That is precisely the point of the ReadOnlyReference modifier, which you would discover if you read that article all the way to the end.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Which one? The article from 2017, talking about the in modifier and readonly struct s, which have already been released? Or the infoworld "subscriber only" article, which can't be read without signing up?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The article that you cited, about the in modifier is very explicit in it summary.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
Did I ever mention that I like C++?
... such stuff as dreams are made on
|
|
|
|
|
I use C++ from time to time, too, but how is that related to this thread?
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
It also solves some sticky issues when you want to ensure that a method cannot modify contents of an object. It would have been a lot of work before to protect data in an object so that it could not be modified. You would have to basically deep clone it and use the clone.
|
|
|
|
|
Especially given that you may need only a subset of its methods and properties, it's often easier to create and adapter that exposes the needed methods as read only properties of itself, and forwards the required methods to the private instance which it adapts. It's usually straightforward to create a basic adapter to meet an immediate need, which can subsequently be extended to support more read only properties and/or forwarded methods.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
If an adapter makes sense, then yes you can, but that may be a lot of adapters if there are many levels that need to be created for different objects, and if adapter does not make sense, them may be increasing maintenance significantly as need to provide different access to methods and properties.
|
|
|
|