Meteor integration with node-ffi on client-side - meteor

Can I use Meteor with node-ffi (https://github.com/node-ffi/node-ffi) on client-side to allow users to load a native shared library on browser, making the browser capable of running the library and return the result to the server?
In practice: the user access the site from browser, click somewere, loads the library library path, them the library is executed and returns the result to server.

I'm pretty sure this won't work. The browser won't support what you are doing, as its a server wrapper, and will build an architecture specific wrapper to run the c++ code.

Related

Why does AFrame require Node?

I've read a bit about AFrame, and I am very familiar with Node.js. But why does AFrame require Node to run? I tried looking at the index.html in the Aframe boilerplate sample--and it runs just the same in the browser with or without Node running. Is Node really required to be running? What is Node rendering?
Node.js is not required to run A-Frame — it runs in a browser with no expectation that your server use Node vs PHP, or that you use a webserver at all. Are you seeing something that makes it seem like Node would be needed?
However, the aframe-boilerplate starter kit does provide convenience features — used only during development — that rely on Node.js to automatically reload the page when your HTML changes, or deploy to GitHub Pages. These are not requirements for A-Frame itself, and can be ignored if you prefer.

Using Qt classes natively in an Android application

The Android application I am about to work on has the UI in Java and the non-UI functionality in C++ that would be accessed via JNI. The C++ code uses some non-UI Qt classes. I am thinking I will spawn a thread in JNI_OnLoadthat essentially will instantiate and run QCoreApplication. Any subsequent JNI call will simply post an event to this thread. Is this possible? Regards.
What you want to do is definitely possible but a bit more difficult than it seems initially.
If you build your app end to end in Qt there's a lot of functionality you get for free from their framework that allows it to run on Android and a lot of that functionality/plumbing is wrapped up in their UI. So if you're not using their UI there's extra work that you need to do.
On Android their UI framework basically creates a native Activity and then uses that activity as a wrapper for the app. If you look at the low-level source for their UI thats what's happening on Android and it's what allows the Qt app to access local resources, the network, OS facilities, etc.
Without the Activity wrapper, your app will only be able to do simple, in-memory operations that require no OS, file system, or network access and also won't be able to make use of other Qt libraries(eg Qt5Sql, Qt5Core, etc).
Here's what we had to do to make this work in our java app:
Create a proxy wrapper Activity for Qt to use that shares the base
context of your app.
Create a QtActivityDelegate.
Set the proxy activity and delegate using the native Qt android
libraries. eg QtNavite.setActivity.
Instantiate and set a DexClassLoader using the same native Qt android libraries.
Load any Qt libraries using System.loadLibrary(..). Please note that the libraries need to be present on the file system already. This part was a big pain for us.
For your Qt Code, make sure you have proper wrappers written so that they can be used via jni. We ended up using swig to auto-generate java wrappers for our code.
You can find out more about swig here: http://swig.org/
After all that you should be able to use your Qt class/library from within a native Android app.
Painful but definitely possible!

running html version of playn

I have playn installed on eclipse (http://code.google.com/p/playn/wiki/GettingStarted#Running_via_Eclipse), i loaded the sample programs and they load file, the java one runs fine. But for html
I right click the showcase-html > google > compile
I don't get any errors:
Compiling module playn.showcase.Showcase
Compiling 1 permutation
Compiling permutation 0...
Compile of permutations succeeded
Linking into C:\Users\(my path)\playn-samples\showcase\html\target\playn-showcase-html-1.0-SNAPSHOT\showcase
Link succeeded
Compilation succeeded -- 12.208s
then
run as > web application
I get a url in the development tab:
http://127.0.0.1:8888/Showcase.html?gwt.codesvr=127.0.0.1:9997
when I run this it hangs my browser
when I run this:
http://127.0.0.1:8888/Showcase.html
it says "GWT MODULE MAY NEED TO BE (RECOMPILED)" on a popup and loads nothing.
Any idea what might be wrong?
I don't recommend using Eclipse to compile and test the HTML5 backend of a PlayN game.
Develop and test using the Java backend, and when the time comes to build the HTML5 version, use the Maven command line to build and test it. It is far more reliable.
However, if you insist on testing the HTML5 backend in Eclipse, you have to be careful. What you've done above is to first compile the Java code to JavaScript (by using Google -> Compile) and then overwritten the compiled JavaScript with GWT devmode stubs (when you used Run as -> Web application).
Instead, you should use Google -> Compile, and then expand playn-showcase-html -> target -> playn-showcase-html-1.0-SNAPSHOT and right click on Showcase.html and select Open With -> Web Browser. EDIT: You'll need to run the generated code in a webserver to avoid crosssite scripting issues.
You never want to use GWT devmode (Run as -> Web application) to test the HTML5 backend of your game, because GWT devmode is pathologically slow for running high-performance code like an HTML5 game.

Environment-dependent compilation properties in Flex/AIR

I'm building a Flex/AIR application that connects to a remote server, the URL of which changes depending on the environment (development/production, and possibly others). For now, this URL parameter is hardcoded in my root application MXML file but it means I have to change it everytime I build my app for a different environment.
Is there a way to externalize such a parameter so that when Flash Builder automatically builds my app (in development mode), it uses the development URL (http://localhost...) and when Flash Builder exports a release build, it uses the production URL (http://www.mycompany.com/myapp)?
Flex compiler supports something called Conditional compilation, you an read about it here: link. The problem is that it still doesn't give you an way to check if you're exporting a release build or building for debug. Probably the simplest way to achieve that is to use ANT for compilation of the release build and use the conditional compilation from there.

Do I have to link my shared library with QWebKit (11Mb) if it's already linked with my host app?

I'm writing an app in Qt that is using QWebKit for accessing webpages.
I want to extract some functionality into a dll that can be automatically updated, but it seems like I have to link QWebkit with both host app and my dll, that will add extra 11Mb to application installer and also extra 11Mb for autoupdate is not what I looking for.
Is there any way to link webkit (and xml and gui) only to host application and let shared library use it while loaded into host app?
Thank you.
If you are using Qt as shared libraries (dll's) rather than statically linking, then you'll only need to ship one copy of the webkit dll.
If you are statically linking, you'll need to link webkit into which ever part of your app requires it. If your main app and the part you want to extract both require webkit, then you'll need to link it in twice.
Unless you have a real need to have the smallest program size possible, I would recommend not statically linking to Qt, and just shipping the dlls you require. It's far less hassle to do it this way than statically linking.

Resources