How to create an application Node.js in bluemix - json

I built my workspace so I have the JSON file and I want to create an application like the example of the car dashboard. I don't want to waste time to write HTML and CSS code so I want to use the code of the car dashboard example and just change the JSON file. How can I do so?

If you mean the Car Dashboard example here, you could follow the instructions on deploying the app (there are some listed), then change the car_workshop.json file and then use the Import Workspace to upload your version of the file.

Related

How to deploy newer version of library and new static code to all users?

I currently have a spreadsheet template that is copied and renamed for each new client. The template contains its own code and html files. It also references a library. I do not have a good understanding of the deployment process.
I currently have a test and prod version of the library. I make changes to the test and then copy them to the prod when ready to publish to the company. I can always be sure that everyone is using the proper prod version.
This is not the same for the code and html resident with the named spreadsheet. This code is static from when the file was copied.
I want to be able to update the library and local code dynamically through the DEPLOY process. Is this achievable? Should the library code be "included" directly into the template rather than being "referenced"? (If yes, How?)

Opening certain files in certain folders in a HTML page

I am trying to learn a bit about web technologies therefore I am trying to create a catalogue for my files.
The situation is the following:
I have a folder with N sub folders;
in each of there sub folders there is an image with always the same name (ie: image.jpg)
in each of there sub folders there is also a certain swg file with always the same name (ie: test.swg)
I would like to create an HTML file which read all the sub folders and create a preview using image.jpg, and when one clicks on the preview test.swg should be launched (not in the browser if possible)
The HTML files should contains all these preview like a catalogue.
How can I do this? should I have a local web server which runs in my machine? is it possible to do this with non web page technologies?
Thank you!
As far as i know Javascript & HTML doesn't have access to the filesystem as it's running on your browser and shouldn't be possible to go through the files iteratively because it would be some kind of breach in security.
If you ask me it's possible or not without a server, it should be possible but it is going to use other technology, for example:
Using a Command Line Interface in Linux or Windows based os you could write a shell script that iteratively will go through the files and folder path, and possibly create a JSON from it. From there the javascript could technically load that file like below.
<script type="text/javascript" src="data.json"></script>
<script type="text/javascript" src="javascript.js"></script>
But do note that you should periodically run the shell script periodically with something like scheduler or refresh it manually.
If you want to do it the normal way you could use many different server side language, for example NodeJs, or PHP as I think both of them require only little configuration.
You could post follow up question if you've decided on which language you want to use.
Below is some reference that you can use to start working on reading the directories
NodeJS
Node.js fs.readdir recursive directory search
Get all files recursively in directories NodejS
PHP
List all the files and folders in a Directory with PHP recursive function
How to recursively iterate through files in PHP?
After reading the directories & Files you just need to pass the data to the "rendering" part, and use some javascript to invoke the .swg when the image is clicked
But I'm not really sure about the .swg file can be invoked to the desktop app directly or not you could do some research on it
Open online file with desktop applications?

Nuxt Content and JSON file automatically retrieved from API

I'm integration nuxtjs/content (https://content.nuxtjs.org/writing) for my contents. But I would like to have the json file generated from responses from my API.
How I can create a command to retrieve, maybe thought cron, the contents and save it in content/ folder?
You could indeed, depending of your hosting solution, have something running every midnight and rebuilding your app. Where you could run some Node.js script to create files in the given directories before it is handled by nuxt/content.
An example of code can be found here: https://stackoverflow.com/a/67689890/8816585

Filling Firestore document with data programmatically

I already have some lists of data stored on my computer, and I want to upload them to my firestore database programmatically, without having to enter them one by one.
Have already seen some articles but none of them really worked for me.
***Note that I want to import the Initial Data that is not going to change over time, and the answer below is perfectly solving that.
I have about 100K documents to import, so programmatical upload was very crucial.
For webapp NodeJS project you can do following steps:
1) Visit https://console.firebase.google.com/project/YOUR_PROJECT_ID/settings/serviceaccounts/adminsdk and download .json file which authorizes your Firebase Admin SDK.
2) Upgrade your Firestore to Blaze plan (pay as you go) as free version doesn't support importing data. You can manage/limit your spending here.
3) Paste the code you see in the page from step 1 to your .js file and use admin to import data like this:
admin
.firestore()
.collection("NAME_OF_YOUR_ORGANIZATION")
.add({key: 'value', key2: 'value2'})
If you want to edit an existing document, you can do it like this:
admin
.firestore()
.collection("NAME_OF_YOUR_ORGANIZATION")
.doc("UID_OF_EXISTING_DOCUMENT")
.set({key: 'value', key2: 'value2'})
I suggest you to checkout the Admin SDK documentation.

Is it possible to save data to a json file on local disk using $resource.save without using any server side implementation?

I am trying to build an Employement Management App in AngularJS where a basic operation is adding an employee.
I am displaying details using a service and getting Json data from the mock json file i am using.
Similarly, can i add form data to a textfile on the harddisk.
I have seen it done in a tutorial using $resource.save.
If at all it is possible without any server side code please share the example,it would be helpful.
Thanks.
You can make use of HTML5 local browser storage, as this does not require folder access. Mode datails here http://diveintohtml5.info/storage.html
AngularJS has modules for local storage which you can use to access such storages like this https://github.com/grevory/angular-local-storage