How do I fold code for comment blocks inside method blocks? - visual-studio-2010

How can I fold comment blocks inside method blocks to be folded (outlined), just like methods and regions, etc.?

Select the block that you want to hide
Ctrl+M+H
This needs to be done only once. The block will become collapsible afterwards.

Edit + Outlining + Start Automatic Outlining.

I think it might be right...
도구 > 옵션 > 텍스트 편집기 > C/C++ > 서식 > 개요 > 문 블록에 개요 사용 : True --> 모든 블록에 folding/unfolding 사용 가능.
Tool > Option > Text Editor > C/C++ > Form > Outline > Use statement on the block overview : True --> Every block folding / unfolding can be used.

Related

Decorating a pattern in Ace Editor

Is there an api implementation for "decorating" a string pattern in Ace Editor (or how would you do it)?
Say you have two variables with ids and names. E.g.:
{
"$id1": "variable_1_name",
"$id2": "varialbe_2_name",
}
You pass the editor the value $id1 + $id2 but want it rendered as variable_1_name + variable_2_name ?
I'm looking for something similar to how draftjs handles this use case: https://draftjs.org/docs/advanced-topics-decorators

JMeter If Controller using groovy and Or is not working

I have a script where I have some if controllers. I'm attempting to add a 4th If controller that will trigger a script failure if none of the 3 expected values is returned. It's saying one of the 3 expected values is invalid.
1st, I have a user defined variable like this:
testTool= ${__P(testTool,APPLES)}
2nd, I have these 3 If controllers with these Expressions:
${__groovy(vars.get("testTool").toUpperCase().equals("APPLES"))}
${__groovy(vars.get("testTool").toUpperCase().equals("BANANAS"))}
${__groovy(vars.get("testTool").toUpperCase().equals("PEACHES"))}
The 4th If is supposed to be triggered if the value of testTool is not one of the 3 expected values. It's Expression looks like this:
> ${__groovy( (vars.get("testTool").toUpperCase().equals("APPLES") == false ||
> vars.get("testTool").toUpperCase().equals("BANANAS") == false ||
> vars.get("testTool").toUpperCase().equals("PEACHES") == false)) }
I have also tried it this way:
> ${__groovy((!vars.get("testTool").toUpperCase().equals("APPLES") ||
> !vars.get("testTool").toUpperCase().equals("BANANAS") ||
> !vars.get("testTool").toUpperCase().equals("PEACHES")),)}
It is somehow saying APPLES is an invalid testTool. What am I doing wrong? All if controllers have the 'Interpret Condition as Variable Expression' checked.
Use the following condition in if controller
${__groovy(!(vars.get("testTool").toUpperCase().equals("APPLES"))||!(vars.get("testTool").toUpperCase().equals("BANANAS"))||!(vars.get("testTool").toUpperCase().equals("PEACHES")))}
Please let me know if it helps
You should use && operator instead of ||, see Groovy Logical Operators for detailed explanation and more information.
Your 4th expression needs to be amended to look like:
${__groovy(!(vars.get("testTool").toUpperCase().equals("APPLES")) && !(vars.get("testTool").toUpperCase().equals("BANANAS")) && !(vars.get("testTool").toUpperCase().equals("PEACHES")))}
An easier option would be using Switch Controller, from implementation and especially performance perspectives it is the optimal solution.
Add Switch Controller to your Test Plan
Use ${testTool} as the "Switch Value"
Put 4 requests as the children of the Switch Controller and name them as:
APPLES
BANANAS
PEACHES
DEFAULT
So if ${testTool} variable value will be APPLES - the APPLES sampler will be executed, if ${testTool} variable value will be BANANAS - the BANANAS sampler will be executed, etc.
If ${testTool} will not match any other children - JMeter will run DEFAULT sampler
See Selection Statements in JMeter Made Easy guide for details.

How to inject two variables next to each other separated with a space?

The expected HTML result is as follows:
<li>description1 name1</li>
<li>description2 name2</li>
<!-- ... -->
Where the list of description-name is known and can be iterated over.
I tried to do:
li
= tool.description
|
= tool.name
or
li
= "#{tool.description} #{tool.name}"
but it seems like an ugly way to achieve that.
Is there any other and elegant solution?
You can use interpolation directly in both Slim and Haml, so you don’t need to use = and quote the whole string.
In Slim, you could do:
li #{tool.description} #{tool.name}
and in Haml the only difference is you just need to add the lead %:
%li #{tool.description} #{tool.name}

Selenium Webdriver + Ruby regex: Can I use regex with find_element?

I am trying to click an element that changes per each order like so
edit_div_123
edit_div_124
edit_div_xxx
xxx = any three numbers
I have tried using regex like so:
#driver.find_element(:css, "#edit_order_#{\d*} > div.submit > button[name=\"commit\"]").click
#driver.find_element(:xpath, "//*[(#id = "edit_order_#{\d*}")]//button").click
Is this possible? Any other ways of doing this?
You cannot use Regexp, like the other answers have indicated.
Instead, you can use a nifty CSS Selector trick:
#driver.find_element(:css, "[id^=\"edit_order_\"] > div.submit > button[name=\"commit\"]").click
Using:
^= indicates to find the element with the value beginning with your criteria.
*= says the criteria should be found anywhere within the element's value
$= indicates to find the element with with your criteria at the end of the value.
~= allows you to find the element based on a single criteria when the actual value has multiple space-seperated list of values.
Take a look at http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/ for some more info on other neat CSS tricks you should add to your utility belt!
You have no provided any html fragment that you are working on. Hence my answer is just based on the limited inputs provided your question.
I don't think WebDriver APIs support regex for locating elements. However, you can achieve what you want using just plain XPath as follows:
//*[starts-with(#id, 'edit_div_')]//button
Explanation: Above xpath will try to search all <button> nodes present under all elements whose id attribute starts with string edit_div_
In short, you can use starts-with() xpath function in order to match element with id format as edit_div_ followed by any number of characters
No, you can not.
But you should do something like this:
function hasClass(element, className) {
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
return re.test(element.className);
}
This worked for me
#driver.find_element(:xpath, "//a[contains(#href, 'person')]").click

Visual Studio switch statement formatting

I'm using Visual Studio 2005. It always wants to format switch statements like this:
switch (thing)
{
case A:
stuff;
break;
case B:
things;
break;
}
Is there a way to have it indent the cases like this?:
switch (thing)
{
case A:
stuff;
break;
case B:
things;
break;
}
Go here:
Tools > Options > Text Editor > C# > Formatting > Indentation > Indent case labels
An updated method of doing this, it's not too different.
Tools > Options > Text Editor > (Language) > Code Style > Formatting > Indentation > Indent case labels
Tools | Options | Text Editor | c# -> check 'Ident block contents' checkbox.

Resources