How to understand the ternjs framework - tern

I am going to create a language specific tool to support hight-lighting, code completion etc and found ternjs is a good framework to use. I read the document from http://ternjs.net/doc/ but not quite understand how it works. Based on that document ternjs needs a server to be launched to support the client side. I inspected the on line demo from http://ternjs.net/doc/demo/#simple. When I type command in this demo, I didn't see any http communication happens between my browser and the ternjs server. I am confused about how ternjs server work in this case. Is there a way for me to setup one locally?

Related

How to terminate an EventSource CGI?

A bit unsure where to look for this one...
Context:
HTML5 web page, that uses HTML5 EventSource / server-side events to get refresh notifications
OpenWrt BarrierBreaker server, running uHTTPd as the web server
a two-level CGI script that provides the server-side events:
the CGI is a shell script (ash, not bash), that parses QUERY_STRING, and calls...
a C application that do the true data extraction (from an SQLite database) and pushes the data to the web page
Everything works, except for a little detail: when the web page is closed,
the C application keeps running. Since it doesn't expect any user input, its current structure is a simple while(1). So after some time, the openwrt box has dozens of copies of the app running.
So the question: how can the application be changed to detect that the client isn't there anymore, and that it should quits?
Thanks
[Edit]
Since posting this a few hours ago, i investigated if the information was somehow available in the script's input stream. It appears it isn't.
I also found http://html5doctor.com/server-sent-events/ that describes a strategy to do exactly this in a Node.js environment, but I have no idea how to translate this in a script-based one.
[/Edit]

Capture web driver network traffic across all browsers

I want to capture all the network calls from Web Driver in Java. I am not doing any UI testing, just testing JS execution and, requests and responses of some network calls.
I tried using Browser Mob as is suggested in most forums, but I need it to work across all browsers. It worked flawlessly with Firefox, but I was facing some issues with the others. Safari driver doesn't event support a Proxy capability.
I don't want to use Fiddler as it involves some manual steps around invoking and storing the calls. Whereas, Browser Mob being an in-code proxy can be integrated in a more smoother fashion.
I also tried using the RC-like package included in Selenium standalone server package. But, I have some HTTPS calls and some nested iframes in cross domains. I am particularly interested in some cross domain POST call and it doesn't work out that well. Also, people keep saying it's not recommended to use that package.
So, I had a solution where we can use a standalone proxy server running on a machine. Using host entries, we'll point Web Driver to hit the proxy instead of the actual server. The proxy will record all the incoming calls and route them to the actual server host. Later, I can make a request to the proxy which will return me all the calls it intercepted. I am not sure whether it's still called a proxy or a router.
I came across TCPmon, but it's no longer being supported. Does anyone know some similar tools that could run on Unix systems or any alternate solutions?
We modified the Fiddler rules script to include a new exec action. If you use their native script editor, it also provide auto complete features and we were comfortably able to get around it. The syntax is similar to that of JavaScript.
The Fiddler package comes with a ExecActions.exe which can be used to pass console arguments to a running Fiddler instance using the command prompt.
The code we wrote processed all the sessions captured by Fiddler and wrote it to a file in a custom JSON format and later used GSON to deserialize it.
Please let me know, if you want further details.

Is a scripting application allowed in the Windows Store?

So I have this bit of a project planned for Windows Store and Android. Basically, a networking multi-tool coupled with a scripting engine to implement protocols and behavior. Ideal uses being things like "my embedded device uses this simplistic network protocol. I'd like to quickly prototype a way to control it from my tablet".
It's my understanding that the Android market should have no problem with this. However, the Windows Store policy includes a vague clause concerning remote code execution
3.9 All app logic must originate from, and reside in, your app package Your app must not attempt to change or extend the packaged content
through any form of dynamic inclusion of code or data that changes how
the application interacts with the Windows Runtime, or behaves with
regard to Store policy. It is not permissible, for example, to
download a remote script and subsequently execute that script in the
local context of your app package.
Of course, the scripting engine will be sandboxed and such and should be "safe"(completely intepreted, no reflection), but does it violate this policy?
If you build in your scripting engine, and only run local scripts, you will be good. However, if you were thinking to have a repository of scripts that could be downloaded and subsequently run, that would be in violation of the policy as we understand it.
Unfortunately I don't think anyone but someone on that team can answer that (or someone with direct experience in that) because of the closeness to the legal language. Have you tried the Windows Store Appl Publishing forum at: http://social.msdn.microsoft.com/Forums/en-US/windowsstore/threads
In the context of scripting engine example given, unless the app modifies the scripting engine after deployment on user's system such that the representation of protocol/behavior (the script artifact's format) is made to change then it'll be policy violation. Its as if you submit Python interpreter, and at some point in time it abruptly moves onto interpreting ecmascript.

URL shortening (tinyURL, Bit.ly) application for internal deployment (open source or commercial)

I'm looking for the equivalent of a URL shortening service such as http://bit.ly/ for an internal deployment in our organisation. Anyone know of any open source projects (especially Java ones) or commercial products which I can install internally rather than using an external service?
Thanks!
Shorty : http://get-shorty.com/
But there's several other url shortener .... most of them are in PHP/Mysql.
Don't know if a Java one exist.
http://monkeytooth.net/2010/12/htaccess-php-how-to-wordpress-slugs/
tells you the core basics of how to achieve the concept with PHP and Htaccess building up from there I can say would solely be on your own. However not all to hard a concept in general to build off of if you know php/mysql. That said your not likely to find anything directly built in JavaScript however using this with JavaScript again wouldn't be all that hard a concept. I say your not likely to find one JS based as you need some type of server-side script to communicate with a DB somewhere, where you have all your short URL identifiers, and JavaScript to my knowledge doesn't support directly at least database connectivity. You can go through any means of AJAX to communicate with a server-side script to then do what you want with the JavaScript though.

facebook-java-api on red5, can they work together?

I have a Adobe Flash Builder GUI application that connects to Red5 to communicate.
can i use the red5 to call facebook API calls? can anyone provide an example? all the examples that i can find are with tomcat.
thanks!
Unfortunately they can't.
facebook-java-api cannot work with red5 because it requires the session data that does not pass into red5 and uses variables that i received only by a java Servlet.
there is also a facebook java api called TinyFbClient (www.socialjava.com).
this client is small, very easy to understand with very nice examples.
here i didn't have to use sessions, but i do need to get the uid of the user i want to query on. the client side can forward that information when needed.
TinyFbClient depends on jersey (http://download.java.net/maven/2/com/sun/jersey/) but unfortunately jersy does not compile on red5 properly. if you'll try to use the binary version you'll just get the error
java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
and that is because the compiled binary cannot operate properly.
I resolved the issue by installing tomcat and allowing the user to connect to tomcat first, with tomcat i fetch the session and the relevant facebook data, stores it in a database and then with red5 i manipulate the data as needed.
hopefully this information will be found useful.
update
i had the previous error message because i did not copy the relevant jars (jersey and jsr311) to the red5 directory. unfortunately it did not solve the problem.
i tried different versions of jersey (1.0.x,1.1.x,1.2). the code did compile but any calls to a facebook api would just stop the application.
i decided to do the facebook information fetching part in tomcat and then to deliver it to red5.
Yes, it can work in Red5. Especially if you had it working in Tomcat, since we provide an embedded Tomcat server.