How do I inspect Vim variables? - variables

In .vimrc, there are several lines that look like:
let g:SuperTabDefaultCompletionType="<c-x><c-o>"
How do I inspect them inside Vim? Something to this effect:
:echom &g:SuperTabDefaultCompletionType
But that command results in an error:
E113: Unknown option: SuperTabDefaultCompletionType
E15: Invalid expression: &g:SuperTabDefaultCompletionType
How do I inspect these kinds of variables in Vim? Some plugins set some defaults which I need to inspect.

:echo g:SuperTabDefaultCompletionType
works fine. It gives an error if the variable isn't defined.

Like lucapette wrote you can use :echo g:foo to inspect a variable. You can also use :let to see all defined variables and their values.

See if this helps: http://learnvimscriptthehardway.stevelosh.com/chapters/19.html. Should give you some insight on how vim variables work, and you can check out chapter 20 as well if you have any difficulties inspecting them due to scope issues.

Related

There was an error compiling the function

When i try to execute this function PROD_TYPE: IIf([PROD_CAT]="OTHER";"OTHER";Mid([PROD_CAT];5)) I get compilation error message. I have tried to check if there was any missing reference i could uncheck but i found non. the MID function seems to be the problem. because when i try to create a dummy query using MID function, it threw the same error message at me.
Access control sources do not accept semicolons when providing parameters, you need to use commas as you can see below:
IIf([PROD_CAT]="Other","Other",Mid([PROD_CAT],5))

TFS/VSTS, refer to a variable in a variable

I wonder if its possible to refer to a variable in another variable using variables in VSTS and/or TFS.
For instance lets assume we have the following variables:
var1:http://environment1.somedomain.local/api/endpoint/1
var2:http://environment1.somedomain.local/api/endpoint/2
var3:http://environment1.somedomain.local/api/endpoint/3
what I would like to achive is something like:
varDomain:environment1.somedomain.local
var1:http://$(varDomain)/api/endpoint/1
var2:http://$(varDomain)/api/endpoint/2
var3:http://$(varDomain)/api/endpoint/3
and the be able to use var1,var2 and var3 later on in my build be able to use these as tokens for my web.conifg "transform".. and/or use them in the tasks for my build and/or release.
Anyone aware if its possible to combine variables in this way?
The examples you provided work perfectly. So the answer to your question is, "yes".

How to identify an element by classname containing curly brackets

when i try to access element:
browser.element('.object{ media }');
I get the following error message:
Error: Argument was an invalid selector (e.g. XPath/CSS).
at element(".object{ media }") - index.js:312:3
Is it possible to access elements by class name including curly brackets?
As per your question and your code trials to access desired element with classname containing curly brackets i.e. {} you can use the following solution:
XPath:
"//*[#class=\"object{ media }\"]"
Following what #DebanjanB said,
You can use something called Regular Expressions to sort issues like this out, what Debanjan has shown you is known as this.
Regular Expressions Guide
It would be useful if you read through a guide so you fully understand the code you are putting into your project, this will allow you to make better use of it later on in your testing.
All the best,
Jack

PHP function written in 5.5 throws error when upgraded to 7.0

here is the function that worked prior to upgrading to 7.0
function set_session_vars() {
$nb_args=func_num_args();
$arg_list=func_get_args();
for($i=0;$i<$nb_args;$i++) {
global $$arg_list[$i];
$_SESSION[$arg_list[$i]] = $$arg_list[$i];
}
}
now it causer error that says:
Parse error: syntax error, unexpected '[', expecting ',' or ';' in /home/mvyc1956/public_html/members/includes/functions.php on line 322
I believe its related to non backward compatable changes to GLOBAL and the use of $$ and arrays, but my PHP is not good enough to figure it out.
Is there someone who is familiar with why this line :
global $$arg_list[$i];
which is line 322 that is being reported as the cause of the error, would be failing now, and what would you recommend I change the code to in order to have it work with PHP 7?
I did some googling and found this page but again, im not understanding what needs to be changed.
thanks
says syntax error so some of the code in the function is no longer valid, but it would take a php 7 expert to see it.
UPDATE
I removed the word GLOBAL from the above code and the app "seems" to be now working fine so I will now ask:
Does anyone know specifically, why Global was the non compatibility issue? and is my fix of simply removing it a solid one or will is there a better practice or will this removal come back to haunt me?
Backward incompatible changes:
global only accepts simple variables
Variable variables can no longer be used with the global keyword. The curly brace syntax can be used to emulate the previous behaviour if required:
// Valid in PHP 5 only.
global $$foo->bar;
// Valid in PHP 5 and 7.
global ${$foo->bar};
So in your case it should become:
global ${$arg_list[$i]};
The global keyword tells PHP to access a global variable (per launch of the script) instead of a local variable (per function). For example,
global $foo;
means that future uses of the variable $foo in that function refer to the global variable with that name, rather than a variable within the function itself.
What this is trying to do is look up a variable by arbitrary name in the global namespace. That's entirely the wrong way to do things. Instead, you should have a global array and use keys in the array. In fact, $$ is arguably a bad idea in general.
But that's neither here nor there. The problem is that the parsing rules changed in PHP 7.0 in a non-backwards-compatible way (because they're using a more traditional parser now, and thus had to make their associativity rules self-consistent).
More details here:
http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect
To make a long story short, you need to rewrite that as:
global ${$arg_list[$i]};
and then your code will work correctly on both PHP 7 and PHP 5.
Incidentally, the function only appears to work without the global keyword. In fact, it is always getting empty values for those variables.

Selenium Accessor not storing variable

I would like to store a value that's inside the inner HTML of a span tag of id="ctl00_body_BatchEditor_LblBatchIdentifyingNumber" with the Selenium IDE. And then I want to take that variable and use the "type" command to place that value inside of an input field.
(1) I'm having trouble with the commands for this Test Case.
(2) I'd want to take this variable and use it in the same Test Case, and would also like to use it in a different Test Case. Is this possible?
Command to store variable:
Command: storeValue
Target: xpath=//span[#id='ctl00_body_BatchEditor_LblBatchIdentifyingNumber']
Value: batchId
Command to use the variable:
Command: type
Target: ctl00_body_QuickDataEntryEditor_TxtBatchId
Value: ${batchId}
Figured this one out. When I used the "storeText" Accessor command rather than the "storeValue" Accessor command, the variable got stored and it worked.