Chrome extension and mysql - mysql

I am trying to develop a chrome extension.
Users have to send data to my server and receive data from my server.
I am new to chrome extension and I find the javascript cannot access the database. e.g MYSQL
I really don't know where to start?
I check the xmlhttprequest, but I still have no idea. Can anyone give me some more hints and suggestions?
If you can provide a sample code, this would be really helpful!
I am searching on the Internet for two days and totally get lost....
Thank you for your help!

You should create web-script with php, python, ruby etc
There you should provide a connection to mysql and process the data and print your result as JSON, for example.
Then you should get that json with ajax request by your chrome extension and process this json with your js code.

Related

Strategy for converting JSON to DBM Hash File (AEM with Apache backend)

I'm looking for some solution design assistance, as an idea I thought I could mimic apache's httxt2dbm tool.
Use case:
We currently manage our 301 RewriteRule's in apache for our AEM environment. My co-worker has built a webform for end users to submit their redirect requests and this puts the form data in MongoDB.
Problem:
How can I convert JSON into a dbm hash file like the httxt2bdm tool does?
Any ideas for how to tackle this problem?
The end goal here is that users can fill in the webform, then a cronjob will run and update apache followed by restarting httpd.
I know about the map manager tool but it doesn't really fit the use case.

Forge ARKit: Cannot load model in Unity

With the latest ForgeARKit-update-6-2018.1, I was trying to load my model in Unity, with the sample Unity scene 'loadAtStartup'. I can successfully load the sample models from 'Sandbox', but I couldn't load my model, which was uploaded through script 'test-2legged'.
Error message shows 504, it seems not reaching the service:
AsyncRequestCompleted The remote server returned an error: (504) Gateway Time-out.
UnityEngine.Debug:Log(Object)
Autodesk.Forge.ARKit.RequestQueueMgr:AsyncRequestCompleted(Object, AsyncCompletedEventArgs) (at Assets/Forge/CodeBase/RequestQueue.cs:322)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
Model URN:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bWFvbGlua3ppOHM3cnlvZWx4bjVndnR4bjcyZWc2N2l0dGp0a2MvMmZsb29yX0FyYy5pZmM=
[Update 23/4/2019]
I found that I can successfully load the same model with ForgeARKit-update-3-2017.1.2f1. I compare the Forge code in Unity. I think it has something to do with the service URL. The version 6 is fetching models from 'https://developer-api-beta.autodesk.io' while version 3 is fetching from 'https://developer-api.autodesk.io'. Meanwhile the shell script 'test-2legged' is uploading to the latter one ('https://developer-api.autodesk.io'). That is why it counldn'd find the resource. Question here is how can I upload model to the 'beta' ARKit? I tried modifying the URL in script 'test-2legged' but it doesn't work. Below screen-shot is the output of script 'test-2legged' when fetching from 'beta' ARkit. It seems model is uploaded successfully, but some parsing post-work failed. I guess the response format is also changed in the beta version. Is there a beta version of 'test-2legged' scripts (and other Scene Preparation scripts)?
Please comments, Thanks.
This is correct. My apologizes for this, I know we did not documented very well on the server changes.
This update6 assumes you are using the new server under beta right now. The scripts and update 3 are using the legacy server. Note that the 2 servers are not necessarily compatible and store the data in different places, so make sure to always use the same server in Unity as the one you used to prepare the scene. When we will switch everyone to the new server, we will transfer the data from the legacy server to the new server cloud storage.
The Update3 package will still be able to read scenes from the new server, as we make sure the old Unity code stays compatible.
Note as well you need to use SafeBase64 encoded string everywhere. I saw in your description that you are using base64 encoded (not safe). The new server will be more strict of parameters and format, so I encourage you to test your scripts/code on the beta server.
Last, I am working on a new Unity code update, and documentation which will be released next week. Make sure to use this version - it adds support for 3legged, automatic 2/3legged token refresh, and more. If you got scenes failing, please contact me directly and share your models and URN. I'll either test it on my development environment, or look into our log files for the reason to fail. My email address is my first name at autodesk.com
Thank you Cyrille for your help!! I am replying you here as it's easier to insert images.
I replaced the function 'xbase64encode()' with 'xbase64safeencode()', and now it works! However it seems for some model it still responds some error and in that case it cannot be loaded in Unity. (as the image below). I checked the script and I think all the encoding are using SafeBase64. Any clue of that? Or is that caused by my model?
BTW, the loading performance is greatly improved than the legacy version!! It looks almost the same as the web client. Huge Thanks for that!
Good to know that there is going to be an update next week. Yes I will test it and get back to you later.

Getting queryString from GET request from website- alternative Tools then Selenium

Aim:
I´m testing a specific site and I want to check wheater the sent key-value-pairs are valid.
I need to get the queryString parameters (key-value-pairs) of a GET request on a website. The queryString is only accessible via the GET requests and is NOT in the url. (I want to compare these key-value-pairs from the website later with other key-value-pairs from a file/html/..etc.)
This is what I did and know until now:
I know I can visualize the K/V-pairs when using FireBug->Network->Parameters.
I can get a GET request with the Selenium WebDriver, but it is complicated to extract the queryString out of the JSON-Object. [I was using Java with jsoup and json.simple]
The only tool I know which can compare key-values on a website is Columbo.io, but I have to write the compared values manually into the tool- that is not flexible enough for my purpose.
In my research I found the following tools: PhantomJS, Ranorex, SmartBear TestComplete, Wetator, Sahi Pro, RedGlass, TestingBot, BugBuster, Canoo Webtest. I sadly cannot find out if these tools are able to give me the key-value-pairs I desire.
Problem:
With Selenium I expect to need a lot of time for writing tests, like maybe 2-4 weeks? So I am searching for other tools which can extract the key-value-pairs of a website easier or quicker.
Question:
Which tools can you recommend for getting these parameters easily?
And if there isn´t any better tool then Selenium then please tell me: maybe I´m overlooking some other issue and there are i.e. better API´s for parsing the JSON-Object to get the key-value-pairs or other things I could improve?
Are there any sites where I can read the experiences of other persons with specific tools.
PS: This is my first question here on Stackoverflow. I hope you can understand and help me.
I am not sure if I get your point correctly but if you want to play with HTTP requests and key-value-pairs, you may have a try to perform with Apache HttpClient which can be integrated with your Selenium-Webdriver java. Hope it can help.

Send file from one user to another using using node.js and html5

I was creating a chat app using node.js, all things i m able to do but not able to get proper method to send files.
I need to send file from one user to other and wants to create skype like experience using node.js and html5.
please help.
Many Thanks in advance.
You could use sockets.io to push the file location to the user, or update a db when someone 'sends' a file, and the person that should get it uses a timed ajax post to query the db to see if they have a file to download.
I don't know if I'd trust users enough to allow them to send any kind of files over my server though. I also don't know if sockets.io can stream bytes from one user to another in order to avoid having to store the file on the server.

Uploading attachment to Asana

I'm trying to add some functionality to an internal Access database that will automatically create tasks on Asana.
My VBA experience is somewhat limited but by examining various code samples online and tinkering I've been able to POST tasks with all the necessary data and GET info back.
But I'm now struggling with being able to upload file attachments to a task. I'm not sure how to go about it.
Leaving the content type as application/x-www-form-urlencoded which works for the normal POST statements when creating tasks and just pointing the send command to a file location using doesn't work and results in an error of "file is not an object", I'm guessing this is because all that's contained in the send command is a file=path pair.
Do I need to encode the file at all, if so how?
I'm hoping someone can point me in the right direction.
Thanks.
You can check out how curl does it, but I believe it needs to be multipart/form-data - I would strongly recommend using a library rather than doing the encoding manually, since there are often subtle gotchas.
Basically, it works a lot like a standard form upload from a web browser.
Hope that helps!