local autocomplete using jQuery-Autocomplete and mockjax - jquery-ui

https://github.com/devbridge/jQuery-Autocomplete
found this tutorial and was able to run it implement it on my app.my problem is, it wont run on local computer/app i think the problem is with mockjax is there way to make this tutorial run locally?or is there other way to make an autocomplete locally?this example is about autocomplete.

In the config lookup is for local data that doesn't rely on external requests. This would rely on loading in the data through JS on the client.
If you want to run it locally why not boot up a simple http server with python and make a get request to a local file?
See here line 133: https://github.com/michaelBenin/Airport-Distance-Calculator/blob/master/script.js

Related

deploy non-nextjs edge-runtime to vercel

Recently I've been playing around with the edge-runtime and finally set things to work normally on my local environment with different routes path handled by some of my custom implementations under fetch event. and these are running under edge-runtime
And with some digging around, to be able to deploy what I've made to Vercel I have to convert my project to nextjs and exposed the config to ensure it to run on the experimental-edge runtime
What I want to ask here is
Is there a way I can deploy my edge-runtime API to Vercel without having to convert my project to NextJS
Thank you
No, Next is required.
use Cloudflare Workers instead for legacy fetch handler support

How to enable caching in ArangoDB via Docker or arangojs?

I would like to enable caching in ArangoDB, automatically when my app start.
I'm using docker-compose to start the whole thing but apparently there's no simple parameter to enable caching in ArangoDB official image.
According to the doc, all the files in /docker-entrypoint-initdb.d/ are executed at container start. So I added a js file with that code:
require('#arangodb/aql/cache').properties({mode: 'on'});
It is indeed executed but caching doesn't seem to be enabled (from what I see with arangosh within the container).
My app is a JS app using arangojs, so if I can do it this way, I'd be happy too.
Thanks!
According to the performance and server config docs, you can enable caching in several ways.
Your method of adding require("#arangodb/aql/cache").properties({ mode: "on" }); to a .js file in the /docker-entrypoint-initdb.d/ directory should work, but keep an eye on the logs. You may need to redirect log output with a different driver (journals, syslog, etc.) to see what's going on. Make sure to run the command via arangosh to see if it works.
If that's a bust, you might want to see if there is a way to pass parameters at runtime (such as --query.cache-mode on). Unfortunately, I don't use Docker Compose, so I can't give you direct advice here, but try something like -e QUERY.CACHE-MODE=ON
If there isn't a way to pass params, then you could modify the config file: /etc/arangodb3/arangod.conf.
And don't forget about the REST API methods for system management. You can access AQL configuration (view and alter) in the Web UI by clicking on the Support -> Rest API -> AQL.
One thing to keep in mind - I'm not sure if the caching settings are global or tied to a specific database. View the configuration on multiple databases (including _system) to test the settings.

Parse Server Cloud Code Does Not Work

Hey guys I have a very confusing issue at hand, I want to state that I have looked through EVERY resource I could find including on here about getting custom cloud code functions to work.
I am hosting Parse Server on Heroku with my database on mLabs
I can successfully call the 'hello' cloud code function
I cannot successfully call any custom Function, even one that prints something to the console
Below is my current process that I have been using trying to get my cloud code functions to work
Open Main.js and Add Cloud code:
Parse.Cloud.define('testParagraph', function(req, res) {
console.log("received......... this is a console log for a test function that will print out a paragraph as a test");
res.success('Hi, this is the start of a new test function that will print out a paragraph');
});
Commit change to git
Push Change to git
Restart Heroku Server
Run App & Call cloud code from iOS app in Swift
Result:
Every Time I get error 141 Invalid Function, however I can call 'hello' successfully. Just not a custom function.
Edit 2: I have discovered that I am unable to update any cloud functions. Meaning that while I can successfully call the "hello" function if I make a change to said function, re-upload to git, restart Heroku the change is not implemented. This leads me to believe that there must be something wrong with either the link to my main.js or it is being uploaded somewhere else and isnt calling the correct main.js... Any insight would be helpful
I solved this issue, my git was behind HEAD and therefore any changes I made did not become active on my Heroku Server, I merged my branches and this solved my problem of not being able to run custom functions. Now I am able to run custom functions, but I still get error 141 when try to query my database, due to the new problem I am marking this as solved and asking a new question.

Using Cloud Code with the Parse Server and Heroku

I am trying to understand the new Parse Server and have deployed on Heroku. This went smoothly but what I am struggling with is figuring out how to write server side code (Cloud Code). I've read over the parse server example many times so I must be missing something but I'm very unclear if I should be using Express for something, or how I even begin to include my Cloud Code files. Any help is very much appreciated.
UPDATE:
I found the cloud folder I was just looking in the wrong place. I moved it and index.js to my apps folder on the desktop. I have changed the default code in main.js to my custom code. I have set up index.js with my apps information. The problem now is when I run the app and try to call the cloud code functions I get error invalid function.
If you have the parse server example running on heroku you are 90 percent there. Just open the cloud/main.js file and start adding your cloud code. There should be a hello cloud function there as an example.
To use your already created cloud code modules/files you can require them as you have done before on parse.com. The only difference is that the path should now be relative instead of absolute. For example require('cloud/cloudFunctions'); should be require('./cloudFunctions'); if you had a module called cloudFunctions.js in the cloud directory.
Cloud Code works similar to how it did on parse.com and you shouldn't have to think too much about expressjs for simple applications. That said, parse server is using expressjs so yes you are using it.
Parse server is simply a another node module similar to the other thousands available. If you do not have previous experience with nodejs, running parse server can seem complicated. Therefore I would recommend reading about the basics of nodejs before a full migration.
I'm using the Bitnami stack on a Google Compute Engine instance and I had a similar problem to yours. To solve it, just navigate to the folder where your server.js file is and create a folder called "cloud". Then create the main.js file inside the cloud folder with the following content:
Parse.Cloud.define('hello', function(req, res) {
res.success('Hi');
});
Now open the server.js file and find the line containing the path to the cloud code file. Change it to point to you main.js file like this:
This could be any arbitrary folder of your choosing.
Now just restart your parse server and call the cloud function:
String result = ParseCloud.callFunction("hello", new HashMap<>());
This is with the Java SDK but should not be much different. The variable result will equal "Hi" if you've used the function from above.

How do I handle post requests from my dart app ran from the dart editor?

I have code that looks something like this (_http is the angular Http object)
var httpFuture = _http.post('/api/items', {
'ids': JSON.encode(new List.from(nonLoadedIds))
});
httpFuture.catchError((e) {
Logger.root.severe('Unable to load items!', e);
});
It is making a post request to load a bunch of things. Potentially more ids than the http get header can handle.
The nice development experience would be if I could fire up the dart editor, mock up some fake response data, run my app, and see the data in the end. I would also accept being able to start up a separate web app and somehow proxy my post requests to that web app.
What I don't want to do is change my '/api/items' into something like 'http://localhost:8084/api/items' mostly because I don't want to have to remember to replace these before deploying (I know I'll forget) and while doable, I don't want to on my server implement CORS just to have to remember to disable it when I deploy to production.
But really, I would accept just about any workflow if it is recommended. I just would like to eliminate any manual code transformations pre production deploy.
The suggested attempt is to use a simple proxy server which forwards to pub serve.
See for example https://code.google.com/p/dart/issues/detail?id=18039
This issue contains the source code for a simple custom proxy server example https://code.google.com/p/dart/issues/detail?id=15731
see also
Dart: How to use different settings in debug and production mode?
How to achieve precompiler directive like functionality
Is there a compiler preprocessor in Dart?

Resources