Alright so I got a big project which I will start from the beginning. I've only done PHP and other web languages (Javascript, Jquery, node) and I have no experience with any of the languages mentioned above.
What I need to achieve is to have a small program written in C# that will make a call to my website, and the website will simply give me an "Okay" if it did recieve the message.
This simply makes the browser checks if a certain local program is running or not.
Where would I need to start to achieve such thing?
Related
I have a Java program that has some input and output displayed through the monitor, and I want to create a web application that can run the Java program with some inputs and then receive any outputs from the program and display them using some JS functions, and I'm wondering how I could go about doing something like that.
I essentially want to create a GUI for my Java program using html/css and JavaScript.
I have already made a static webpage using html/JS that has the appropriate inputs, now I need to figure a way to start the Java program with those inputs and evaluate the outputs.
That's.. generally not how its done.
Instead you run a JVM (a java app) that keeps running and answers web requests itself. In other words, write a webapp. In java.
For example, by using Dropwizard, spark, etc - one of the many, many web frameworks for java.
Your web service can just answer in JSON, keep things simple, no problem. You can also set up your apache, nginx or whatever it is to redirect most calls to your usual web frameworks, and some subset to your jvm webserver that is otherwise 'hidden' from outside view (firewalled off).
I need help with the following, I am trying to get a get from a page (it brings a client information), but said page has a javascript that is executed to monitor, the idea is that when I do the get I also execute said script.
I have looked for some solutions but none is what I need. Is there a way to execute the javascript that is on the web when making the request?
thanks for te help.
Locust does not run javascript, it is not a real browser.
The best way to work around this is by reimplementing any client-side logic you need in Python (in your locust file).
If your javascript is very complex, you could try remote-controlling an actual browser using WebDriver. It is prohibitively resource-intensive on the load gen side and quite unstable (like WebDriver always is), but for low-load scenarios it can be done.
https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/webdriver_ex.py
But the first option is the best in 99% of cases.
So i will build an application that will rely mainly on a lot of js code ... no matter how much i obfuscate it ... it is still on the user machine .... so 1 - 0 for the user if he wants to dig into my code
Now i do not know exactly how node works but from all the searches i did online i got the impression that all my js code can run on the server and not on the clients machine ... is that true?
My application will be on my server ... i will not distribute it or something so the only protection i need is to keep bad intended users away from the code on my server ... so ... if the answer to the first question is no ... is there an alternative to achieve this?
You can move a lot of your javascript code to the server, such as formulas, algorithms, etc, and have node.js return just the final result to the browser.
So you can very effectively hide much of your business logic by moving it. With Node.js and the browser both using javascript this is easy to do vs converting javascript to php or some other language.
You'll have to keep DOM manipulation and the displaying of final results on the client, but they'll see that anyway unless you have some kind of special DOM manipulation trick, which is unlikely.
If it's on the server and stays there, no user should be able to see it.
Udacity gives students a web editor to enter Python programs. The editor recognizes Python keywords and built-in functions and allows to run a program. Do you know how this technology works? Are programs submitted to a backend and executed by the standard Python interpreter or is it a JavaScript based Python interpreter? Does the editor simply hold a static list of Python keywords and built-in functions or does it interact with the standard or JavaScript based Python to obtain these?
While javascript python interpreters do exist: http://syntensity.com/static/python.html , they don't appear to be using one. It would be far too easy to cheat if they didn't at least run the programs once for verification on their own interpreter.
After looking at the network activity on Udacity I can see that they make an ajax call with a bunch of data and then get the results of the program run back in JSON.
At a guess they have the standard python interpreter running in a sandbox that will execute the assignments, then the results are packed into JSON, returned to the client and updated to the screen. At the same time the results of your submission will be recorded as part of your class results.
Very late to the party here, but I work as an engineer at Udacity, so I figured I'd give it a shot.
There are two fundamental things going on:
The current syntax highlighting and editing is provided by a Codemirror implementation, although we have used several different editors in the past couple years.
When you hit submit (or run), your code is packaged up and shipped off to a sandboxed cluster we run for execution. If you're hitting submit, this is where we run our own tests against your code and "grade" it to see if it passes. The output from that (in various forms) is piped back to the front end, and you get your feedback.
Not quite as fast as running it locally, but it sure beats supporting a few hundred thousand people trying to install Python for the first time ;)
I haven't tried Udacity, but for the syntax highlighting parts, it can be easily done with a simple backend code, which is updated using some Ajax. One of the easiest ways can be used as lexical analyzing as in compilers or interpreters ..
There are many tools that scrape HTML pages with javascript off, however are there any that will scrape with javascript on, including pressing buttons that are javascript callbacks?
I'm currently trying to scrape a site that is soley navigated through javascript calls. All the buttons that lead to the content execute javascript without a href in sight. I could reverse engineer the javascript calls (that do, in part return HTML) but that is going to take some time, are there any short cuts?
I use htmlunit, generally wrapped in a Java-based scripting language like JRuby. HtmlUnit is fantastic because it's JavaScript engine handles all of the dynamic functionality including AJAX behind the scenes. Makes it very easy to scrape.
Have you tried using scRubyIt? I'm not 100% sure, but I think I used it to scrape somo dynamic web sites.
It has some useful methods like
click_link_and_wait 'Get results', 5
Win32::IE::Mechanize
You could use Watij if you're into Java ( and want to automate Internet Explorer ). Alternatively, you can use Webdriver and also automate Firefox. Webdriver has a Python API too.
At the end of the day, those website which do not use Flash or other embedded plugins will need to make HTTP requests from the browser to the server. Most, if not all of those requests will have patterns within their URI's. Use Firebug/LiveHTTPHeaders to capture all the requests, which in turn will let you see what data comes back. From there, you can build ways to grab the data you want.
That is, of course, they are not using some crappy form of obfuscation/encryption to slow you down.