Showing posts with label LibreOffice. Show all posts
Showing posts with label LibreOffice. Show all posts
Tuesday, July 11, 2017
--- Graphics ---
2016
One of my more frustrating programming episodes occurred with one of OpenOffices updates. I tried to install the new version and it wouldn't install. The suggestion on the user forum was to uninstall the older version and then try to install the new version. The new install still didn't work so I had no working version of OpenOffice and a lot of work on DANSYS that I had not saved. Dumb of me - irritating of OpenOffice. That was when I decided to junk OpenOffice and switch to LibreOffice.
The biggest loss was a set of programs I had put a lot of work into that expanded the ability of OpenOffice Calc to produce statistical graphs. They constituted a graph building suite. Instead of creating a set of predesigned graphs (as with the charts currently produced by Calc), I could build graphs from elements such as axes, points, lines, and such. I decided to ditch the idea. I just didn't have the heart to redo all that work, and I had other programs that would produce all the statistical graphs I would ever need.
But then I started thinking (often a big mistake, but one that often leads to adventure) that it would be nice to have DANSYSX be able to generate some simple graphics. Points and lines and such are useful for a lot more than making statistical graphs.
One limitation of spreadsheet functions is that they can only output data into cells, so I couldn't use functions to generate geometrical objects on a spreadsheet. I would have to use subroutines, and thus commands, to do the job, and that meant creating a menu of graphical commands.
I also wanted to be able to translate the positions of the geometrical objects into a specified area - a frame. I had done that with the OpenOffice commands, so I should be able to do it again for LibreOffice.
This is a different kind of programming than creating a function to output a value or matrix of values. I had to actually place objects on a spreadsheet. That meant that I had to have the program determine where everything had to go and place it there. LibreOffice Basic can do that and I'll show you the frame routine. You can find the others in the Graphics folder of the DANSYSX macros.
One thing I remember doing over and over in the older programs was translating data points from one range (the range of data values) to another (the range of positions on a frame on a spreadsheet). That got old, so, this time I created a very simple function to do that. It looks like this:
Function Rescale(c,a,b,y,z)
'Rescales a value, c, between a and b to be proportionally
'between y and z)
Rescale=(c-a)*(z-y)/(b-a)+y
End Function
That was easy and, if you went through the article, DANSYSX: Complex cubic equations, you know what that all means.
The way I had the older macros work is that the user would create a specification form on a spreadsheet for a specific object, fill it out, process the specifications, and then display the object on the spreadsheet. I've trimmed this four step process down in DANSYSX except for the frame. You still have to process the specifications for the frame. A frame has to be generated (whether it's displayed or not) so LibreOffice knows where to place the graphics object.
The Specification routine is tedious (there's a lot of information required to specify the frame) but straightforward. A frame is just a rectangle. Draw a rectangle and you have a frame that you can situate everything else on.
The only complication is that I need different specifications according to the kind of background to have on the frame, so I had to work up a dialog to select the kind of background before printing the specification form.
Here is the specification routine:
SUB FrameSpec()
'Prints out a frame specification form onto a spreadsheet
'beginning at the current cell.
DIM I AS INTEGER, J AS INTEGER
DIM RP, CP, DLG AS OBJECT, STL AS INTEGER, LBX AS OBJECT
DIM oDoc AS OBJECT, oSheet AS OBJECT, oSel AS OBJECT
DIM addr AS OBJECT, M AS INTEGER, N AS INTEGER
DIM oCell AS OBJECT, oView AS OBJECT
'Display dialog Frame
DialogLibraries.LoadLibrary("Standard")
DLG=CreateUnoDialog(DialogLibraries.Standard.Frame)
DLG.Execute()
LBX=DLG.getControl("ListBox1")
STL=LBX.SelectedItemPos
IF DLG.Execute()=0 THEN EXIT SUB
'Print form
oDoc=ThisComponent
oView=ThisComponent.getCurrentController()
oSheet=oView.getActiveSheet()
oSel=oDoc.getCurrentSelection
addr=oSel.getRangeAddress()
m=addr.StartRow
n=addr.StartColumn
oCell=oSheet.getCellByPosition(n,m)
oCell.String="Frame"
oCell=oSheet.getCellByPosition(n,m+1)
oCell.String="Position 1/10 mm"
oCell=oSheet.getCellByPosition(n+1,m+2)
oCell.String="X"
oCell=oSheet.getCellByPosition(n+1,m+3)
oCell.String="Y"
oCell=oSheet.getCellByPosition(n,m+4)
oCell.String="Size 1/10 mm"
oCell=oSheet.getCellByPosition(n+1,m+5)
oCell.String="Width"
oCell=oSheet.getCellByPosition(n+1,m+6)
oCell.String="Height"
oCell=oSheet.getCellByPosition(n,m+7)
oCell.String="Margins: 1/10 mm"
oCell=oSheet.getCellByPosition(n+1,m+8)
oCell.String="Top"
oCell=oSheet.getCellByPosition(n+1,m+9)
oCell.String="Bottom"
oCell=oSheet.getCellByPosition(n+1,m+10)
oCell.String="Left"
oCell=oSheet.getCellByPosition(n+1,m+11)
oCell.String="Right"
oCell=oSheet.getCellByPosition(n,m+12)
oCell.String="Caption"
oCell=oSheet.getCellByPosition(n+1,m+13)
oCell.String="Top"
oCell=oSheet.getCellByPosition(n+1,m+14)
oCell.String="Bottom"
oCell=oSheet.getCellByPosition(n+1,m+15)
oCell.String="Left"
oCell=oSheet.getCellByPosition(n+1,m+16)
oCell.String="Right"
oCell=oSheet.getCellByPosition(n,m+17)
oCell.String="Transparency: percent"
oCell=oSheet.getCellByPosition(n,m+18)
oCell.String="Border"
oCell=oSheet.getCellByPosition(n+1,m+19)
oCell.String="Line Style: NONE, SOLID, DASH"
oCell=oSheet.getCellByPosition(n+1,m+20)
oCell.String="Line Color: RGB"
oCell=oSheet.getCellByPosition(n+1,m+21)
oCell.String="Line Transparency :percent"
oCell=oSheet.getCellByPosition(n+1,m+22)
oCell.String="Line Width: 1/10 mm"
oCell=oSheet.getCellByPosition(n+1,m+23)
oCell.String="Line Joint: NONE, MIDDLE, BEVEL, MITER, ROUND"
SELECT CASE STL
CASE=0
oCell=oSheet.getCellByPosition(n,m+24)
oCell.String="Background: NONE"
CASE=1
oCell=oSheet.getCellByPosition(n,m+24)
oCell.String="Background: SOLID"
oCell=oSheet.getCellByPosition(n+1,m+25)
oCell.String="Red"
oCell=oSheet.getCellByPosition(n+1,m+26)
oCell.String="Green"
oCell=oSheet.getCellByPosition(n+1,m+27)
oCell.String="Blue"
CASE=2
oCell=oSheet.getCellByPosition(n,m+24)
oCell.String="Background: HATCH"
oCell=oSheet.getCellByPosition(n+1,m+25)
oCell.String="Style: SINGLE, DOUBLE, TRIPLE"
oCell=oSheet.getCellByPosition(n+1,m+26)
oCell.String="Color: RGB"
oCell=oSheet.getCellByPosition(n+1,m+27)
oCell.String="Distance: 1/100 mm"
oCell=oSheet.getCellByPosition(n+1,m+28)
oCell.String="Angle: 1/10 degree"
CASE=3
oCell=oSheet.getCellByPosition(n,m+24)
oCell.String="Bitmap - Named"
oCell=oSheet.getCellByPosition(n+1,m+25)
oCell.String="Name"
oCell=oSheet.getCellByPosition(n+1,m+26)
oCell.String="Style: REPEAT, STRETCH, NO_REPEAT"
CASE=4
oCell=oSheet.getCellByPosition(n,m+24)
oCell.String="Bitmap - URL"
oCell=oSheet.getCellByPosition(n+1,m+25)
oCell.String="URL"
CASE=5
oCell=oSheet.getCellByPosition(n,m+24)
oCell.String="Gradient - Named"
oCell=oSheet.getCellByPosition(n+1,m+25)
oCell.String="Name"
CASE=6
oCell=oSheet.getCellByPosition(n,m+24)
oCell.String="Gradient - Custom"
oCell=oSheet.getCellByPosition(n+1,m+25)
oCell.String="Style: LINEAR, AXIAL, RADIAL, ELLIPTICAL, SQUARE, RECT"
oCell=oSheet.getCellByPosition(n+1,m+26)
oCell.String="Start Color: RGB"
oCell=oSheet.getCellByPosition(n+1,m+27)
oCell.String="End Color: RGB"
oCell=oSheet.getCellByPosition(n+1,m+28)
oCell.String="Angle: 1/10 degree"
oCell=oSheet.getCellByPosition(n+1,m+29)
oCell.String="X Offset: 1/10 mm"
oCell=oSheet.getCellByPosition(n+1,m+30)
oCell.String="Y Offset: 1/10 mm"
oCell=oSheet.getCellByPosition(n+1,m+31)
oCell.String="Start Intensity: percent"
oCell=oSheet.getCellByPosition(n+1,m+32)
oCell.String="End Intensity: percent"
oCell=oSheet.getCellByPosition(n+1,m+33)
oCell.String="Step Count: number of color graduations"
END SELECT
It's long but fairly simple. It does illustrate how you can get things from a program onto a spreadsheet, though. Let's look at the sections.
Variables can be set to hold things like documents, sheets, cells, ranges, shapes, and such but they have to be declared as objects. This program uses several object variables.
DialogLibraries.LoadLibrary("Standard")
DLG=CreateUnoDialog(DialogLibraries.Standard.Frame)
DLG.Execute()
LBX=DLG.getControl("ListBox1")
STL=LBX.SelectedItemPos
IF DLG.Execute()=0 THEN EXIT SUB
This section displays the dialog that has the list box of styles for backgrounds. I constructed the dialog in the dialog editor (Select Macro>Organizer>Dialogs tab) with a listbox (I specified the items in the listbox in the properties settings for the listbox.), a Okay button, and a Cancel button. Here's what the dialog editor looked like:
"DialogLibraries.LoadLibrary("Standard")" loads the library that contains the Frame dialog.
"DLG=CreateUnoDialog(DialogLibraries.Standard.Frame)" sets the DLG object variable to contain the Frame dialog.
"DLG.Execute()" displays the dialog. As long as the dialog is displayed and working, nothing else runs in Calc.
"LBX=DLG.getControl("ListBox1")" loads the listbox1 control into object variable LBX and "STL=LBX.SelectedItemPos" gets the selected text string from the listbox1.
"IF DLG.Execute()=0 THEN EXIT SUB" specifies that, if the Cancel button is clicked (which generates a 0 from the DLG object), that the subroutine is closed without doing anything.
oDoc=ThisComponent
oView=ThisComponent.getCurrentController()
oSheet=oView.getActiveSheet()
oSel=oDoc.getCurrentSelection
addr=oSel.getRangeAddress()
m=addr.StartRow
n=addr.StartColumn
The oDoc variable is set to contain the document that is currently open (DANSYSX)
The oView variable is set to contain the current documents view.
The oSheet variable is set to contain the currently active sheet in the view of the document.
The oSel variable is set to contain the currently active range (in this case, just one cell, the top left cell intended to start the Frame form.)
The addr variable contains the address structure of oSel. It contains the starting and ending cell row and columns as a data structure.
Data structures are addressed by the name of the data structure (in this case addr) followed by a period and the name of the specific value to be accessed. For instance, addr.StartRow returns the value of the StartRow value in addr. The integer variable m is set to the StartRow value and the integer variable n is set to the StartColumn value.
The rest of the subroutine is just a long list of statement of the form:
oCell=oSheet.getCellByPosition(n,m)
oCell.String="Frame"
Here, the oCell variable is set to the cell at column n and row m on the currently active sheet. Notice that cell positions are opposite to matrix positions. Matrix positions are addressed by (row,column); cell positions are addresses by (column, row) order. This is in keeping with the way cells are addressed on spreadsheets. A cell at position C5 is at column C and row 5. It's also not obvious here, but the first row on a spreadsheet is row 0, and the first column is column 0.
I use a Select Case structure to decide the labels to output onto the spreadsheet according to which background style is chosen. The Select Case structure works like this:
SELECT CASE (statement)
CASE (value)
CASE (value)
...
CASE (value)
END SELECT
The statement in the first line specifies what the following case values refer to. In this example, the case is the value of STL, the numerical position of the selected style in the dropdown list of the dialog. The first CASE statement is CASE 0, which is the value of the first item, NONE, in the list. If STL=0, the block of statements following CASE 0 is executed and, then, the other case statements are ignored. END SELECT marks the end of the Select Case structure. Notice that the Case values can be numerical or string values, inequalities like >5 or <=3, or statements like "between 2 and 5".
When this routine is run from the Graphics menu>FrameSpec, a form is printed onto the active spreadsheet beginning at the selected cell. This form can be filled in to specify a frame for other graphic objects.
Saving all this information so that it doesn't go away between sessions requires that I construct a hidden spreadsheet to save it on. You can see that by unhiding the Graphics sheet in DANSYSX. Right click on any sheet tab and select the Show Sheet... command. It will open a list of hidden sheet. Double click Graphics. Be careful and don't change anything. You'll the information generated by the FrameSpec command in the top part of the sheet. Below that, though, are several calculated value. These are values necessary to scale values to the frame, taking margin specifications into account.
The FrameGen command transfers information from the frame table to the FrameSpec sheet. It uses much of the same Basic and Uno commands but there are two sheets to deal with, the sheet the table is on and the FrameSpec sheet. You will recognize most of the code if you look at it.
This pattern is repeated a lot.
oCell=oSheet.getCellByPosition(n1+1,m1+0)
aCell=aSheet.getCellByPosition(1,0)
aCell.Value=oCell.Value
That, of course, transfers the information from the first column to the right and top row of the frame table to the first column and top row of the Frame Spec sheet. These lines are quite simple but tedious to write. Luckily, there is a lot of cut, paste, and modification going on.
There is an interesting little subroutine tagged onto the end that parses out a string of color specifications. Here, color is specified by three numbers from 0 to 225 specifying how much red, green, or blue is used to create the color desired. The subroutine is called using the statement:
GOSUB FG10
The cell containing the string is first specified as aCell. The subroutine has to come after the last line of the main subroutine:
EXIT SUB
and it must begin with the calling label. Here is the subroutine:
FG10: 'RGB subroutine. Sets R, G, and B.
RGBSTR=aCell.String
Clr=""
S=1
FOR I=1 TO LEN(RGBStr)
Clr=Clr & MID(RGBStr,I,1)
IF MID(RGBStr,I,1)="," OR I=LEN(RGBStr) THEN
IF S=1 THEN
R=Val(Clr)
ELSEIF S=2 THEN
G=Val(Clr)
ELSE
B=Val(Clr)
END IF
S=S+1
Clr=""
END IF
NEXT I
RETURN
END SUB
The string in aCell is transferred into the RGBStr variable and the following loop structure takes the string apart, converting the parts between the commas into numerical values stored in the R, G, and B variables. The last line of the subroutine is RETURN, which switches processing back to the line immediately following the last GOSUB statement. Finally, the whole macro is closed out using the END SUB statement.
More than one subroutine with different line labels can be placed at the end of a macro, but they all have to come before the END SUB or END FUNCTION statement.
The FrameShow command acually places the graphics frame on the spreadsheet. It is just a drawn rectangle and the LibreOffice Basic Programmer's Guide very adequately explains how to code for various drawn shapes and I will direct you to that since there are a lot of possibilities, but I will point out a few things that it doesn't make terribly clear.
First, every spreadsheet has it's own drawing page. In Draw and Impress, this is pretty explicit, but not for Calc. The way the drawing page for the active sheet is specified is:
oSheet = aDoc.getcurrentcontroller.activesheet
DPAGE=oSheet.DrawPage
The first line defines the active sheet and loads it into an object variable (oSheet). The second loads the drawing page of oSheet into another object variable called DPAGE. Later, the frame, which is a rectangle stored in the object variable oRect, is placed on the drawing page by the following line:
DPAGE.add(oRect)
The frame is built up by sequentially adding the frame and all the specified captions (which are rectangles with text) with similar commands.
Other commands to create points, lines, ellipses, and boxes will be very similar. They will all be in the Graphics folder of the DANSYSX macro library.
Labels:
Calc,
computer,
DANSYS,
DANSYSX,
dialog,
Draw,
draw page,
frame,
generalities,
graphics,
LibreOffice,
programming
Wednesday, June 28, 2017
--- Structuring programs ---
2016
My big project is a software package programmed into Calc, the LibreOffice spreadsheet component. The strength of this approach is that the statistics package already has all the utilities of a powerful spreadsheet. I call it DANSYS - the Data ANalysis System.
I'll be using DANSYS to talk about how to program in LibreOffice Basic. The manual, available at the LibreOffice website, is useful but there's a lot it doesn't explain how to do, and I've picked up a lot of tricks and workarounds over time. I'm working on an expanded version of DANSYS and I'll take you along on the journey.
I had to decide whether I wanted to just keep expanding DANSYS or make two versions: a basic version that does the most common statistical procedures and the expanded version that's much bigger and clunkier but will do many, many more cool things. I decided to go with the two version plan and both will be available on my other website (http://www.theriantimeline.com/excursions/labbooks) as I develop them. Currently, DANSYS and a statistics decision tree and glossary are available. I'm working on a user's manual for DANSYS and you'll see my progress on DANSYSX here.
Programming is a lot easier if you take a structured approach. Some languages (like Python) requires you to structure your programs. Others, like modern BASIC make it easy to structure programs but do not require it. Structured programming uses indentation to indicate levels of code (that will become much clearer as we go along). It also helps if you add notes to your code as you go along. This documentation serves two big functions: it reminds you what sections of code do if you need to go back and modify the code (which you often will), and it allows other people who use your code to understand what you've done.
I will admit that I sometimes slack off when it comes to documentation, but I will try to be responsible with the code in DANSYSX.
I try to maintain a five section structure for my LibreOffice Basic programs. The first section is the header. The first line of LibreOffice Baisc code names the program, tells whether the program is a subroutine or a function, and passes all the necessary information into the program.
The second section defines all the variables I'll be using in the program using DIM (DIMension) statements. I usually precede this section with a long comment explaining the program.
The third section initializes whatever variables need to start with some specific value.
The fourth section is where all the good stuff happens. It contains the works of the program.
The fifth and last section formats and outputs the data from the program.
Flow charts are useful to some people to help plan out complicated programs. I tend more to plot the way the program is supposed to work in pseudocode. Pseudocode describes the working of a program in descriptive English, line by line. For instance, if I want to add 1 to the variable bx over and over until it reaches 15, I might describe it with the following pseudocode:
bx=0
When bx reaches 15, jump out of the following loop
Add 1 to bx
Continue looping
More often, I type a scaffold of comments before I even start programming and then fill in the code. A comment in LibreOffice Basic looks like this:
'This is a comment. Notice that it begins with an apostrophe.
'LibreOffice Basic will ignore any statement beginning with an apostrophe.
[Note: If you've tried to use any of the in-text links to the Timeline, you will have found that they don't work anymore. That will be because I've moved it to a more secure site. I keep the links in the link section at the upper right of my webpages updated, and those do work.]
Wednesday, April 26, 2017
--- Using computers ---
2016
Long ago, in the late 60s, my brother was a computer technician in the Air Force. That gave me my first deep exposure to computers because I got to look through his training materials and he got permission to show us around what was then the Southeastern Defense installation. Back then, the Southeastern Defense computer was stored in a three and a half story, air-conditioned block house. The block house was air conditioned because the computer was made of vacuum tubes that would explode in the Southeastern summer if they were not kept cool. The computer could be programmed using assembly language but a lot of work was still done in machine code - all 1s and 0s.
Later, in the seventies, I took computer courses at Auburn University and even programmed as a work study student using strange languages like APL, PL-1, FORTRAN, and (Yuck!) COBOL. The computer I used was scattered across the campus. I programmed using punch cards (look it up!) but there was a new medium - paper tape that could be punched and kept in a roll until the code was compiled. A favorite program for up and coming programmers was a few lines that would make the tape punching machine spit out a prodigious pile of paper tape before an administrator could shut it off.
Back then, I would punch lines of code on paper card and carry the deck over to the computer department where I would wait a couple of days until they compiled the code. Hopefully the printout would say what I wanted it to say instead of ERROR.
In the 80s, I worked for Radio Shack and sold TRS-80 personal computers and Color Computers. My first personal computer was a 256K (that's a whopping 256 kilobytes of random access memory) Color Computer with a printer and, for external storage, a tape recorder. There were modules available that could be plugged into the side of the computer. I had an early spreadsheet and (my favorite) a synthesizer that I could program to play four-part harmonies. Some of my original pieces (now available for listening or download on the Therian Timeline) were composed on that computer. 256K - laugh if you want but that computer was more powerful than the Southeastern defense computer my brother worked on. I could program in BASIC!. A new thing at that time was a sorta cool thing called the Internet.
To that point, a computer user was also a computer programmer. Then, user friendly computer programs began coming out and, today, many, if not most computer users have no experience in programming.
When I finally began my professional life in Selma, Alabama, I was equipped with a computer with a few megabytes of RAM, a CRT monitor, and Windows 3.0. I had a job search program which always included Brain Surgeon in the list of possible jobs. I was trying to complete a Masters research project and the work computer couldn't handle my data set. By the time I retired in 2013, I had graduated to a Windows XP machine. I couldn't upgrade further because the program I had built over the 20 years in Selma to process my client information would not work on later versions of Microsoft Office. They had dropped the Visual Basic macro language I was using to program.
I have graduated now to a 581 Gigabyte computer with a Terabyte external hard drive and four CPUs, and a telephone (a telephone, mind you!) with 3.74 gigabytes of RAM and 29.71 gigabytes of internal memory.
And I still get impatient waiting the few minutes it takes for my computer to finish doing what it's doing.
The Yale-New Haven Teacher's Instiute (http://www.yale.edu/ynhti/) has a quaint module called "Computing" from 1981 (That's about the time I was buying my first computer). You might want to read it - it has historical interest.
But, although they used BASIC then, I still use a version of BASIC to program. The Basic that's used as a macro language for OpenOffice and LIbreOffice is both more and less powerful than the BASIC I learned as a first programming language. It's more powerful because it is able to access and manipulate just about all the objects that make up the LibreOffice productivity suite. It's less powerful because the programming part of the language is only a subset of BASIC. For instance, it doesn't have the Data....Read structure that allows BASIC to load tables of data from strings of data contained in the code. I missed that so badly that I ended up programming a couple of functions to do approximately the same thing. "Real" programmers today use languages like Python, C, Java, and Drupal.
Not long ago, a striking shift occurred in the world. Suddenly, paper was not the preferred medium for storage. Before, even with computers, you printed a text and put it on a shelf or in a filing cabinet. Now, people save everything on digital media and, if they want to send something to someone else, they send an electronic file. And there is something called a cloud in which you can save all your stuff on the Internet, in cyberspace.
I often say that my father saw more change in his lifetime than was seen in the entire history of mankind before him. I have seen more change in my lifetime than has been seen in the entire history of mankind before me. My nephew has seen more change in his lifetime than has been seen in the entire history of mankind before him. It's daunting.
When I started to college, students were required to know how to use the greatest portable ever - the (nope, not the graphing calculator) slide rule. Now students have to be effective with a calculator that does logarithms, calculus, and graphs functions. When I started to college, a four function calculator (add, subtract, multiply, and divide) was just coming down to below a hundred dollars. I still like slide rules. They don't require batteries or the sun - but now they're antiques so they cost over a hundred dollars.
Another change.....do you know what an analog computer is? Twenty years ago, analog computers were a thing.
Sunday, April 2, 2017
LibreOffice internal help files
Huzzah! And the crowd goes wild!
LibreOffice has fixed their internal help files. You still have to download the file separately, but it works spectacularly.
I am told by Coyote, who should know being a top rank IP specialist, that many advanced computer people prefer to use online help files for their software, but I have been pining for the ability to punch a button, whether the Internet is connected or not, and look up information about LibreOffice, and especially the Macro language.
Kudos, LibreOffice, and also thanks for quick results of bug reports.
LibreOffice has fixed their internal help files. You still have to download the file separately, but it works spectacularly.
I am told by Coyote, who should know being a top rank IP specialist, that many advanced computer people prefer to use online help files for their software, but I have been pining for the ability to punch a button, whether the Internet is connected or not, and look up information about LibreOffice, and especially the Macro language.
Kudos, LibreOffice, and also thanks for quick results of bug reports.
Thursday, March 16, 2017
--- Open Source and Freeware ---
2016
I use some software that I have bought and I have nothing against commercial software but I will rarely recommend it here.
It is possible to completely equip a computer using free downloads. If you need an operating system, there's Linux and if you need a graphical user interface, there's Ubuntu. For web browsing there are programs like Google Chrome and Firefox. LibreOffice is as good an office suite as Microsoft Office (and sometimes better). There is good freeware for just about anything you want to do and I want you to be able to do the things I write about even if you can't buy software, so I will be talking about freeware and inexpensive software here.
Although there is some commercial software that I have real problems with. When I became a vocational evaluator, I set out to automate my department and, of course, the fact that most office productivity suites have macro languages that allow users to program them to do specific tasks made a good office suite essential. The facility I worked for used Microsoft Office and I was happy with that for many years until they came out with Vista.
With Vista, Microsoft no longer supported their Visual Basic for Applications, which was, of course, the language of my evaluation software. There was no more upgrading for me and I lived in terror that a virus or lightening strike would destroy my computer (Well, not actually "terror". I'm made of sterner stuff than that.)
So, I have had a grudge against Microsoft ever since. My next office productivity suite was OpenOffice, which is a free download, by the way. I was more or less happy with that although it was rather unstable. You could place a number of picture files in a document, close it, and, when you reopen it, all the pictures have gone. Also, large and complex files get crankier and crankier. They tend to crash.
Looking at their forum for help in dealing with idiosyncracies, I ran into regulars who insulted people looking for help and maintained that users should not program macros in spreadsheets (my favorite part of a productivity suite). So, I was less and less happy with OpenOffice until one day I downloaded an upgrade which wouldn't install. When I uninstalled the old version as recommended by the user forum, the new version still wouldn't install, so I no longer had a working office suite and I was in the middle of a complex programming job.
Looking for alternatives, I found that a group of disgruntled programmers split away from OpenOffice when it was bought out by Oracle and they formed LibreOffice.
I was so happy with LibreOffice that I am now going to recommend it.
LibreOffice has retained some of the instablilities of OpenOffice but the people at LibreOffice actively support the software so that much of the glitchiness has been worked out of it. Upgrades occasionally introduce new problems but they tend to be ironed out in the next upgrade. Also, most upgrades are perceptibly upgrades. I can tell that something has been done to improve the program.
The major components of LibreOffice are:
Writer, the word processor
Calc, the spreadsheet
Impress, the presentation editor
Draw, the graphics editor
Base, the database
There is also a mathematics formula editor. Many LibreOffice users also produce extensions for the package.
The primary macro language is LibreOffice's version of Visual Basic which is more powerful than the classical BASIC in that it allows the user to manipulate most of the elements of LibreOffice but it's weaker in that it's a subset of BASIC that has dropped some of the core commands of the BASIC language. For instance, there is no Data....Read structure. I missed that one so much that I programmed a function into DANSYS that would do pretty much the same thing. Otherwise, it's a real pain to load specific values into a matrix from code.
Generally, I enjoy using LibreOffice. It can be obtained from the LibreOffice website: https://www.libreoffice.org
A warning: LibreOffice does not have an offline help file. It has to be downloaded separately at the LibreOffice website. And the last upgrade would not access it. Hopefully the next upgrade will address that. Our Internet is glitchy and I'd like to be able to look at helpfiles when the Web is down.
There's some confusion about open source and freeware. Open source isn't freeware (some of it is and some of it isn't). "Open source" just means that the code for the software is open to the user so they can modify it to suit their needs. "Freeware" means that the software can be downloaded and used for free. There are a variety of licenses that designate what you are legally able to do with any particular program.
Often, it is considered a common courtesy that, if you like a freeware program and will continue to use it, and can afford it, that you make a donation to the creator. Some creators specifically say that they are not after donations. For instance, my statistics package is something I dreamed up for my own use and decided to make available. I don't want donations. If a creator wants donations, they generally make that plain in the description of the product.
My favorite source for freeware programs is SourceForge (https://sourceforge.net).
Labels:
DANSYS,
data...read statement,
donations,
freeware,
generalities,
GUI,
LibreOffice,
LibreOffice Basic,
open source,
operating system,
programs,
software,
SourceForge,
web browsers
Tuesday, March 7, 2017
--- My hub ---
2016
Did I mention that I love spreadsheets?
In addition to ledger type calculations (the "real" purpose of spreadsheets), I like them for layouts (which see my LabBooks as an example) and control documents. In the latter case, I plan to start on a toolbox spreadsheet pretty soon that has things like counters and timers and randomizers. I'll chronicle the development of that in the Mathematics LabBook.
Also, I have a control spreadsheet as a hub for the resources in my computer. I'd make a copy available but I also use it to store personal information. I can tell you a little about it, though.
It's a LibreOffice spreadsheet document. There's a page for each topic such as computer programming, language, social sciences, etc. The first page has links to commonly used general resources and links to each of the other sheets. I also have sheets of links to equipment sources, personal information, personal contacts, project plans, and a keyword index to the Yale - New Haven volumes.
Each sheet has several sections. In the upper right corner are buttons that open programs. These are macro driven. For instance, the button that opens GraphCalc is just a rectangle attached to the following macro:
Sub GraphCalc
Shell("C:\Program Files (x86)\GraphCalc\GrphCalc.exe")
End Sub
I'll go into more depth about programming using LibreOffice's version of BASIC, but this is a simple program and works exactly as I have copied it (as long as GraphCal is installed in the Program Files (x86) directory).
All LibreOffice Basic macros are either subroutines (Subs) or functions. A function returns a value, either to another chunk of code or to a cell or range on the spreadsheet. A subroutine doesn't return a value but does something in the document. This one opens a program. And subroutines need some event to activate them from a spreadsheet, like clicking a drawing (they can also be simply called by other programs.) This small program only needs a simple heading that says whether it's a sub or a function and gives the name: Sub GraphCalc.
The shell statement does all the work. It has two parts: a command "Shell", and the path to the executable file it's opening in parentheses and quotes. An easy way to get the path is to right click on a shortcut to the executable file and select Properties. When the dialog opens, the path is already highlighted, so all I have to do is press Ctrl C, which is the keyboard shortcut for copy, position the cursor after "Shell("" in my macro, and press Ctrl V, which is the keyboard shortcut for paste. I close the macro off with another quote and parenthesis and the End Sub statement and it's ready to go.
To connect the rectangle on the spreadsheet to the macro, I simply use the Drawing toolbar to draw the rectangle where I want it and, then right click on the rectangle and select Assign macro. A dialog opens up that allows me to choose the macro to attach to the rectangle.
The Shell statement works well with all executable files with the extension .exe. It works with other executable files also but there are some that it won't open, like some Java files. I just make a note that there's a shortcut in a folder I keep for such things.
Below the program links, I have a section of links to commonly used websites, then, below that, links to useful spreadsheet documents. Those are often specialty calculators. I can use LibreOffice's hyperlinks dialog to create website links and links to other documents.
To the right of the website links, I have a list of equipment in my home lab. I try to keep the material part of my adventuring simple, inexpensive, and in portable containers. I also have an inventory spreadsheet that tells me where everything is. If I have to move (as I have had to do so often in my past), I want everything to be ready to go.
Below that, I have links to my digital library - all the reference books in the topic that I commonly use. Those are just hyperlinks and LibreOffice has a command and dialog that helps construct those. It's easy.
I also have other useful information entered into cells on the spreadsheets.
This hub places everything I commonly use in my memory in one organized place so I can go right to it when I want it.
Subscribe to:
Comments (Atom)
