I am using this C++ code on an ESP8266 to check on several http accessible data. Once in a while this device acts strangelay and I would like to be able to look at the data it gets. So I collect all payloads to be able to check it via rest api. The following code ALMOST works
String payloadAll = "start ###";
http.begin(client, getLink2);
httpCode = http.GET();
if ( httpCode > 0 ) { payload = http.getString(); payloadAll = payloadAll + payload.c_str() + "### ENDE-PAYLOAD1 ###"; }
the output looks like this:
start ###Internals: DEF 1 60 192.168.40.1:1502 TCP DeviceName 192.168.40.1:1502 EXPECT idle FD 6 FUUID 5xxxxx-fxxx-9xxx-fxxx-exxxxxxxxxxx IODev SolarEdge Interval 60 LASTOPEN 1647580317.55657 MODBUSID 1 MODE master MODEL SE8K-XXXXXXXXXX### ENDE-PAYLOAD1 ###
That is the first line of the payload only. I don't know much about the formast the requested data is in but once it is in the String, I can search ind find keyword and such from the lines I don't see in the output, so I know the data is there. If I leave out the ".c_str()" part, I will only get "start ###### ENDE-PAYLOAD1 ###"
How can I get all the lines - formatting is not important - it can all be one line, I just need to be able to see it as plain text.
Thanks!
WWW::Mechanize::Chrome loses somehow the node, when calling a different method like ->find_all_links()
No node with given id found
-32000 at /usr/local/share/perl/5.20.2/Chrome/DevToolsProtocol/Target.pm line 490
Node 447 has gone away in the meantime, could not resolve at /usr/local/share/perl/5.20.2/WWW/Mechanize/Chrome/Node.pm line 206.
No node with given id found
When I do $mech->get($url) again before fetching all links, it's working, but I don't want to re-get URLs every time when we call a method and we need to submit forms later on anyway.
my $mech = WWW::Mechanize::Chrome->new(
headless => 1,
launch_exe => '/usr/bin/google-chrome',
launch_arg => ["--headless" , "--no-sandbox"],
separate_session => 1,
);
&parse_content;
sub parse_content {
$mech->get($url);
my $content = $browser->content;
# parse some content
}
# $mech->get($url);
# fetching the links would work when getting the URL again
# but this is not the way it should work
my #links = $mech->find_all_links();
Can anybody help?
I am using free version of soapui. In my load test, I want to read request field value from a text file. The file looks like following
0401108937
0401109140
0401109505
0401110330
0401111204
0401111468
0401111589
0401111729
0401111768
In load test, for each request I want to read this file sequentially. I am using the code mentioned in Unique property per SoapUI request using groovy to read the file. How can I use the values from the file in a sequential manner?
I have following test setup script to read the file
def projectDir = context.expand('${projectDir}') + File.separator
def dataFile = "usernames.txt"
try
{
File file = new File(projectDir + dataFile)
context.data = file.readLines()
context.dataCount = context.data.size
log.info " data count" + context.dataCount
context.index = 0; //index to read data array in sequence
}
catch (Exception e)
{
testRunner.fail("Failed to load " + dataFile + " from project directory.")
return
}
In my test, I have following script as test step. I want to read the current index record from array and then increment the index value
def randUserAccount = context.data.get(context.index);
context.setProperty("randUserAccount", randUserAccount)
context.index = ((int)context.index) + 1;
But with this script, I always get 2nd record of the array. The index value is not incrementing.
You defined the variable context.index to 0 and just do +1
You maybe need a loop to read all values.
something like this :
for(int i=0; i <context.data.size; i++){
context.setProperty("randUserAccount", i);
//your code
}
You can add this setup script to the setup script section for load test and access the values in the groovy script test step using:
context.LoadTestContext.index =((int)context.LoadTestContext.index)+1
This might be a late reply but I was facing the same problem for my load testing for some time. Using index as global property solved the issue for me.
Index is set as -1 initially. The below code would increment the index by 1, set the incremented value as global property and then pick the context data for that index.
<confirmationNumber>${=com.eviware.soapui.SoapUI.globalProperties.setPropertyValue( "index", (com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "index" ).toLong()+1 ).toString()); return (context.data.get( (com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "index" )).toInteger())) }</confirmationNumber>
Which header file to be included for following code snippet to measure time using cuda event mathods?
cudaEvent_t start,stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
float Elapsed=0,Cycle;
for (int p=1; p<=MSG_NUM; p++)
{
cudaEventRecord(start,0);
add<<<R, (M+R), (M+R)* sizeof(int)>>>( d_msg, d_checkSumArray );
cudaEventRecord(stop,0);
cudaEventSynchronize(stop);
cudaElapsedTime(&Cycle,start,stop);
Elapsed += Cycle;
}
printf("Time = %f",Elapsed);
My program show following error as no header file included.
error : identifier "cudaElapsedTime" is undefined
Can someone give the solution please?
The correct API call is cudaEventElapsedTime(...).
Other than that your parameters look correct.
You don't need any special include headers if you are compiling with nvcc.
Originally this question and its precursor were asked on R-Sig-Geo:
https://stat.ethz.ch/pipermail/r-sig-geo/2012-July/015648.html
The "mow.R" contains:
library (RgoogleMaps)
png (filename="RgoogleMaps-package_%03d_med.png", width=480, height=480)
MyMap <- GetMap(markers =
'40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc',
sensor = "false", destfile = "MyTile1.png");
tmp <- PlotOnStaticMap(MyMap,lat = c(40.702147,40.711614,40.718217),
lon = c(-74.015794,-74.012318,-73.998284), cex=1.5,pch=20,col=c('red',
'blue', 'green'), add=F)
Executing this from R results in:
> source('mow.R')
[1] "Note that when center and zoom are not specified, no meta
information on the map tile can be stored. This basically means that R
cannot compute proper coordinates. You can still download the map tile
and view it in R but overlays are not possible. Do you want to proceed
? (y/n)"
y
[1] "40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc"
[1] "http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=false40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc"
Error in download.file(url, destfile, mode = "wb", quiet = TRUE) :
cannot open URL
'http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=false40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc'
In addition: Warning message:
In download.file(url, destfile, mode = "wb", quiet = TRUE) :
cannot open: HTTP status was '403 Forbidden'
>
I copied its url and pasted it in the browser:
http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=false40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc
It resulted in the following message:
The Google Maps API server rejected your request. The "sensor"
parameter specified in the request must be set to either "true" or
"false".
When I change the position of "&sensor=false" in the above url, it works fine:
http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png3240.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc&sensor=false
How to incorporate this change in the "mow.R" file now?
Please help;
You are not just changing the position of the sensor parameter. In your second URL you set it properly, on the first URL you don't set it at all because you're missing an ampersand '&' after the false value.
http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=false40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc
Should be:
http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=false&40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc