IDEA Debugger - Search variable in Variables - debugging

I debug my project and have a list of Variables. This is enough big project and my question sounds :
There is any option to find for example variable named objectColor in this Variables list ?

Related

How to debug ansible variable precedence

I have a complex ansible setup which I want to refactor, with variables defined in various places / at various levels.
I am aware of the basic inheritance rules:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#ansible-variable-precedence
I would like to do a verbose debug run, that dumps all the variable key-value pairs to stdout or a file - as they would be effectively applied to my host or environments, but without actually applying any playbooks.
How can I do that with Ansible?
Also, how can I get Ansible to show which yaml files it sources in which order (e.g. what it has found where)

Maven - dynamically creating a map, and referring to it

Our generic Maven build needs to pass on a number of properties to child processes.
Right now, we are providing these as environment variables, and reading them in individually as properties.
These properties are then substituted into a file to configure a test runtime, and provided to the Failsafe plugin as environment variables for the test run.
The above is fine, except for a couple of things:
The environment variable -> property map is manual - we need a property definition for every environment variable we want to pull in.
Specifying environment variables to Failsafe is again manual - we need a variable definition for every environment variable we want to pass on.
Right now, if we have 20 environment variables, we have 20 lines for each of these stages, and that's getting tedious quickly.
Is there a better way to do this?
My naive thoughts include (though I can't find a way to achieve it):
Define Maven properties dynamically, potentially based on a regex, from environment variables.
From Maven properties, automatically construct a list of environment variables, to be passed to Failsafe, again preferably via a regex.

% in Windows environmental variables value

What does % mean in windows environmental variables ?
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
Especially the Path, TMP, TEMP variable values have this sign. There might be other variables also, but I came across only these three.
Do I need to bother about it while setting my own path variables ?
Do I need to bother about it while setting my own path variables ?
Under normal circumstances, no, you don't. You would only do this if you wanted the effective value of PATH to depend on some other environment variable. Even then it is only a convenience, never a necessity.
As a real-world example of when it might be convenient, suppose you've written a program that automates updating the Java SDK to the latest version, so your users don't have to do it by hand. Updating the SDK moves it to a different location, so you probably want to add the new location of the SDK to the path, and remove the old one.
You could do that the hard way, by parsing PATH each time, locating the part that points to the old location and changing it appropriately. But that's a pain, and if you're doing this globally, the users don't have any choice over whether Java is in the path, even if they don't use it. So instead you might create a variable JAVA_PATH that points to the current SDK location. That way, it is easy to change, and individual users can choose whether or not to put %JAVA_PATH% in their own paths.
In Microsoft's case (the examples you noticed) the system root is never going to move, but by using a variable they could hard-code the default value of PATH rather than having to explicitly generate it during operating system installation.
PS: the environment variables referenced in PATH must all be system variables. Referencing a user variable will not work.
%VariableName% is the syntax for referencing an environment variable. The actual name is the part between the % symbols.
So your first line, when fully expanded, would evaluate to the value of the SystemRoot variable, followed by \system32;.
You'll need to use %...% if you want to make use of environment variables in the Windows shell, or if you want to define environment variables that reference other variables.

Is it possible to undefine a variable in freemarker?

In the freemarker template language, I can test whether a variable exists by using constructs like variable?exists or variable??. I can also cause a previously non-existent variable to exist by assigning to it, e.g., <#assign variable = "hi" />. But how can I cause a previously existing variable to no longer exist?
I have some other dude's freemarker template, with logic at various points that tests for the (non-)existence of certain variables. In my use case, it would be simplest if I could have a variable that exists at one point, then becomes undefined when including his template, then gets assigned to again later on. The alternative is to restructure things more significantly.
No, there's no directive fort that. Maybe it can be achieved with a custom directive (TemplateDirectiveModel) that can then write null into the variable through the Environment. (Unless the Environment API checks for null-s...)

how to inspect objects while debugging groovy (eclipse plugin or other)

I have started to learn groovy by building a pet project. I fetch some html with XmlSlurper and parse it etc. I am using eclipse3.4 with groovy 1.6 plugin. I am having a very difficult time trying to iterate thorugh all the html elements etc. I expected to set some breakpoint, inspect the current variable where my contents are, see what it contains, what do I have to iterate over, evaluate some expressions etc etc.
But I almost cannot do anything like that:
- some variables don't appear in the variables view (maybe its the ones not having a type?)
- select any expression but you cannot evaluate
- and worst of all (for me) is that any variable is shown with all its groovy stuff (metaclass, value...). The things that most of the time will interest the developer are buried inside the hierarchy and very difficult to find.
I had thougth that the ObjectExplorer mentioned in the doco would be able to help but I was unable to get it running with my script.
What do people use for this sort of thing while developing in groovy?
Option 1:
Give following a try in your script
groovy.inspect.swingui.ObjectBrowser.inspect(object)
This gives all public fields, properties, methods, etc
Option 2:
You can also use obj.dump() and or object.inspect() method to see values of the object
e.g. println obj.inspect() or assert obj.inspect() == "some values"
Other options:
Eclipse 3.4 debug perspective works pretty well. Even the one without type information show up. Can you give specific problem that you are facing with debugging in 3.4
println variables
Writing Unit test with asserts regarding expected output of the xml

Resources