Other Tools to Make Life Simpler

8 May

Other Tools to Make Life Simpler
Utilities

Using DOS batch files
On our Windows 98 computers, these commands for BuildDependency are too long to type in a DOS command window. DOS seems to limit any single command we

type to 127 characters. To get around this, we need to create a batch file (like build.bat) and enter the command in there. There doesn’t seem to be a limit to the command length in a batch file. Then all we need to do is execute the build.bat file, which also saves in typing when we need to rerun BuildDependency. Here is a batch file that we find quite handy. This can easily be tailored to compile each new application. It will also FTP your .tini file to TINI stick if the compile completes successfully. Note that you will need to specify the hostname of your TINI either in the batch file (set TINI=name) or on the command line or have the DOS environment variable MYTINI set (set MYTINI=whatever). This batch file is well commented, so we will not discuss it in detail here.

:noow
ECHO Environment variable “OW_HOME” is not set.
GOTO end
:noclass
ECHO Environment variable “CLASSPATH” is not set.
ECHO You may have trouble running this program”
:: Good so far. Look for a bin directory, create as needed.
:begin
Echo Looking for bin directory
IF EXIST bin GOTO next
mkdir bin
:: OK, lets compile. Look for errors on the way, bail if any.
:next
Echo Building %PROG%
echo javac …
javac -bootclasspath %TINI_HOME%\bin\tiniclasses.jar -d bin
src\%PROG%.java
IF ERRORLEVEL 1 GOTO end
echo TINIConvertor …
java -classpath %TINI_HOME%\bin\tini.jar;. BuildDependency -p
%TINI_HOME%\bin\owapi_dependencies_TINI.jar -f bin -x
%TINI_HOME%\bin\owapi_dep.txt -o bin\%PROG%.tini -d
%TINI_HOME%\bin\tini.db                                         %ARGS%
IF ERRORLEVEL 1 GOTO end
:: Lets send the .tini file to the TINI
:: Use %1 as first coice. Then look for %TINI% then %MYTINI%
:: Give up if none of these
IF NOT “%1”==”” SET TINI=%1
IF “%TINI%”==”” SET TINI=%MYTINI%
IF “%TINI%”==”” GOTO end
:: Make a temp file “ftptotini”
echo sending %PROG%.tini to %TINI% …
echo open %TINI%> ftptotini
echo root>> ftptotini
echo tini>> ftptotini
echo send bin/%PROG%.tini>> ftptotini
echo quit>> ftptotini
:: send file using ftp script
ftp -s:ftptotini
:: clean up
del ftptotini
:end
echo .
echo Done!

We have found the following tools to be quite helpful when developing Java applications in general and for TINI.

Using FTP
We have used FTP to copy files from our computer to our TINI. In the development of our programs we use FTP repeatedly for copying the same file. Here is a simple way to automate this FTP step. If you are using FTP under Windows, FTP is able to take a script file

C:\> ftp -s:script.ftp

where the script file contains the things you would normally type at the FTP prompt. This is what this script.ftp file looks like. You should personalize it to include the IP address of your TINI and the filename of the program you are developing.

open 192.168.1.85
root
tini
send TiniWebStat.tini
quit

If you are using FTP from Unix or Linux, this is a little different. Use lftp instead, as this also deals nicely with script files, just a little differently than the Windows version of FTP:

% lftp -f script.lftp

where this script file contains the things you would normally type at the lftp prompt. This is what this script.lftp file looks like. Again, as with FTP, you should personalize it to include the IP address of your TINI and the filename of the program you are developing.

open 192.168.1.85
user root tini
put TiniWebStat.tini
quit

Alternately, you can specify everything on the

command line: lftp -e “put bin/TiniWebStat.tini;quit” -u root,tini 192.168.1.85 With either of these, FTP or lftp, you can add any other FTP command you need to get the job done, like cd to change directory or even use get to retrieve files from TINI and rm or delete to delete files from TINI. Note that if you use both Windows and Linux,  FTP and lftp don’t have exactly the same command set.

ƥ

Random Posts

Comments are closed.