Jerry Nagasaki's Info-Page
 
Tool Collection
The helping DOS- and Perl-Tools below are published by me to make it easy for programmers, to find solutions for certain problems. It's clear to me that here is not presented a "high sofisticated" programming style, but delibarte simple algorithms, which are executeable easily for the user.
For myself I'm sick of finding complex "solutions" in the WWW, which makes it necessary to download c libraries and Perl CPAN modules. And in the end after some effort I've recognized not rarely, that those downloads were not fulfilling the desired solutions. I think, this could be easier for small and compact jobs.
Therefore I do not use "cryptical" programming code, but easy-to-read programming style. This code is sure "optimizable", but this would be contrapruductive for reading and understanding the algorithms.
And, of course: All these programs and scripts are completely unsorted and are published here for my own taste and requirements. ;-)
 Copyright Note

home
M$-DOS- / Windumb Tools written in C
Paint Shop Pro 6.x - 8.x Browser File Name Extractor
This M$-DOS-C-Program (getbrw.c) extracts the order of the picture file names of a user's arranged PSP browser file (pspbrwse.jbf) and creates a (plain-) text file named "brwlist". The program provides long Win2000+ file names. Now in improved, save version (1.1).

Renaming files with a file list into alphabethical order
This M$-DOS-C-Program (renamer.c) generates a M$-batch-file (renfiles.bat) from a text file, which contains valid file names to rename those files. The user is asked via keyboard input for a leading "string" and a start number for the new file names for generating this batch file.
The text file also can be the "brwlist" file, mentioned above or be generated with
  dir /B > brwlist
In this case "brwlist" is the <input-file> for "renamer.c"

Usage in the M$ DOS window:
  renamer <input-file>
  Input "String", e. g..: Mypix
  Input "Start number", e. g.: 100
  Input "Number of chars of counting", e. g.: 4

After starting the generated batch file "renfiles.bat" all files listed in <input-file> are renamed to:
  Mypix0100, Mypix0101, Mypix0102, ...

This program is intended for all users who doesn't have something like "Perl" on their computers.
The same funcitionallity of this program can be found in a perl script listed below.

home
Perl Scripts
Remark
All Perl Scripts below have the file extension ".pl_" by download. Please rename them to ".pl" for usage.

Transparent 1x1-Pixel Gif (CGI)
To "hide" CGI-Scripts on a web page, mostly an invisible (transparent) 1x1 pixel GIF imgae is used. The script can provide the image data to the caller page either by using a "real existing" GIF image of the web space or by generating the image data by itself. This script generates the image data of the smallest possible (42 bytes) transparent 1x1 GIF image and sends the data to the caller page.

Extract the Picture Size of a JP(E)G File (Local Perl)
This script extracts the height and width of a JP(E)G picture file. This algorithm can be used to generate HTML thumbnail views by script preserving a desired maximum table/display width.

Transform HTML-Tabele into CSV-File (Local Perl)
This script transforms a simple n*m HTML-Table into a comma separated values file (CSV).

Transform CSV-File into HTML-Tabelle (Local Perl)
This script transform a csv file into an unformated HTML table.

Renaming files with a file list into alphabethical order (Local Perl)
This script has the same function like "renamer.c". (see above)

Generation of an Html Directory Tree from a CSV file (Local Perl)
Please read README.html.

Renaming of just Number- or String-prefixed-JPG-Files to numbered files with 5 randomized leading characters (Local Perl)
Sometimes it is very annoying when webmasters are very unimaginative when they name their pictures of their web sites (you sure know, which sites I mean. ;-)) just like "01.jpg", "02.jpg", "03.jpg", etc. or "pp01.jpg", "pp02.jpg", "pp03.jpg", etc. When you save such a set of pictures for the first time there is no problem, but if you visit another web page, which uses the same picture file names, you have to choose a new file name typing it in per hand in the "save-as-dialog". This is unpractical and time-consuming.
This Perl script looks in the actual directory for "Just-Number/String-prefixed-JPG-Files", generates a string of 5 random characters ([A-Z][a-z][0-9]) and renames the files while using this string as a prefix.
Command line: perl namer.pl <string prefix, optional>

Calculation of Year Calendar (Local Perl)
This script calculates an ASCII-calendar divided into halfyears. It calculates automatically leap-years and the names of the weekdays. The column width is given by the user.
Output example: calendar.txt.

Generating a sub directory list recursively (CGI / Local Perl)
This tiny script generates an absolute-path-list of all existing sub directories starting at a root directory. It uses recursive calls of a sub routine. The generated list can be used to draw an "ASCII Art" directory tree (Example: drawtree.pl). Output example: tree.txt
Update: The recursive call may take "aeons" if the sub directories have may entries. It is possible to "grep" only for entries w/o ".". The disadvantage is that in this case no directories with a dot in their name such as system.$$$ are found anymore. But the recursive call is about 100 times faster then!

Calculates the ammount of file sizes of a root directory and its sub directories (Local Perl)
This tiny script adds all file sizes of a root directory including all files in its sub directories. Optionally all file names can be output. I know, that this functionallity is included in many file tools, but sometimes a printable list is desired to get easily a quick overview.
Update: Please see „Speed-up note“ in the script. Explanation: "dirtree"-Perl-Script above.

Output a list of all files of a root directory and its sub directories sorted by size (Local Perl)
Sometimes it is difficult to detect large files in widely ramified sub directories. Especially usig USB memory sticks this detection can be very useful. This script searches all sub directories and the root directory and lists all files sorted by size afterwards. The number of listed files can be set as an option.
Update: Please see „Speed-up note“ in the script. Explanation: "dirtree"-Perl-Script above.

home
Perl Hint for Windumb Users (2K, XP)
For an easy UNIX/Linux-like perl script call without .pl extension, without perl.exe prefix, but with arguments like
  scriptname arg1 arg2 ...
please type help ftype in the DOS console and follow the instructions.

home
Compiling the C-Source-Codes
Compiled exe-versions of the c source codes are available by the webmaster on demand.

To compile the c codes by yourself, please use a usual c compiler like gcc.

For Windows/DOS please download the M$-DOS-C-compiler package from: DJ DELORIE. Follow the "installation guide". After this compile the regarding c source code by typing
  gcc <filename>.c -O2 -s -o <filename>.exe
in the M$-DOS-Window.

Alternatively the free development environment LCC-WIN32 can be used. In this case please create a DOS console application and use the provided make to compile the program to an exe file.

When the compiled <filename>.exe file is copied to the windows directory (c:\WINNT) it is executeable in any other sub directory (or add path to the system path variable).

home
Important Note / Nonliability
All source codes of this sub site are free for any user. They are all written by me and there is no copyright. Use, change, and modify them for your own as you want.
I assume no liability for any data loss or damage that may happen to the user by using these codes. The usage is at the own risk of the user. These codes are not tested fully and are primarily intended for demonstration purposes.

Nevertheless it would be very nice, if my name could "survive" these changes and modifications at least in the remarks in your code. ;-)

home Deutsche Version