C debugger in Webpage? - javascript

I want build a simple webpage so I can write a C++ code in html page and run the code, then the result showing in the same page.
Is it possible to do this?
If so is there any idea how can I get started?

It is not possible to execute C++ code directly in a browser. It is possible to compile and generate the HTML for a website with C++, though. Visual Studio will help you setup a website built on C++.

Related

Java/Python Cross-Compiling in JavaScript

I am working on a project that involves having a Java code editor and a Python code editor but I have no way of compiling that code. I've used Ace within my html and I have no idea how to compile the Java code or Python code using JavaScript. I currently have a way of retrieving all of the Java/Python code to a string. From there I need a way of compiling that code so that I can run it on my website and test it. There will be no GUIs involved, all of the Java/Python code will just have console output. However, I need a way I can run the Java/Python code on my website in live speed. Everything must be done on the website, the client shouldn't have to download anything extra. I am basically trying to replicate the website 'codingbat.com'. Thanks for the help in advance.
Python would usually get JITted when you invoke a good Python interpreter (ha, the name does not apply). Java has some great compilers (standard javac or the Eclipse JDT) so I would not even think of compiling with some other language.
Where does the need come from to cross-compile in JavaScript? It sounds like you are searching for a Java compiler implemented in JavaScript, and likewise for Python.
If everything has to be built and deployed to some website, why don't you create a script (shell, JavaScript, or a Jenkins Pipeline) that compiles the java part using javac, precompiles the python part as required and deploys the output directly to your website?

Using ElectronJS, is there a way to run a Java applet (.jar) in the window?

I'm working on a project for a friend, and it involves inserting a Java applet into an Electron HTML document for the user to interact with. Is there a way to do this?
I've already tried using node-jre to run it, and I am able to output the results into the console which is fine, but that doesn't give me an applet. I'm not too familiar with Java, but I understand some concepts of it.
Here's what I have using node-jre:
var output = jre.spawnSync(['client.jar']);
console.log(output);
I need the result to be <applet archive="file.jar"></applet> in the HTML file the user will view.
No, this isn't possible.
In the past, embedding a Java applet in a web page (or other web view) required the Java NPAPI plugin to be installed. This plugin was discontinued in Java 9, and browser engines no longer support NPAPI plugins, so there is no way to do this.
You will need to run your Java applet as a standalone application, or rewrite it in Javascript to run within an Electron app.

How to run python code from javascript code using xampp?

I have a website written in html and I have a button that when clicked should run a python script. The button is programmed in javascript, and I have seen on this site how to connect javascript and python together, but the problem is that I'm running the website using xampp and localhost, so I don't know the configurations to run the python code. I have tried to use up mod_wsgi, but the instructions are very confusing and I really have no idea what I'm doing.
I don't want to use JQuery or Ajax, I'd rather use just regular javascript to run the python code. How would I accomplish this? Basically I just want the button to run a python script I have, which is in the same directory as the website is. I don't want to run the python code from localhost directly, rather I want to reference and run it from the javascript code for the button.
Edit: it has been pointed out to me that JavaScript and python are connected through a client server relationship. Therefore my question is how to run the python code through a webserver from xampp.
Thanks in advance

Run a script on an external file in WebStorm

I'm trying to run some JavaScript on an RDF-XML file on my local machine on WebStorm. I want to replicate the functionality of writing JavaScript into Firebug after the document loads - something not explicitly included in the HTML code itself (RDF-XML in my case), kinda like in JSFiddle.
The idea is to test some JS code on the RDF document without having to do it on a browser debugger like Firebug (not the best place to write code, and I dont want to keep copy pasting back and forth from an editor/IDE).
I am a JS and WebStorm newbie. Im not sure if WebStorm allows me to do this, and if so, how I configure it to do so.
Could anyone help? How do you guys debug write and debug bulky JavaScript?

Converting an HTML/Javascript Project into an Executable

So I'm working on a just for fun project to get practice using HTML/CSS/Javascript.
I'm using Aptana to write all my code and it is currently set up to run and work in a browser (obviously) it's a text adventure game.
It would be really cool though to be able to compile the code into an executable file that runs in its own window, not in a browser.
Is this something relatively easy to accomplish?
Thanks in advance for any help! :)
FF and Chrome provide a function to run a custom website in an app mode. That means no menubars, no addressbar and a complete window for the website. Maybe this is already what you are looking for.
http://www.rarst.net/software/dedicated-web-app-window/
https://superuser.com/questions/33548/starting-google-chrome-in-application-mode
https://superuser.com/questions/171235/does-internet-explorer-have-something-equivalent-to-chromes-app-mode
But if you are interested in compiled code for speeding up your game, this is not the way to achieve this.
For Windows as OS
see http://www.autoitscript.com/autoit3/docs/libfunctions/_IECreateEmbedded.htm
AutoIt is a scripting language for basically everything (with automation). SciTE is the editor to go.
In the example of the _IECreateEmbedded function, just change:
_IENavigate($oIE, "http://www.autoitscript.com")
to
_IENavigate($oIE, "file://.../thegame.html")
Very simple, you just have to copy-paste it and build it - you can even build it Online: AutoIt Online Compiler
There are many different ways you can acheive this.
If you're only targeting windows machines, then creating a HTA would be the simplest approach.
The modification to the structure of your existing code would be minimal, its essentially changing the file type and adding an extra couple of tags in. If you wanted a single file, instead of an exe and any resources (images etc) that you use you would have to base64 encode your images, and insert external scripts into the main page.
for information about embedding images and icons into a hta: http://www.john-am.com/2010/07/building-a-self-contained-hta-with-embedded-images-and-icons/
You could also use AppJS, node-webkit or similar type projects, but they would add around 30MB of stuff thats not being used.

Categories