Automating attaching to multiple processes in Visual Studio 2019 - visual-studio-2019

For my debugging I have to attach to many process instances:
The EXE for our app.
5 instances of some other process (let's call it "foo").
8 instances of some other process (let's call it "bar").
41 instances of some other process (let's call it "Agnes" in honor of the Twilight Zone episode, "From Agnes with Love").
Rather than having to Ctrl-select all of them and then click "Attach", is there some sort of template I can define that will say?:
Attach to and EXE called "whatever".
All instances of a process called "foo".
All instances of a process called "bar".
All instances of a process called "Agnes".

You can use my Visual Commander extension to automate it with code like:
foreach(Process proc in DTE.Debugger.LocalProcesses)
{
if(proc.Name.ToString().EndsWith("foo.exe"))
{
proc.Attach();
}
}
See Attach to specific Process shortcut in Visual Studio for more details.

Related

What is the difference between new ActiveXObject() and WScript.CreateObject()?

According to the Microsoft documentation, one can create instances of the COM objects using both the ActiveXObject() and the WScript.CreateObject() functions. It seems like the lines
var objXL = new ActiveXObject("Excel.Application");
and
var objXL = WScript.CreateObject("Excel.Application");
are identical. Is this a true assumption? and if not what is the difference? Examples to show the difference would be highly appreciated.
P.S. The post this has been flagged as a duplicate to is about the difference between VBScript's CreateObject() method and JScript's WScript.CreateObject(). It answers mention the JScript's ActiveXObject() constructor with no further elaborations.
Are they the same?
The short the answer is Yes they are the same (in the sense they perform the same job of instantiating an automation object).
Basically unlike VBScript which has the global function CreateObject() there is no such equivalent in JScript which was based on ECMAScript 3rd Edition. So, Microsoft added its own extension ActiveXObject which does the same job as CreateObject.
Both languages can be hosted in the Windows Scripting Host which gives them access to WScript.CreateObject() which is another method that does exactly the same function but only in the context of the WScript object that is only available through the Windows Scripting Host.
Following up
There has been some debate about whether they are the same, I still stand by my original answer they are the same. However, I will concede that I was comparing VBScript CreateObject() and JScript new ActiveXObject() not Wscript.CreateObject() (which is slightly different).
Let's be clear though, all these functions and objects serve the same purpose which is to instantiate an automation object (COM). To back this up here is the official description of each;
WScript - CreateObject() Method
Creates a COM object
JScript - ActiveXObject Method
Enables and returns a reference to an Automation object
VBScript - CreateObject() Function
Creates and returns a reference to an Automation object
If they were completely the same what would the point of them be? We already have language-specific automation instantiation methods, so what would the point of Wscript.CreateObject() be?
The difference is when called with a second parameter it allows you to specify a prefix that will use to distinguish event handlers for that COM object.
Here is an example taken from this answer that shows how the second argument is used to set a prefix of objIE_ that will then be used to prefix any event handlers associated with that COM object, in this case, the InternetExplorer.Application object.
// JScript
var objIE = WScript.CreateObject("InternetExplorer.Application","objIE_")
objIE.Visible = true
while (objIE.Visible){
WScript.Sleep(500);
}
function objIE_NavigateComplete2(pDisp, URL){
WScript.Echo("You just navigated to", URL)
}
function objIE_OnQuit(){
boolBrowserRunning = false ;
}
It allows an Internet Explorer instance to be opened and the URL navigated to captured through the bound event, once the Internet Explorer Window is closed the script will end.
So while not identical they do perform the same function of instantiating an Automation (COM) object.
Useful Links
Answer to What is the difference between CreateObject and Wscript.CreateObject?

Unable to run multiple Pipelines in desired order by creating template in Apache Beam

I have two separate Pipelines say 'P1' and 'P2'. As per my requirement I need to run P2 only after P1 has completely finished its execution. I need to get this entire operation done through a single Template.
Basically Template gets created the moment it finds run() its way say p1.run().
So what I can see that I need to handle two different Pipelines using two different templates but that would not satisfy my strict order based Pipeline execution requirement.
Another way I could think of calling p1.run() inside the ParDo of p2.run() and keep the run() of p2 wait until finish of run() of p1. I tried this way but stuck at IllegalArgumentException given below.
java.io.NotSerializableException: PipelineOptions objects are not serializable and should not be embedded into transforms (did you capture a PipelineOptions object in a field or in an anonymous class?). Instead, if you're using a DoFn, access PipelineOptions at runtime via ProcessContext/StartBundleContext/FinishBundleContext.getPipelineOptions(), or pre-extract necessary fields from PipelineOptions at pipeline construction time.
Is it not possible at all to call the run() of a pipeline inside any transform say 'Pardo' of another Pipeline?
If this is the case then how to satisfy my requirement of calling two different Pipelines in sequence by creating a single template?
A template can contain only a single pipeline. In order to sequence the execution of two separate pipelines each of which is a template, you'll need to schedule them externally, e.g. via some workflow management system (such as what Anuj mentioned, or Airflow, or something else - you might draw some inspiration from this post for example).
We are aware of the need for better sequencing primitives in Beam within a single pipeline, but do not have a concrete design yet.

How do you stop Idea 14 from comingling base methods within extended classes in the UI?

In IDEA 14 how do you stop base methods from showing up in the UI for an extended class?
As you can see in the image below (grails project) I have extended the Register Controller. While my class only has a register and verifyRegistration method, the UI lists all of the methods of the base class. If I double-click on one of the other methods (for example: forgotPassword) IDEA will open that method in the base class (in this case by opening the groovy file contained in the spring-security-ui plugin). Unless you are very careful you are likely to inadvertently edit the base method (ex: register) rather than your extended version.
Is there some way to stop IDEA from doing this? Ideally I should only see the actual methods (register, verifyRegistration) in the tree view to the left.
Thanks,

How to start several non-otp processes and register them with different names

For one of my "learning projects" I have a set of erlang processes (different modules implementing gen_server). Each of this processes spawns and supervises a child process which consists in a single module not implementing otp behaviour.
therefore I have the following situation:
gen_server_a <-> module_a
gen_server_b <-> module_b
gen_server_c <-> module_c
Each child process does the same set of things:
register itself with the name of the module (e.g. module_a)
does some operations based on configuration parameters passed by parent during spawning
receives commands from parent using its registered name
Now, I know that this is far from perfect. I would like to abstract the architecture in order to have still 3 gen_servers, but only one beam file for the child part so that I could achieve something like:
gen_server_a <-> module_generic (registered as module_a)
gen_server_b <-> module_generic (registered as module_b)
gen_server_c <-> module_generic (registered as module_c)
how can I achieve something like this? Just passing during the spawning an atom to be used for registering the process? Is there any other option?
In module_generic build an own start_link/1 which spawns the process function and then registers the Pid:
start_link(Name) ->
Pid = spawn_link(?MODULE, loop, []),
register(Name, Pid),
Pid.

Reduce number of class files produced by BlackBerry app

I have developed an order processing application for BlackBerry. When I look at the bin folder I see more than 100 .class files.
I have created a main screen class for adding new clients. The screen has 7 LabelField objects and 7 corresponding TextField objects. This screen also creates a VerticalFieldManager and adds all these fields to it and then adds the VerticalFieldManager to the screen.
For this screen, I have 14 .class files in the bin folder. It seems there is one class file for every field in the progam.
For example:
NewClient.class
NewClient$1.class
...
NewClient$14.class
How do I design the UI in order to reduce the number of compiled classes?
Building a Java-ME app for BlackBerry is a two step process. First the java source code is compiled to class files, then those class files are compiled again into a .cod file, which can be deployed onto a simulator or a device.
'rapc' is the RIM compiler that takes java programs and turns them into a cod or alx file for deployment. 'rapc' can take either java source code, or compiled java classes. Either way, it can produce output suitable for a device.
When starting with Java source files, you can explicitly compile them to class files and hand those class files to rapc or you can pass the Java source to rapc and it will compile the source directly. rapc just defers to the JDK javac compiler when presented with java source code. This means a standard java JDK compiler is always used as the first step of compiling a BlackBerry app, and we can look at standard java behavior to understand what is happening.
In Java, every class that is instantiated has exactly one .class file. For normal classes with a declared name, like this:
public class Foo extends Bar {
}
The .class file is assigned a name that matches the declared class name. However, Java also allows anonymous classes. These take the form of a new Foo() followed by a curly brace which turns this into an anonymous class. This presents a problem, as this anonymous class must be assigned a name at the VM level, despite having none at the Java source level. The solution is to use a character that is invalid in Java source, but valid in the VM, namely $. The anonymous classes are assigned a name based on the enclosing Java class, followed by $, then an integer index based on the number of anonymous classes ahead of this one. In your case, that is NewClient, followed by 14 distinct integers.
To see the behavior you describe, your fields must all actually be anonymous implementations of those classes you mention. To reduce the number of classes, try reusing explicit classes, instead of writing custom behavior with each instantiation.
Set your jdk bin folder path on the environment variable path on right clicking on the myComputer icon
Then Restart the pc
Other way is to don't use overwrite method on your code such as
btmSave.setChangeListner(new FieldChangeListner()
{
private void fieldChange()
{
}
}
);
Avoid This type of writing code it create your no of class Files on project bin folder

Resources