WebAssembly via d8.exe - embedded-v8

I posted this question here because I asked this question as part of another post, but found the solution before anyone answered it. Just want to share my findings.
I decided to try d8.exe only because I want to play around with WebAssembly don't feel like installing Chrome Canary. Still trying to figure out how to load .wasm file into d8.exe since I can't use XMLHttpRequest or fetch to read the binary files.

My findings:
Enable WebAssembly in d8.exe with --expose_wasm flag.
Use binaryen to convert hand-written .wast to .wasm.
Use binaryen.js to compile string into wasm inside d8.exe.
Read .wasm with readbuffer.
WebAssembly's JavaScript API can be found in https://github.com/WebAssembly/design/blob/master/JS.md

Related

How to use Express server back end with Nuxt JS

I just started working with Nuxt JS, and I'm trying to pass a request from the client to my Express server, but Nuxt treats the routes like they were suppose to be pages.
Hence I get the errors page not found in pages folder. Help please.
I've gotten into using an express backend with nuxt and it's a great way to go about it. As there is quite a lot steps to take and files to set up it's perhaps beyond the scope of a single answer here to cover what's needed. I'd recommend you start with this tutorial on codeburst which covers all the steps you need and can be expanded upon easily once you understand it. Good luck.

creating NWJS desktop app with source code protection and use of node.js routes

I am posting this question in the lack of tutorials available for nwjs app development. Also, documentation in not much of a help. There are a few YouTube tutorials but they are 4-5 year old. Since then Node-webkit has changed into nwjs and now available in two different flavors. None of those tutorials are helping because they are based on old node-webkit and none of them answers any of my questions below. -
Let me break the title question into parts -
Which version should I used for making nwjs based desktop app? Regular or SDK?
How to make nwjs desktop app?
What would be the app/folder structure?
How to use node module with nwjs?
How to make use of route in nwjs app? Or do I need route at all?
Question 1. Which version should I should of nwjs? Whatever I have read online, found that nwjs sdk is best bet because it allows to debug the app during development, which fairly answers my this question.
Question 2. How to make nwjs desktop app? I found another SOF post where one example has been given in an answer to create basic app - Here Though, example is pretty straight forward but I still have few confusion which I need clarification so I am gonna ask them in the next question below.
Question 3. What would be the ideal folder structure for nwjs app? I have this folder structure right now in my nodejs app.
**Main App
|__app/
|__backend/
|__bigtable/
|__pubsub/
|__config/
|__client.json
|__models/
|__database-models.js
|__node_modules/
|__public/
|__css
|__js
|__img
|__libs
|__routes/
|__auth-routes.js
|__app-routes.js
|__api-routes.js
|__views/
|__index.ejs
|__login.ejs
|__*.env
|__package.json
|__package-lock.json
|__server.js
I don't know if can take this exact folder structure into nwjs, if yes? then How? if no, then how can I restructure my app for nwjs. What are the parts of the code that I need to restructure or redistribute or reintegrate in the app? As shown in the example in the above link server.js has been attached in the html file, why? What I have learned from developing nodejs app is that you need to run server.js and go to the localhost:port# in browser. This all had made me confused to develop nwjs app. Basically require doesn't work in browser but it does in nwjs
Question 4. How to use nodejs module in nwjs app? I know that nwjs creates its own local server and runs the app. You don't need to make express server or http server separately which runs on by default 8080 port. In the examples provided in the above link, uses express server which runs on 3000 port. Why do you need to create express server? Why can't we use default server which runs on 8080? Do I really need to use express module to use other nodejs modules (non-inbuilt modules)?
Question 5. Making use of routes in nwjs app?
case 1 Let say if we can use default server then how can I utilize that to create routes to make front end interact with modules.
case 2 Let say if we need express and we are attaching server.js into html file then do we need routes?
Extra I have also read that we can directly call node_modules from html then do we need express? do we need routes then? How can we secure code in nwjs? How can I package nwjs app for distribution with source code protection?

Mbedtls - Download file from server

Does someone can explain how to download file from the server using Mbedtls library?
They provide some example for using GET request from localhost. I have used it and modified to work with POST. This works just fine but
it looks like when I send a GET request which supposes to bring back a file data as a stream I get back just a header without data.
I pretty much sure I am doing something wrong in my code. Do I need to set some specific configuration to download file ?
pretty stuck and need assist, any help will be more than appreciated.
Does it work with this library? It is built on top of nodejs/http-parser which should also handle chunked responses and other weird things you might encounter in the wild.
If that doesn't help, the URL to the resource you try to download would be appreciated :-).

Using UIWebView as a script engine

I am working on a survey engine for the iPhone. We use a declarative xml format that can be downloaded post store install. It's working pretty well but not being able to script is becoming problematic. I have this idea to use a webView to execute javascript code to provide this functionality.
My question is will this run afoul of Apple's rule of not downloading executable script code? They do seem to allow for downloading of JS code that will run in a web view. Would they consider this approach an abuse of this rule?
Thanks
I don't think so. A lot of native applications are actually built this way. They simply open a webview and load a web page, with all the logic done in javascript.

How to use generic libraries from a Web framework?

OK, I had a look at the memcached module for Nginx but this is clearly not for the faintheart.
Does anyone know about a way to load a library in memory and then use its functions - from a Web server like Nginx, Lighhtpd or Apache?
Example of such libraries abound like JSON parsers, Database client libraries, etc.
Hard to find anything about doing it but those guys have made it pretty easy:
http://dearetc.com/
It takes only one line of code to import a library and all its functions.
Hope it will help others...