Code Monkey home page Code Monkey logo

Comments (13)

prakhar1989 avatar prakhar1989 commented on July 20, 2024

@etosch - I have cloned and built runner.jar on my computer. Can you paste some examples on how I can run sample json survey to validate with the jar file.

from react-surveyman.

etosch avatar etosch commented on July 20, 2024

runner.jar handles communication with backends; @jfoley threw together a
StaticAnalysisServer for running the static analyses (which includes the
validation).

  • pull the latest version of the SurveyMan repository
  • run make package
  • run java -cp edu.umass.cs.surveyman.server.StaticAnalysisServer

Send the request as json to /analyser via POST.

On 7/19/15 12:18 PM, Prakhar Srivastav wrote:

Add support for incrementally validating survey by making a ajax call
to runner.jar.


Reply to this email directly or view it on GitHub
#35.

from react-surveyman.

prakhar1989 avatar prakhar1989 commented on July 20, 2024

Hi @etosch

So I pulled in the Surveyman code and was able to build the package too. However, I'm unable to start the server. Can you tell me what's wrong?

PS: Not quite well-versed with the java stack 😬

 java -cp edu.umass.cs.surveyman.server.StaticAnalysisServer
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

from react-surveyman.

prakhar1989 avatar prakhar1989 commented on July 20, 2024

Run command - java -cp surveyman.jar edu.umass.cs.surveyman.server.StaticAnalysisServer

So I was able to run the server and hit the /analyze route but no matter what JSON is sent in POST, the server keeps throwing up an exception.

Here's the curl request that I'm making

curl -X POST -H "Content-Type: application/json" -d '{"survey": [
    {
        "id": "b_10101",
        "randomize": true,
        "questions": [],
        "subblocks": []
    }
]}' 'http://localhost:1234/analyze'
java.lang.NullPointerException
    at edu.umass.cs.surveyman.input.json.JSONParser.makeCorrelationMap(JSONParser.java:258)
    at edu.umass.cs.surveyman.input.json.JSONParser.populateSurvey(JSONParser.java:363)
    at edu.umass.cs.surveyman.input.json.JSONParser.parse(JSONParser.java:382)
    at edu.umass.cs.surveyman.server.StaticAnalysisServer.parseJSON(StaticAnalysisServer.java:175)
    at edu.umass.cs.surveyman.server.StaticAnalysisServer.analyzeRequest(StaticAnalysisServer.java:118)
    at edu.umass.cs.surveyman.server.StaticAnalysisServer$1.handle(StaticAnalysisServer.java:46)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:363)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:745)

@jjfiv / @etosch: Any pointers?

from react-surveyman.

prakhar1989 avatar prakhar1989 commented on July 20, 2024

With the latest build the server is working now. Here's what I get when I run the curl above -

<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 400 SurveyException: A survey must have at least one question.</title>
</head>
<body>
<h2>HTTP ERROR: 400</h2>
<p>Problem accessing /analyze. Reason:
<pre>    SurveyException: A survey must have at least one question.</pre></p>

So then I added a single question (as shown below) but now I keep getting a 501 Unimplemented error.

{"survey": [
    {
        "id": "b_10101",
        "randomize": true,
        "questions": [
        {
          "id": "q_5847",
          "qtext": "First question",
          "options": [
            {
              "id": "o_97512",
              "otext": "first"
            },
            {
              "id": "o_57705",
              "otext": "second"
            },
            {
              "id": "o_32878",
              "otext": "third"
            }
          ],
          "ordering": false,
          "freetext": false,
          "exclusive": true
        }
      ],
      "subblocks": []
    }
]}

from react-surveyman.

etosch avatar etosch commented on July 20, 2024

s/ordering/ordered

from react-surveyman.

prakhar1989 avatar prakhar1989 commented on July 20, 2024

Tried. Same error 😢

from react-surveyman.

etosch avatar etosch commented on July 20, 2024

It's failing when trying to assign breakoff (not finding the permitBreakoff tag). This isn't required, though, and the assignment for that value does check to see if the tag is present in the JSON node. More on this in a minute.

from react-surveyman.

prakhar1989 avatar prakhar1989 commented on July 20, 2024

@etosch: I just noticed that the server response is missing access-control headers because of which I'm unable to make requests to it via the react-surveyman app.

from react-surveyman.

etosch avatar etosch commented on July 20, 2024

@jjfiv merged; try out and confirm.

  Emma Tosch
  [email protected]

On Fri, Aug 14, 2015, at 02:13 AM, Prakhar Srivastav wrote:

@etosch[1]: I just noticed that the server response is missing access-control headers because of which I'm unable to make requests to it via the react-surveyman app.


Reply to this email directly or view it on GitHub[2].

Links:

  1. https://github.com/etosch
  2. #35 (comment)

from react-surveyman.

prakhar1989 avatar prakhar1989 commented on July 20, 2024

I downloaded the latest build and tried running the server - but I still can't see the new headers.

curl -i POST -H "Content-Type: application/json" -d '{"survey": [
    {
        "id": "b_10101",
        "randomize": true,
        "questions": [
        {
          "id": "q_5847",
          "qtext": "First question",
          "options": [
            {
              "id": "o_97512",
              "otext": "first"
            },
            {
              "id": "o_57705",
              "otext": "second"
            },
            {
              "id": "o_32878",
              "otext": "third"
            }
          ],
          "ordered": false,
          "freetext": false,
          "exclusive": true
        }
      ],
      "subblocks": []
    }
]}
' 'http://localhost:1234/analyze' | head

> HTTP/1.1 200 OK
Content-Length: 831
Server: Jetty(7.x.y-SNAPSHOT)

Min Path Length:    1
Max Path Length:    1
Average Path Length:    1.000000
Max Possible Entropy:   1.584963
Prob. False Correlation:    1.000000
group,percentBots,entropy,TP,FP,TN,FN

from react-surveyman.

etosch avatar etosch commented on July 20, 2024

I see the new access control header when running locally; will upload my jar.

from react-surveyman.

etosch avatar etosch commented on July 20, 2024

See https://github.com/SurveyMan/SurveyMan/releases/download/v1.6.6/surveyman.jar

from react-surveyman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.