Is there javaToJS/jsToJava api similar to Rhino in J2V8? - j2v8

It's grateful that you provide so excellent J2V8 framework, I'm embedding it for my
project, My project is now using Rhino engine.
I'm facing one problem.
I found there's no javaToJS or jsToJava api in J2V8, but Rhino has this api.
In our project, we use javaToJS to convert java object to javascript object directly,
it's necessary and convenient api for us.
Therefore, would you do us favor to tell us how to convert java object to javascript in
J2V8, or javascript to java.

In our project we have same goal of migration from Rhino to V8.
I have found, that for conversion of V8 objects to Java objects V8ObjectUtils.getValue() could be used. Also TypeAdapter could be used optionally to provide custom transformation rules if needed.
Unfortunatly V8 does not provide ability to convert Java objects to V8 object.
But I have found nice project, which does it - v8-adapter
Also I have added some behaviour to the project, which is similar to Rhino - e.g. read V8 objects as Java maps or V8 arrays as Java lists in Java host objects. As well as some other enhancements. Thus your migration should be easier now. The v8-adapter project is developed actively - feel free to contribute if something is needed.

Related

Framework for GAE which use datastore (python preferred)

I love the free tier of GAE, especially Datastore.
I would like to know which frameworks that use Datastore as database.
For example, I only know
Kay Framework (not maintain anymore)
http://kay-docs.shehas.net/
Ferris 2 (not maintain anymore)
http://ferris-framework.appspot.com/docs/index.html
I prefer Python, but php or java are ok too.
Honestly, GAE kind of is the framework. That's part of the point.
If you look at the Google Cloud documentation, you can see that they use Flask, Django or webapp2 as the Python frameworks for providing examples related to the use of Datastore. Personally I cannot recommend any frameworks that utilize Datastore as their database.
In general for Python you can use either the REST API or the client library for a GAE application. This article demonstrates the CRUD functionality implemented using the client library.
If you wish to use third party client libraries for the Datastore API, you can find a list here where two Java libraries are mentioned (Objectify and Catatumbo) and one PHP library (Datastore Library for PHP).
webapp2 is very light weight and has all the basics you would need. however if you are looking for a more "extensive" framework where you dont have to worry as much you could also look into Django (https://cloud.google.com/python/django/appengine)
If you like to do more yourself, like structuring your project in your own way, building your own libs = webapp2
If you want a full framework out the box in GAE Python = Django
GAE is an AMAZING service, and either way I would say you are making a great choice.
Hope this helps.

How to give multiple language support in nodejs

I have been given a project made in chinese language that uses nodejs, angularjs, and nodejs also provides restAPIs to mobile apps. I am required to give multiple language support in this project. I have planned to make json files for each language and load the file when required. But i am confused if it is the right way to do the project.
See the modules on npm:
https://www.npmjs.com/browse/keyword/multilingual
https://www.npmjs.com/browse/keyword/i18n
There are a lot of them - both specific ones for the framework that you're using and general one to be used in projects independent on the framework.

JSPs for a simple Project Reporting Web App?

I'm about to start developing a simple reporting tool for tasks in international projects. In a nutshell: using the tool, a project is created, defining team members, tasks, and work packages. Team members will be asked to periodically submit reports on the work they've done (related to tasks and/or work packages). These reports will be stored and accessed trough the tool.
I'll use Google App Engine (client requirement) and its datastore (using JDO). But I want to ask you for advice on the frontend part: JSP looks pretty messy for non Java developers... any other idea???
Thanks!!!
Seems like at the moment it's either java or python. However, you may want to look at Grails. GSPs might looks a little less 'messy'. I'm suggesting Grails based on your description of the project, that I suspect will turn out anything but simple later on. You might end up being glad for the mix of constraints and flexibility that Grails will afford.
JSP doesn't need to be any messier than other similar HTML presentation frameworks, it really comes down to implementation. That being said, it is old Java technology which means it's not being kept up to date, and finding a good single source of documentation is difficult.
If you don't want to use JSP, there are other frameworks you can use, you just need to make sure they're compatible with Google App Engine.
The new kid on the block is the Play framework, and that's a Java MVC framework similar to Ruby on Rails. You can find a tutorial here: http://viralpatel.net/blogs/first-play-framework-gae-siena-application-tutorial-example/
If you're going to use Spring, check out this question: Alternatives to JSP for Spring MVC view layer
For a front end developer, if the code is separated correctly, you won't have to know anything about Java since there shouldn't be any Java mixed in with the HTML. If that's your only worry, then I would just go with JSP to keep things simple unless the team has experience with another technology.

ruby inside silverlight functionality over c#

Having just found out that you can use Ruby or Python inside a SilverLight application..
link here
..I wonder if its possible to bypass some of the SilverLight limitations with use of these languages instead of C#.
I know that the Ruby Engine inside the SilverLight application is trimmed down, just as the .NET CLR is, so I would like to know that even without all the functionality of a full Ruby or Python Engine:
Can I still be able to do something
with the use of these dynamic
languages that I wouldn't be able to do
in C# SilverLight?
.
If we need to download something built
by the community to extend the cut
down Ruby implementation (to support
Interop calls for instance?), what's
the impact on deployment?
.
If not, if you cannot do anything
you wouldn't be able to with c#, with these engines, besides
the typical benefit of a dynamic
language, and not really circumventing
some of the restrictions of the
SilverLight's CLR, why would one
choose to use Ruby in a SilverLight
application?
One of my interest points is use of sockets, socket usage in SilverLight is improving in each version, but it can still be troublesome because of the xml authorization file required on the server side..would ruby be able to make this unnecessary?
Thanks,
Ric
I suspect you won't be able to work around that. Keep in mind that it's not the language imposing the limitations here but the runtime. TO be precise, it's Silverlight itself. Since both C# and Ruby are compiled to CIL in this case you're left with more or less the exact same capabilities (except some differences in the typing system).
I'm not sure what you're getting at. Regardless of language you are still running inside the same "sandbox", security model and limited with the same cutdown libraries in Silverlight. You can extend the bits that you feel are "limited", assuming your code doesn't violate the security model, with any language.
You might be able to do things differently using another language, but the same basic constraints still apply.
You need to make sure the files are included in the xap or use the silverlight 3 slvx system to stream the assemblies defined in C# or VB etc.
The ruby language should be a complete ruby implementation so you can use all the language features ruby offers like metaprogramming etc.
All source files need to be included in the xap to work.
If you're using ruby then you get gestalt too and you can include ruby source files in the same way as you include javascript files in an html page today.
One of the best scenario for the usage of dynamic languages in .NET is to let the users extend the application with their own code, so that's the main reason I use IronPython in my Silverlight application. It's so nice to have that available in the limited .NET runtime of Silverlight. It's really easy to integrate (although I had a hard time making C# extension methods visible to Python) and it can be very powerful for the users.

Do you have any comments on using GWT with Appengine?

I'm looking for tips, suggestions, advice or examples of applications build using Google's Web Toolkit with Google AppEngine.
Since Google AppEngine now supports Java using GWT just became a whole lot easier (ie. you can use GWT RPC).
Take a look this screencast.
Here's a screencast on the subject: Using Java (GWT) with Google App Engine
Functionality seems very limited though since GAE uses Python + JavaScript and not Java.
Can you elaborate more on why using GWT with the Java version of GAE would necessarily be a good idea?
I'm not arguing against it, and it seems obvious Java would be the way to go, but just wanted to hear the concrete reasons.
To answer my own question: GWT provides an interface called "GWT RPC" that allows you to talk directly to Java Servlets, therefore offering an amazing level of integration between client and server.
The crux of the problem with GWT and GAE is that you want to use JDO to persist your objects when using GAE, and the bytecode manipulation done by the nucleus (JDO implementation) makes your domain objects no longer work with "GWT-RPC".
Today, the best solution is probably the Gilead GWT adapter for Google App Engine which is currently under early stage.

Resources