How to fix these issues in Processing? - javascript

I'm a beginner of coding. I have encounter these two problem in learning Processing:
I can't use JavaScript mode in processing.When I change to JavaScript mode in processing, the IDE closed automatically. However, I check the program in task manager, I found that the javaw.exe is still running. I think it maybe the version problem.My processing version is 3.2.1
I can't save my file in processing.The error is that:
image
Can anyone help me to fix these two issues?

If you plan to use p5.js, while the main Processing editor is being developed, I recommend trying the p5.js editor (direct download link for Windows)
It's simpler and iterated much faster than the main Processing IDE, so should be easier to get started.
Additionally, here are few great video tutorial resources for p5.js:
1-6: Foundations of Programming in JavaScript - p5.js Tutorial
Introduction to Programming for the Visual Arts with p5.js
The Nature of Code
Have fun!

JavaScript mode isn't supported in Processing 3 yet. If you want to use the Processing editor, you'll have to download version 2.2.1.
Edit: I thought you were talking about Processing.js, but it looks like you're talking about p5.js. In that case, check out George's answer.

For the saving question: I think that processing always delete all the old files before saving again the new ones. Maybe it could be a problem that you are not running it as administrator. Try that.

Related

Call JavaScript (3rd party library) from Python

I've already searched quite a bit but came to now clear conclusion as some projects (pyv8) seem to be dead and I'm not sure if that is suitable at all. The 3rd part lib requires a DOM, eg. a container element in which it runs. It also uses web assembly and in general is pretty heavy.
Not sure if libs like pyv8 would actually be suitable for that. Other approach would be to go with selenium and headless chrome or a local node.js service but both of these sound very heavy. Oh, and the lib must work in windows as that's simply company policy, windows servers so PyMiniRacer is out.
What are my other options?
Consider taking a look at this post: How do I call a Javascript function from Python?.
However, if your objective is to access JS code in a webpage for reasons such as webscraping, you could also consider using selenium webdriver + python to do so. Take a look at this medium.com post: How to Run JavaScript in Python | Web Scraping | Web Testing
Other Resources:
https://www.quora.com/How-do-we-use-JavaScript-with-Python
Python to JS: https://pypi.org/project/javascripthon/
P.S: I am not sure if this would help you. There is another library (PyExecJS) which is maintained no longer; but I think you have looked it up already.

Anyone using IronJS yet?

I'm just wondering if there is anyone else using IronJS within their apps yet?
IronJS is really awesome as it's JavaScript on the DLR. Personally, I've been waiting to be able to write both server-side and client-side code in ASP.NET / ASP.NET MVC using JavaScript. It's too bad Microsoft abandoned Managed JScript, but no worries since IronJS is really showing promise.
I am wondering if anyone has started using it in any of their apps yet?
Lately, I've been playing around a little bit with adding the ability to code ASP.NET MVC Controller Actions in JavaScript using IronJS.
As a developer on the IronJS, I have to say that I am using it. :)
However, most of my work has been running command-line projects like CoffeeScript (which works, 100%) and Uglify.js (which is not quite working).
If you find any rough edges, please post them on the GitHub bug tracker. I will also be watching the IronJS tag here on SO, to help with any Q/A style requests.
I've been playing around with integrating ASP.NET MVC and IronJS, and the result is the new IronJSMVC project. If you are interested in IronJS, then you'll probably be interested in IronJSMVC.
https://github.com/crpietschmann/IronJSMVC
It's still in a very early prototype stage (at the time of posting this) and not meant for production use just yet. But don't let that scare you away from checking it out.
I actually played a bit with in my DynamicPad project
https://github.com/khebbie/Dynamicpad/
But decided on using IronRuby since it's more mature
By the way I also had some fun playing with IronJs in linqPad
https://gist.github.com/1256505

Disoriented when writing JavaScript - Architectural Integration - Grockage

I'm a reasonably experience programmer (10+ years), and have only hacked JavaScript. I don't feel comfortable writing more than a few lines of it, but I'm seeing it more and more unavoidable to learn properly.
I get the same feeling writing JavaScript as I first did writing Unix shell scripts. I didn't fully understand the environment, where things are going, and so forth. It took a few well-timed suggestions to sort it all out.
I have a hard time with Js tools. I'm okay with almost any text editor, but is there anything other than alert('foo') and Firefox error console to see what the heck is going on?
Ps. I have bought books. Yes, I can write code snippits, but nothing sufficiently explained the whole paradigm. It's all code snippits, with no larger picture of how to integrate it architecturally with server side scripts, and not have to duplicate everything on the server side.
Maybe that's the answer. . write some on the server side?
edit:
tl;dr AMA OO PHP programmer. how do I quickly and completely grok javascript/jquery?
This article might be helpful to you: Organizing A jQuery Application. It dissects a non-trivial jQuery application and explains how to architect a whole JavaScript application (as opposed to code snippets). You can download the code there, and sing along.
Learn to use the console tab of Firebug, including breakpoints. It's a simple and powerful way to see what's actually going on in your scripts.
Firebug also gives you a JS command line to work with, which is a great way to experiment with short snippets and see what they do.
http://getfirebug.com/javascript

Writing a non-GUI bot using Mozilla Framework

I'm looking for a way to write a non-GUI bot using Mozilla Framework. The bot should be able to work like normal browser (automatically download relevant JS files, make XMLHTTPRequests, run JS operations, modify DOM), except no GUI will be needed.
I wonder if it is possbile to build XULRunner without X, GTK/KDE (without any GUI dependencies), as I will run the bot on FreeBSD server 6.4.
It may sound a bit weird but I need a bot with capacity to operate like browser, runs JS, modifies DOM, submit forms running on non-GUI environments.
I've looked into other browsers such as Lynx, Links, Hulahop, Chrome V8 engine, WebKit JavascriptCore but yet to find desirable output.
It's a part of school project, thesis. We will use to observe price change of budget airlines and after one year long data collection, we need to deduce pricing strategy and customer behavior. It is a serious Final Year Project.
Any hint or help is greatly appreciated! Thank you in advance!
Regards.
You should be able to make progress with selenium. It's a record/test/play tool but its core is manipulating the DOM.
Update from Grundlefleck's comment: As for launching the actual tests there is selenium remote-control, which allows you to write your tests in Java, Ruby, plain HTML and other possible drivers.
Yes, it is possible (but it might very well require LOTS of code changes).
No, I do not know any of the details.
I would not recommend this approach for your purposes. From your comment, it sounds like you are trying to scrape webpages. If you really need to use JavaScript, you can use a stand-alone JavaScript-engine (Mozilla's is available here). Otherwise, I would use Beautiful Soup with Python or Twill. You might also want to read this question.

Is there a decent browser-based javascript self-editor?

Is there a decent browser-based javascript self-editor?
It is obvious one can make a quick js editor with a page containing a form textarea, some buttons and callbacks. I'm wondering if someone has taken that as a beginning and ran with it.
The javascript to be edited could be defined in a global string or it could be a served .js
The ideal editor would show a pretty version inside a browser window and provide some kind of development environment for editing the script.
It is understood that user-written scripts would only exist inside the browser and could not be saved without some additional server-side functionality. The ideal package would discuss and explore this.... but I'd settle for anything that just lets the user make their own simple changes to 100-200 line scripts.
I'm not sure exactly what you're asking for, but does jsbin satisfy your needs?
The hard part of what it sounds like you want to do is going to be parsing the javascript so that you can do intelligent things with it. The CodeMirror library can help you develop something to put on a page.
UPDATE:
Etherpad isn't around anymore but Ace is really nice. It's got a long history and is the engine used by the Cloud9 IDE
There is
http://sourceforge.net/projects/codepress
http://www.cdolivet.com/index.php?page=editArea&sess=4b049cee4477f0820c82231b09e80a91
http://marijn.haverbeke.nl/codemirror/
Do also check out Bespin.
There are also integrated solutions which, in addition to browser-based online editing of JavaScript code, do other things for you, like running the JS code in the browser or hosting it for you.
If you're interested in those, try Erbix.com.
coderun

Categories

Resources