Web-based JavaScript Debugger - javascript

I have an idea for a project that has to do with helping people learn to program. One of the things I think would be cool would be to have a place on the site where you can edit JavaScript code in real time in your browser.
I know there are a number of web-based JavaScript editors, but I haven't been able to find out if there are any tools that let you debug JavaScript from your browser. I think being able to step through your code is a valuable learning experience for people who are new to programming. It seems like something along those lines should be possible, though.
I originally thought you could use something like Firebug Lite: http://getfirebug.com/firebuglite, but they don't support debugging. Is this just too hard of a problem to solve in JavaScript?

I suggest you try Cloud9. It is a full-featured web based IDE for Javascript, which includes a great debugger. It is free for open source projects, which I imagine would include most learning purposes.

Why not just use the build in Javascript console from the browser? Every modern browser has this feature.

Related

How to run javascript snippets in firefox/chrome from a script

I am currently trying to learn javascript. Coming from a python/R background I find it really useful for learning purposes to be able to write code in a script in Rstudio/pyCharm which I can then execute in a interpreter by highlighting specific lines of code and then pressing a ctrl+enter or some other keyboard shortcut.
The console available on firefox/chrome seems incredibly rich and useful for learning / testing specific pieces of code but I find it quite limiting that I can't store each line in a script with comments/notes to myself.
Is there a way to run lines of javascript in firefox/chrome like pycharm & rstudio can with their respective interpreters or how is it usually recommend for people to learn the language in an efficient manner ?
Use node.js which is a javascript runtime using v8 (powering the chrome console)
You can get an REPL similar to Python.
You cannot, however use it to modify the DOM or access the window. In such case, using an online IDE like jsfiddle or codepen might be a good alternative.

Retrieving a javascript processed Web page

What am I asking for is the ability to download a rendered / processed page via Google Chrome or Firefox I think.
For example, I don't want:
hendry#x201 ~$ w3m -dump http://hello.dabase.com
FAIL
I want:
$ $answer http://hello.dabase.com
Hello World
You should be able to do it using PhantomJS. It is running WebKit without the visuals, but you get the same fast and native supports for JavaScript, HTML/DOM, CSS, SVG, Canvas, and many others.
Disclaimer: I started PhantomJS.
Probably too early, but someone ported V8 to Go-lang, so now you could write your own client that makes use of this powerful combo:
http://bravenewmethod.wordpress.com/2011/03/30/embedding-v8-javascript-engine-and-go/
Looks quite straightforward, doesn't require an ugly Java/Rhino stack and adopts the next big programming language.
It looks similar to the problem http://simile.mit.edu/wiki/Crowbar is trying to solve.
You could use jsdom:- https://github.com/tmpvar/jsdom
I'd build a node driver for it, but it's supposed to work with Rhino etc.
I'd take a look at Rhino.
I'd use the excellent env.js library in conjunction with Rhino to simulate the browser environment as much as is technically possible. Once you've implemented some web spider bootstrap code you should be able to obtain the result you want above.
I'd be interested in other solutions to this though.

Breakpoints in Ruby IDE?

I currently use TextMate for Ruby/Javascript/Actionscript development and it is amazing. But one thing I would really love to use are breakpoints so I could stop code execution and examine the state of the variables and walk through the code. Something like what Flex Builder does.
Does TextMate have this capability? Or what do you use to do breakpoints and that sort of thing with Ruby? How about for Javascript too?
Thanks!
Since TextMate is not an IDE but just a text editor (on steroids though!) I believe this is something totally not supported.
As for the javascript, this is something you can do with firebug (at least for firefox) and similar tools are included (or can be found) for IE, Chrome and Safari :)
There are 3 mostly-Java IDEs that run under Mac OS X yet do a good job of developing (and of course debugging) Ruby.
Eclipse, with the Aptana plugin;
IntelliJ IDEA (it knows lots of programming languages)
NetBeans (I think).
All three are free (even IntelliJ, they have an Open Source edition out now), so you can just download, play around with it, get accustomed and go to town.
Eclipse with the Dynamic Languages Toolkit supports Ruby debugging. I have used it in the past, and it supports Javascript as well.
TextMate is an editor and not a full-blown IDE, so it doesn't support debugging.
If you're looking for a Ruby IDE, I highly recommend RubyMine. It's got great support for debugging, running tests, easily navigating between files, and basic refactoring. Admittedly it's a lot more heavyweight, so I tend to use it for major work (or when getting up to speed on an existing code base), and still use TextMate for quick changes.
There are some open source solutions as well. In the past I've used NetBeans and RadRails, and particularly NetBeans has worked very well for me, too. Not as good as RubyMine, but well worth checking out if you're on a budget.
I should also point out that you can debug Ruby apps from the command line, using the ruby-debug gem. Basically, you place a debugger call into your code to set a breakpoint, and then run the app with rdebug instead of ruby. Check out this article for an overview.
arcadia is a ruby editor written in ruby with ruby debugging support. A little rough still, but at least you get the good feeling of running ruby :)
-r

Javascript, Firebug: How do I have multiple views or what is the right of way of doing development?

Most of my javascript work is done with Firebug and I feel annoying most of the times having to switch between the HTML mode and console mode (which again I split into output mode and input mode). When I switch to a different page to see the HTML and come back, I lose the code that I write. What is the best way to go about developing javascript applications using firebug?
Something like a mini IDE would be awesome: It just has to let me insert some code, examine the current page and then let me execute it. Any suggestions?
I use a simple text editor (vim) to write Javascript and HTML, and I check the result every now and then in Firefox. I have always two windows open: one for my text editor, and one with the current page open in Firefox. After saving a change in the Javascript, I switch to the browser and refresh the page to observe results. That was my workflow until recently.
A couple of weeks ago, I discovered the Combiner tool by Nicholas C. Zakas. To release my Javascript code, I am now using a complete build process based on Apache Ant, similar to what I was using while doing Java development previously.
The first step is to check the Javascript code with the JSLint tool by Douglas Crockford. I used to painfully copy and paste my Javascript code in the online version of the tool, once in a while; being able to run it on all my Javascript files at once with this Ant script is a huge convenience.
The second step is to combine all my Javascript files into a single file using the Combiner tool. The third step is to minify the Javascript code using YUI Compressor by Yahoo!. These last two steps allow to optimize the delivery of Javascript code to reduce page loading.
You can find an example Ant build file that you may adapt to your own needs. I am currently using this file to build my own Javascript library, bezen.org.
The other answers so far have been correct: I've never heard of anyone actually developing inside Firefox/Firebug, because it's a tool designed for debugging, not coding. To do your coding, you should use a tool designed for it (either a text editor or a full-fledged IDE).
But that being said, you might want to check out FireEclipse (Link). It will allow you to integrate Firebug with the Eclipse IDE (which itself has at least three different JS plug-ins to choose from). Alternatively I think the main (aka Web Standard Toolkit, aka WST) JS editor for Eclipse has some functionality which is similar to Firebug, but I've never used it so I don't know the details.
Hope that helps.
Write your HTML in an editor/IDE
Save your changes
Preview it in your browser
Debug using Firebug
Make your code edits in your SOURCE CODE
Repeat
Firebug is for debugging and allows you to do some "what if" fiddling while the page is live. This is not a replacement for an IDE.

JavaScript tools for Visual Studio 2005

I need to find if there are any tools targeting both Visual Studio 2005 and JavaScript. I'm interested in plugins which will increase the quality of work done in VS2005 with JavaScript oriented development.
I think you'll be hard pressed to find anything specific for VS2005, since it is a dev environment and JS is a client technology. However, a couple of ideas you might want to consider:
jQuery. The recent availability of Intellisense for jQuery (although I think it is only for VS2008) helps your quality of work in the sense that you don't have to spend so much time looking back and forth at documentation, although I would say that is the best way to really become familiar with it anyway. There are several other good JS libraries out there, but (a) I don't think that was the point of your question, and (b) jQuery is the only one "semi-officially" supported in VS that I'm aware of.
Script#. Although I haven't used it, it looks interesting... basically you program in C#, and it gets translated to JS at runtime.
If you could afford it, I'll recommend upgrading to Visual Studio 2008. You can open .NET 2.0 application without converting them. It comes with much better Javascript Intellisense.
(source: scottgu.com)
One of the other JavaScript features in VS 2008 is the much-improved support for JavaScript debugging.
These features are enabled in both the free Visual Web Developer 2008 Express edition as well as in Visual Studio, and makes using JavaScript and building AJAX applications significantly easier.
If you are using jQuery in your applications, then you could install jQuery Intellisense in VS 2008.
Well, if you want something that will help you write better Javascript in Visual Studio then you can give JSLint a try. It's a plugin that will verify your Javascript code, spot errors, and help you debug it.
Beware, JSLint can hurt feelings.

Categories