Jmeter - How do I add comments to a parameter file? - performance

This may be a somewhat basic question, but how do I add comments to a parameter file for a Jmeter test?
Have seen what purport to be examples using both # and //.
Which is correct?
In need of this as I have a number of tests using a lot of parameters and I need to comment them up such that the next guy to run them will have an easier time understanding them.
Thanks,
Iain

For you parameter file which is a properties file, comment will be specified through
#

Related

conditional include in asciidoc

I am using Spring RestDoc together with AsciiDoc to describe my rest api. RestDoc generates different files depending if there are request parameters described / response fields etc. I would like to have one template conditionally including whatever file exists.
something like this:
Request:
include::{reqresPath}/http-request.adoc[]
Response:
include::{reqresPath}/http-response.adoc[]
Parameters:
ifeval::[{{reqresPath}/request-parameters.adoc}.exists]
include::{reqresPath}/request-parameters.adoc[]
endif::[]
ifeval::[{{reqresPath}/request-parameters.adoc}.exists]
include::{reqresPath}/request-parameters.adoc[]
endif::[]
or at least exclude warnings in case of a missing file. But I could not figure out how to suppress these.
As of today, where is no operator for ifeval available, which can be used to check the existence of a file.
The way I would go is to write an extension for Asciidoctor, which can also be done by using Java. If your projects is big enough, I would suggest to go for this solution.
The most extreme way is to make a custom TemplatedSnippet which is generating an empty snippet to be included...
I hope there is a better way to do this.
Edit:
Take a look of http://asciidoctor.org/docs/user-manual/#by-tagged-regions

On Veins, how to get some values from ini file?

On Veins applications (veins/src/modules/application/app_name.(cc, h), how to get values like
*.car[*].appl.numVehicles from theini file?
I can get values like sim-time-limit (see below) and anothers createad by me one, by I can't acess values on *.car[*].* or *.rsu[*].* from ini file.
stringTmp = ev.getConfig()->getConfigValue("sim-time-limit");
I'd appreciate any help
I got the "numVehicles" parameter from the .ini file using the following codification:
long numV = Veins::TraCIScenarioManagerLaunchdAccess().get()->par("numVehicles").longValue();
I hope this can help you.
Douglas
Reading parameter values of a module can be done via a call to this module's par(...) method.
I would highly recommend doing the TicToc tutorial, where this is demonstrated succinctly

Add a comment on .htpasswd

I was wondering if it is possible to write a comment on the .htpasswd file.
Why ? Because sometimes, we have to "disable" some users, just for a couple of days. I checked on StackOverflow and other websites, and it seems pretty confusing :
Not possible
Possible with ::
Possible with # (like .htaccess)
::bar:$apr1$G3iw8iqc$IGNoXDw7e7HolcSgE/V0a0
#foo:$apr1$3dJLDmbn$/zODUbSXmqDfeeCmMFKO8/
NB: I don't want to disable users by adding a fake char at the beginning of the line, for instance. I want a clean way, if this is possible ;)
After testing, both seems to work, but I want some expert opinions (and btw VIm doesn't syntax highlight neither :: nor #)
Apache's config file format (of which .htaccess files are one example) doesn't technically support inline comments, only full-line comments (i.e. a line beginning with a #).
Lines that begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on a line after a configuration directive. -- Official Apache 2.4 manual
As far as I know, the syntax of these files is the same as other Apache configuration files. Apache does not document this specifically for .htpasswd, but says generically that comments can be added to their config files by using #. Comments can only span one line. Directives must be on one line, but can span multiple lines when appended with \ at the end of the line.

How to split a large csv file into multiple files in GO lang?

I am a novice Go lang programmer,trying to learn Go lang features.I wanted to split a large csv file into multiple files in GO lang, each file containing the header.How do i do this? I have searched everywhere but couldnt get the right solution.Any help in this regard will be greatly appreciated.
Also please suggest me a good book for reference.
Thanking You
Depending on your shell fu this problem might be better suited for common shell utilities but you specifically mentioned go.
Let's think through the problem.
How big is this csv file? Are we talking 100 lines or is it 5G ?
If it's smallish I typically use this:
http://golang.org/pkg/io/ioutil/#ReadFile
However, this package also exists:
http://golang.org/pkg/encoding/csv/
Regardless - let's return to the abstraction of the problem. You have a header (which is the first line) and then the rest of the document.
So what we probably want to do (if ignoring csv for the moment) is to read in our file.
Then we want to split the file body by all the newlines in it.
You can use this to do so:
http://golang.org/pkg/strings/#Split
You didn't mention but do you know how many files you want to split by or would you rather split by the line count or byte count? What's the actual limitation here?
Generally it's not going to be file count but if we pretend it is we simply want to divide our line count by our expected file count to give lines/file.
Now we can take slices of the appropriate size and write the file back out via:
http://golang.org/pkg/io/ioutil/#WriteFile
A trick I use sometime to help think me threw these things is to write down our mission statement.
"I want to split a large csv file into multiple files in go"
Then I start breaking that up into pieces but take the divide/conquer approach - don't try to solve the entire problem in one go - just break it up to where you can think about it.
Also - make gratiutious use of pseudo-code until you can comfortably write the real code itself. Sometimes it helps to just write a short comment inline with how you think the code should flow and then get it down to the smallest portion that you can code and work from there.
By the way - many of the golang.org packages have example links where you can literally run in your browser the example code and cut/paste that to your own local environment.
Also, I know I'll catch some haters with this - but as for books - imo - you are going to learn a lot faster just by trying to get things working rather than reading. Action trumps passivity always. Don't be afraid to fail.
Here is a package that might help. You can set a necessary chunk size in bytes and a file will be split on an appropriate amount of chunks.

Checkstyle vs. nonJavadoc comments?

My company requires specific comment header blocks at the top of a file, prior to class definitions, and methods.
I'm using the Regexp in the config file to validate the file header comments. If there is a nonJavaDoc comment before a class or method, can I access the text?
My clunky solution is to get a CTOR_DEF or METHOD_DEF, then get the line number...then get the filecontents...find the line, then try to backup to the comment header.
Is there a way to get the text of nonJavaDoc comments in context? Thanks.
Your clunky approach is the only viable one. I would suggest that you can use the method FileContents.getCppComments() to get a map of all C++ comments in a file.
You may also find the method FileContents.lineIsComment() is useful.

Resources