How to get a value in bootstrapper with wix? - javascript

I'm working on an installer and specifically with the bootstrapper I'm trying to grab a path from a bundle.wxs I have setup. The bundle itself is just a bunch of property variables. In it, I have access to the path I need to get. However, I'm not sure how to get that path from the bundle. I have a localization file that I would ideally call to get the information, inferring that the localization file would be the one accessing the bundle to get the value. Anyone know how to do this nicely? I've attempted to use pre-processed variables to do it, but it hasn't worked so far.
Thanks!

Related

"Failed to Load Resource Error" despite file being in directory

I'm programming a project using HTML and JavaScript. I access my js code with the following script tags:
<script src="js/monthChanger.js"></script>
However, when running my program in Edge & Google Chrame, I keep getting
this error.
Why is this happening? Looking at my file directories there doesn't seem to be anything wrong with the way I declared the function.
check out this article on absolute and relative paths
you probably want this:
<script src="./js/monthChanger.js"></script>
The ./ makes it relative to the current folder.
Alright, so it turns out my issue had nothing to do with HTML.
I didn't specify this in the OP, but I was also using a Django's framework in my project. I had mistakenly assumed that static fields such as css, js, and images would be called the same way they are called in normal html files. However, after reading django's documentation on managing static files, I realize that this is not the case. I follow django's instructions and was able to get my code working.

Make a small HTML application update a JSON file

I want to make a local HTML application read and update a JSON file and use its content to display HTML content. Alas, I'm stuck at the very first step, as I can't seem to setup any sort of test file that simply notices and reads a JSON file. From what I see online, I need to use other libraries. I attempted to use require.js but I can't make it work and the documentation doesn't help me.
I imported the require.js with a tag and attempt to launch something out of what I got from the documentation, but there's nothing to do. It doesn't look like it's willing to take .json files.
requirejs([
'example'
], function(example) {
const config = require('./config.json')
});
My issue is to get the program to read the file. From there I believe I can make the display of it, but this JS thing is all alien to me.
The recommended way would be to run a web server or use something like Electron and build a desktop app (as #chrisG points out in the comments). But if you wanna do this in the browser without an web server you could do something like:
Run Chrome with the --allow-file-access-from-files (or however you allow local file access in your browser of choice)
Put your JSON in a js file and load it (to just do this you don't need the flag, but if you want to use absolute path you'll need it)

How to create a symlink within browserFS

I'm trying to create a symlink inside of BrowserFS.
I can confirm that BrowserFS can read sym links just fine... (I tested by making a zip file and loading it in, and doing fs.readFile and all is A-OK)
However, when I try to create a sym link via fs.symlink, I get an Error, I assume this is meaning it is not supported.
Can any of the folks out there that may use browserFS know how to propertly create, or any workarounds for creating symlinks?
One idea is to create the contents of a symlink and set file modes, but I had a hard time finding the exact way to do that. Any help appreciated!
I've included a codesandbox in case anyone is interested! https://codesandbox.io/s/43wroyjy9w

Can you change the output location for the Randori generated html files?

I'm creating a new project and I want to customize the location of the generated files from Randori. How can I do this?
Check out Lesson-02: Creating an Initial HTML file & Run Configuration
From here you will see how to edit your Randori configuration. You can make the generated output anything you want. However just make sure to update your main html file and point to the correct (customized) generated folder.
One more point on this when you call the launch() method of RandoriBootstrap, you can pass two arguments. The first is whether you want debug mode on or off (debug mode does cache busting) the second is the URL that the class loader will use to find your classes. Should you put things in generatedFoo folder, you need to make sure the RandoriBootstrap knows this.

How to access proprietary .js file in Spring MVC?

I am newby in Spring, but have a task, and I am learning on the fly.
I used Roo to generates for me part of the code, but now I have to make some dynamic list binding, which is done with form, popping-up in new window, and when the submit button is pushed I have to insert the new values in the parent window.
For the purpose I wrote a .js file, which hooks the values to the parent DOM tree, but the point is that I can't configure Spring to deliver the required .js file to the browser.
The browser, doesn't recognize my function. Even when I try to access the .js file via the browser, I receive error that the file couldn't not be found.
I've tried to configure the web.xml, but it didn't work...
Any ideas, how I can configure the access to a .js file in a Spring MVC application?
Thanks a lot!
P.S. Respectively, I'll need to grant access for a static .htm(l) file... I suppose the principle for configuration of the access of static html files is the same..., right?
You just need to get the path to the file right. Assuming you have a Maven-like set-up (I assume you do because you're using Roo), then your script belongs under src/main/webapp - probably in something like a scripts folder.
Let's assume that your file is at src/main/webapp/scripts/myscript.js
You can create a URL reference for your script by adding the following Spring tag:
<spring:url value="/scripts/myscript.js" var="script_url"/>
This should give you the right path to your script, regardless of the context in which you later decide to publish your webapp.
After that, it's just a matter of using that reference:
<script type="text/javascript" src="${script_url}"></script>

Categories