Export all defects from HP ALM using PHP - php

How can I export all defects with certain status from HP ALM using a PHP script?

If you are using REST API of HP QC, then command you should send during your session is something like:
GET https://qc-SERVER/qcbin/rest/domains/DOMAIN/projects/PROJECT/defects?query={status[open]}
In this case you will get all the defect in status OPEN. If you remove the query part, then it is possible to get all the defects under QC. If your projects has plenty of defects, then you should think to specify:
page-size=%d&start-index=%d
where %d are numbers to set how big can be the xml coming back (usually MAX=2000) and at which index you want to start.
Hope this solve your query! Have a nice day.

Related

How to use WebIOPi in existing website

I'm trying to use WebIOPi but I'm quite lost in getting it to work with my project.
Background:
I'm using Raspberry Pi B+ running Wheezy. I'm working on a web-based application that will only be accessed locally. I have a bunch of php files in /var/www that run on Apache. Now I need to get my coin acceptor to with the project. The coin acceptor http://www.adafruit.com/products/787 sends single pulses (I only need one coin). I first tried the coin acceptor with a python script using interrupts and it works fine.
GPIO.setup(PIN_COIN_INTERRUPT,GPIO.IN)
GPIO.add_event_detect(PIN_COIN_INTERRUPT,GPIO.FALLING,callback=coinEventHandler)
But now I need to be able to capture those pulses and show them on a php page, updating the amount for every coin insert. I've been studying WebIOPi for hours but I can only find info on reading a pin's status, not listening for interrupts. Can anybody point me to the right direction?
Any help would be greatly appreciated. Thank you!
So, you seem to have two problems:
1. how do I, on the server, detect a new coin event
2. how do I then push this to the client browser.
I don't know webiopi at all, so I can't say there's not a way to use that to solve both, but as an alternative:
For part 1: you have a python program which you said works; I would suggest running as a background service and just have it do something simple like writing the latest value of coinage to a file:
GPIO.setup(PIN_COIN_INTERRUPT,GPIO.IN)
GPIO.add_event_detect(PIN_COIN_INTERRUPT,GPIO.FALLING,callback=coinEventHandler)
def coinEvenHandler(*arguments):
try:
f = open("coin.txt","rt")
cnt = int(f.read())
f.close()
except: # handle file doesn't exist and file doesn't contain an int
cnt = 0
f = open("coin.txt","wt")
f.write(str(cnt))
f.close()
For part 2:
1. Create a page which returns the value of "coin.txt"
2. Use Ajax (e.g. jquery) to poll for this value from your client page.

memory execution in large php program execution

I have created script where I get user review from Yelp, google etc using their API.
Using this review for Part of speech tagging, kinda Natural lang processing stuff.
I keep loop, which contiously keep fetching the review and extract noun, adjective for each.
I am using this tutorial:
http://phpir.com/part-of-speech-tagging
When I execute the script, it abruptly stops after 40-50 review processing. It does not show any error. DOes is it due to
"php has run out of space in memory"
as per one of the comment on above link. OR some other issue. When I tried my script with limited review example, it works fine.
Here is the link where I execute my script:
http://ec2-54-186-110-98.us-west-2.compute.amazonaws.com/scrap/getreview.php
Try adding this to your script -
ini_set("memory_limit", "-1");
set_time_limit(0);
This happened to me when i fetched some mediumtext column from mysql. Are you using like this?

Amazon MWS (PHP) - How does the request work

I am trying to pull a report in PHP for active listings.
I've made progress, however, I cannot understand how this works and there is nothing out there that can explain it.
For example, in the Samples provided from the PHP library, I see quite a few XML files. When you run the RequestReportResponse sample, does that generate the XML file, or does the XML file tell the RequestReportResponse what to do based on values and functions?
I am asking because, with the MWS Scratchpad - I select all the necessary fields, submit it then refresh the Amazon Reports page of my seller central section and it shows a pending report.
I'm just asking how the XML content affects the report or how the report can affect the XML.
The answer to your question comes in two parts.
Part 1 - Calling the Amazon API
Most MWS requests do not require any file (be it plain text or XML) to be sent to Amazon. For example, all parameters needed to do send RequestReport can (and must) be sent as regular parameters. I'm not sure what Amazon would do if you did submit a file along with it as I've never tried. But then again... why would you?
One of the calls that does require a file to be send is the SubmitFeed call where that file is the actual feed to be submitted. It depends on the type of feed you're submitting if Amazon expects it to be plain text or XML.
Part 2 - Handling Amazon's API responses
When you get information back from Amazon's API, it usually is in XML format (there are a few calls that may return plaintext instead). You will need to decode this data to get your information out.
To make it a bit clearer, I'll outline a typical process for you:
The process of getting all your listings from Amazon:
Do a RequestReport call to Amazon. No XML attached
Decode the XML that you're getting back (it is a RequestReportResponse). If all went well, you'll get a RequestReportId as part of the response, and Amazon will start processing your request.
Amazon may need a few minutes to actually create the report, in cases of very complex or large requests or during high activity hours it may actually take up to an hour or more. So we need to find out when the request we made is actually done.
Poke Amazon API with a GetReportRequestList call asking for the status of your request with ReportRequestIdList.Id.1={YourRequestIdHere}. This also does not need a XML attachment.
Decode the XML that you're getting back. (it is a GetReportRequestListResponse)
If its ReportProcessingStatus is not _DONE_, wait for at least 45 seconds, then repeat from step 3. If the report is actually done, you'll see a valid GeneratedReportId in the response. If it is missing, you'll need to do an extra GetReportList call to find its ID.
Call GetReport to finally fetch your report with ReportId={YourGeneratedReportIdHere}
Decode whatever you're getting back. Depending on the type of report you requested, the response may be XML or plain text.
This process is explained in detail (and with a pretty flow chart) in Amazon Marketplace Web Service Reports API Section Reference (Version 2009-01-01)
To finally answer your question with respect to getting active listings from Amazon MWS:
None of the three calls require you to send XML to Amazon. The data you receive from Amazon will be in XML format (with the possible exception step 6 if you requested a plain text report).

Real time tracking in google map

I already wrote a android apps to upload the lat and long to MySQL database(updated every 2min).
now, i have no idea how to show the real time location on Google map in the website(php,javascript,html)
which means how to dynamic update the Google map markers every 2 min [get the last two minutes records from MySQL database
and show the markers(update or disappear)]
and after i click the marker, it should show the info[get from mysql database(not important point because it same with static Google map!?]
just like this: http://traintimes.org.uk/map/tube/
I just know how to do when i just get 1 time (Static Google map!?) with my limited knowledge.
I have already searched same question in stack overflow and google
but i am sorry i still no idea how to do it because of my lack of knowledge.
Real time Google Map
anyone could give me some tutorial website or suggestion?
At last, thank all of you
and
I still a learner of English,I am sorry about any wrong grammar.
Real-time Tracking Geo Latitude/Longitude on a Map
You are looking to update coordinate entities (lat/lon position) on a map (google maps or otherwise) in real-time as the updates occur. Here is a blog post that may get you started in the right direction: http://blog.pubnub.com/streaming-geo-coordinates-from-mongodb-to-your-iphone-app-with-pubnub-using-websocket-sdk/ - this uses MongoDB and Ruby rather than PHP and MySQL. However it will be easy to get things setup in this case with a real-time map in PHP and MySQL on an HTML page with the following details. And there is a video too: https://vimeo.com/60716860
Using MySQL to Trigger Update in Real-time
First you'll want to use either MySQL triggers to push the Lat/Long coords - Invoke pusher when mysql has changed - this uses MySQL Triggers
Or as an alternative you may want to use PHP directly to invoke the push signal using a PHP push SDK as follows: https://github.com/pubnub/php#php-push-api
$pubnub->publish(array(
'channel' => 'live_map_coords',
'message' => array( 12.3482, 8.3344 )
));
Receiving The Push Message in JavaScript and Showing the Updates on a Map
<script src=//pubnub.a.ssl.fastly.net/pubnub-3.4.5.min.js></script>
<script>(function(){
PUBNUB.init({
subscribe_key : 'demo'
}).subscribe({
channel : 'live_map_coords',
callback : function(lat_lon) { alert(lat_lon) }
});
})();</script>
Once you have an map.html page with the above code in it, you can change the alert(lat_log) message popup with drawing coords on a map. Here is a fully working map drawn example using D3 JavaScript SVG rendering Framework: https://github.com/stephenlb/pubnub-mongo-pipe/blob/master/phone/map.html
NOTE: This is only a starting point and provides you with references on getting started to make it easy and simple, yet flexible based on the direction you will be taking your app.
Next Steps to Piece Together the Real-time Geo Map
You will next want to do the following to complete the process and join together all the separate components listed here.
Modify the map.html page for your purposes to display always-visible dots. Note that in the video the dots are temporary beacons that display and vanish rapidly. You'll want to make them persist on the map. This is basically the "Make it look the way you want it" step.
Decide how and when you want to trigger the TCP Socket Push events from PHP or MySQL directly. I'd recommend the PHP approach.

PHP Sample to Request and Download Bing Ads Report not working

I'm really stucked on this so any help would be really useful!!
I've download the PHP Sample to Request and Download Bing Ads Report: http://code.msdn.microsoft.com/PHP-Sample-that-Shows-How-d817dfe5 and is not working for me. I've tried lots of things and don't know what to do now.
I'm using Ubuntu and got my SOAP installed, it's seems that Request Classes are not generated by SOAP, I paste what happens next:
$ php ReportingSample.php
To specify the report to generate, please enter the numeric value of the corresponding report. Otherwise, enter the ID of a previous download attempt.
1 - Account Performance Report
2 - Ad Performance Report
3 - Campaign Performance Report
4 - Keyword Performance Report
5 - Negative KW Conflict Report
6 - Search Query Report
Type (or 99 to end): 4
Enter a valid file name to write the report to. Do not include an extension.
test
The report will be written to /home/opascual/projects/bing/PHP/PhpReportingSample/ReportingSample/reports/test.zip.
PHP Fatal error: Class 'KeywordPerformanceReportRequest' not found in /home/opascual/projects/bing/PHP/PhpReportingSample/ReportingSample/ReportingSample.php on line 347
Thanks in advance!!
Oscar
You will need to download the Bing API PHP production classes from
http://code.msdn.microsoft.com/windowsdesktop/PHP-Production-Classes-for-378b0d25

Categories