I'm developing a skill in Amazon Alexa. I'm trying to test the same using echosim.io but the problem is as below.
My Skill name is MyBot and the same is invocation name.
In echosim.io, When I say Alexa Launch MyBot, it gives the welcome response (The help response that I've coded in). When I say help, it gives me the help response that I've entered.
I've 4 intents say
FaqIntentOne
FIntentOne
FaqIntentTwo
FIntentTwo
And my Sample utterances are as below.
FaqIntentOne what is first answer
FIntentOne give me first answer
FaqIntentTwo what is second answer
FIntentTwo give me second answer
When I run these, Alexa doesn't give me a response.
I've the correct methods and the correct response set there. please let me know why it is not working for the utterances other than the built in ones.
when test in Alexa's test interface in developer.amazon.com, it is giving me the correct response.
This is quite confusing.
Below is how it looks in my code.
if ("FaqIntentOne".equals(intentName) || "FIntentOne".equals(intentName)) {
return getFirstHelp(intent, session);
}
else if ("FaqIntentTwo".equals(intentName) || "FIntentTwo".equals(intentName)) {
return getSecondHelp(intent, session);
}
Thanks
Though Amazon has referred people to echosim, it is not 'official' (it was developed by a 3rd party), so if it works in Amazon's test environment and not in echosim then it is possible that the issue is with echosim.
Otherwise I think you are going to need to look more closely at what is happening in your code, ie. debug it or put in some print statements and compare what happens when invoked in those 2 ways.
If you are running in Lambda - seems to be the most common - then you will need to take a look at CloudWatch logs.
Related
I'm trying to make a program that checks avaliable positions and books the first avaliable one. I started writing it and i ran into a problem pretty early.
The problem is that when I try to connect with the site (which is https) the program doesn't do anything. It doesn't throw an error, it doesn't crash. And the weirdest thing is that it works with some https websites and with some it doesn't.
I've spent countless hours trying to resolve this problem. I tried using htmlunitdriver and it still doesn't work. Please help.
private final WebClient webc = new WebClient(BrowserVersion.CHROME);
webc.getCookieManager().setCookiesEnabled(true);
HtmlPage loginpage = webc.getPage(loginurl);
System.out.println(loginpage.getTitleText());
I'm getting really frustrated with this. Thank you in advance.
As far as i can see this has nothing to do with HttpS. It is a good idea to do some traffic analysis using Charles or Fiddler.
What you can see....
The page returned from the server as response to your first call to https://online.enel.pl/ loads some external javascript. And then the story begins:
This JS looks like
(function() {
var z = "";
var b = "766172205f3078666.....";
eval((function() {
for (var i = 0; i < b.length; i += 2) {
z += String.fromCharCode(parseInt(b.substring(i, i + 2), 16));
}
return z;
})());
})();
As you can see someone likes to hide the real javascript that gets processed.
Next step is to check the javascript after this simple decoding
It is really huge and looks like this
var _0xfbfd = ['\x77\x71\x30\x6b\x77 ....
(function (_0x2ea96d, _0x460da4) {
var _0x1da805 = function (_0x55e996) {
while (--_0x55e996) {
_0x2ea96d['\x70\x75\x73\x68'](_0x2ea96d['\x73\x68\x69\x66\x74']());
}
};
.....
Ok now we have obfuscated javascript. If you like you can start with http://ddecode.com/hexdecoder/ to get some more readable text but this was the step where i have stopped my analysis. Looks like this script does some really bad things or someone still believes in security by obscurity.
If you run this with HtmlUnit, this codes gets interpreted - yes the decoding works and the code runs. Sadly this code runs endless (maybe because of an error or some incompatibility with real browsers).
If you like to get this working, you have to figure out, where the error is and open an bug report for HtmlUnit. For this you can simply start with a small local HtmlFile and include the code from the first external javascript. Then add some log statements to get the decoded version. Then replace this with the decoded version and try to understand what is going on. You can start adding alert statements and check if the code in HtmlUnit follows the same path as browsers do. Sorry but my time is to limited to do all this work but i really like to help/fix if you can point to a specific function in HtmlUnit that works different from real browsers.
Without the URL that you are querying it is dificult to say what could be wrong. However, having worked with HTML unit some time back I found that it was failing with many sites that I needed to get data from. The site owners will do many things to avoid you using programs to access them and you might have to resort to using some lower level library like Apache HTTP components where you have more control over what is going on under the hood.
Also check if the website is constructed using JavaScript which is getting more and more popular but making it increasingly dificult to use programs to interrogate the content.
I'm attempting to do a reverse lookup on a route I've created.
The route is defined as such in my routes file:
POST /login controllers.Web.Application.authenticate
However, when I try to do a reverse on it in a form I made, I can't seem to find it. I'm attempting to do a reverse like this:
#helper.form(action = routes.login())) {
rest of the form here...
}
However, the login appears in red in intellij and when attempting to run the program, I get the following error:
play.sbt.PlayExceptions$CompilationException: Compilation error[value login is not a member of object controllers.routes]
I've attempted recompiling the project multiple times and looking around the docs, but it's just not working... Any ideas?
So, an interesting thing happened recently and I found a way to point to the original structure properly. To do so, rather than writing:
routes.Web.Application.authenticate()
As Tyler suggested, I was supposed to write:
Web.routes.Application.authenticate()
Which is totally counter-intuitive and all, but that allows me to use the original package structure.
Edit:
As we discovered in the comments, the reverse router doesn't seem to like sub packages. You should remove the Web part of your package, and move everything up a level, then change the code to be this:
#helper.form(action = routes.Application.authenticate())) {
rest of the form here...
}
Original answer:
You need to refer to the controller function, and not the name of the route, so it should look something like this:
#helper.form(action = routes.Web.Application.authenticate())) {
rest of the form here...
}
I'm having trouble figuring out how to create issue a redirect to the browser after a certain condition in a Java webapp running on Tomcat. I'm sure there must be a simple solution, but my Java skills are extremely limited.
Here's the specific code I'm working with (copied from guacamole-auth-passthrough):
if (req.getParameter("username") == null {
LOG.error("username is required");
throw new GuacamoleServerException("username is required");
}
I'd like to replace that exception with a redirect back to the index page. In PHP I could simply do this:
header("Location: https://site.domain.com/",TRUE,302);
Java's not letting me off so easily, though. The best direct analog I could find is this:
response.sendRedirect("https://site.domain.com/");
However, that fails compilation with:
[ERROR] /home/dev/guacamole-client-0.9.9/extensions/guacamole-auth-passthrough/src/main/java/com/github/edouardswiac/guacamole/ext/PassthroughAuthProvider.java:[31,6] error: cannot find symbol
I've found many other examples of Java redirects (including this other stackoverflow thread), but almost all of them seem to implement separate methods to implement the redirect. As I said, my java skills are very basic, and I have no idea how to actually implement something like that to be used/called from within an if condition.
Can anyone provide some pointers on how I can correctly implement this within the condition above? I'm pretty much completely out of ideas at this point, and would very much appreciate any guidance. Thanks.
I would suggest to write response.sendRedirect() in the catch block of the exception. For example:
HttpServletResponse response = credentials.getResponse();
try{
if (req.getParameter("username") == null {
LOG.error("username is required");
throw new GuacamoleServerException("username is required");
}
catch(GuacamoleServerException e){
response.sendRedirect("https://site.domain.com/");
}
P.S. This is provided you are using Java Servlets for your purpose.
I wanted to use the Braintree Marketplace (I've got the approval and signed to use the marketplace functionality). I used JAVA for my backend and played with the Sandbox account.
I was trying to create a submerchant accorinding to the tutorials in the overview and the specific section. E.g., the code I directly copied from the guide is (I'VE ALSO TRIED TO USE MY VALID PERSONAL INFORMATION BELOW):
MerchantAccountRequest request = new MerchantAccountRequest().
individual().
firstName("Jane").
lastName("Doe").
email("jane#14ladders.com").
phone("5553334444").
dateOfBirth("1981-11-19").
ssn("456-45-4567").
address().
streetAddress("111 Main St").
locality("Chicago").
region("IL").
postalCode("60622").
done().
done().
funding().
descriptor("Blue Ladders").
destination(MerchantAccount.FundingDestination.BANK).
email("funding#blueladders.com").
mobilePhone("071101307").
accountNumber("1123581321").
routingNumber("071101307").
done().
tosAccepted(true).
masterMerchantAccountId("14ladders_marketplace").
id("blue_ladders_store");
Result<MerchantAccount> result = gateway.merchantAccount().create(request);
I've also tried to use the testing first name
com.braintreegateway.test.MerchantAccount.Approve
so that the creation should always succeed. The code snippet is:
Result<MerchantAccount> result = gateway.merchantAccount().create(
new MerchantAccountRequest().
individual()
.firstName(com.braintreegateway.test.MerchantAccount.Approve)
.done()
);
However, in any case, when I tried to check if the result is successful (and if not, what the errors are):
logger.info("Is the result successful? " + result.isSuccess());
ValidationErrors errors = result.getErrors();
logger.info("Number of errors returned " + result.getErrors().size());
The result.isSuccess() always returns false, while there are no errors in result.getErrors(). I also cannot find any (error) information from the sandbox web account. Any insights what might go wrong? or is this because I haven't enabled the marketplace functionality?
Thanks!
I work at Braintree. If you have more questions, you can always get in touch with our support team. It looks like you already have an open ticket with us and got a response, but I'll post his here for others who have the same problem.
You're looking for result.getErrors().getAllDeepValidationErrors() not just result.getErrors().
For more information on this type of failure, see the validation errors page in the Braintree docs.
I am working on a web-app using the Play Framework. I am trying to pass a variable through a dynamic URI. I am following the example shown here. However, I am getting this error:
not enough arguments for method showClients: (clientId: Long)play.mvc.Result. Unspecified value parameter clientId.
routes file:
GET /clients/{clientId} controllers.Application.showClients
Controller Code:
public static Result showClients(Long clientId) {
Client c = clientFinder.byId(clientId);
return ok(client.render(c));
}
URL
http://localhost:9000/clients/1
Does anyone see a problem with my code? After googling around, I have found similar questions, but no one with the exact same problem, so I am thinking it is something simple. Thanks for the help.
Whoops...It looks like I was looking at documentation for a previous version of Play. The current documentation here shows that my routes file should look like this:
GET /clients/:clientId controllers.Application.showClients(clientId : Long)
Thanks to anyone who looked into finding an answer to the question.