Extract .xsn extension files using JavaScript - javascript

Is it possible to extract .xsn extension file in Node.JS
I am using electron to convert InfoPath forms into html templates, but I got stuck at phase one.
I tried using extract-zip, ZipJS libraries, but their mainly focused on ZIP files. Renaming the .xsn extension to .zip did not solve anything.

The Infopath *.xsn files are cabinet files (CAB). An archived MSDN blog post has a script but that depends on the extract.exe utility and thus requires windows.
https://learn.microsoft.com/en-us/archive/blogs/infopath/modifying-infopath-manifest-xsf-file-from-script-25

Related

Eclipse for PHP Developers - Javascript Content Assist and Tasks Not Working

I'm using Eclipse IDE for PHP Developers Version 2020-03 (4.15.0) on Windows 10 Home, 64-bit.
When I create a JavaScript project (or create a PHP project and convert it to a JavaScript project) and edit a .js file or type JavaScript code between tags in an .html file, Content Assist is not giving any suggestions for built-in JavaScript objects or methods, and task tags (like TODO) are not showing in the Tasks view.
Content Assist will suggest functions, variables, objects, and methods created in whatever .js file is currently being edited, but it won't suggest any built-in JavaScript objects or methods unless they've already been used in the file (in which case it treats them as user-defined). ECMAScript Built-In Library, JavaScript Web Project Support, and ECMA 3 Browser Support Library are all included in the project's JavaScript Include Path. I can expand the Libraries under "JavaScript Resources" in the project tree and double-click on any of the entries to open the .js files that contain the definitions for the built-in objects and methods, but Content Assist doesn't suggest any of them when I type and press ctrl+space.
The Tasks view shows task tags in .php, .css, and .html files, but not in .js files. If I add a task tag in a .js file (like "/TODO Fix this/") the tag is highlighted correctly (syntax highlighting in .js files works), but it doesn't register as a task (the task icon doesn't appear in the gutter to the left of the line number the way it does in .html, .css, and .php files).
I've been searching for solutions for hours but everything I find either doesn't work, says to change a setting that's already set correctly, or doesn't apply to this version of Eclipse.
I tried using an older version of Eclipse (Oxygen.3a) and it does exactly the same thing, so I'm assuming I'm doing something wrong?
EDIT: Some answers for older versions of Eclipse that I wasn't able to find on my own showed up after I posted this (such as Eclipse: Content Assist not showing suggestions). I tried downloading an even older version of Eclipse, Mars.2, and everything is working correctly in that version. Are the issues in Eclipse 2020.3 just "bugs"?

Can Gatsby/GraphQL leverage javascript files?

I'm porting over my site from a different site framework to Gatsby. I am currently importing my old site and sourcing the files using gatsby-source-filesystem however this only gives me information about the files versus the contents. I've ran into some transformers for the markdown files as part of my exploration, but I want to know if there's anyway to leverage my javascript (.js) and handlebars (.hbs) files to obtain the objects within them and possibly output them onto a page.

Programmatically drive Excel files

The Problem
There are a bunch of excel files (complicated models hobbled together) that change a lot. A lot of different people use these files to produce reports, but don't download the latest versions so the reports are wrong.
My First Idea
Make a web app and allow users to interact with the master form via a website. But I can't find any JavaScript libraries that can drive Excel file (run the functions).
Next Idea
Use python in the background. I looked at xlwings and win32com Python libraries but it seems they just interact with the actual Excel program and not xlsx files.
Questions
Is there a way to drive excel files using a web interface?
Is there a better way to solve the main problem of people using disparate files?

How to reference a TypeScript file from a web page

Preamble
I can get this to work but I'm not sure I'm using the technology as Microsoft intended.
Context
A web page can refer to a JS file containing JavaScript by means of a reference tag like this:
<script src="Scripts/jquery.js"></script>
In the above example, the JS file is part of a Visual Studio ASPX.NET project. It was both placed in the project Scripts folder and added to the project by Nuget.
Having added a Typescript file to an existing ASP.NET project, I would like to use the generated JS from an ASPX web page.
Instructing Solution Explorer to show all files reveals that the expected JS file has indeed been generated on the expected path.
Am I using this correctly? What is the recommended method?
There are a couple of ways one might go about things.
Refer directly to the generated JS file
I was concerned that files not part of a project would be excluded from a web server deployment, but have since determined that they are deployed.
Add some kind of reference to the Typescript file
It would be great if there were some syntax for a reference to the TS file that will be transformed into a script tag referring to the generated JS file. Alas, if this exists it's not very well publicised.
In VS2015, dragging the TS file onto an HTML or ASPX page in the editor will insert a link tag referring to the corresponding JS file.
DO NOT use server URL rewriting to remap references to the TS file to the JS file. This interferes with VS and browser debug support via source map files.

How to use PDF.js to load file included in web app (not from "file:" URL?

I want to be able to show PDF files within my Chrome app using PDF.js but the documentation is non-existent. I've been unable to find any simple examples or tutorials that show the code to load a PDF from a relative URL, show the page, and navigate through the PDF. They have very complex examples where 95% of the code does other things and it's very difficult to parse these and find the relevant functions. I would like to:
Include the relevant code in my app (is this the "pdf.js" created by "node make generic" and nothing else? Or do i need to include other JS files as well?)
Be able to show PDF files that are inside my myapp.crx file
Does pdf.js require "LocalStorage"? Will localStorage continue to be allowed in Chrome extensions/apps or is it deprecated?
Can someone tell me if #2 is possible and how to find some example code or documentation on the proper classes/functions to call and files to include/build?
node make generic outputs to the build/generic directory. This directory contains two subdirectories, "build" and "web".
"build" contains "pdf.js", which is the actual PDF engine.
"web" contains a viewer, similar to the one at http://mozilla.github.io/pdf.js/web/viewer.html.
After copying both of those previous directories to your app, you should be able to load the PDF file using chrome.extensi/web/viewer.html?file=path%2Fto%3Ffile.pdf
PDF.js does not require localStorage.It's used if available for persisting settings such as scroll position, but if unavailable, PDF.just continues to work without it.
There is one significant issue though: PDF.js loads the localization files using synchronous XMLHttpRequest. This is not allowed in a Chrome app. You could solve this issue by serializing all files in the locales, put it in a single JavaScript file, load this in viewer.html, and simplify l10n.js to read the translations from the file I just described.
Just to clarify: normally you should be able to access a file baked into your CRX by providing a relative or absolute path to it within the CRX's internal directory structure, e.g.:
'myfiles/pdfs/example.pdf'
With PDF.js, I guess that's what "path-to-file.pdf" should be in Rob's answer above, verbatim.

Categories