Mechanical Turk Java API: Creating HITS in Loop - mechanicalturk

I have question in form of XML and I create them in loop for each question. I then create HIT in each loop giving input question file. But then each time HIT is created the url seems to be same and my previous HIT gets overwritten. Any help is appreciated.
In below code Iam referring to
String url = service.getWebsiteURL() + "/mturk/preview?groupId=" + hit.getHITTypeId()
where url that is formed is same for all HITS.
How can i create different HIT url?
HITQuestion question = new HITQuestion(questionFile);
HITProperties props = new HITProperties(propertyFile);
//Creating the HIT and loading it into Mechanical Turk
HIT hit = service.createHIT(null, // HITTypeId
props.getTitle(),
props.getDescription(),
props.getKeywords(), // keywords
question.getQuestion(),
props.getRewardAmount(), props.getAssignmentDuration(),
props.getAutoApprovalDelay(), props.getLifetime(),
props.getMaxAssignments(), props.getAnnotation(),
props.getQualificationRequirements(),
null // responseGroup
);
System.out.println("Created HIT: " + hit.getHITId());\
System.out.println("You may see your HIT with HITTypeId '" + hit.getHITTypeId() + "' here: ");
System.out.println(service.getWebsiteURL() + "/mturk/preview?groupId=" + hit.getHITTypeId());

When you create HITs with the same qualifications and payment, they appear under the same groupid. When you complete as a Worker one HIT, another will then become available. If you log onto the Requester view on mturk.com you will be able to see all your HITs individually

Related

How to troubleshoot issues related to requests and responses from ws loaded in SM

I am working on an integration between Microfocus Service Manager and Remedy. In order to troubleshoot issues related to requests and responses from SM to Remedy is needed to print or send that information to a log. I have tried using a debug -RTM:3 flag in my testing port configuration, but unfortunately there is a lot of information in my log since it writes every step performed by the tool. After that, I set the -debughttp flag in my port, but it only writes inputs/outputs from external resources.
Here is what I have done:
Load Remedy customer's endpoint with WSDL2JS utility.
Invoke the endpoint with a SL.
Perform a request to the endpoint.
Get an undefined response.
Check logs written by -RTM and -debughttp without success.
Is there any way to check what’s happening with my requests or with my customer’s reponses?
You can get the content of your requests and responses using the sl created by WSDL2JS only adding a piece of code within it.
For your requests, look for this part of the code (about line 129):
this.resultXML = doSOAPRequest( this.location, soapOp.SOAPAction, result.xml,
this.user, this.password,
this.connectTimeOut, this.sendTimeOut, this.recvTimeOut,
this.attachments, this.acceptfastinfoset );
Add the following code below:
//Print your request
print(result.xml)
//Send your xml request to a internal log called integration_debug.log in your app server
writeFile("../logs/integration_debug.log","a","\n");
writeFile("../logs/integration_debug.log","a","######### REQUEST INFO XML######\n");
writeFile("../logs/integration_debug.log","a",system.functions.tod()
+ "\n"
+ result.xml
+ "\n"
+ "\n");
For your customer’s responses, look for this part of the code:
if ( soapOp.responseObj == "null" ) // one-way MEP ?
{
return null;
}
var resultObj = new Object();
resultObj.responseObj = soapOp.responseObj;
Add the following code below:
//Print your customer response
print(this.resultXML.getDocumentElement())
//Send your xml response to a internal log called integration_debug.log in your app server
writeFile("../logs/integration_debug.log","a","\n");
writeFile("../logs/integration_debug.log","a","######### RESPONSE INFO XML#######\n");
writeFile("../logs/integration_debug.log","a",system.functions.tod()
+ "\n"
+ this.resultXML.getDocumentElement()
+ "\n"
+ "\n");
As a reference you can check the following picture to identify where inserting your code:
Hopefully, that can be helpful for your troubleshooting.

New member not able to see all other existing members in the audio room

We are building an audio broadcasting app. The issue is that when the audio room has more than 3 users, now when another user joins the room, he/she sometimes can only see a portion of the existing users in the room. (This issue does not happen all the time)
The way we are implementing this is that when a user joins the room, existing members use the method sendMessageToPeer to send the info of themselves to the new user. My guess is that some sendMessageToPeer calls may fail and that causes some members not showing up in the new users' screen.
My questions are:
are we doing it correctly? If not, what should be the right way?
Is there a way to fetch a batch of the existing users in the room?
If this is the right we to send info the new users, would it be very slow if there are many users in the audio room
this._rtmEngine.on('channelMemberJoined', evt => {
const {rtcUid} = this.state
const {userData} = this.props
// send data to new joined user
this._rtmEngine?.sendMessageToPeer({
peerId: evt.uid,
text:
this.state.rtcUid +
':' +
userData._id +
':' +
userData.profilePicUrl +
':' +
userData.firstName,
offline: false,
})
})
Are you also getting the new users information to the existing users in the channel?
You can do this by sending a channel message to all the existing users in the channel when someone joins an audio room.
If you've covered that then the code snippet looks correct, I'd check if the message is failing by adding console.log(s) on the recipient end.
You can get members in an RTM channel using getMembers method.

SoftLayer API unable to get networkComponents in time after createObject

In the past, Using getObject method to get networkComponents(PrimaryBackendNetworkComponent, PrimaryNetworkComponent) in time after createObject.
The curl URL is below with appropriate object mask.
$ curl 'https://{username}:{api_key}#api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/{vid}.json?objectMask=mask%5Bid%2C+globalIdentifier%2C+hostname%2C+domain%2C+fullyQualifiedDomainName%2C+status.name%2C+powerState.name%2C+activeTransaction%2C+datacenter.name%2C+operatingSystem%5BsoftwareLicense%5BsoftwareDescription%5Bname%2Cversion%5D%5D%2Cpasswords%5Busername%2Cpassword%5D%5D%2C++maxCpu%2C+maxMemory%2C+primaryIpAddress%2C+primaryBackendIpAddress%2C+privateNetworkOnlyFlag%2C+dedicatedAccountHostOnlyFlag%2C+createDate%2C+modifyDate%2C+billingItem%5BnextInvoiceTotalRecurringAmount%2C+children%5BnextInvoiceTotalRecurringAmount%5D%5D%2C+notes%2C+tagReferences.tag.name%2C+networkVlans%5Bid%2CvlanNumber%2CnetworkSpace%5D%2C+primaryBackendNetworkComponent%5BprimaryIpAddress%2C+networkVlan%5Bid%2Cname%2CvlanNumber%2CprimaryRouter%5D%2C+subnets%5Bnetmask%2CnetworkIdentifier%5D%5D%2C+primaryNetworkComponent%5BprimaryIpAddress%2C+networkVlan%5Bid%2Cname%2CvlanNumber%2CprimaryRouter%5D%2C+subnets%5Bnetmask%2CnetworkIdentifier%5D%5D%5D'
And readable object mask is below:
INSTANCE_DETAIL_MASK = "id, globalIdentifier, hostname, domain, fullyQualifiedDomainName, status.name, " +
"powerState.name, activeTransaction, datacenter.name, " +
"operatingSystem[softwareLicense[softwareDescription[name,version]],passwords[username,password]], " +
" maxCpu, maxMemory, primaryIpAddress, primaryBackendIpAddress, " +
"privateNetworkOnlyFlag, dedicatedAccountHostOnlyFlag, createDate, modifyDate, " +
"billingItem[nextInvoiceTotalRecurringAmount, children[nextInvoiceTotalRecurringAmount]], notes, tagReferences.tag.name, networkVlans[id,vlanNumber,networkSpace], " +
"primaryBackendNetworkComponent[primaryIpAddress, networkVlan[id,name,vlanNumber,primaryRouter], subnets[netmask,networkIdentifier]], primaryNetworkComponent[primaryIpAddress, networkVlan[id,name,vlanNumber,primaryRouter], subnets[netmask,networkIdentifier]]"
But about 18 hours ago, This way is not working because two primary network components stay null. And I have to wait about 30 seconds to call in the workaround.
The question is that I want to know that this situation is temporary or permanent change. We programmatically request these API requests. So it is risky if not to find the root cause.
Please tell me if anyone knows the details of Softlayer.
the createObject method does not create a Virtual server immediately, you need to check first if the server has been provisioned properly, for that propourse you can see the provisionDate property as it is detailed here: https://sldn.softlayer.com/blog/phil/simplified-cci-creation Once the server has been provisioned properly you should be able to see all the information that you want to

Google Spreadsheet API Changes

We are using Spreadsheet API in our .Net Application to change content dynamically in the spreadsheet, and we are using that content to update values in the Google Ads with AdWords Script.
But from 1st June 2015 we are facing issues in our .Net Application, because of the update in the Spreadsheet API.
Our earlier work :- We were making window based application and scheduling it hourly. In the background it was retrieving and adding value in the spreadsheet. In the previous application, we used to authenticate our Gmail id and password only once in our code.
Below is the exact problem we are facing :-
As per the new API we need to authenticate our app each and every time it runs and also every time we need to put unique access code, which will badly affect our automation.
I would appreciate your immediate attention to this matter, and looking forward to your revert.
After lot of R&D I got the solution.
Links:
https://developers.google.com/apps-script/guides/jdbc
//it will insert value into table entries
function main() {
// Replace the variables in this block with real values.
var address = 'Your Server IP:1433';
var user = 'Server username';
var userPwd = Server Password';
var db = 'lms';
var dburl = 'jdbc:sqlserver://Your Server IP:1433;DataBaseName=lms';
// Write one row of data to a table.
var conn = Jdbc.getConnection(dburl, user, userPwd);
Logger.log(conn);
var stmt = conn.prepareStatement('INSERT INTO entries '
+ '(guestName, content) values (?, ?)');
stmt.setString(1, 'First Guest');
stmt.setString(2, 'Hello, world');
stmt.execute();
// Write 500 rows of data to a table in a single batch.
}

store.load() triggers read + create

I'm developing a app where a list is automatically refreshed every 15 sec. To do so, I load the store every 15 sec from server (sending the params) via php page linked to a postgreSQL DB. So far, so good, and it works OK.
Buy I have noticed that every time the store is loaded, it sends two requests to the server (read + create). While the read request is necessary to load new elements to the store, the create is completely useless, because it sends the whole store as payload and receives nothing making use of the network for nothing.
How can I make the store to read, and only read, from the server when it loads?
Thanks
Some week sago I had some unexpected creates too. Googles learned me that there is an issue with Sencha with store.load(). It seems loaded records stay phantoms after loading. A store.sync() will create all records in a store that are phantoms (means they are not yet in back end).
I have next code in my on load callbacks:
callback: function(records, operation, success) {
var x = records.length;
for (i = 0; i < x; i++) {
records[i].phantom = false;
}
}
This solved my problem.