- INSTALLATION
- Currently the program requires a LISP interperter. The emacs version of the program is not fully functional and is not recommended for use yet. All the functions in tcalc.lisp are emacs compatable so you can call them from emacs after loading them (if you wish -- this is not in any manner a recommended method at this time).
For the following example we are going to assume:
1 You have clisp located at /usr/local/bin/clisp
2 You want to use the clisp interperter.
3 You have installed the sources to ~/doc/tcalc
4 ~/bin is in your $PATH
5 You want to save your usage information in ~/.private
First we want to create a simple shell script to run our program. This is very easy to do, but there is also a sample one (tcalc.sh) you can modify as well. You can call it anything you wish... we are going to call it tcalc.sh for this document. Put two lines in it (without the numbers).
1 #!/bin/sh
2 /usr/local/bin/clisp ~/doc/tcalc/mytcalc.lisp
You should change these values to match what you want. Please note, you can change the names of all the files to something more obscure, if you desire, but you need to remember to change your config file to point to the new names. Make sure to change the file to be executable (chmod 700 ~/bin/tcalc.sh).
Next we need to edit ~/bin/tcalc/mytcalc.lisp for our system. This is a proto file which you should use. You can edit it to meet your needs and rename it.
Change lines 9, and 10, to represent where our files are.
9 (load "tcalc.lisp")
10 (load "THCcalc.lisp")
---
9 (load "~/doc/tcalc/tcalc.lisp") 10 (load "~/doc/tcalc/THCcalc.lisp")
Change line 17 (datafile) to where we want to save our usage information.
17 (setq datafile "file.data")
---
17 (setq datafile "~/.private/worthless.junk")
As you can see, we can name the file anything we want. You can also rename the default file for a database dump or the cutoff level if you wish. You will have the option to change the filenames from inside the program.
That pretty much sums up the installation. It is very flexible and allows you to stick the files anywhere you wish (share the main files among many users) or name them anything you want. There are other things we can do to make this more optimal depending on lisp interperter -- such as compiling all the code into fast access libraries beforehand and calling them. But this is not necessary.
BASIC USAGE:
This program is based off the old program with some differences. One of
the main differences is the ability to store usage patterns in a database
file so that it does not need to be re-entered each time the person wishes
to know their current percentage. It also allows you to track multiple
usage patterns (by using more than one data file) if you desire to.
If you set a reasonable default filename, you should be able to use the program very smoothly. The program is fairly intuitive. You are presented with a menu. You select the number of the option you want to do.
There are currently (1.2.0 version) two menus which look like so:
- Load the datafile
- Save the datafile
- Change filename of datafile
- Start a new record
- Trim data lists
- Edit a date
- Auxillary function menu
9. Quit
- Write a daily dump to file
- Change the dump file name
- Print dates of usage
- Print current percent
- Help and general info
9. Return to primary menu
A brief explaination of each action is described below: Load the datafile: This will load the file where you have saved usage data. This file MUST exist! You can define this file in mytcalc.lisp or use option #3 to change the filename when you run the program. This will also automatically prompt you for usage information through the current date from the last date of informtation the file has.
Save the datafile: This saves the current usage information into a datafile so that you can load it later. This lets you enter just the most recent information into the file for a complete view of your past use. It uses the same filename as #1, and can also be changed with #3.
Change filename of datafile: This will let you change the filename of the file to store usage information in. This change is NOT retained between programs runs. So if you want to make it permanent you will need to edit mytcalc.lisp.
Start a new record: This will prompt you for a date and then get a usage pattern from that date through the current day. You can then use this as if you had loaded it from a file. If you want to keep it, you will need to save it with option #2.
Trim data lists: It is not really useful to have more than 180 days of usage information. The program will work just fine with long data lists but it is a matter of convienence. You can use this to trim the lists by number of days or cut-off the list by a date. As some of the functions are recursive, if you have a large number of dates (into the thousands) and a slow system, you might notice a performance increase for certain operations by trimming the lists. On most systems, with a reasonable amount of data, you will not notice the difference in speed.
Edit a date: If you accidentally put the wrong information in for a date, you can use this to edit that date. It will prompt for a date, and tell you what it currently has for that date. It will then allow you to enter new information.
Auxillary function menu: Go to the second menu
Write a daily dump to file: This will dump the usage information in a format useful for reading into a spreadsheet program for making charts or whatever. The filename is shown at the top of the menu. It can be changed in mytcalc.lisp or by using option #2 from the auxillary menu. This function was used to create the logo.
Change the dump file name: This option allows you to change the name of the file to dump information into. I recommend keeping the .csv extension as it is the most recognizable for spreadsheet programs.
Print dates of usage: This will print out a list of all the dates you have used. It might be useful if you wonder. Obviously, if you are a heavy user this function will not be very useful.
Print current percent: If you edited the file or have any other reason that you need to see if you pass or fail but forgot. Then you can use this to recalculate your percentage and print it on the screen.
Help and general info: A totally useless help screen.
Return to primary menu: Go back to the main menu.
And that is basically it. Everything should be fairly easy to figure out. Please read the OLDINTRO file for information about why these numbers are used and what they mean.
CREATING A GRAPH:
One of the nice features of the old program was that it created a visual
representation of the amount of THC in your blood. It didn't stop you from
being screwed when you pissed in the cup but it was pretty soothing. This
program was written as a command line program so that it would be easily
portable to a variety of smokers who use Un*x-type operating systems. This
does not mean it is not possible to create the graph but it does mean you
will have to go through a few more steps.
One of the options you have is to write the daily output to a file. This could be useful for any number of reasons -- implicating yourself not-withstanding. Well, you output the daily levels to a file.
This creates a file in the format: <date> , <level> <date> , <level>
We can get most spreadsheets to import this comma separated database. As an
example I will use gnumeric but the problem is essentially the same no
matter which program you use. In gnumeric you can just say
% gnumeric file.csv
It will load the file and you will get the date in one column and the level
in the other. I like to have a base line to compare the level to. This
line is usually the cutoff level I use. You can set it at 40,50,60
depending on how paranoid you are. You put that in column C and copy it
all the way down.
Then you go Insert -> Chart It should select all your data. Check first column as label -- because the date is our label. Then you can create whatever type of graph you want. Enjoy. That is how I created the graph used in the logo -- well I changed it a little with gimp but that is another story.
