Notes About Our Praxis Here Concerning Linux Lite Diamond 4.x

When it comes to Linux Lite I never forget the mission statement of the development team; in fact, everything I get involved with concerning Linux Lite is to show how easily users can utilize the wonderful applications in the default OS to create unique implementations for their specific computing needs. I am not a developer but it is always enjoyable for me to discover new ways to utilize Linux Lite. It is true that there is no guarantee that the AplhaVantage API will be around for any length of time considering the history of such free financial data APIs. Once we had both Yahoo and Google finance to work with. Still the starting point I am using made sense to me; simple BASH scripting, and now an .html interface. The very nature of the process to access a free API that provides financial market data demands a prerequisite flexibility in the BASH scripting itself, and in the particular coding of any implemented GUI controls. We could hardly call it user friendly if changes to both the scripts and the interface were not easily accomplished by the user. In my opinion this disqualifies standard GTK and Glade or even YAD/Zenity interfaces for this particular job, and eliminates nodejs as well, as users are unlikely to be able to customize and make changes to the interface easily. Fortunately the Linux Lite XFCE DE has integrated Firefox and Thunar (correctly in my opinion) in such a way that we are able to run BASH scripts from a hyper-link in an .html page. Html fits very nicely to the need for a flexible editable interface, and the Firefox integration in Linux Lite 4.x XFCE DE can allow for viewing a script, editing a script, and then running a script from a hyper-link on an .html page.

(*I am not going to remark on why this is NOT a real security issue for Debian DE, or for Linux Lite 4.x running Firefox, other than to say I would never recommend an unsafe praxis to Linux Lite users, and the method described here is secure.)

1) Building an .html Interface

Linux Lite Diamond 4.x series comes with all the software you will need to build an interface: LibreOffice Writer Web, LibreOffice Draw, Screenshot Tool, & Shotwell. Below is an image of the interface I built to interact with my API data, and data accessing BASH scripts. (see image below) I have covered simple .html page building in another tutorial (see link below) so I will not cover the same ground again. *One important thing to remember is you cannot click on a .html file in the thunar file manager and select >open with LibreOffice Writer as this call will not open the .html editor in LibreOffice. You must open LibreOffice Writer from the main XFCE whisker menu, then close the empty document that appears, then select >File >New >HTML Document, from the general LO menu. Later on when you want to reload your .html document to the editor you must first open a new .html document in this fashion, and then from >File in the running editor select >Open and browse to your .html document and load it for further editing.

Building A Web Page With LibreOffice

If you have not been following my previous tutorials on this subject you should probably read through them before continuing (see links below) as there is decent information concerning writing and making BASH scripts executable, the file structure we intend to use, and connecting to the AlphaVantage API. Note that I am assuming at this point you already have wget, gnuplot, fim, and optionally figlet installed. I will not cover that information in this tutorial.

Tutorial 1

Tutorial 2

Tutorial 3

2) Checking A Script’s Functionality

First check to see that your script is executable, and that Thunar can execute scripts. If you have already created the usefim.sh script, right click on it in Thunar and you should see the menu in the window pictured below. (see image below)

Next open up Firefox and open up the preferences window. For the content type: shell script, select the protocol: Always ask. (see image below)

You can now safely set up hyper-links on the buttons of your .html interface to your various shell scripts. Because it is necessary in this instance to also be able to open and edit them from a text editor you should use the “Always ask” setting. It will open a dialogue window in Firefox from which you will have the option to run a script or open it with text editor. When you select Thunar from the dialogue window the script will run if it is executable from Thunar. When you select Text Editor from the dialogue window the script will open in a text editor where you can edit it. (see image below)

3) Setting Up Hyper-links

Now you will need to set up a hyper-link in your interface that links to your script. If you already have the usefim.sh script it is a simple candidate for the this test. Open up LibreOffice Writer. Close the empty document that appears. From >File in the main LibreOffice menu select >New >HTML document. From >Insert in the top window menu bar of the .html editor select >Image from the drop down menu. Insert a button image into the document. Right click on the image and select >Anchor >As character. Right click on the image again and select >Properties>Hyperlink. (see images below) Use browse to locate your usefim.sh script file. Click OK when the full file path appears. Save the whole page as scriptest.html or whatever name you want. Next select >File>Preview in Web browser and when the page opens click on your link button. The Firefox dialogue window should appear like the image above. If you choose thunar the script will run and a fim window will open with all your previous charts.

(*This method is for Linux Lite 4.x 64bit and the current version of Firefox. I haven’t tested it on the 3.x series. This will not work for Debian. In Debian you will need dconf editor to allow script execution from whatever file manager you use, or run gnome-commander file manager. In Ubuntu, as far as I know since 16.04, you will probably need to rewrite the default apps configuration files, and reload mime type defaults, basically an annoying subject for another tutorial.)

4) Setting Up From The Free Download

The purpose of this tutorial is to show users how create hyper-links that can run BASH script files, and how to configure Firefox and Thunar, so that they can use an .html interface to work with the AlphaVantage API data provider. Previous tutorials explain building a simple .html page, and provide enough scripting information for users to create the scripts. You will need to have installed wget, gnuplot, fim, and figlet for every feature to work. What I have done now is to make available a download on my website that includes the scripts, images, the .html interface page itself, the folder structure the application uses, as well as a complete script of all the functions that runs from a terminal and uses fim for graphics, and figlet for messages. If you choose to download it, extract it in downloads and copy all the files and folders to an empty folder ~/litemarkets2. You will have to edit all the scripts and substitute your user name for trinidad, and add your API key to replace XXX in the wget script at apikey=XXX. You will also have to open the .html interface file in LibreOffice Writer Web and confirm the file path replacing trinidad with your user name for all the local links. Just go through them one button at a time and save the page when done. You will not have to edit the links in column three of the interface as they are all Web URLs. Before you run the application the first time open the temp, daily, weekly, monthly, and lists folders and delete the example files which are only there for .zip folder recognition purposes. A blank default button and a test script button are included in the images folder, for use in later modifications, as well as sample charts in the da, we, and mo folders, and icons for the Linux Lite whisker menu. If you edit correctly everything should work fine from the interface. The download contains a read_me_help file which can be read from the interface in .html format or opened in a text editor. I suggest reading it after you extract the download.

Below are some images of what your file structure should look like after extraction and copying to an empty ~/litemarkets2 folder which you must do to match the file structure in the scripts and interface links. (see images below)

This one is what’s inside the chartstorage folder.

Again please read the read_me_help documentation if you are using the download to correctly configure your interface and scripts before running them.

5) Setting Up The Application Launcher In Linux Lite

What follows now is a simple way to set up a launcher for your interface and scripts in Linux Lite 4.x. (see images below) Open >Menu>Settings>Menu Editor in you Linux Lite whisker menu.

Enter properties like the image below to create a launcher for your interface. Substitute you real user name for mine. The full command is: firefox /home/yourusername/litemarkets2/intfce2.html Two sizes of the icon are included in the images folder of the download.

If you like you can configure a separate launcher for viewing all your charts with a fim window without using the interface.

6) Obtain Your Download

The download link is below. Select Linux Lite Interface & Scripts For the AlphaVantage API from the menu and save the .zip file to downloads. Extract the .zip file in downloads. Open the llmkts2 folder there and copy all the files and folders and paste to an empty ~/litemarkets2 folder. Do not just copy and paste the llmkts2 folder to ~/litemarkets2 folder as this will not fit the file tree of the scripts. Read the Read_Me_Help file and follow the instructions to configure your interface and scripts.

https://www.dbts-analytics.com/tcdwnlds/tutdwnlds.html

Below is a link to a demonstration video.

Demonstration Video


RETURN to Cruz Analytics