Cogs and Levers A blog full of technical stuff

UniVerse development cheatsheet

A cheatsheet of UniVerse commands

Command Prompt

Action Command
Quitting the session QUIT
Logging off a session LO
Breaking out into a shell SH
Change to a different account LOGTO accountname
Start online help HELP commandname
Execute a UniVerse BASIC command XEQ command
Echo a string out to screen DISPLAY string

Command Stack

All of the items with an “n” in their execution can either be removed (to operate on the most recent item) or replaced with a number indicating the item in the stack the operation is to effect.

Action Command
Viewing your command history .L
Executing a command from the stack .Xn
Delete an item from the stack .Dn
Recall an older command to the head of the stack .Rn
Change a string in a command on the stack .Cn/oldstring/newstring
Change all occurences of a string in a command on the stack .Cn/oldstring/newstring/G
Appending something to the end of a command on the stack .An extra

Files

Creating a new file

	
CREATE.FILE filename filetype other

Filenames should be uppercase with words divided by periods (.)

File type Type Description
1 & 19 directory  
2 static Keys end with numbers.
3 static Keys end mainly with numbers.
4 static Keys end with letters.
5 static Keys end with full range of ASCII characters.
6 static Keys begin with numbers.
7 static Keys begin mainly with numbers.
8 static Keys begin with letters.
9 static Keys begin with full range of ASCII characters.
10 static Keys are numbers.
11 static Keys are mainly numbers.
12 static Keys are letters.
13 static Keys are full range of ASCII characters.
14 static Entire keys are numbers.
15 static Entire keys are mainly numbers.
16 static Entire keys are letters.
17 static Entire keys are full range of ASCII characters.
18 static Entire keys are of arbitrary form.
30 dynamic  

other depends on the filetype being created Creating a new directory file

	
CREATE.FILE filename 1
CREATE.FILE filename 19

Creating a new static file

	
CREATE.FILE filename (2-18) modulo separation

modulo is the number of groups the file has. separation is the number of 512 bytes disk frames are allocated to each group

Maintaining a file

	
RESIZE filename newtype newmodulo newseparation

Creating a dynamic file

	
CREATE.FILE filename 30

Copy a file

	
COPY FROM sourcefile TO destfile ALL OVERWRITING

Editing Records

Action Command
Invoking the Editor ED filename recordkey
Display a pageful of the record P
Qutting a record Q
Inserting lines I
Moving between lines n (move to line n)
  +n (move forward n lines)
  -n (move backward n lines)
  t (move to top)
  b (move to bottom)
Changing lines (/G for global) C/oldstring/newstring/G
Undo OOPS
Appending to a line A extra-string
Breaking a line B word-to-break-on
Concatenating lines CAT
Deleting lines D
Duplicating lines DUP
Locating and finding L something
  F something
Setting editing blocks < (sets the starting block)
  > (sets the ending block)
Copy, move or drop blocks COPY
  MOVE
  DROP
Saving your record SAVE

Editor Macros

Creating a new ED macro

@FILE variable can be used to be the existing file being edited. @ID variable can be used to be the key of the current record being edited. Example usage of @FILE and @ID within a macro

	
> ED &ED& MACRONAME				  
----: I
0001= E
0002= SAVE
0003= XEQ BASIC @FILE @ID
0004= XEQ RUN @FILE @ID
0005=

The VOC File

Creating a verb (command word)

	
> ED VOC verbname
----: I
0001= V
0002= programname
0003= type
0004=

All verbs start with a V. The name of the program to execute is specified by the second line. The type of the program is specified on the third line. Possible options are:

Letter Language
B UniVerse Basic
C C shell script
D DOS batch file
E External
I Internal
P Primitive
Q Query command
S Bourne sheel script
B Operating system command

Creating a keyword (parameter or modified applied to verbs)

	
> ED VOC keywordname
----: I
0001= K
0002= value
0003= verbcommand (optional)

Keywords start with a K. Their second parameter is the value that gets substituted for the word. Creating a paragraph (script)

	
> ED VOC paragraphname
----: I
0001= PA
0002= script ....
0003= script ....

Paragraphs start with PA, then continue to define the script itself. For variables that are unknown at runtime the «…» syntax can be used to prompt the user inline for the value. Creating a sentence (a one line paragraph)

	
> ED VOC sentencename
----: I
0001= PA
0002= script ....

Creating a file pointer

	
> ED VOC filename
----: I
0001= F
0002= directoryname
0003= filename

Creating a qpointer

	
> ED VOC synonymname
----: I
0001= Q
0002= (space)
0003= filename

Creating a remote command

	
> ED VOC remotecommandname
----: I
0001= R
0002= filename that contains the command record
0003= key of the command record

Dictionaries

A description of common fields for a dictionary record

Field Description
Conversion Blank unless a conversion is required. e.g. D DMY[2,A3,4] would store 1 for 01 JAN 1968
Column Header Title that appears at the head of the column
Format The number of characters to display and alignment. 10R - 10 characters, right aligned.
  10T - 10 characters, text aligned. 10L - 10 characters, left aligned.
Single or Multi S for single value, M for multi-value

Creating a data field

	
> ED DICT filename fieldname
----: I
0001= D Description of the field
0002= field number
0003= conversion
0004= header
0005= format
0006= single or multi

Creating an imaginary field

		
> ED DICT filename fieldname
----: I
0001= I Description of the field
0002= formula
0003= conversion
0004= header
0005= format
0006= single or multi

Creating a phrase field

		
> ED DICT filename fieldname
----: I
0001= PH Description of the field
0002= fieldnames

Indexing Fields

Action Command
Creating an index CREATE.INDEX filename fieldname
Bringing an index up to date BUILD.INDEX filename fieldname
Checking indexes on a file LIST.INDEX filename fieldname/ALL
Removing an index from a file DELETE.INDEX filename fieldname

RetrieVe

Action Command
A basic list LIST filename
Listing fields LIST filename field1 field2 field3
Sorting by fields LIST filename field1 field2 BY field3
  LIST filename field1 BY field2 BY field3
  LIST filename field1 field2 BY.DSND field3
  SORT filename BY field1
Sampling a list LIST filename SAMPLE n
Listing with criteria LIST filename field1 field2 WITH field3 = 'data'
Totalling a field LIST filename field1 field2 TOTAL field3
Setting a breakpoint LIST filename BREAK.ON field1 field2 field3
Summarising a report LIST filename BREAK.ON field1 field2 DET.SUP
Providing headers and footers LIST filename field1 field2 field3 HEADING "report heading" FOOTING "report footing"
Overriding existing dictionary definitions LIST filename field1 FMT "override format"
  LIST filename field1 CONV "new conversion"
  LIST filename field1 COL.HDG "new heading"
  LIST filename field1 SINGLE.VALUE
  LIST filename field1 MULTI.VALUE
Columns without dictionary entries LIST filename EVAL "formula"

Criteria

Symbol Synonyms Description
= EQ Equal to
# <>,>;<,NE Not equal to
> GT, AFTER Greater than
< LT, BEFORE Lesser than
>= =>, GE Greater than or equal to
<= =<, LE Lesser than or equal to
LIKE MATCHES, MATCHING Finds a matching word (… is a wildcard)
UNLIKE NOT.MATCHING Finds not matching word (… is a wildcard)
SPOKEN SAID, ~ Phonetic matching

Criteria can be reversed with NOT and concatenated with AND or OR.

Select Lists

Action Command
Creating a select list SELECT filename
Numbered select lists SELECT filename TO n
Saving a select list SELECT filename
  SAVE.LIST listname FROM n
Getting a saved list GET.LIST listname TO n
Clearing a list CLEARSELECT n

TCL Commands

Action Command
Count the records in a file COUNT filename
Copy a record to the terminal (display a record) CT filename record
Copy a record to the printer CP filename record
Copy records to another file COPY FROM sourcefile TO destfile record1 record2 record3
  COPY FROM sourcefile TO destfile ALL
Change the name of a file CNAME oldname TO newname
Change the key of a record in a file CNAME filename oldrecord, newrecord
Swap the contents of two records EXCHANGE filename record1 record2
Delete records from a file DELETE filename record1 record2
Remove all records from a file CLEAR.FILE filename
Clear the terminal CS

References

life, the universe, and everything

UniVerse BASIC cheatsheet

A cheatsheet for writing UniVerse BASIC programs

Program Management

Creating a directory for programs

> CREATE.FILE BP 19

Creating a file to store a program

> ED BP PROGRAM.NAME

Compiling a program

> BASIC BP PROGRAM.NAME

Running a program

> RUN BP PROGRAM.NAME 

Sourcecode Editing

Formatting sourcecode

----: FORMAT 

File IO

Opening a file

0001= OPEN 'filename' TO FILE.VAR ELSE STOP "Couldn't open filename" 

Reading a record from a file

0001= READ RECORD.VAR FROM FILE.VAR, 'RELLEVEL' ELSE RECORD.VALUE = '' 

Writing a record to a file

0001= WRITE RECORD.VAR TO FILE.VAR, 'TEST.WRITE' 

Reading a record from a file into an array

0001= MATREAD RECORD.VAR FROM FILE.VAR, 'RELLEVEL' ELSE MAT RECORD.VAR = '' 

Writing a record from an array into a file

0001= MATWRITE RECORD.VAR TO FILE.VAR, 'TEST.WRITE' 

Reading a single field from a file

0001= READV TYPE.DESC FROM FILE.VAR, 'RELLEVEL', 1 ELSE TYPE.DESC = '' 

Writing a single field to a file

0001= WRITEV TYPE.DESC TO FILE.VAR, 'TEST.WRITE', 1 

Deleting a record from a file

0001= DELETE FILE.VAR, 'RELLEVEL' 

Locking records for update

0000= READU RECORD.VAR FROM FILE.VAR, 'RELLEVEL' LOCKED 
0000= MATREADU RECORD.VAR FROM FILE.VAR, 'RELLEVEL' LOCKED 
0000= READVU TYPE.DESC FROM FILE.VAR, 'RELLEVEL' LOCKED 

Locking records from read

0000= READL RECORD.VAR FROM FILE.VAR, 'RELLEVEL' 
0000= MATREADL RECORD.VAR FROM FILE.VAR, 'RELLEVEL' 
0000= READVL TYPE.DESC FROM FILE.VAR, 'RELLEVEL' 

An example record read

0001= OPEN 'VOC' TO VOC.FILE ELSE STOP "Can't open VOC" 
0002= READ VOC.RECORD FROM VOC.FILE, 'RELLEVEL' ELSE VOC.RECORD = '' 
0003= PRINT VOC.RECORD 

An example record read to an array

0001= DIM VOC.RECORD(10) 
0002= OPEN 'VOC' TO VOC.FILE ELSE STOP "Can't open VOC" 
0003= MATREAD VOC.RECORD FROM VOC.FILE, 'RELLEVEL' ELSE MAT VOC.RECORD = '' 
0004= FOR FIELD.NUMBER = 1 TO 10 
0005= PRINT VOC.RECORD(FIELD.NUMBER) 
0006= NEXT FIELD.NUMBER 

An example record read from a select list

0001= OPEN 'VOC' TO VOC.FILE ELSE STOP "Can't open VOC" 
0002= EOF = 0 
0003= EXECUTE 'SELECT VOC WITH TYPE = "M"' 
0004= LOOP 
0005= READNEXT VOC.KEY ELSE EOF = 1 
0006= UNTIL EOF 
0007= PRINT VOC.KEY 
0008= REPEAT 

References

life, the universe, and everything

Ripping Discs at the Console

A very brief guide to ripping DVD media at the console with handbrake.

# Rip a disc with the normal preset
HandBrakeCLI -i /dev/dvd -o output.mp4 --preset=Normal --main-feature  

# Scan a disc for chapter data
HandBrakeCLI -i /dev/dvd -t <chapter> --scan

# Rip a specific chapter
HandBrakeCLI -i /dev/dvd -o output.mp4 --preset=Normal -t <chapter>  

Rails 3 Cheatsheet

A cheatsheet of Rails 3 commands once all of the software infrastructure has been setup and is running.

Creating and destroying things

# Create a new application
rails new ApplicationName

# Create a new model
rails generate/g model ModelName

# Create a new controller
rails generate/g controller ControllerName

# Create a new migration
rails generate/g migration MigrationName

# Create a scaffolded controller, model and view 
rails generate/g scaffold ModelName ControllerName

# Destroy a new model
rails destroy model ModelName

# Destroy a new controller
rails destroy controller ControllerName

# Destroy a new migration
rails destroy migration MigrationName

Controlling the application

# Start the rails server
rails server/s

# Install a plugin
rails plugin install PluginName

# Start the rails console
rails console/c

# Start the database console
rails dbconsole/db

# Benchmark/Profile the application
rails performance

Manage the database

# Create the database
rake db:create

# Drop the database  
rake db:drop

# Migrate the database
rake db:migrate

# Drop and recreate database from schema
rake db:reset

# Rollback the latest migration
rake db:rollback

# Create the schema file
rake db:schema:dump

# Create a sessions migration
rake db:sessions:create

Utility tasks

# Build the RDOC html files
rake doc:app

# List all available tasks
rake –tasks

# Truncate log files
rake log:clear

# Clear session, cache and socket files
rake tmp:clear

# Print out all defined application routes
rake routes

Testing your application

# Run all tests
rake test

# Run functional tests
rake test:functionals

# Run integration tests
rake test:integration

# Run unit tests
rake test:units

Working with Gems

# Lock this application's gem set
rake rails:freeze:gems

# List dependent gems
rake gems

# Install all required gems
rake gems:install

# List all installed gems 
gem list

# Install a gem
gem install GemName

# Uninstall a gem
gem uninstall GemName

# Start the gem server
gem server

Installing UniVerse 10.3 (Personal Edition) on CentOS 6.3 amd64

A guide for installing the UniVerse database system on a RedHat flavored distribution.

Installation Pre-requisites

As the database server is being installed to a 64bit system, some 32bit libraries are required for the installation to succeed.

yum install glibc.i686 libstdc++.so.6 pam.i686

Running the installer

# Unpack the database installation into a temporary location.
unzip uvpe_rhlinux_10.3.3.zip

# Extract the uv.load script out of the archive
cpio -ivcBdum uv.load < ./STARTUP

# Set the date on the system to satisfy licensing requirements
date -s 1/1/2009

# Run the uv.load script
./uv.load

Completing the installation

Select the first option from the first menu:

1) Make 'root' the default owner and administrator of uniVerse.  
The current installation continues uninterrupted.  

On the second menu, change the rewind and no-rewind tape names to the location of the installation files.

4) Rewind tape name          /tmp/uvpe  
5) No-rewind tape name        /tmp/uvpe  

Starting the RPC daemon

Before attempting to start the RPC daemon from within the uv environment, an entry for the service itself needs to be added to the /etc/services file

echo "uvrpc 31438/tcp # uvNet rpc port" >> /etc/services  

References

Installing UniVerse on CentOS 6.2
http://u2tech.wordpress.com/2012/07/08/installing-universe-centos-6-2/