Cannot get JSON data to display on Leaflet map - json

I've been struggling with getting leaflet markers to display on a map by pulling in data from a JSON file. I think I'm missing something very fundamental, since I can even copy working example files from Plunker and load them to my hosts web server. It just display's the base map but no markers from the JSON file.
Search "displaying .json files in leaflet" in Stack Overflow and check Plunker link under the one answer to see the example I've been trying to make work on my hosts web server.
I'm placing all four files in the same folder on the web server. Works fine when I run it on Plunker, but not on my hosts web server. Host is GoDaddy :(. I don't get any error messages, just an empty base map layer.
Is there some setting that may be blocking this? Totally stumped. Note, that I can get it to work fine if I hard code my marker data into the web page, but for the project I'm working on there will be way to many data points, so need to pull this from an external file. Here is "live" test example where I just hard code data into web page: http://bwcawild.com/PMA-Pitfall-Lake/Test-Lake/Test2-Lake.html
Anyone got any ideas on this? Thanks for your help.

Related

Why does REST API not work on my local MediaWiki?

I've successfully installed MediaWiki on my laptop. Here is the entry tease out.
As you can see, the link to this entry on my local host is http://192.168.56.1/wiki/index.php/tease_out. Then I want to use REST API to convert this page to html. The corresponding link on the online Wiktionary is https://en.wiktionary.org/w/rest.php/v1/page/tease_out/html. The desired result is
Then I try http://192.168.56.1/w/rest.php/v1/page/tease_out/html. But it shows
Could you please elaborate on this issue and how to solve it? Please let me know if you need further information.

Google Docs Viewer doesn't display Firebase storage URL in an iframe due to "sameorigin" policy

I've read up about this error but the proposed solutions don't seem to work for .doc/.docx files.
I am building a web app which involves displaying pdf/doc files. The files are stored in a google storage bucket, and I am using Firebase's getDownloadURL() method to get a link which I can use as the source in an <iframe>. This works fine for PDF files directly. However, given that this direct display is not possible for doc/docx files, I tried displaying them through Google Docs Viewer by taking the generated URL and appending as follows:
https://docs.google.com/gview?url=https://firebasestorage.googleapis.com/v0/b/project-name.appspot.com/o/filename?alt=media&token=a-b-c-1-2-3
This yields a Refused to display <URL> in a frame because it set X-Frame-Options to same origin error. I have also tried adding an &embedded=true to the URL as has been suggested in other similar queries, but that yields another error: Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
I thought this could be an issue with parsing the URL due to the "&", so I changed it to "%26", but the "sameorigin" error persists.
I'm not sure how to tackle this, and any guidance on how to resolve this issue (or alternative ways of solving the problem) would be greatly appreciated.
Google docs creates its own storage objects, and will only serve those objects. It won't display other objects that happen to be in doc/docx format from other repositories.
It sounds like you need a way to render objects you uploaded (using Firebase) to GCS. I don't have experience doing that specific thing but I suggest you try to find some software that does it. For example from a quick web search I found Render docx file in a browser.

How do I parse a json image returned from an API?

To make an example Wordpress plugin that shows an image, or at least stores it in the media library, I go out to the NASA Open API and fetch the Astronomy Picture of the Day. I have not yet tested that code, but assuming it works my problem is: then what? I guess I have to parse the return data and somehow get an image file I can upload to the library. I'm used to grabbing pre-known text fields such as data.customerid, etc. but never an image. The API site is not much help. I have gleaned from around here a few references to "base64" but I don't know what that means. I can't find a straightup example if what to do. Any thoughts?
you'll have to do steps along this lines, you are pretty much correct on that:
fetch response from API (example: https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY)
parse url:
use media_sideload_image function in WordPress to save image in media to be able to show it in your plugin or to your users..
I suggest you to start building your plugin from scratch and then when you get stuck post your code here and community can help you better..

dartdocgen: how to view docs locally

I am having trouble using dartdocgen and dartdoc-viewer to pump my JSON files to the browser. I have had success getting all the JSON files from my application but haven't had any success actually viewing them in the browser. Based on my research, the best way to do this is hosting dartdoc-viewer on a local server as mentioned by this document:
https://www.dartlang.org/tools/dartdocgen/#deploy
However I just cannot seem to get it to work following these directions (I would like to approach it via dartium):
https://github.com/dart-lang/dartdoc-viewer/
I understand that once I am able to run pub build and compile to javascript that I dump the client/build folder into my server along with the docs folder under the URL, I am golden. That's where the issue is, how to get it from the docs folder to javascript to the browser.
I would like to be able to use dartdocgen to it's full potential so can I get some ideas?
Just run dartdocgen --serve .
see https://www.dartlang.org/tools/dartdocgen/#view-locally
Is not what you are looking for?

file_get_contents( [file direct link] ) not working in php anymore

I have an enterprise box account, and I was tasked with creating a crawler that would scan an account on box and save all meta information (including a direct link) in a local database. This works fine.
in PHP I have also built a function that downloads the documents (via the direct link I obtained from the api) and extracts readable text from them. This was working perfect a week ago, yesterday however this stopped working completely. I'm using the file_get_contents() function to download the file, and currently it only retrieves the document's file size rather than the document itself, which I find strange. I have tried CURL and I get the same result, it seems box is responding to my direct file requests with the file size instead of the actual file.
The files are ALL open access, so anyone with a direct link can download the file without logging in. I have also tried running this code on another server in another hosting company and I get the exact same result. I have tested my code by accessing other files from other locations (not box) and it works fine.
It's important to note that this was working fine just a week ago, but now it doesn't work at all. Nothing changed in between on my end, (that I know of). Anyone have an idea?