As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I just recently got interested in how search engines work, and I found out that they use "bots" or "webcrawlers". I immediately started wondering about how do these things work and I wanted to create one! So, first of: how do you make a program that requests a page from a server? It would be awesome if you gave me a simple example in JavaScript (I'm running it as a normal scripting language using Node). Next, is there a Node module that let's me interpret HTML? Create a DOM for me so I can cycle trough all the links and so on? Correct me if I'm wrong but I guess it's done like that... Any examples in C++, C or Python are warmly welcomed as well, although I'd prefer JS or Python because I'm more familiar with high-level scripting languages.
Getting HTTP pages: node http.get (example is there)
DOM documents: jsdom (also includes examples)
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Maybe an unusual question. I am starting work at a new company (my first job) and wanted to create some dummy program to make sure I'm familiar with their set up when I start. I've been told that I'll be coding in C/C++ and should be familiar with XML, JavaScript and Win 32 API.
Can anyone think of a program I could create in C that could incorporate XML or JavaScript?
Thanks
Well, for XML you could write an XML parser (not especially full featured).
As for javascript, I would tell you to write a javascript interpreter, but no, don't do that :D
You could try out QML and have fun mixing JavaScript (for the GUI) and C++ for the business logic.
EDIT: I don't know about the Win32 API.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I would like to allow powerusers to perform certain actions on the site in a command-line like interface (think Quake console that slides in from above ;-). Is there a library that already implements the basics of what I need in the browser? Tasks like getting the input from the user, command history etc. Me and my colleagues will have limited time to implement this during a hackathon, so we want to have as much time as possible to implement the actual commands interfacing with our app.
Have a look at Josh.js for a bash-like environment in the browser:
http://sdether.github.com/josh.js/
Of course there is also the excellent termlib found here.
You may find this project helpful:
https://github.com/chjj/tty.js
Have a look at JavaScript shells from mozilla.org
See also Jash: JavaScript Shell
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I hope this question is not too general, but i haven't found any good tutorial on how to do the transition from standard javascript / jQuery code to modular / tested code.
Mmy new task is the complete refactoring of the javascript of our wordpress plugin.
Our current code is standard jQuery code, thrown all into a file, with checks on the existance of dom elements to understand on what page we are in and attach the correct event handlers.
My goal is simply to write more manteinable and clear code, and introduce tests in the process.
My approach would be:
Try to modularize code in separate files (one file for each page) and use require.js to load only the required code.
write some tests with jasmine/sinon and try to adapt the esisting code so that the tests pass
Have you got any other suggestions/best practice?
Can you share some example on how you approached similar tasks?
I was thinking about bringing in an mvc framework but if i can stick to standard jQuery code i think it's easier for the development team because it doesn't add complexity
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
i don't understand the meaning of the word library -
regarding to jQuery: will it be right to say that "library" is a huge file with many plug ins that are ready to use?
jQuery is a fast and concise JavaScript Library that simplifies HTML
document traversing, event handling, animating, and Ajax interactions
for rapid web development. jQuery is designed to change the way that
you write JavaScript.
All this means is that jQuery itself does not do anything. A library is "a collection of resources used to develop software". jQuery allows you to write cross-browser JavaScript a heck of a lot easier than it would be without it.
A library is something that extends a base langage. So in this definition jQuery is a library
A small(not huge!!!) file (32K only)... With many many functions and features.
Libraries contain code and data that provide services to independent programs. This encourages the sharing and changing of code and data in a modular fashion, and eases the distribution of the code and data.
Wikipedia
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Has any one used this? I don't have a large background in Javascript and this lib looks like it may speed things along.
www.pyjs.org
yep. me. i'm the lead developer. drop by on groups.google.com "pyjamas-dev" and say hello.
Yes, I've used. It's amazing! I think it's much easier to use than the Java-based GWT. I found the Google Code wiki on it very practical: http://code.google.com/p/pyjamas/w/list
If you're just starting out with it, then definitely check out the showcase: http://pyjs.org/showcase/Showcase.html for usable snippets/widgets
As of now, it is not supported on M$ Windows, but runs beautifully on Linux.
yes it works fine on windows (it's a compiler: you just need python, to run the conversion to javascript). but if you're thinking of pyjamas-desktop, 0.6 added support for MSHTML as one of the engines, so that works too.
Yes. I've used pyjs to build minesweeper game: http://pymines.appspot.com/