WDDX library for Javascript? - javascript

I'm aware that there is (or was?) a JS library for WDDX (wddx.js) somewhere but I couldn't find it anymore since both www.openwddx.org and wddx.org don't seem to be active now. Can anyone give me info? I'm trying out WDDX (ie. create a packet) on a jsp page and thinking of using those js functions cause it seems like a simpler approach.
It may have been asked already but resource on Javascript and WDDX are so limited so I appreciate any help.
Thanks!

You can find them here: http://www.finwin.com/Dev/wddxsdk/2__Software_Libraries/Installation.html
http://rightworker.comoj.com/2__Software_Libraries/Installation.html
It says:
This is the current distribution of the WDDX libraries available for the various platforms that support WDDX at this time. Please check back at Wddx.org often for updates.
Please refer to the corresponding portions of the Building Apps With WDDX and References sections of this SDK for documentation, suggestions, examples, and usage.
But be aware, the JS code is from 1999. I'm using it to deserialize wddxPackets comming from PHP and it works for me. I don't know if there are any other JS implementations and/or newer ones releases of the one above.

Related

what is a good search strategy to look for source code of a particular function in chrome/firefox repository?

I'm currently studying javascript.
Usually, when I study something, I would like to go into the details and look at source code and try to understand how things really work internally.
I tried to find the source code for JSON.stringify function and I have found two repositories (one for chrome and the other one for firefox).
However, the source code repository is massive and I can't seem to find what I want. So I was just wondering, is there a good search strategy that assist in finding a particular thing in such massive repositories?
I don't know too much about the Chrome source code, so I will partially answer this for the Firefox codebase. As you correctly identified, the latest Firefox source code lives here.
Searching the Firefox codebase
However, the repository itself isn't well suited for searching the codebase and looking up functions/implementations, unless you already know where you need to look :) For this reason, a couple of services were created to ease searching the Firefox codebase: DXR and searchfox. Both tools have pros and cons and do their job fairly well.
Looking up JSON.stringify
Now, the tricky party. I know that the JS engine lives under the js/src directory (the mdn docs say so!). And the JSON object is part of the set of builtin objects, as described here. So my first guess search tried to look for the stringify word in that directory. And I got lucky! Apparently, the jsapi.h header file mentions "JSON.stringify as specified by ES5." in a comment: the comment is for the JS_Stringify(), which has its implementation in the related jsapi.cpp file.
Let me know if that helps or you have further questions!

How to customize a ppapi which could be used by Javascript?

I am researching on the Chromium PPAPI. After looking through all APIs from the official reference here: https://developer.chrome.com/native-client/cpp-api-dev, I seldom found any APIs that could be used by, or communicate with JS directly. In my opinion, a plugin process will set up a PP::instance and all functions within this instance would be loaded. Take video_capture.cc as an example, you could find it under /ppapi/examples/video_capture in chromium source codes. In this example, a customized PP::instance called VCDemoInstance registered some methods, yet I found only HandleMessage() could communicate with JS layer. From JS, you might use postMessage() to pass something to HandleMessage() above.
So here is my key question: Is there a way to create or define a method in PP::instance that could be used by or communicated with JS layer directly? Is it possible to register a JS object and call PPAPI like obj.apiFromPlugin? At lease I knew in Opera JSPP framework, it could be done.
Please correct me if anything is wrong. You're appreciated.
After digging into PPAPI, I couldn't find a way to create an JS object in plugin. I finally switched to Chromium Embed Framework which can port content API to JS. Using CefV8Handler may solve my question absolutely.

Is it possible to build jQuery with a subset of the components? - jQuery

just wondering if it possible to build the jQuery library with just a selection of components:
e.g. without Effects or Manipulation?
Sounds like it would be mission impossible!! :)
Thanks everyone!
Reason:
I read somewhere a long time ago about jquery being modular since version 1.4.x . Not being able to find anything on jQuery.com and elsewhere I gave up and came here.
Like always the answers are always helpful, even though a question doesn't have an answer.
Any ideas? Thanks guys :)
Not without modifying the source yourself. (which I recommend against)
John Resig WAS going to do this because of jQuery Mobile but they decided on one large bundle. Just use theversion hosted by Google's CDN and you shouldn't have to worry too much about load speed, chances are it'll already be in the user's cache.
I can't find the duplicate right now but the bottom line is no, it's not possible without huge effort; but it doesn't matter, because it's loaded just once, and if there were any serious performance advantages to gain, the founding fathers jQuery developers would have created a provision for it.
I suppose it would be possible, but it would take a ton of work. Many of the methods inside the jquery library are dependent on eachother - it would take hours and hours of debugging to get a non-broken version. You are better off just including everything - it's not that large of a resource hog anyways.
Developer time is more important and fiddling for that task is gonna be expensive :)
I suggest that you just use the one on Google's hosted, most of the time its already cached on their browsers
My favorite version btw is 1.2.6 and packed
http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js

Is there a resource to help convert Prototype JavaScript to jQuery?

I have extensively used Prototype before and it helped us add considerable interactivity to our web applications. However we are looking at making the move to use jQuery in order to standardize on something better supported in Visual Studio.
I understand that we can use the jQuery.noConflict to run it alongside Prototype, but we would like to avoid having users need to download both libraries to use our website.
So, is there a good resource that can help us move old scripts from Prototype to jQuery?
I can't really help you too much with your question, other than to say that I haven't heard of any such tool, and that I'd be really surprised if one actually existed.
While I think jQuery is a great library, and that you're right to be wanting to only use one library, just remember that the cost of you changing over all your scripts is going to be many many hours of work. The cost of your users downloading an extra 30kb of scripts is going to be roughly 0.3 seconds. Perhaps try to slowly phase out Prototype and only refactor your existing pages when a) you have to, or b) if you've got nothing better to do.
Falkayn,
There is no automated process available for conversion of JavaScipt code written against one JS library to another one. Moreover there cannot be one. Different libraries implement different proramming models as well as they arrange their APIs in different manner.
So, before you have found a solution to your problem now ask yourself a question: Am I going to convert my jQuery code once another even "cooler" "X-type" JavaScript library became available?
If your answer is no, take your time and convert the code manually no mater how long will it take. In case you answer "yes" don't convert the code at all.
So it goes.
Thanks guys for your input. I was looking for more of a syntax comparison than anything automated, but nickf makes a good point in that the real cost need not be too great. We only used Prototype on a few pages that really needed a high level of interactivity, so as long as mind out Ps and Qs it should not hurt to use jQuery everywhere else.

JavaScript object browser?

I was recently tasked to document a large JavaScript application I have been maintaining for some time. So I do have a good knowledge of the system.
But due the sheer size of the application, it will probably take a lot of time even with prior knowledge around the code and the source code itself in uncompressed form.
So I'm looking for tools that would help me explore classes and methods and their relationships in JavaScript and if possible, document them along the way, is there one available?
Something like object browser in VS would be nice, but any tools that help me get things done faster will do.
Thanks!
Firebug's DOM tab lets you browse the contents of the global window object, and you can inspect a particular object by entering inspect(whatever) in the command line.
You won't be able to use it to detect relationships unless an instance of one object holds an instance of a related object, but it's a start.
You can also use the Options menu on the DOM tab to restrict what's shown to user-defined functions and properties, which should help reduce clutter.
Take a look at Aptana, they have an outline that can help you to determine what are the objects and somtetimes their relationship.
Firebug + uneval(obj) is a simple trick that is often helpful.
I see a lot of people talking about examining the DOM within Firebug. However, from your question it looks like you want something like jsdoc? just add type and class information through comments and jsdoc generates documentation including class relationships. http://jsdoc.sourceforge.net/
Google has a fork of it with added functionality http://code.google.com/p/jsdoc-toolkit/
UPDATE: It's not a fork, it's a rewrite by the developer that wrote jsdoc originally as a perl script. It aims at being more adaptable so you can use whatever js inheritance/events/properties style you'd like. Another feature is that it lets you modify the templates used to generate the HTML in a much simpler way.
We don't know if this JS application is designed to run in a Web browser...
If yes, as advised, Firebug (a Firefox extension) is excellent at debugging JS and exploring Dom.
On the IE side, you have some tools like IEDocMon, Web Accessibility Toolbar (it does more than its name) or Fiddler (unrelated to your question, but still a good tool to have).
Firebug (Firefox) / Dragonfly (Opera) can help you with viewing objects in realtime
Aptana / JS/UML(Eclipse) can help with relationships of objects
This is an old question, but let me answer it anyway.
Use an IDE. Integrated Development Environments were made for jumping around rapidly among the code. The key features you will exercise during exploration are viewing the file structure or outline, jumping to a declaration or usage, and searching the entire project for all instances of a string. If you are using WebStorm, set up a custom scope for files except generated files and node.js to aid in searching.
Run 'npm la | less' which lists all your dependent modules with one line descriptions. You may have never seen moment.js and never need to read the documentation, but taking the time to read a one line summary of it is worthwhile. If you need more information on a tool than one line summary, search for the term on SlideShare. Slides are faster than ReadTheDocs.
Document a little as you go. I'm a fan of forcing people to use notebooks constantly rather than scratch paper. Also, I find adding a one line comment to each JavaScript file is worthwhile. You want to know what should be in each directory of your project. I also recommend building a glossary of the exact meaning of domain terms in your system, e.g., what does "job" in your system.
Finally, you may need to just fire up the application in a debugger and start stepping through parts of it. Most large projects have accreted worth from programmers of various skill levels and motivations.
You are aiming for a level of "conceptual integrity" (to quote Yourdon) or to "grok" the software (to quote Heinlien). It does take some time, cannot be bypassed, and can be done efficiently.

Categories

Resources