We are creating a map application that has a list view of the resultant set using JSON and jQuery and presenting the result to the user. How can we give the user the ability to download the result as an Excel file/CSV file?
Assuming a web application...
Convert JSON to CSV
Present It as an HTTP response.
You mentioned JSON and jQuery. I assume this is being used on the client side? There are a number of utilities for making the JSON-to-CSV conversion depending on the language you would want to use. Here are some examples.
Javascript/jQuery
PHP
Python
Related
Is there a way to store tag in DB without using HTML tags. In order words I dont want the string thats getting stored to be like
'<b>This</b> is a sample', instead it could be some kind of encoded format.
As of now I have a got a few findings like encoding the html content before storing it via some 3rd party library
https://github.com/mathiasbynens/he
However, is there any better approach to do the same without using 3rd party library?
We are consuming apis returning json in our projects. The json from those api can contain rather large structures which need to be mapped into other large structures (usually json but could be xml or csv rarely).
We used to use dataweave (from Mulesoft) to do that, and if you're not familiar with dataweave, it's pretty good at that sort of mapping. It let's you define a sample input, and while editing the dataweave it shows you a preview of the result in a separate pane.
For some apis we switched to using nodejs (because it offers better control and debugging than Mule, long story). But I'd really like the same mapping experience as dataweave.
So I guess the question is: can I use vscode to define an input file in a directory, a transformation file in javascript and have the resulting mapped output display in a pane which is updated live?
Is there some plugin offering that? Couldn't find it.
My understanding is the following:
You have a mule workflow which needs to read a file(you edited the file in vscode) and execute a server side javascript (nodjs) to transform the file and after the result is obtained, the mapped result will be pushed into a web page ? right ?
All happen under a given mule workflow right? and you are wondering there is any mule connector to do this process ? right ?
In my application I am uploading a PDF file after uploading, I should display the information present in PDF file to a HTML form we are using angular 2 for frontend and node js for backend. Can any one help me with this.
Please remember PDF to HTML.
You can do one thing. Convert your pdf to a JSON. Use pdf2json.
pdf2json is a node.js module that parses and converts PDF from binary to json format, it's built with pdf.js and extends it with
interactive form elements and text content parsing outside browser.
The goal is to enable server side PDF parsing with interactive form
elements when wrapped in web service, and also enable parsing local
PDF to json file when using as a command line utility.
perform npm install pdf2json
Create an empty JSON whose key values will be the main headings from the pdf like a customer, age etc. Its values are obtained from the uploaded pdf.
Using this JSON values fill your form, on saving the form using, node.js save it to your DB. Is this what you want?
Simply what you need is to render a PDF in your application.
You could use this library ng2-pdf-viewer
Almost all the basic functionalities are available as properties to this component. You could manipulate it to your requirement.
I'm a beginner at website programming and want to understand some basics.
I've created a Python 3 script which fetches some data from a website and makes some calculations. Result is then about 20 rows with 7 columns.
What is the easiest way to make them available on my website? When refreshing my website, the Python script should fetch the data from the 3rd party website and this data should then be displayed in a simple table with sorting option.
I've discovered the jQuery plugin DataTables with Ajax JSON source. I would create a PHP script which executes the Python script which writes data to a DB like MariaDB. PHP then creates a JSON for Ajax.
Is this the right way or are there easier ways? Maybe using a framework etc.?
Thanks!
It's easier than I thought, there is no need for PHP and MariaDB.
When using nginx, you need uswgi and uswgi-plugin-cgi to let nginx know that the Python script is a script and not data. Point to the Python script in the Ajax parameter of the DataTable JS code, make it executable and print the array with JSON function in the Python script, and include cgi/json header strings. The array should look like that in the example of Datatables Website (Ajax source).
It's all running in the memory now.
Trying to encode/decode base64 within an XML document that is handled within a route in Fusesource ESB.
We are using Blueprint.xml to try to encode/decode, but cannot find a way to do this.
We need our ruote to convert XML data to base64 string to hit an external webservice that requires some binary. We also need to extract some binary coming back from the webservice response and change this into .pdf (or a string first).
Fuse ESB / Apache Camel offers a number of data formats for encoding/decoding
http://camel.apache.org/data-format.html
Though we don't have a Base64 out of the box. So I have logged a ticket to add such a format in a future release: https://issues.apache.org/jira/browse/CAMEL-5807
You can build a custom data format, or use the message translator EIP pattern with a Java bean and do a bit of java code to do the encoding/decoding yourself. http://camel.apache.org/message-translator.html
There is a camel-fop component for outputting to PDF: http://camel.apache.org/fop.html