Can't use paramaters in HP Loadrunner 11 - c

I have the following code:
lr_output_message( "We are on iteration #%s", lr_eval_string( "{iteration}" ) );
Return log message:
We are on iteration #{iteration}
Did anyone have the same poblem?
A few hours ago, it was works fine.

The only time you'll see an output like that is if LoadRunner can't find a parameter with that precise name.
Usually this is because you've done something wrong; a typo, etc.
Did you define "iteration" EXACTLY like you are using it? Or did you do something like use a capital 'I' (Iteration), or spell it differently, etc?

Please try this:
lr_output_message( "We are on iteration # %d", atoi(lr_eval_string("{iterationnumber}")));

Related

array_search returns just 1 result

I´m starting to study PHP and I have a doubt in one lesson about array_search.
The teachers example shows "A peeple who got a 10" and as only one of the people got a 10 everything works fine, showing the person's name.
But I've been trying to use it to fetch more than one result. In this case I created this array, with 3 people taking 10:
$notas2=array(
"Ana"=>4,
"Misca"=>10,
"Chatuba"=>6,
"Jurandir"=>7,
"Musca"=>10,
"Mickey Mouse"=>10,
);
echo array_search(10,$notas2);
This code just returns "Misca". I tried a foreach, but it returned only "MiscaMiscaMiscaMiscaMiscaMisca". lol
foreach(array_search(10,$notas2)as $tirou10){
echo $tirou10;
}
Anyone can help-me?
Tanks.
array_search will export only first corresponding key. If you want to get all people who got 10 use array_keys($notas2, 10) it will return array and instead of echo use var_dump() or var_export()
The PHP function array_search only returns the first entry.

Using Google Sheet's Filter function, clarification needed

I am trying to filter some information with 2 conditionals (something is true and something else is >0)
Independently things work just fine:
=unique(filter(
indirect($A$1&"!$E$3:E"),
indirect($A$1&"!$C$3:C")=TRUE
))
gives me a list of things that are true, and
=unique(filter(
indirect($A$1&"!$E$3:E"),
indirect($A$1&"!$J$3:J")>0
))
gives me a list of things that are >0.
When i try to combine them, like this
=unique(filter(
indirect($A$1&"!$E$3:E"),
indirect($A$1&"!$C$3:C")=TRUE,
indirect($A$1&"!$J$3:J")>0
))
I get an error No matches are found in FILTER evaluation.
What am i missing please?
PS: It goes without saying that I do indeed have things that are both true and are > 0
for non-english locale it would be:
=unique(filter(
indirect($A$1&"!$E$3:E");
indirect($A$1&"!$C$3:C")=TRUE;
indirect($A$1&"!$J$3:J")>0))

Flex does not recognize identifiers

I am trying to implement a very simple parser using flex. I am currently stuck in the ID recognition. That is my code:
ID [a−zA−Z_][a−zA−Z0−9_]*
...
{ID} { printf( "An identifier: %s\n", yytext ); return TOK_ID;}
However what I get is only the first letter of the identifier, for example if I try to parse:
int _underscore ;
The result is:
An identifier: _
Any advice?
EDIT:
With a more accurate analysis I have figured out that the code is able to recognize only the id with a,z,A,Z,_, that are the explicit characters in the regular expression. I did not find anything like that online, is that a bug?
EDIT2:
If I modify the code in that way all work
ID [a−zA−Z_][a−zA−Z0−9_]*
...
[a−zA−Z_][a−zA−Z0−9_]* { printf( "An identifier: %s\n", yytext ); return TOK_ID;}
According to the documentation it should work also in the other way.
This is a character encoding issue. In your copy-and-pasted source code, the things that look like ASCII hyphens (-, code U+2D) in your definition of ID:
ID [a−zA−Z_][a−zA−Z0−9_]*
aren't. Instead they're unicode minus signs (−, U+2212). If you replace the incorrect minus signs with the correct hyphens, the line will look like:
ID [a-zA-Z_][a-zA-Z0-9_]*
Depending on your font, if you look very closely, you may see a difference between the − in the first version and the - in the second.
Anyway, replace your ID definition with the second version above (or else retype it from scratch, and all should be well.

for each (root of variable) in SPSS

I'm new in SPSS program but I've tried to search a solution to my problem. The idea is find a way to loop through some variable names (or I think so). I want to create the variables P216_XX, P217_XX, T211_XX and OCUPAC_XX, with other variables like some inputs (P216_13, P216_12, P216_11, P216_10, P217_13, P217_12, P217_11, P217_10, T211_13, T211_12, T211_11, T211_10, OCUPAC_13, OCUPAC_12, OCUPAC_11, OCUPAC_10 and IIIDDDEEE).
I'm following the next tedious instruction:
******TEDIOUS INSTRUCTION:
*****P216_XX.
IF (IIIDDDEEE=1) P216_XX=P216_13.
EXECUTE.
IF (IIIDDDEEE=2) P216_XX=P216_12.
EXECUTE.
IF (IIIDDDEEE=3) P216_XX=P216_11.
EXECUTE.
IF (IIIDDDEEE=4) P216_XX=P216_10.
EXECUTE.
*****P217_XX.
IF (IIIDDDEEE=1) P217_XX=P217_13.
EXECUTE.
IF (IIIDDDEEE=2) P217_XX=P217_12.
EXECUTE.
IF (IIIDDDEEE=3) P217_XX=P217_11.
EXECUTE.
IF (IIIDDDEEE=4) P217_XX=P217_10.
EXECUTE.
*****T211_XX.
IF (IIIDDDEEE=1) T211_XX=T211_13.
EXECUTE.
IF (IIIDDDEEE=2) T211_XX=T211_12.
EXECUTE.
IF (IIIDDDEEE=3) T211_XX=T211_11.
EXECUTE.
IF (IIIDDDEEE=4) T211_XX=T211_10.
EXECUTE.
*****OCUPAC_XX.
IF (IIIDDDEEE=1) OCUPAC_XX=OCUPAC_13.
EXECUTE.
IF (IIIDDDEEE=2) OCUPAC_XX=OCUPAC_12.
EXECUTE.
IF (IIIDDDEEE=3) OCUPAC_XX=OCUPAC_11.
EXECUTE.
IF (IIIDDDEEE=4) OCUPAC_XX=OCUPAC_10.
EXECUTE.
In stata, the form would reduce the previous syntax with something like that:
foreach x in P216 P217 T211 OCUPAC {
replace `x'_XX=`x'_13 if IIIDDDEEE==1
replace `x'_XX=`x'_12 if IIIDDDEEE==2
replace `x'_XX=`x'_11 if IIIDDDEEE==3
replace `x'_XX=`x'_10 if IIIDDDEEE==4
}
*
In SPSS, I proved with vector, but SPSS don't accept me root in the vector, only variables. I don't know how to continue and I haven't found something similar yet
Is possible found a solution with native SPSS language? (I forgot to comment that in my work, the "administrator" doesn't allow us to install other programs like Python). What would be a possible solution?
There are a quite a lot of ways you can simplify this code, look up:
DEFINE/ENDDEFINE, SPSS's macro language.
DO IF
DO REPEAT
You need to be familiar with each and know what your end goal is to assess which option is best for you.

Display result GeoQuerySet

I'm trying to query my PostGis database thanks to geoDjango but I have an error where I found no solution on the internet.
close_loc=PlanetOsmPoint.objects.get(way__distance_lte=(lePoint, D(**distance_from_point)))
Whatever I try on the result (close_loc) with a print, I have this error :
django.db.utils.DatabaseError: Only lon/lat coordinate systems are supported in geography.
I tried to convert it to a correct format thanks to transform(SRID) but nothing was solved, still the same problem.
Here's some informations :
Transformation :
sr1=SpatialReference('54004')
sr2=SpatialReference('NAD83')
ct=CoordTransform(sr1, sr2)
What I'm doing after getting the close_loc :
close_loc.transform(ct)
print close_loc[0]
close_loc type is GeoQuerySet.
How can I exploit this result ?
The transform() function expects an integer, not a string. The correct syntax is:
close_loc.transform( new_srid_number )
In your case, something like this:
close_loc.transform(54004)
Hope it'll work !

Resources